Commit f6b3d85f authored by Felix Fietkau's avatar Felix Fietkau Committed by Johannes Berg

mac80211: fix spurious RCU warning and update documentation

Document rx vs tx status concurrency requirements.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 3670946f
...@@ -3043,7 +3043,8 @@ void ieee80211_napi_complete(struct ieee80211_hw *hw); ...@@ -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 * 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 * for a single hardware must be synchronized against each other. Calls to
* this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be * 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(). * In process context use instead ieee80211_rx_ni().
* *
...@@ -3059,7 +3060,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb); ...@@ -3059,7 +3060,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
* (internally defers to a tasklet.) * (internally defers to a tasklet.)
* *
* Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not * 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 * @hw: the hardware this frame came in on
* @skb: the buffer to receive, owned by mac80211 after this call * @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); ...@@ -3073,7 +3075,8 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
* (internally disables bottom halves). * (internally disables bottom halves).
* *
* Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may * 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 * @hw: the hardware this frame came in on
* @skb: the buffer to receive, owned by mac80211 after this call * @skb: the buffer to receive, owned by mac80211 after this call
...@@ -3196,7 +3199,8 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif, ...@@ -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 * This function may not be called in IRQ context. Calls to this function
* for a single hardware must be synchronized against each other. Calls * for a single hardware must be synchronized against each other. Calls
* to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe() * 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 * @hw: the hardware the frame was transmitted by
* @skb: the frame that was transmitted, owned by mac80211 after this call * @skb: the frame that was transmitted, owned by mac80211 after this call
......
...@@ -688,8 +688,15 @@ int rate_control_set_rates(struct ieee80211_hw *hw, ...@@ -688,8 +688,15 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
struct ieee80211_sta *pubsta, struct ieee80211_sta *pubsta,
struct ieee80211_sta_rates *rates) 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); rcu_assign_pointer(pubsta->rates, rates);
if (old) if (old)
kfree_rcu(old, rcu_head); kfree_rcu(old, rcu_head);
......
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