* [PATCH v3] mac80211: Avoid unnecessary locking on CSA counter update
@ 2015-06-10 11:06 Wojciech Dubowik
2015-06-17 8:43 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Wojciech Dubowik @ 2015-06-10 11:06 UTC (permalink / raw
To: linux-wireless; +Cc: julian.calaby, johannes, Wojciech Dubowik
v2: Use splitted functions instead of direct counter decrement.
v3: Changed subject and commit message
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
---
net/mac80211/tx.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 7fe528a..7425803 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3211,6 +3211,16 @@ static void ieee80211_set_csa(struct ieee80211_sub_if_data *sdata,
rcu_read_unlock();
}
+static u8 __ieee80211_csa_update_counter(struct beacon_data *beacon)
+{
+ beacon->csa_current_counter--;
+
+ /* the counter should never reach 0 */
+ WARN_ON_ONCE(!beacon->csa_current_counter);
+
+ return beacon->csa_current_counter;
+}
+
u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
{
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
@@ -3229,11 +3239,7 @@ u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
if (!beacon)
goto unlock;
- beacon->csa_current_counter--;
-
- /* the counter should never reach 0 */
- WARN_ON_ONCE(!beacon->csa_current_counter);
- count = beacon->csa_current_counter;
+ count = __ieee80211_csa_update_counter(beacon);
unlock:
rcu_read_unlock();
@@ -3333,7 +3339,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
if (beacon) {
if (beacon->csa_counter_offsets[0]) {
if (!is_template)
- ieee80211_csa_update_counter(vif);
+ __ieee80211_csa_update_counter(beacon);
ieee80211_set_csa(sdata, beacon);
}
@@ -3379,7 +3385,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
if (beacon->csa_counter_offsets[0]) {
if (!is_template)
- ieee80211_csa_update_counter(vif);
+ __ieee80211_csa_update_counter(beacon);
ieee80211_set_csa(sdata, beacon);
}
@@ -3409,7 +3415,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
* for now we leave it consistent with overall
* mac80211's behavior.
*/
- ieee80211_csa_update_counter(vif);
+ __ieee80211_csa_update_counter(beacon);
ieee80211_set_csa(sdata, beacon);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] mac80211: Avoid unnecessary locking on CSA counter update
2015-06-10 11:06 [PATCH v3] mac80211: Avoid unnecessary locking on CSA counter update Wojciech Dubowik
@ 2015-06-17 8:43 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2015-06-17 8:43 UTC (permalink / raw
To: Wojciech Dubowik; +Cc: linux-wireless, julian.calaby
On Wed, 2015-06-10 at 13:06 +0200, Wojciech Dubowik wrote:
> v2: Use splitted functions instead of direct counter decrement.
> v3: Changed subject and commit message
I've applied this, but I really think you should've had a commit
message ...
johannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-17 8:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 11:06 [PATCH v3] mac80211: Avoid unnecessary locking on CSA counter update Wojciech Dubowik
2015-06-17 8:43 ` Johannes Berg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.