Commit 12da8d97 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

fakelb: use own channel and page attributes

This patch adds an own phy attribute for page and channel into
fakelb_phy. The current way is to use the internal mac802154 stored phy
pib values which can occur in locking issues while using it inside the
driver layer.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent e369dc8f
...@@ -38,6 +38,9 @@ static DEFINE_RWLOCK(fakelb_ifup_phys_lock); ...@@ -38,6 +38,9 @@ static DEFINE_RWLOCK(fakelb_ifup_phys_lock);
struct fakelb_phy { struct fakelb_phy {
struct ieee802154_hw *hw; struct ieee802154_hw *hw;
u8 page;
u8 channel;
struct list_head list; struct list_head list;
struct list_head list_ifup; struct list_head list_ifup;
}; };
...@@ -54,8 +57,12 @@ fakelb_hw_ed(struct ieee802154_hw *hw, u8 *level) ...@@ -54,8 +57,12 @@ fakelb_hw_ed(struct ieee802154_hw *hw, u8 *level)
static int static int
fakelb_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel) fakelb_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{ {
pr_debug("set channel to %d\n", channel); struct fakelb_phy *phy = hw->priv;
write_lock_bh(&fakelb_ifup_phys_lock);
phy->page = page;
phy->channel = channel;
write_unlock_bh(&fakelb_ifup_phys_lock);
return 0; return 0;
} }
...@@ -80,8 +87,8 @@ fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) ...@@ -80,8 +87,8 @@ fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
if (current_phy == phy) if (current_phy == phy)
continue; continue;
if (phy->hw->phy->current_channel == if (current_phy->page == phy->page &&
current_phy->hw->phy->current_channel) current_phy->channel == phy->channel)
fakelb_hw_deliver(phy, skb); fakelb_hw_deliver(phy, skb);
} }
read_unlock_bh(&fakelb_ifup_phys_lock); read_unlock_bh(&fakelb_ifup_phys_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment