2017-01-24 15:42:29

by Amadeusz Sławiński

[permalink] [raw]
Subject: [PATCH 1/2] mac80211: use helper function to access ieee802_1d_to_ac[]

cleanup patch to make use of ieee80211_ac_from_tid() to retrieve ac from
ieee802_1d_to_ac[]

Signed-off-by: Amadeusz Sławiński <[email protected]>
---
net/mac80211/rx.c | 2 +-
net/mac80211/status.c | 2 +-
net/mac80211/tx.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 3e289a6..cf8ed1c 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1391,7 +1391,7 @@ void ieee80211_sta_pspoll(struct ieee80211_sta *pubsta)
void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *pubsta, u8 tid)
{
struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
- u8 ac = ieee802_1d_to_ac[tid & 7];
+ int ac = ieee80211_ac_from_tid(tid);

/*
* If this AC is not trigger-enabled do nothing unless the
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index ddf71c6..dd48de0 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -95,7 +95,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
*/
if (*p & IEEE80211_QOS_CTL_EOSP)
*p &= ~IEEE80211_QOS_CTL_EOSP;
- ac = ieee802_1d_to_ac[tid & 7];
+ ac = ieee80211_ac_from_tid(tid);
} else {
ac = IEEE80211_AC_BE;
}
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0d8b716..009eb36 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1410,7 +1410,7 @@ void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata,
txqi->txq.sta = &sta->sta;
sta->sta.txq[tid] = &txqi->txq;
txqi->txq.tid = tid;
- txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
+ txqi->txq.ac = ieee80211_ac_from_tid(tid);
} else {
sdata->vif.txq = &txqi->txq;
txqi->txq.tid = 0;
@@ -4542,7 +4542,7 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb, int tid,
enum nl80211_band band)
{
- int ac = ieee802_1d_to_ac[tid & 7];
+ int ac = ieee80211_ac_from_tid(tid);

skb_reset_mac_header(skb);
skb_set_queue_mapping(skb, ac);
--
1.9.1


2017-01-25 09:17:47

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/2] mac80211: use accessor functions to set sta->_flags

On Wed, 2017-01-25 at 09:55 +0100, Amadeusz Slawinski wrote:
> And yes I did. Somehow managed to ignore those warnings though, sorry
> about that.

:)
That was intentional so nobody changing mac80211 in the future will
accidentally play with those flags through the normal accessors.

> Rechecked with just first patch and it should still be good. Please
> ignore this one ;)

Yeah, I still have that one pending, no worries :)

johannes

2017-01-24 15:42:30

by Amadeusz Sławiński

[permalink] [raw]
Subject: [PATCH 2/2] mac80211: use accessor functions to set sta->_flags

cleanup patch to make use of set_sta_flag()/clear_sta_flag() in places
where we access sta->_flags

Signed-off-by: Amadeusz Sławiński <[email protected]>
---
net/mac80211/sta_info.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index b6cfcf0..6c9cc2f 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1855,13 +1855,13 @@ int sta_info_move_state(struct sta_info *sta,
switch (new_state) {
case IEEE80211_STA_NONE:
if (sta->sta_state == IEEE80211_STA_AUTH)
- clear_bit(WLAN_STA_AUTH, &sta->_flags);
+ clear_sta_flag(sta, WLAN_STA_AUTH);
break;
case IEEE80211_STA_AUTH:
if (sta->sta_state == IEEE80211_STA_NONE) {
- set_bit(WLAN_STA_AUTH, &sta->_flags);
+ set_sta_flag(sta, WLAN_STA_AUTH);
} else if (sta->sta_state == IEEE80211_STA_ASSOC) {
- clear_bit(WLAN_STA_ASSOC, &sta->_flags);
+ clear_sta_flag(sta, WLAN_STA_ASSOC);
ieee80211_recalc_min_chandef(sta->sdata);
if (!sta->sta.support_p2p_ps)
ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
@@ -1869,13 +1869,13 @@ int sta_info_move_state(struct sta_info *sta,
break;
case IEEE80211_STA_ASSOC:
if (sta->sta_state == IEEE80211_STA_AUTH) {
- set_bit(WLAN_STA_ASSOC, &sta->_flags);
+ set_sta_flag(sta, WLAN_STA_ASSOC);
ieee80211_recalc_min_chandef(sta->sdata);
if (!sta->sta.support_p2p_ps)
ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
} else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
ieee80211_vif_dec_num_mcast(sta->sdata);
- clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
+ clear_sta_flag(sta, WLAN_STA_AUTHORIZED);
ieee80211_clear_fast_xmit(sta);
ieee80211_clear_fast_rx(sta);
}
@@ -1883,7 +1883,7 @@ int sta_info_move_state(struct sta_info *sta,
case IEEE80211_STA_AUTHORIZED:
if (sta->sta_state == IEEE80211_STA_ASSOC) {
ieee80211_vif_inc_num_mcast(sta->sdata);
- set_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
+ set_sta_flag(sta, WLAN_STA_AUTHORIZED);
ieee80211_check_fast_xmit(sta);
ieee80211_check_fast_rx(sta);
}
--
1.9.1

2017-01-24 15:44:34

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/2] mac80211: use accessor functions to set sta->_flags

On Tue, 2017-01-24 at 16:42 +0100, Amadeusz Sławiński wrote:
> cleanup patch to make use of set_sta_flag()/clear_sta_flag() in
> places
> where we access sta->_flags
>
> Signed-off-by: Amadeusz Sławiński <[email protected]>
> ---
>  net/mac80211/sta_info.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
> index b6cfcf0..6c9cc2f 100644
> --- a/net/mac80211/sta_info.c
> +++ b/net/mac80211/sta_info.c
> @@ -1855,13 +1855,13 @@ int sta_info_move_state(struct sta_info *sta,
>   switch (new_state) {
>   case IEEE80211_STA_NONE:
>   if (sta->sta_state == IEEE80211_STA_AUTH)
> - clear_bit(WLAN_STA_AUTH, &sta->_flags);
> + clear_sta_flag(sta, WLAN_STA_AUTH);

You should try to run this patch sometime :)

johannes

2017-01-26 08:51:30

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/2] mac80211: use helper function to access ieee802_1d_to_ac[]

On Tue, 2017-01-24 at 16:42 +0100, Amadeusz Sławiński wrote:
> cleanup patch to make use of ieee80211_ac_from_tid() to retrieve ac
> from
> ieee802_1d_to_ac[]

Applied.

johannes

2017-01-25 08:55:58

by Amadeusz Sławiński

[permalink] [raw]
Subject: Re: [PATCH 2/2] mac80211: use accessor functions to set sta->_flags

And yes I did. Somehow managed to ignore those warnings though, sorry
about that.
Rechecked with just first patch and it should still be good. Please
ignore this one ;)

On 24 January 2017 at 16:44, Johannes Berg <[email protected]> wrot=
e:
> On Tue, 2017-01-24 at 16:42 +0100, Amadeusz S=C5=82awi=C5=84ski wrote:
>> cleanup patch to make use of set_sta_flag()/clear_sta_flag() in
>> places
>> where we access sta->_flags
>>
>> Signed-off-by: Amadeusz S=C5=82awi=C5=84ski <[email protected]=
m>
>> ---
>> net/mac80211/sta_info.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
>> index b6cfcf0..6c9cc2f 100644
>> --- a/net/mac80211/sta_info.c
>> +++ b/net/mac80211/sta_info.c
>> @@ -1855,13 +1855,13 @@ int sta_info_move_state(struct sta_info *sta,
>> switch (new_state) {
>> case IEEE80211_STA_NONE:
>> if (sta->sta_state =3D=3D IEEE80211_STA_AUTH)
>> - clear_bit(WLAN_STA_AUTH, &sta->_flags);
>> + clear_sta_flag(sta, WLAN_STA_AUTH);
>
> You should try to run this patch sometime :)
>
> johannes

2017-01-29 15:53:57

by kernel test robot

[permalink] [raw]
Subject: [mac80211] 4a6736b0fd: WARNING:at_net/mac80211/sta_info.h:#sta_info_move_state[mac80211]

FYI, we noticed the following commit:

commit: 4a6736b0fd81a3ddc7056957a9fe4972df0783e4 ("mac80211: use accessor functions to set sta->_flags")
url: https://github.com/0day-ci/linux/commits/Amadeusz-S-awi-ski/mac80211-use-helper-function-to-access-ieee802_1d_to_ac/20170125-083917
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master

in testcase: hwsim
with following parameters:

group: hwsim-01



on test machine: 8 threads Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz with 8G memory

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):


+-------------------------------------------------------------------+------------+------------+
| | cad7befc7f | 4a6736b0fd |
+-------------------------------------------------------------------+------------+------------+
| boot_successes | 4 | 2 |
| boot_failures | 0 | 6 |
| WARNING:at_net/mac80211/sta_info.h:#sta_info_move_state[mac80211] | 0 | 4 |
| invoked_oom-killer:gfp_mask=0x | 0 | 2 |
| Mem-Info | 0 | 2 |
| Kernel_panic-not_syncing:Out_of_memory_and_no_killable_processes | 0 | 2 |
+-------------------------------------------------------------------+------------+------------+



[ 19.700413] wlan0: send auth to 02:00:00:00:03:00 (try 1/3)
[ 19.700770] wlan0: authenticated
[ 19.700779] ------------[ cut here ]------------
[ 19.700820] WARNING: CPU: 4 PID: 311 at net/mac80211/sta_info.h:567 sta_info_move_state+0x311/0x330 [mac80211]
[ 19.700820] Modules linked in: arc4 mac80211_hwsim mac80211 cfg80211 rfkill rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver netconsole sd_mod sg snd_hda_codec_hdmi intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel pcbc aesni_intel snd_hda_codec_realtek ahci crypto_simd glue_helper snd_hda_codec_generic ppdev libahci cryptd firewire_ohci pcspkr serio_raw libata firewire_core crc_itu_t snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep i915 snd_pcm snd_timer snd video soundcore shpchp drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm parport_pc parport nuvoton_cir rc_core ip_tables
[ 19.700848] CPU: 4 PID: 311 Comm: kworker/u16:6 Not tainted 4.10.0-rc4-00737-g4a6736b #1
[ 19.700849] Hardware name: /DH67GD, BIOS BLH6710H.86A.0132.2011.1007.1505 10/07/2011
[ 19.700873] Workqueue: phy0 ieee80211_iface_work [mac80211]
[ 19.700874] Call Trace:
[ 19.700879] dump_stack+0x63/0x8a
[ 19.700880] __warn+0xcb/0xf0
[ 19.700882] warn_slowpath_null+0x1d/0x20


To reproduce:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/wfg/lkp-tests.git
cd lkp-tests
bin/lkp install job.yaml # job file is attached in this email
bin/lkp run job.yaml



Thanks,
Kernel Test Robot


Attachments:
(No filename) (3.11 kB)
config-4.10.0-rc4-00737-g4a6736b (151.92 kB)
job-script (4.22 kB)
dmesg.xz (504.70 kB)
hwsim (110.84 kB)
job.yaml (3.46 kB)
reproduce (7.83 kB)
Download all attachments