2011-05-02 23:04:34

by Fabio Rossi

[permalink] [raw]
Subject: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]()

I get the following WARNING:

WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]
()
Hardware name: System Product Name
Modules linked in: ath5k ath mac80211 cfg80211 vboxnetadp vboxnetflt vboxdrv
fglrx(P) gspca_zc3xx gspca_main [last unloaded: cfg80211]
Pid: 0, comm: kworker/0:1 Tainted: P W 2.6.39-rc5-wl #9
Call Trace:
<IRQ> [<ffffffff8103af1a>] warn_slowpath_common+0x7a/0xb0
[<ffffffff8103af65>] warn_slowpath_null+0x15/0x20
[<ffffffffa0566b52>] ieee80211_wep_add_iv+0x52/0x150 [mac80211]
[<ffffffffa0567090>] ieee80211_crypto_wep_encrypt+0x60/0xc0 [mac80211]
[<ffffffffa057fce5>] ieee80211_tx_h_encrypt+0x85/0x90 [mac80211]
[<ffffffffa057fdc6>] invoke_tx_handlers+0xd6/0x150 [mac80211]
[<ffffffffa05800db>] ieee80211_tx+0x5b/0xb0 [mac80211]
[<ffffffffa05801cd>] ieee80211_xmit+0x9d/0x1c0 [mac80211]
[<ffffffffa057def9>] ? ieee80211_skb_resize+0xa9/0x130 [mac80211]
[<ffffffffa058112e>] ieee80211_subif_start_xmit+0x32e/0x700 [mac80211]
[<ffffffff81473d0e>] dev_hard_start_xmit+0x31e/0x630
[<ffffffff814e04fc>] ? iptable_mangle_hook+0x11c/0x140
[<ffffffff8148b407>] sch_direct_xmit+0xe7/0x1b0
[<ffffffff81474183>] dev_queue_xmit+0x163/0x5b0
[<ffffffff814a6570>] ? ip_finish_output2+0x280/0x280
[<ffffffff814a66a0>] ip_finish_output+0x130/0x310
[<ffffffff814a6920>] ip_output+0xa0/0xb0
[<ffffffff814a5a4e>] ? __ip_local_out+0x9e/0xa0
[<ffffffff814a5a74>] ip_local_out+0x24/0x30
[<ffffffff814a5eab>] ip_queue_xmit+0x15b/0x3b0
[<ffffffff814bf059>] ? __tcp_v4_send_check+0x59/0xf0
[<ffffffff814ba7f2>] tcp_transmit_skb+0x3c2/0x870
[<ffffffff814bc8fa>] tcp_retransmit_skb+0x1ba/0x5d0
[<ffffffff814be146>] tcp_retransmit_timer+0x276/0x620
[<ffffffff814beb08>] tcp_write_timer+0x188/0x200
[<ffffffff8104707b>] run_timer_softirq+0x11b/0x230
[<ffffffff810478b1>] ? update_process_times+0x71/0x80
[<ffffffff814be980>] ? tcp_delack_timer+0x210/0x210
[<ffffffff810640e8>] ? tick_dev_program_event+0x48/0x110
[<ffffffff81040d81>] __do_softirq+0x91/0x120
[<ffffffff810599c5>] ? hrtimer_interrupt+0x155/0x240
[<ffffffff815716cc>] call_softirq+0x1c/0x30
[<ffffffff81003f3d>] do_softirq+0x4d/0x80
[<ffffffff81040c26>] irq_exit+0x86/0xa0
[<ffffffff8101bc3b>] smp_apic_timer_interrupt+0x6b/0xa0
[<ffffffff81571193>] apic_timer_interrupt+0x13/0x20
<EOI> [<ffffffff8105af91>] ? notifier_call_chain+0x51/0x80
[<ffffffff81283765>] ? intel_idle+0xb5/0x110
[<ffffffff81283748>] ? intel_idle+0x98/0x110
[<ffffffff813f74a2>] cpuidle_idle_call+0x82/0xf0
[<ffffffff81001579>] cpu_idle+0x59/0xb0
[<ffffffff81569f25>] start_secondary+0x181/0x185
---[ end trace be478a136930e9e5 ]---



Fabio


2011-05-03 14:28:53

by Johannes Berg

[permalink] [raw]
Subject: RE: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]()

On Tue, 2011-05-03 at 07:25 -0700, Yogesh Powar wrote:
> >so may will this help? I don't know whether its a correct and with a
> >quick test the warning gets fixed.
> That should solve our problem with following explanation.
>
> The devices that require IV generation in software need tailroom reservation
> for ICVs used in TKIP or WEP encryptions.
>
> Currently, decision to skip the tailroom reservation in the tx
> path was taken only on whether driver wants MMIC to be generated
> in software or not. Following patch appends IV generation check for such
> decisions.
>
> diff --git a/net/mac80211/key.c b/net/mac80211/key.c
> index ca3c626..f3c4deb 100644
> --- a/net/mac80211/key.c
> +++ b/net/mac80211/key.c
> @@ -102,7 +102,9 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
> if (!ret) {
> key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;
>
> - if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC))
> + if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
> + (key->conf.flags &
> + IEEE80211_KEY_FLAG_GENERATE_IV)))
> key->local->crypto_tx_tailroom_needed_cnt--;

Can we have a bit nicer code style? :)

Also, need to submit a proper patch with S-o-b etc, and reported-by
rossi.

johannes


2011-05-03 11:27:37

by Fabio Rossi

[permalink] [raw]
Subject: RE: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]()

>Da: [email protected]
>Data: 03/05/2011 12.51
>A: "[email protected]"<[email protected]>, "[email protected]"
<[email protected]>
>Cc: "[email protected]"<[email protected]>
>Ogg: RE: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150
[mac80211]()
>
>>I get the warning every few seconds.
>>
>>Fabio
>I failed to regenerate the issue on my setup. I am using WEP40 on
>Ath5k as station on 32 bit machine. I even tried disabling hw encryption.
>
>Some more details would be helpful.
>
>Thanks
>Yogesh

I'm using WEP with 128bit key on a 64bit system using ath5k driver. The hw
encryption is configured with the default value. I don't have access right now
to the machine, I can provide more details tonight if needed. I can test
patches to diagnose the problem.

Regards,
Fabio



2011-05-03 08:31:22

by Johannes Berg

[permalink] [raw]
Subject: Re: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]()

On Mon, 2011-05-02 at 22:57 +0200, Fabio Rossi wrote:
> I get the following WARNING:
>
> WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]
> ()

Once, or consistently? Must be caused by

commit aac6af5534fade2b18682a0b9efad1a6c04c34c6
Author: Yogesh Ashok Powar <[email protected]>
Date: Wed Apr 27 18:40:29 2011 +0530

mac80211: Skip tailroom reservation for full HW-crypto devices

Yogesh, please investigate how this happens.

johannes


2011-05-03 14:27:30

by Yogesh Ashok Powar

[permalink] [raw]
Subject: RE: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]()

>so may will this help? I don't know whether its a correct and with a
>quick test the warning gets fixed.
That should solve our problem with following explanation.

The devices that require IV generation in software need tailroom reservation
for ICVs used in TKIP or WEP encryptions.

Currently, decision to skip the tailroom reservation in the tx
path was taken only on whether driver wants MMIC to be generated
in software or not. Following patch appends IV generation check for such
decisions.

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index ca3c626..f3c4deb 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -102,7 +102,9 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
if (!ret) {
key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;

- if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC))
+ if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
+ (key->conf.flags &
+ IEEE80211_KEY_FLAG_GENERATE_IV)))
key->local->crypto_tx_tailroom_needed_cnt--;

return 0;
@@ -161,7 +163,9 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)

key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;

- if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC))
+ if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
+ (key->conf.flags &
+ IEEE80211_KEY_FLAG_GENERATE_IV)))
key->local->crypto_tx_tailroom_needed_cnt++;
}

--

2011-05-03 15:18:27

by Mohammed Shafi

[permalink] [raw]
Subject: Re: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]()

On Tue, May 3, 2011 at 7:58 PM, Johannes Berg <[email protected]> wrote:
> On Tue, 2011-05-03 at 07:25 -0700, Yogesh Powar wrote:
>> >so may will this help? I don't know whether its a correct and with a
>> >quick test the warning gets fixed.
>> That should solve our problem with following explanation.
>>
>> The devices that require IV generation in software need tailroom reservation
>> for ICVs used in TKIP or WEP encryptions.
>>
>> Currently, decision to skip the tailroom reservation in the tx
>> path was taken only on whether driver wants MMIC to be generated
>> in software or not. Following patch appends IV generation check for such
>> decisions.
>>
>> diff --git a/net/mac80211/key.c b/net/mac80211/key.c
>> index ca3c626..f3c4deb 100644
>> --- a/net/mac80211/key.c
>> +++ b/net/mac80211/key.c
>> @@ -102,7 +102,9 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
>> ? ? ? if (!ret) {
>> ? ? ? ? ? ? ? key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;
>>
>> - ? ? ? ? ? ? if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC))
>> + ? ? ? ? ? ? if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? (key->conf.flags &
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IEEE80211_KEY_FLAG_GENERATE_IV)))
>> ? ? ? ? ? ? ? ? ? ? ? key->local->crypto_tx_tailroom_needed_cnt--;
>
> Can we have a bit nicer code style? :)
>
> Also, need to submit a proper patch with S-o-b etc, and reported-by
> rossi.

Can please send the patch, with some more testing.


>
> johannes
>
>

2011-05-03 11:44:47

by Mohammed Shafi

[permalink] [raw]
Subject: Re: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150 [mac80211]()

On Tue, May 3, 2011 at 4:57 PM, [email protected] <[email protected]> wrote:
>>Da: [email protected]
>>Data: 03/05/2011 12.51
>>A: "[email protected]"<[email protected]>, "[email protected]"
> <[email protected]>
>>Cc: "[email protected]"<[email protected]>
>>Ogg: RE: WARNING: at net/mac80211/wep.c:101 ieee80211_wep_add_iv+0x52/0x150
> [mac80211]()
>>
>>>I get the warning every few seconds.
>>>
>>>Fabio
>>I failed to regenerate the issue on my setup. I am using WEP40 on
>>Ath5k as station on 32 bit machine. I even tried disabling hw encryption.
>>
>>Some more details would be helpful.
>>
>>Thanks
>>Yogesh
>
> I'm using WEP with 128bit key on a 64bit system using ath5k driver. The hw
> encryption is configured with the default value. I don't have access right now
> to the machine, I can provide more details tonight if needed. I can test
> patches to diagnose the problem.
>
> Regards,
> Fabio

this also hits ath9k i think.
just running a traffic between WEP secured AP will reproduce this issue.
saw in set_key call back in ath9k/ath5k

key->hw_key_idx = ret;
/* push IV and Michael MIC generation to stack */
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MM

so may will this help? I don't know whether its a correct and with a
quick test the warning gets fixed.

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index ca3c626..49444c8 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -102,7 +102,8 @@ static int ieee80211_key_enable_hw_accel(struct
ieee80211_key *key)
if (!ret) {
key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;

- if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC))
+ if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)||
+ (key->conf.flags &
IEEE80211_KEY_FLAG_GENERATE_IV)))
key->local->crypto_tx_tailroom_needed_cnt--;

return 0;
@@ -161,7 +162,8 @@ static void ieee80211_key_disable_hw_accel(struct
ieee80211_key *key)

key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;

- if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC))
+ if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)||
+ (key->conf.flags &
IEEE80211_KEY_FLAG_GENERATE_IV)))
key->local->crypto_tx_tailroom_needed_cnt++;
}



>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>