]> Pileus Git - ~andy/linux/commitdiff
mac80211: fix spurious RCU warning and update documentation
authorFelix Fietkau <nbd@openwrt.org>
Fri, 3 May 2013 08:01:03 +0000 (10:01 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 16 May 2013 20:38:05 +0000 (22:38 +0200)
Document rx vs tx status concurrency requirements.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/rate.c

index 04c2d4670dc6f66cefead56a19cd57e95cca9a5d..885898a40d13530504ad41e489b9d58a6b233366 100644 (file)
@@ -3043,7 +3043,8 @@ void ieee80211_napi_complete(struct ieee80211_hw *hw);
  * This function may not be called in IRQ context. Calls to this function
  * for a single hardware must be synchronized against each other. Calls to
  * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
- * mixed for a single hardware.
+ * mixed for a single hardware. Must not run concurrently with
+ * ieee80211_tx_status() or ieee80211_tx_status_ni().
  *
  * In process context use instead ieee80211_rx_ni().
  *
@@ -3059,7 +3060,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
  * (internally defers to a tasklet.)
  *
  * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not
- * be mixed for a single hardware.
+ * be mixed for a single hardware.Must not run concurrently with
+ * ieee80211_tx_status() or ieee80211_tx_status_ni().
  *
  * @hw: the hardware this frame came in on
  * @skb: the buffer to receive, owned by mac80211 after this call
@@ -3073,7 +3075,8 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
  * (internally disables bottom halves).
  *
  * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may
- * not be mixed for a single hardware.
+ * not be mixed for a single hardware. Must not run concurrently with
+ * ieee80211_tx_status() or ieee80211_tx_status_ni().
  *
  * @hw: the hardware this frame came in on
  * @skb: the buffer to receive, owned by mac80211 after this call
@@ -3196,7 +3199,8 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
  * This function may not be called in IRQ context. Calls to this function
  * for a single hardware must be synchronized against each other. Calls
  * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe()
- * may not be mixed for a single hardware.
+ * may not be mixed for a single hardware. Must not run concurrently with
+ * ieee80211_rx() or ieee80211_rx_ni().
  *
  * @hw: the hardware the frame was transmitted by
  * @skb: the frame that was transmitted, owned by mac80211 after this call
index 0d51877efdb74260b07f33935ce2101df6f57678..d3f414fe67e0beb9592e87d344a6b3a5c0fed66b 100644 (file)
@@ -688,8 +688,15 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
                           struct ieee80211_sta *pubsta,
                           struct ieee80211_sta_rates *rates)
 {
-       struct ieee80211_sta_rates *old = rcu_dereference(pubsta->rates);
+       struct ieee80211_sta_rates *old;
 
+       /*
+        * mac80211 guarantees that this function will not be called
+        * concurrently, so the following RCU access is safe, even without
+        * extra locking. This can not be checked easily, so we just set
+        * the condition to true.
+        */
+       old = rcu_dereference_protected(pubsta->rates, true);
        rcu_assign_pointer(pubsta->rates, rates);
        if (old)
                kfree_rcu(old, rcu_head);