Commit e176b681 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

mac802154: rx: move rcu locking

Instead of twice lock and unlock mechanism this patch hold these locks
only once at one position.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 9cf215d0
...@@ -205,7 +205,6 @@ mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb) ...@@ -205,7 +205,6 @@ mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
return; return;
} }
rcu_read_lock();
list_for_each_entry_rcu(sdata, &local->interfaces, list) { list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (sdata->type != IEEE802154_DEV_WPAN || if (sdata->type != IEEE802154_DEV_WPAN ||
!netif_running(sdata->dev)) !netif_running(sdata->dev))
...@@ -215,7 +214,6 @@ mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb) ...@@ -215,7 +214,6 @@ mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb)
skb = NULL; skb = NULL;
break; break;
} }
rcu_read_unlock();
if (skb) if (skb)
kfree_skb(skb); kfree_skb(skb);
...@@ -234,7 +232,6 @@ mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb) ...@@ -234,7 +232,6 @@ mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
skb->pkt_type = PACKET_OTHERHOST; skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = htons(ETH_P_IEEE802154); skb->protocol = htons(ETH_P_IEEE802154);
rcu_read_lock();
list_for_each_entry_rcu(sdata, &local->interfaces, list) { list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (sdata->type != IEEE802154_DEV_MONITOR || if (sdata->type != IEEE802154_DEV_MONITOR ||
!netif_running(sdata->dev)) !netif_running(sdata->dev))
...@@ -249,7 +246,6 @@ mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb) ...@@ -249,7 +246,6 @@ mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
netif_rx_ni(skb2); netif_rx_ni(skb2);
} }
rcu_read_unlock();
} }
void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb) void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb)
...@@ -273,9 +269,13 @@ void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb) ...@@ -273,9 +269,13 @@ void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb)
skb_trim(skb, skb->len - 2); /* CRC */ skb_trim(skb, skb->len - 2); /* CRC */
} }
rcu_read_lock();
mac802154_monitors_rx(local, skb); mac802154_monitors_rx(local, skb);
mac802154_wpans_rx(local, skb); mac802154_wpans_rx(local, skb);
rcu_read_unlock();
return; return;
fail: fail:
......
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