* Re: [PATCH] net/wireless: add COUNTRY to to regulatory device uevent
From: Johannes Berg @ 2011-11-08 22:15 UTC (permalink / raw)
To: Scott James Remnant
Cc: John W. Linville, linux-wireless, Kay Sievers, Greg Kroah-Hartman,
Sam Leffler, keybuk, Luis R. Rodriguez
In-Reply-To: <1299609930-14011-1-git-send-email-scott@netsplit.com>
On Tue, 2011-03-08 at 10:45 -0800, Scott James Remnant wrote:
> From: Scott James Remnant <keybuk@google.com>
>
> Regulatory devices issue change uevents to inform userspace of a need
> to call the crda tool; however these can often be sent before udevd is
> running, and were not previously included in the results of
> udevadm trigger (which requests a new change event using the /uevent
> attribute of the sysfs object).
>
> Add a uevent function to the device type which includes the COUNTRY
> information from the last request if it has yet to be processed, the
> case of multiple requests is already handled in the code by checking
> whether an unprocessed one is queued in the same manner and refusing
> to queue a new one.
>
> The existing udev rule continues to work as before.
Luis points out that it looks like this caused the crash I reported
earlier today -- in the module exit path we have a use-after-free of
last_request now.
johannes
^ permalink raw reply
* Re: regulatory crash
From: Luis R. Rodriguez @ 2011-11-08 21:58 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1320756755.4304.29.camel@jlt3.sipsolutions.net>
On Tue, Nov 8, 2011 at 4:52 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> After random poking with hwsim:
>
> [ 640.357147] mac80211_hwsim: unregister radios
> [ 640.357151] mac80211_hwsim: closing netlink
> [ 640.871735] BUG: unable to handle kernel paging request at ffff88001a06b5ab
> [ 640.879198] IP: [<ffffffffa030df9a>] reg_device_uevent+0x1a/0x50 [cfg80211]
> [ 640.880507] PGD 1836063 PUD 183a063 PMD 1ffcb067 PTE 1a06b160
> [ 640.880507] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
> [ 640.880507] CPU 0
> [ 640.880507] Modules linked in: cfg80211(-) [last unloaded: mac80211]
> [ 640.880507]
> [ 640.880507] Pid: 2279, comm: rmmod Tainted: G W 3.1.0-wl+ #663 Bochs Bochs
> [ 640.880507] RIP: 0010:[<ffffffffa030df9a>] [<ffffffffa030df9a>] reg_device_uevent+0x1a/0x50 [cfg80211]
> [ 640.880507] RSP: 0000:ffff88001c5f9d58 EFLAGS: 00010286
> [ 640.880507] RAX: 0000000000000000 RBX: ffff88001d2eda88 RCX: ffff88001c7468fc
> [ 640.880507] RDX: ffff88001a06b5a0 RSI: ffff88001c7467b0 RDI: ffff88001c7467b0
> [ 640.880507] RBP: ffff88001c5f9d58 R08: 000000000000ffff R09: 000000000000ffff
> [ 640.880507] R10: 0000000000000000 R11: 0000000000000001 R12: ffff88001c7467b0
> [ 640.880507] R13: ffff88001d2eda78 R14: ffffffff8164a840 R15: 0000000000000001
> [ 640.880507] FS: 00007f8a91d8a6e0(0000) GS:ffff88001fc00000(0000) knlGS:0000000000000000
> [ 640.880507] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> [ 640.880507] CR2: ffff88001a06b5ab CR3: 000000001c62e000 CR4: 00000000000006f0
> [ 640.880507] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [ 640.880507] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> [ 640.880507] Process rmmod (pid: 2279, threadinfo ffff88001c5f8000, task ffff88000023c780)
> [ 640.880507] Stack:
> [ 640.880507] ffff88001c5f9d98 ffffffff812ff7e5 ffffffff8176ab3d ffff88001c7468c2
> [ 640.880507] 000000000000ffff ffff88001d2eda88 ffff88001c7467b0 ffff880000114820
> [ 640.880507] ffff88001c5f9e38 ffffffff81241dc7 ffff88001c5f9db8 ffffffff81040189
> [ 640.880507] Call Trace:
> [ 640.880507] [<ffffffff812ff7e5>] dev_uevent+0xc5/0x170
> [ 640.880507] [<ffffffff81241dc7>] kobject_uevent_env+0x1f7/0x490
> [ 640.880507] [<ffffffff81040189>] ? sub_preempt_count+0x29/0x60
> [ 640.880507] [<ffffffff814cab1a>] ? _raw_spin_unlock_irqrestore+0x4a/0x90
> [ 640.880507] [<ffffffff81305307>] ? devres_release_all+0x27/0x60
> [ 640.880507] [<ffffffff8124206b>] kobject_uevent+0xb/0x10
> [ 640.880507] [<ffffffff812fee27>] device_del+0x157/0x1b0
> [ 640.880507] [<ffffffff8130377d>] platform_device_del+0x1d/0x90
> [ 640.880507] [<ffffffff81303b76>] platform_device_unregister+0x16/0x30
> [ 640.880507] [<ffffffffa030fffd>] regulatory_exit+0x5d/0x180 [cfg80211]
> [ 640.880507] [<ffffffffa032bec3>] cfg80211_exit+0x2b/0x45 [cfg80211]
> [ 640.880507] [<ffffffff8109a84c>] sys_delete_module+0x16c/0x220
> [ 640.880507] [<ffffffff8108a23e>] ? trace_hardirqs_on_caller+0x7e/0x120
> [ 640.880507] [<ffffffff814cba02>] system_call_fastpath+0x16/0x1b
> [ 640.880507] Code: 5b 5d c3 66 0f 1f 44 00 00 bf 10 00 00 00 eb d1 90 55 48 89 e5 66 66 66 66 90 48 8b 15 b8 3b 02 00 31 c0 48 85 d2 48 89 f7 74 06
> [ 640.880507] 7a 0b 00 74 08 5d c3 66 0f 1f 44 00 00 0f be 4a 09 48 c7 c6
> [ 640.880507] RIP [<ffffffffa030df9a>] reg_device_uevent+0x1a/0x50 [cfg80211]
> [ 640.880507] RSP <ffff88001c5f9d58>
> [ 640.880507] CR2: ffff88001a06b5ab
> [ 640.880507] ---[ end trace 147c5099a411e8c0 ]---
> [ 640.880507] BUG: sleeping function called from invalid context at /home/johannes/sys/wireless-testing/kernel/rwsem.c:21
> [ 640.880507] in_atomic(): 0, irqs_disabled(): 1, pid: 2279, name: rmmod
> [ 640.880507] INFO: lockdep is turned off.
> [ 640.880507] irq event stamp: 31652
> [ 640.880507] hardirqs last enabled at (31651): [<ffffffff814bd1b0>] __slab_alloc.isra.58.constprop.63+0x3b8/0x3db
> [ 640.880507] hardirqs last disabled at (31652): [<ffffffff814cb536>] error_sti+0x5/0x6
> [ 640.880507] softirqs last enabled at (31204): [<ffffffff81052ab7>] __do_softirq+0x137/0x3c0
> [ 640.880507] softirqs last disabled at (31185): [<ffffffff814cd07c>] call_softirq+0x1c/0x30
> [ 640.880507] Pid: 2279, comm: rmmod Tainted: G D W 3.1.0-wl+ #663
> [ 640.880507] Call Trace:
> [ 640.880507] [<ffffffff81089740>] ? print_irqtrace_events+0xd0/0xe0
> [ 640.880507] [<ffffffff8103b729>] __might_sleep.part.132+0xb9/0xd0
> [ 640.880507] [<ffffffff8103b791>] __might_sleep+0x51/0x70
> [ 640.880507] [<ffffffff814c9246>] down_read+0x26/0x9c
> [ 640.880507] [<ffffffff810a39cb>] acct_collect+0x4b/0x1b0
> [ 640.880507] [<ffffffff8104f1eb>] do_exit+0x30b/0x470
> [ 640.880507] [<ffffffff81005b19>] oops_end+0x89/0xc0
> [ 640.880507] [<ffffffff814b7864>] no_context+0x146/0x153
> [ 640.880507] [<ffffffff814b7a42>] __bad_area_nosemaphore+0x1d1/0x1f0
> [ 640.880507] [<ffffffff814caaa5>] ? _raw_spin_unlock+0x35/0x60
> [ 640.880507] [<ffffffff814b7a74>] bad_area_nosemaphore+0x13/0x15
> [ 640.880507] [<ffffffff8102a7ed>] do_page_fault+0x40d/0x4e0
> [ 640.880507] [<ffffffff814bd1b0>] ? __slab_alloc.isra.58.constprop.63+0x3b8/0x3db
> [ 640.880507] [<ffffffff8108a23e>] ? trace_hardirqs_on_caller+0x7e/0x120
> [ 640.880507] [<ffffffff81249cde>] ? string.isra.5+0x3e/0xd0
> [ 640.880507] [<ffffffff8124c91d>] ? trace_hardirqs_off_thunk+0x3a/0x3c
> [ 640.880507] [<ffffffff814cb2f5>] page_fault+0x25/0x30
> [ 640.880507] [<ffffffffa030df9a>] ? reg_device_uevent+0x1a/0x50 [cfg80211]
> [ 640.880507] [<ffffffff81303560>] ? platform_uevent+0x30/0x40
> [ 640.880507] [<ffffffff812ff7e5>] dev_uevent+0xc5/0x170
> [ 640.880507] [<ffffffff81241dc7>] kobject_uevent_env+0x1f7/0x490
> [ 640.880507] [<ffffffff81040189>] ? sub_preempt_count+0x29/0x60
> [ 640.880507] [<ffffffff814cab1a>] ? _raw_spin_unlock_irqrestore+0x4a/0x90
> [ 640.880507] [<ffffffff81305307>] ? devres_release_all+0x27/0x60
> [ 640.880507] [<ffffffff8124206b>] kobject_uevent+0xb/0x10
> [ 640.880507] [<ffffffff812fee27>] device_del+0x157/0x1b0
> [ 640.880507] [<ffffffff8130377d>] platform_device_del+0x1d/0x90
> [ 640.880507] [<ffffffff81303b76>] platform_device_unregister+0x16/0x30
> [ 640.880507] [<ffffffffa030fffd>] regulatory_exit+0x5d/0x180 [cfg80211]
> [ 640.880507] [<ffffffffa032bec3>] cfg80211_exit+0x2b/0x45 [cfg80211]
> [ 640.880507] [<ffffffff8109a84c>] sys_delete_module+0x16c/0x220
> [ 640.880507] [<ffffffff8108a23e>] ? trace_hardirqs_on_caller+0x7e/0x120
> [ 640.880507] [<ffffffff814cba02>] system_call_fastpath+0x16/0x1b
>
It seems we cannot tell udev we are committing suicide at __exit() for
whatever reason. Not sure why. I find this odd unless this is
generally true. Can you reproduce easily? Can you try this.
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2520a1b..9f1037e 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2259,6 +2259,8 @@ void /* __init_or_exit */ regulatory_exit(void)
mutex_lock(&cfg80211_mutex);
mutex_lock(®_mutex);
+ dev_set_uevent_suppress(®_pdev->dev, true);
+
reset_regdomains();
kfree(last_request);
Luis
^ permalink raw reply related
* Re: [PATCH] Fix linking with libnl-3
From: Gilles Espinasse @ 2011-11-08 21:17 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless
In-Reply-To: <1320739783-3415-1-git-send-email-g.esp@free.fr>
----- Original Message -----
From: "Gilles Espinasse" <g.esp@free.fr>
To: <johannes@sipsolutions.net>
Cc: <linux-wireless@vger.kernel.org>; "Gilles Espinasse" <g.esp@free.fr>
Sent: Tuesday, November 08, 2011 9:09 AM
Subject: [PATCH] Fix linking with libnl-3
> iw3.2 fail to link libnl-3.2.2 with this error
> /usr/bin/ld: cannot find -lnl-genl
>
> Contrary to previous libnl version, on v3 there is a dedicated
libnl-genl-3.0.pc file
> Simply use that.
>
> Signed-off-by: Gilles Espinasse <g.esp@free.fr>
> ---
> Makefile | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 8443ee6..fb46324 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -36,10 +36,11 @@ LIBS += -lnl-genl
> NLLIBNAME = libnl-2.0
> endif
>
> +# libnl-3 has a separate libnl-genl-3.0.pc
> ifeq ($(NL3FOUND),Y)
> CFLAGS += -DCONFIG_LIBNL30
> -LIBS += -lnl-genl
> -NLLIBNAME = libnl-3.0
> +LIBS =
> +NLLIBNAME = libnl-genl-3.0
> endif
>
> ifeq ($(NLLIBNAME),)
> --
> 1.5.6.5
>
I had a bit of doubt and checked libnl-3.0, libnl-3.1, libnl-3.2.0
While the patch perfectly work for libnl-3.2.0..3.2.2 :
- it break libnl-3.0 where previous code would have work (no
libnl-genl-3.0.pc)
- libnl-3.1 had a libnl-genl-3.1.pc, so Makefile is broken with previous and
new code
Unsure there is a need to support 3.0 and 3.1 when three 3.2.<x> versions
exist?
Gilles
^ permalink raw reply
* Compat-wireless release for 2011-11-08 is baked
From: Compat-wireless cronjob account @ 2011-11-08 21:11 UTC (permalink / raw)
To: linux-wireless
>From git://github.com/mcgrof/compat
6aa6962..fd3c355 master -> origin/master
compat-wireless code metrics
815679 - Total upstream lines of code being pulled
2488 - backport code changes
2143 - backport code additions
345 - backport code deletions
8650 - backport from compat module
11138 - total backport code
1.3655 - % of code consists of backport work
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Johannes Berg @ 2011-11-08 21:08 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless
In-Reply-To: <4EB999BE.8050909@candelatech.com>
On Tue, 2011-11-08 at 13:06 -0800, Ben Greear wrote:
> > About APs: that can't be right, there certainly will be 1x1 APs.
>
> Section 20.1.1 again:
>
> "An HT non-AP STA shall support all equal modulation (EQM) rates for one spatial stream (MCSs 0 through
> 7) using 20 MHz channel width. An HT AP shall support all EQM rates for one and two spatial streams
> (MCSs 0 through 15) using 20 MHz channel width."
>
> Again, I think the requirement is lame, and maybe everyone will just ignore it,
> but it is there...
Funny. Yeah I'm pretty sure everybody ignores that. Of course maybe you
can't get a 1x1 AP certified as an AP, but surely that'll happen with a
P2P GO all the time.
> > start = allow_single_stream_mask ? 0 : 1;
> >
> > for (i = start; i< IEEE80211_HT_MCS_MASK_LEN; i++) {
> > u8 val = smask[i]& scaps[i];
> > val |= ht_cap->mcs.rx_mask[i]& ~smask[i];
> > ht_cap->mcs.rx_mask[i] val;
> > }
> >
> > or so. right? Much simpler?
>
> Depends on whether we want to honour the AP part of 20.1.1.
> Since we don't support AP mode anyway right now,
> I'm fine with your suggestion. Let me know if you want
> me to proceed with your suggested changes.
I don't want to honour it. In fact, the more I think about it the less I
want to honour the 0-7 part here, since that just made the code more
complex and almost nobody will be using this override anyway.
johannes
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Ben Greear @ 2011-11-08 21:06 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1320785889.24797.75.camel@jlt3.sipsolutions.net>
On 11/08/2011 12:58 PM, Johannes Berg wrote:
> On Tue, 2011-11-08 at 12:44 -0800, Ben Greear wrote:
>> On 11/08/2011 12:09 PM, Johannes Berg wrote:
>>> On Tue, 2011-11-08 at 11:36 -0800, greearb@candelatech.com wrote:
>>>
>>>> + /*
>>>> + * We always need to advert at least MCS0-7, to
>>>> + * be a compliant HT station, for instance
>>>> + */
>>>> + if (((i * 8 + q)>= min_rates)&&
>>>
>>> This is a little misleading -- why min_rates when the comment says
>>> MCS0-7?
>>
>> I let caller determine the min, but comment was to tell why
>> the min might be set. In APs, the min supported rates are 16, evidently...not
>> that this code supports APs at the moment...
>
> About APs: that can't be right, there certainly will be 1x1 APs.
Section 20.1.1 again:
"An HT non-AP STA shall support all equal modulation (EQM) rates for one spatial stream (MCSs 0 through
7) using 20 MHz channel width. An HT AP shall support all EQM rates for one and two spatial streams
(MCSs 0 through 15) using 20 MHz channel width."
Again, I think the requirement is lame, and maybe everyone will just ignore it,
but it is there...
>> When this is about local use instead of advertising, then any minimum
>> is OK.
>>
>> Want me to just remove the comment entirely?
>
> Well, so, I think the logic there is a little odd anyway -- why aren't
> you doing it byte-wise, if the only thing that can possibly happen is
> that the first byte is masked or not? Maybe change the parameter to
> "bool allow_single_stream_mask" or something like that and adjust the
> algorithm like:
>
> start = allow_single_stream_mask ? 0 : 1;
>
> for (i = start; i< IEEE80211_HT_MCS_MASK_LEN; i++) {
> u8 val = smask[i]& scaps[i];
> val |= ht_cap->mcs.rx_mask[i]& ~smask[i];
> ht_cap->mcs.rx_mask[i] val;
> }
>
> or so. right? Much simpler?
Depends on whether we want to honour the AP part of 20.1.1.
Since we don't support AP mode anyway right now,
I'm fine with your suggestion. Let me know if you want
me to proceed with your suggested changes.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Johannes Berg @ 2011-11-08 21:02 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless
In-Reply-To: <4EB99812.3000507@candelatech.com>
On Tue, 2011-11-08 at 12:58 -0800, Ben Greear wrote:
> >> +bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata)
> >> +{
> >> + if ((sdata->u.mgd.ht_capa_mask.cap_info&
> >> + IEEE80211_HT_CAP_SUP_WIDTH_20_40)&&
> >> + !(sdata->u.mgd.ht_capa.cap_info&
> >> + IEEE80211_HT_CAP_SUP_WIDTH_20_40))
> >> + return true;
> >> + return false;
> >
> > Would it really go above 80 cols if you didn't line-wrap it? Maybe
> > remove the extra sets of parentheses? And even if it goes to a little
> > bit above 80 it's still be more readable without the wrapping ...
>
> It is more readable w/out the wrapping, but hard to know when
> patches get rejected about that or not, so I tried to keep
> checkpatch happy. If you'll take slightly longer lines I'll
> happily un-wrap it.
Please. I'd rather go over a bit than read the above :-)
> > One thing I don't quite understand: Why don't you calculate the HT caps
> > to use upon assoc request, and then store *those* instead, then you
> > wouldn't have to check the overrides every time.
>
> Adding more state just gives more places to mess up that
> state or forget to update it somehow. Think of the channel
> pointers in the scan & work code :)
> Not to mention the extra bloat in RAM.
> Since this is not hot-path code, I think having less state
> is well worth the effort.
You don't have more state though, you actually should end up with less
since you can throw away the configured ht_caps & ht_mask? And you
really just shift the access from sband->... to calculated_... stuff.
> > For example here:
> >
> >> if (!(ap_ht_cap_flags& IEEE80211_HT_CAP_40MHZ_INTOLERANT)&&
> >> + !ieee80111_cfg_override_disables_ht40(sdata)&&
> >> (sband->ht_cap.cap& IEEE80211_HT_CAP_SUP_WIDTH_20_40)&&
> >> (hti->ht_param& IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
> >> switch(hti->ht_param& IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
> >
> > This just adds complexity. If you calculate sdata->used_ht_caps first
> > then you can replace the sband->ht_cap.cap check with an
> > sdata->used_ht_caps.cap check and be done with it, instead of having to
> > check both.
>
> I think that's a bad idea, but will change it if you insist.
I really think that'd be much nicer. As it is now we have to add all
these checks everywhere, if we just calculate it once and then change
places to use it we just have to remember to use the right thing.
johannes
^ permalink raw reply
* Re: pull request: bluetooth-next 2011-10-17
From: John W. Linville @ 2011-11-08 20:58 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-wireless, linux-bluetooth, linux-kernel
In-Reply-To: <20111017203900.GE2631@joana>
On Mon, Oct 17, 2011 at 06:39:01PM -0200, Gustavo Padovan wrote:
> As the 3.1 release is taking too long to happen I decided to send you another
> pull request. If you think it's too late just ignore it, or queue it up for
> 3.3 merge window. Do what is better to you. ;)
Well, I did think it was too late so I didn't pull it. I went to
pull it today, but it seems there is some newer stuff on top. Worse,
that newer stuff seems to cause conflicts. :-(
I'll just take the "ignore it" option for now until your next pull
request. :-)
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Johannes Berg @ 2011-11-08 21:00 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless
In-Reply-To: <1320785889.24797.75.camel@jlt3.sipsolutions.net>
On Tue, 2011-11-08 at 21:58 +0100, Johannes Berg wrote:
> On Tue, 2011-11-08 at 12:44 -0800, Ben Greear wrote:
> > On 11/08/2011 12:09 PM, Johannes Berg wrote:
> > > On Tue, 2011-11-08 at 11:36 -0800, greearb@candelatech.com wrote:
> > >
> > >> + /*
> > >> + * We always need to advert at least MCS0-7, to
> > >> + * be a compliant HT station, for instance
> > >> + */
> > >> + if (((i * 8 + q)>= min_rates)&&
> > >
> > > This is a little misleading -- why min_rates when the comment says
> > > MCS0-7?
> >
> > I let caller determine the min, but comment was to tell why
> > the min might be set. In APs, the min supported rates are 16, evidently...not
> > that this code supports APs at the moment...
>
> About APs: that can't be right, there certainly will be 1x1 APs.
>
> > When this is about local use instead of advertising, then any minimum
> > is OK.
> >
> > Want me to just remove the comment entirely?
>
> Well, so, I think the logic there is a little odd anyway -- why aren't
> you doing it byte-wise, if the only thing that can possibly happen is
> that the first byte is masked or not? Maybe change the parameter to
> "bool allow_single_stream_mask" or something like that and adjust the
> algorithm like:
>
> start = allow_single_stream_mask ? 0 : 1;
>
> for (i = start; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
> u8 val = smask[i] & scaps[i];
> val |= ht_cap->mcs.rx_mask[i] & ~smask[i];
> ht_cap->mcs.rx_mask[i] val;
> }
Ok, no, I totally misunderstood the variables here, but anyway, it seems
there's no need for bit-wise stuff.
johannes
^ permalink raw reply
* Re: [PATCH] compat: add some workarounds for Debian squeeze
From: Luis R. Rodriguez @ 2011-11-08 20:58 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: linux-wireless
In-Reply-To: <1320785191-8052-1-git-send-email-hauke@hauke-m.de>
On Tue, Nov 8, 2011 at 12:46 PM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> Debian squeeze also backports some stuff and this conflicts with compat
> wireless stuff. This is a nice way of making compat work with debian
> squeeze without breaking normal kernels.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Thanks, applied, and also applied the other two compat.git patches and
the pending compat-wireless patch you had sent. Thanks!!
Luis
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Ben Greear @ 2011-11-08 20:58 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1320783128.24797.48.camel@jlt3.sipsolutions.net>
On 11/08/2011 12:12 PM, Johannes Berg wrote:
> On Tue, 2011-11-08 at 11:36 -0800, greearb@candelatech.com wrote:
>
>> +bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata)
>> +{
>> + if ((sdata->u.mgd.ht_capa_mask.cap_info&
>> + IEEE80211_HT_CAP_SUP_WIDTH_20_40)&&
>> + !(sdata->u.mgd.ht_capa.cap_info&
>> + IEEE80211_HT_CAP_SUP_WIDTH_20_40))
>> + return true;
>> + return false;
>
> Would it really go above 80 cols if you didn't line-wrap it? Maybe
> remove the extra sets of parentheses? And even if it goes to a little
> bit above 80 it's still be more readable without the wrapping ...
It is more readable w/out the wrapping, but hard to know when
patches get rejected about that or not, so I tried to keep
checkpatch happy. If you'll take slightly longer lines I'll
happily un-wrap it.
>
> One thing I don't quite understand: Why don't you calculate the HT caps
> to use upon assoc request, and then store *those* instead, then you
> wouldn't have to check the overrides every time.
Adding more state just gives more places to mess up that
state or forget to update it somehow. Think of the channel
pointers in the scan & work code :)
Not to mention the extra bloat in RAM.
Since this is not hot-path code, I think having less state
is well worth the effort.
> For example here:
>
>> if (!(ap_ht_cap_flags& IEEE80211_HT_CAP_40MHZ_INTOLERANT)&&
>> + !ieee80111_cfg_override_disables_ht40(sdata)&&
>> (sband->ht_cap.cap& IEEE80211_HT_CAP_SUP_WIDTH_20_40)&&
>> (hti->ht_param& IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
>> switch(hti->ht_param& IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
>
> This just adds complexity. If you calculate sdata->used_ht_caps first
> then you can replace the sband->ht_cap.cap check with an
> sdata->used_ht_caps.cap check and be done with it, instead of having to
> check both.
I think that's a bad idea, but will change it if you insist.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Johannes Berg @ 2011-11-08 20:58 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless
In-Reply-To: <4EB994A1.1020808@candelatech.com>
On Tue, 2011-11-08 at 12:44 -0800, Ben Greear wrote:
> On 11/08/2011 12:09 PM, Johannes Berg wrote:
> > On Tue, 2011-11-08 at 11:36 -0800, greearb@candelatech.com wrote:
> >
> >> + /*
> >> + * We always need to advert at least MCS0-7, to
> >> + * be a compliant HT station, for instance
> >> + */
> >> + if (((i * 8 + q)>= min_rates)&&
> >
> > This is a little misleading -- why min_rates when the comment says
> > MCS0-7?
>
> I let caller determine the min, but comment was to tell why
> the min might be set. In APs, the min supported rates are 16, evidently...not
> that this code supports APs at the moment...
About APs: that can't be right, there certainly will be 1x1 APs.
> When this is about local use instead of advertising, then any minimum
> is OK.
>
> Want me to just remove the comment entirely?
Well, so, I think the logic there is a little odd anyway -- why aren't
you doing it byte-wise, if the only thing that can possibly happen is
that the first byte is masked or not? Maybe change the parameter to
"bool allow_single_stream_mask" or something like that and adjust the
algorithm like:
start = allow_single_stream_mask ? 0 : 1;
for (i = start; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
u8 val = smask[i] & scaps[i];
val |= ht_cap->mcs.rx_mask[i] & ~smask[i];
ht_cap->mcs.rx_mask[i] val;
}
or so. right? Much simpler?
johannes
^ permalink raw reply
* [PATCH] compat: add some workarounds for Debian squeeze
From: Hauke Mehrtens @ 2011-11-08 20:46 UTC (permalink / raw)
To: mcgrof, mcgrof; +Cc: linux-wireless, Hauke Mehrtens
Debian squeeze also backports some stuff and this conflicts with compat
wireless stuff. This is a nice way of making compat work with debian
squeeze without breaking normal kernels.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
include/linux/compat-2.6.33.h | 9 +++++++++
include/linux/compat-2.6.34.h | 6 ++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index 386ee4c..539b469 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -55,6 +55,9 @@ static inline void compat_release_firmware(const struct firmware *fw)
/* this will never happen on older kernels */
#define NETDEV_POST_INIT 0xffff
+/* mask netdev_alloc_skb_ip_align as debian squeeze also backports this */
+#define netdev_alloc_skb_ip_align(a, b) compat_netdev_alloc_skb_ip_align(a, b)
+
static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
unsigned int length)
{
@@ -107,6 +110,9 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
#define sock_recv_ts_and_drops(msg, sk, skb) sock_recv_timestamp(msg, sk, skb)
+/* mask pci_pcie_cap as debian squeeze also backports this */
+#define pci_pcie_cap(a) compat_pci_pcie_cap(a)
+
/**
* pci_pcie_cap - get the saved PCIe capability offset
* @dev: PCI device
@@ -144,6 +150,9 @@ static inline bool pci_is_pcie(struct pci_dev *dev)
#define __always_unused /* unimplemented */
#endif
+/* mask IS_ERR_OR_NULL as debian squeeze also backports this */
+#define IS_ERR_OR_NULL(a) compat_IS_ERR_OR_NULL(a)
+
static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
{
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
diff --git a/include/linux/compat-2.6.34.h b/include/linux/compat-2.6.34.h
index 0ab344c..562ccf7 100644
--- a/include/linux/compat-2.6.34.h
+++ b/include/linux/compat-2.6.34.h
@@ -212,6 +212,8 @@ do { \
#define usb_alloc_coherent(dev, size, mem_flags, dma) usb_buffer_alloc(dev, size, mem_flags, dma)
#define usb_free_coherent(dev, size, addr, dma) usb_buffer_free(dev, size, addr, dma)
+/* only include this if DEFINE_DMA_UNMAP_ADDR is not set as debian squeeze also backports this */
+#ifndef DEFINE_DMA_UNMAP_ADDR
#ifdef CONFIG_NEED_DMA_MAP_STATE
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME
#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME
@@ -227,6 +229,10 @@ do { \
#define dma_unmap_len(PTR, LEN_NAME) (0)
#define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
#endif
+#endif
+
+/* mask dma_set_coherent_mask as debian squeeze also backports this */
+#define dma_set_coherent_mask(a, b) compat_dma_set_coherent_mask(a, b)
static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
{
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Ben Greear @ 2011-11-08 20:44 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1320782949.24797.45.camel@jlt3.sipsolutions.net>
On 11/08/2011 12:09 PM, Johannes Berg wrote:
> On Tue, 2011-11-08 at 11:36 -0800, greearb@candelatech.com wrote:
>
>> + /*
>> + * We always need to advert at least MCS0-7, to
>> + * be a compliant HT station, for instance
>> + */
>> + if (((i * 8 + q)>= min_rates)&&
>
> This is a little misleading -- why min_rates when the comment says
> MCS0-7?
I let caller determine the min, but comment was to tell why
the min might be set. In APs, the min supported rates are 16, evidently...not
that this code supports APs at the moment...
When this is about local use instead of advertising, then any minimum
is OK.
Want me to just remove the comment entirely?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* net-next open for business
From: David Miller @ 2011-11-08 20:36 UTC (permalink / raw)
To: netdev; +Cc: linux-wireless, netfilter-devel
As promised, now that the merge window is closed, the net-next is once
again open for business.
Damn the torpedoes, full speed ahead!
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Johannes Berg @ 2011-11-08 20:17 UTC (permalink / raw)
To: greearb; +Cc: linux-wireless
In-Reply-To: <1320783128.24797.48.camel@jlt3.sipsolutions.net>
On Tue, 2011-11-08 at 21:12 +0100, Johannes Berg wrote:
> For example here:
>
> > if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) &&
> > + !ieee80111_cfg_override_disables_ht40(sdata) &&
> > (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
> > (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
> > switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
>
> This just adds complexity. If you calculate sdata->used_ht_caps first
> then you can replace the sband->ht_cap.cap check with an
> sdata->used_ht_caps.cap check and be done with it, instead of having to
> check both.
Similarly in ieee80211_add_ht_ie(), you wouldn't have to re-calculate
the override, etc. I think it would be a lot simpler that way.
johannes
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Johannes Berg @ 2011-11-08 20:12 UTC (permalink / raw)
To: greearb; +Cc: linux-wireless
In-Reply-To: <1320780995-30483-2-git-send-email-greearb@candelatech.com>
On Tue, 2011-11-08 at 11:36 -0800, greearb@candelatech.com wrote:
> +bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata)
> +{
> + if ((sdata->u.mgd.ht_capa_mask.cap_info &
> + IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
> + !(sdata->u.mgd.ht_capa.cap_info &
> + IEEE80211_HT_CAP_SUP_WIDTH_20_40))
> + return true;
> + return false;
Would it really go above 80 cols if you didn't line-wrap it? Maybe
remove the extra sets of parentheses? And even if it goes to a little
bit above 80 it's still be more readable without the wrapping ...
One thing I don't quite understand: Why don't you calculate the HT caps
to use upon assoc request, and then store *those* instead, then you
wouldn't have to check the overrides every time.
For example here:
> if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) &&
> + !ieee80111_cfg_override_disables_ht40(sdata) &&
> (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
> (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
> switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
This just adds complexity. If you calculate sdata->used_ht_caps first
then you can replace the sband->ht_cap.cap check with an
sdata->used_ht_caps.cap check and be done with it, instead of having to
check both.
johannes
^ permalink raw reply
* Re: [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: Johannes Berg @ 2011-11-08 20:09 UTC (permalink / raw)
To: greearb; +Cc: linux-wireless
In-Reply-To: <1320780995-30483-2-git-send-email-greearb@candelatech.com>
On Tue, 2011-11-08 at 11:36 -0800, greearb@candelatech.com wrote:
> + /*
> + * We always need to advert at least MCS0-7, to
> + * be a compliant HT station, for instance
> + */
> + if (((i * 8 + q) >= min_rates) &&
This is a little misleading -- why min_rates when the comment says
MCS0-7?
johannes
^ permalink raw reply
* Re: [PATCH v8 1/2] wireless: Support ht-capabilities over-rides.
From: Johannes Berg @ 2011-11-08 20:07 UTC (permalink / raw)
To: greearb; +Cc: linux-wireless
In-Reply-To: <1320780995-30483-1-git-send-email-greearb@candelatech.com>
On Tue, 2011-11-08 at 11:36 -0800, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
>
> This allows users to disable features such as HT, HT40,
> and to modify the MCS, AMPDU, and AMSDU settings for
> drivers that support it.
>
> The MCS, AMPDU, and AMSDU features that may be disabled are
> are reported in the phy-info netlink message as a mask.
>
> Attemping to disable features that are not supported will
> take no affect, but will not return errors. This is to aid
> backwards compatibility in user-space apps that may not be
> clever enough to deal with parsing the the capabilities mask.
>
> This patch only enables the infrastructure. An additional
> patch will enable the feature in mac80211.
Looks ok to me now.
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
>
> v8: Fix compile bugs from v7. Must have compiled the
> wrong tree while testing that.
>
> :100644 100644 8049bf7... 34c3973... M include/linux/nl80211.h
> :100644 100644 92cf1c2... 5598b91... M include/net/cfg80211.h
> :100644 100644 b9ec306... 8357ed6... M net/wireless/core.h
> :100644 100644 21fc970... bf538e1... M net/wireless/mlme.c
> :100644 100644 b3a476f... 31f17c8... M net/wireless/nl80211.c
> :100644 100644 6e86d5a... ed9d0e6... M net/wireless/sme.c
> include/linux/nl80211.h | 15 +++++++++++++++
> include/net/cfg80211.h | 28 ++++++++++++++++++++++++++++
> net/wireless/core.h | 10 ++++++++--
> net/wireless/mlme.c | 37 ++++++++++++++++++++++++++++++++++---
> net/wireless/nl80211.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
> net/wireless/sme.c | 7 ++++++-
> 6 files changed, 134 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
> index 8049bf7..34c3973 100644
> --- a/include/linux/nl80211.h
> +++ b/include/linux/nl80211.h
> @@ -1109,6 +1109,18 @@ enum nl80211_commands {
> * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
> * used for asking the driver to perform a TDLS operation.
> *
> + * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable
> + * this feature. Currently, only supported in mac80211 drivers.
> + * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the
> + * ATTR_HT_CAPABILITY to which attention should be paid.
> + * Currently, only mac80211 NICs support this feature.
> + * The values that may be configured are:
> + * MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40
> + * AMPDU density and AMPDU factor.
> + * All values are treated as suggestions and may be ignored
> + * by the driver as required. The actual values may be seen in
> + * the station debugfs ht_caps file.
> + *
> * @NL80211_ATTR_MAX: highest attribute number currently defined
> * @__NL80211_ATTR_AFTER_LAST: internal use
> */
> @@ -1337,6 +1349,9 @@ enum nl80211_attrs {
> NL80211_ATTR_TDLS_SUPPORT,
> NL80211_ATTR_TDLS_EXTERNAL_SETUP,
>
> + NL80211_ATTR_DISABLE_HT,
> + NL80211_ATTR_HT_CAPABILITY_MASK,
> +
> /* add attributes here, update the policy in nl80211.c */
>
> __NL80211_ATTR_AFTER_LAST,
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 92cf1c2..5598b91 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -1036,6 +1036,15 @@ struct cfg80211_auth_request {
> };
>
> /**
> + * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
> + *
> + * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
> + */
> +enum cfg80211_assoc_req_flags {
> + ASSOC_REQ_DISABLE_HT = BIT(0),
> +};
> +
> +/**
> * struct cfg80211_assoc_request - (Re)Association request data
> *
> * This structure provides information needed to complete IEEE 802.11
> @@ -1046,6 +1055,10 @@ struct cfg80211_auth_request {
> * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
> * @crypto: crypto settings
> * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
> + * @flags: See &enum cfg80211_assoc_req_flags
> + * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
> + * will be used in ht_capa. Un-supported values will be ignored.
> + * @ht_capa_mask: The bits of ht_capa which are to be used.
> */
> struct cfg80211_assoc_request {
> struct cfg80211_bss *bss;
> @@ -1053,6 +1066,9 @@ struct cfg80211_assoc_request {
> size_t ie_len;
> struct cfg80211_crypto_settings crypto;
> bool use_mfp;
> + u32 flags;
> + struct ieee80211_ht_cap ht_capa;
> + struct ieee80211_ht_cap ht_capa_mask;
> };
>
> /**
> @@ -1151,6 +1167,10 @@ struct cfg80211_ibss_params {
> * @key_len: length of WEP key for shared key authentication
> * @key_idx: index of WEP key for shared key authentication
> * @key: WEP key for shared key authentication
> + * @flags: See &enum cfg80211_assoc_req_flags
> + * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
> + * will be used in ht_capa. Un-supported values will be ignored.
> + * @ht_capa_mask: The bits of ht_capa which are to be used.
> */
> struct cfg80211_connect_params {
> struct ieee80211_channel *channel;
> @@ -1164,6 +1184,9 @@ struct cfg80211_connect_params {
> struct cfg80211_crypto_settings crypto;
> const u8 *key;
> u8 key_len, key_idx;
> + u32 flags;
> + struct ieee80211_ht_cap ht_capa;
> + struct ieee80211_ht_cap ht_capa_mask;
> };
>
> /**
> @@ -1903,6 +1926,9 @@ struct wiphy_wowlan_support {
> * may request, if implemented.
> *
> * @wowlan: WoWLAN support information
> + *
> + * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
> + * If null, then none can be over-ridden.
> */
> struct wiphy {
> /* assign these fields before you register the wiphy */
> @@ -1983,6 +2009,8 @@ struct wiphy {
> /* dir in debugfs: ieee80211/<wiphyname> */
> struct dentry *debugfsdir;
>
> + const struct ieee80211_ht_cap *ht_capa_mod_mask;
> +
> #ifdef CONFIG_NET_NS
> /* the network namespace this phy lives in currently */
> struct net *_net;
> diff --git a/net/wireless/core.h b/net/wireless/core.h
> index b9ec306..8357ed6 100644
> --- a/net/wireless/core.h
> +++ b/net/wireless/core.h
> @@ -339,13 +339,17 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
> const u8 *bssid, const u8 *prev_bssid,
> const u8 *ssid, int ssid_len,
> const u8 *ie, int ie_len, bool use_mfp,
> - struct cfg80211_crypto_settings *crypt);
> + struct cfg80211_crypto_settings *crypt,
> + u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
> + struct ieee80211_ht_cap *ht_capa_mask);
> int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
> struct net_device *dev, struct ieee80211_channel *chan,
> const u8 *bssid, const u8 *prev_bssid,
> const u8 *ssid, int ssid_len,
> const u8 *ie, int ie_len, bool use_mfp,
> - struct cfg80211_crypto_settings *crypt);
> + struct cfg80211_crypto_settings *crypt,
> + u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
> + struct ieee80211_ht_cap *ht_capa_mask);
> int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
> struct net_device *dev, const u8 *bssid,
> const u8 *ie, int ie_len, u16 reason,
> @@ -377,6 +381,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
> bool channel_type_valid, unsigned int wait,
> const u8 *buf, size_t len, bool no_cck,
> u64 *cookie);
> +void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
> + const struct ieee80211_ht_cap *ht_capa_mask);
>
> /* SME */
> int __cfg80211_connect(struct cfg80211_registered_device *rdev,
> diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
> index 21fc970..bf538e1 100644
> --- a/net/wireless/mlme.c
> +++ b/net/wireless/mlme.c
> @@ -501,13 +501,32 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
> return err;
> }
>
> +/* Do a logical ht_capa &= ht_capa_mask. */
> +void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
> + const struct ieee80211_ht_cap *ht_capa_mask)
> +{
> + int i;
> + u8 *p1, *p2;
> + if (!ht_capa_mask) {
> + memset(ht_capa, 0, sizeof(*ht_capa));
> + return;
> + }
> +
> + p1 = (u8*)(ht_capa);
> + p2 = (u8*)(ht_capa_mask);
> + for (i = 0; i<sizeof(*ht_capa); i++)
> + p1[i] &= p2[i];
> +}
> +
> int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
> struct net_device *dev,
> struct ieee80211_channel *chan,
> const u8 *bssid, const u8 *prev_bssid,
> const u8 *ssid, int ssid_len,
> const u8 *ie, int ie_len, bool use_mfp,
> - struct cfg80211_crypto_settings *crypt)
> + struct cfg80211_crypto_settings *crypt,
> + u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
> + struct ieee80211_ht_cap *ht_capa_mask)
> {
> struct wireless_dev *wdev = dev->ieee80211_ptr;
> struct cfg80211_assoc_request req;
> @@ -537,6 +556,15 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
> memcpy(&req.crypto, crypt, sizeof(req.crypto));
> req.use_mfp = use_mfp;
> req.prev_bssid = prev_bssid;
> + req.flags = assoc_flags;
> + if (ht_capa)
> + memcpy(&req.ht_capa, ht_capa, sizeof(req.ht_capa));
> + if (ht_capa_mask)
> + memcpy(&req.ht_capa_mask, ht_capa_mask,
> + sizeof(req.ht_capa_mask));
> + cfg80211_oper_and_ht_capa(&req.ht_capa_mask,
> + rdev->wiphy.ht_capa_mod_mask);
> +
> req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
> WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
> if (!req.bss) {
> @@ -574,14 +602,17 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
> const u8 *bssid, const u8 *prev_bssid,
> const u8 *ssid, int ssid_len,
> const u8 *ie, int ie_len, bool use_mfp,
> - struct cfg80211_crypto_settings *crypt)
> + struct cfg80211_crypto_settings *crypt,
> + u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
> + struct ieee80211_ht_cap *ht_capa_mask)
> {
> struct wireless_dev *wdev = dev->ieee80211_ptr;
> int err;
>
> wdev_lock(wdev);
> err = __cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid,
> - ssid, ssid_len, ie, ie_len, use_mfp, crypt);
> + ssid, ssid_len, ie, ie_len, use_mfp, crypt,
> + assoc_flags, ht_capa, ht_capa_mask);
> wdev_unlock(wdev);
>
> return err;
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index b3a476f..31f17c8 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -196,6 +196,10 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
> [NL80211_ATTR_TDLS_OPERATION] = { .type = NLA_U8 },
> [NL80211_ATTR_TDLS_SUPPORT] = { .type = NLA_FLAG },
> [NL80211_ATTR_TDLS_EXTERNAL_SETUP] = { .type = NLA_FLAG },
> + [NL80211_ATTR_DISABLE_HT] = { .type = NLA_FLAG },
> + [NL80211_ATTR_HT_CAPABILITY_MASK] = {
> + .len = NL80211_HT_CAPABILITY_LEN
> + },
> };
>
> /* policy for the key attributes */
> @@ -1007,6 +1011,11 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
> if (nl80211_put_iface_combinations(&dev->wiphy, msg))
> goto nla_put_failure;
>
> + if (dev->wiphy.ht_capa_mod_mask)
> + NLA_PUT(msg, NL80211_ATTR_HT_CAPABILITY_MASK,
> + sizeof(*dev->wiphy.ht_capa_mod_mask),
> + dev->wiphy.ht_capa_mod_mask);
> +
> return genlmsg_end(msg, hdr);
>
> nla_put_failure:
> @@ -4359,6 +4368,9 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
> const u8 *bssid, *ssid, *ie = NULL, *prev_bssid = NULL;
> int err, ssid_len, ie_len = 0;
> bool use_mfp = false;
> + u32 flags = 0;
> + struct ieee80211_ht_cap *ht_capa = NULL;
> + struct ieee80211_ht_cap *ht_capa_mask = NULL;
>
> if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
> return -EINVAL;
> @@ -4402,11 +4414,25 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
> if (info->attrs[NL80211_ATTR_PREV_BSSID])
> prev_bssid = nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]);
>
> + if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT]))
> + flags |= ASSOC_REQ_DISABLE_HT;
> +
> + if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK])
> + ht_capa_mask =
> + nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]);
> +
> + if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) {
> + if (!ht_capa_mask)
> + return -EINVAL;
> + ht_capa = nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]);
> + }
> +
> err = nl80211_crypto_settings(rdev, info, &crypto, 1);
> if (!err)
> err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid,
> ssid, ssid_len, ie, ie_len, use_mfp,
> - &crypto);
> + &crypto, flags, ht_capa,
> + ht_capa_mask);
>
> return err;
> }
> @@ -4896,6 +4922,22 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
> return PTR_ERR(connkeys);
> }
>
> + if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT]))
> + connect.flags |= ASSOC_REQ_DISABLE_HT;
> +
> + if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK])
> + memcpy(&connect.ht_capa_mask,
> + nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]),
> + sizeof(connect.ht_capa_mask));
> +
> + if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) {
> + if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK])
> + return -EINVAL;
> + memcpy(&connect.ht_capa,
> + nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]),
> + sizeof(connect.ht_capa));
> + }
> +
> err = cfg80211_connect(rdev, dev, &connect, connkeys);
> if (err)
> kfree(connkeys);
> diff --git a/net/wireless/sme.c b/net/wireless/sme.c
> index 6e86d5a..ed9d0e6 100644
> --- a/net/wireless/sme.c
> +++ b/net/wireless/sme.c
> @@ -189,7 +189,9 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
> prev_bssid,
> params->ssid, params->ssid_len,
> params->ie, params->ie_len,
> - false, ¶ms->crypto);
> + false, ¶ms->crypto,
> + params->flags, ¶ms->ht_capa,
> + ¶ms->ht_capa_mask);
> if (err)
> __cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
> NULL, 0,
> @@ -773,6 +775,9 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
> wdev->connect_keys = NULL;
> }
>
> + cfg80211_oper_and_ht_capa(&connect->ht_capa_mask,
> + rdev->wiphy.ht_capa_mod_mask);
> +
> if (connkeys && connkeys->def >= 0) {
> int idx;
> u32 cipher;
^ permalink raw reply
* [PATCH] cfg80211: deprecate CFG80211_WEXT
From: Johannes Berg @ 2011-11-08 19:39 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
From: Johannes Berg <johannes.berg@intel.com>
Almost all wireless tools have transitioned to
or at least added compatibility with nl80211 so
there's no real need for CONFIG_CFG80211_WEXT
any more. Mark it for removal, and also change
the default to not be enabled.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
Documentation/feature-removal-schedule.txt | 13 +++++++++++++
net/wireless/Kconfig | 1 -
2 files changed, 13 insertions(+), 1 deletion(-)
--- a/Documentation/feature-removal-schedule.txt 2011-11-08 20:01:41.000000000 +0100
+++ b/Documentation/feature-removal-schedule.txt 2011-11-08 20:35:51.000000000 +0100
@@ -565,6 +565,19 @@ Who: Hans Verkuil <hans.verkuil@cisco.co
----------------------------
+What: CONFIG_CFG80211_WEXT
+When: as soon as distributions ship new wireless tools, ie. wpa_supplicant 1.0
+ and NetworkManager/connman/etc. that are able to use nl80211
+Why: Wireless extensions are deprecated, and userland tools are moving to
+ using nl80211. New drivers are no longer using wireless extensions,
+ and while there might still be old drivers, both new drivers and new
+ userland no longer needs them and they can't be used for an feature
+ developed in the past couple of years. As such, compatibility with
+ wireless extensions in new drivers will be removed.
+Who: Johannes Berg <johannes@sipsolutions.net>
+
+----------------------------
+
What: g_file_storage driver
When: 3.8
Why: This driver has been superseded by g_mass_storage.
--- a/net/wireless/Kconfig 2011-11-08 20:36:57.000000000 +0100
+++ b/net/wireless/Kconfig 2011-11-08 20:37:04.000000000 +0100
@@ -114,7 +114,6 @@ config CFG80211_WEXT
bool "cfg80211 wireless extensions compatibility"
depends on CFG80211
select WEXT_CORE
- default y
help
Enable this option if you need old userspace for wireless
extensions with cfg80211-based drivers.
^ permalink raw reply
* [PATCH v8 2/2] mac80211: Support ht-cap over-rides.
From: greearb @ 2011-11-08 19:36 UTC (permalink / raw)
To: linux-wireless; +Cc: Ben Greear
In-Reply-To: <1320780995-30483-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
This implements ht-cap over-rides for mac80211 drivers.
HT may be disabled, making an /a/b/g/n station act like an
a/b/g station. HT40 may be disabled forcing the station to
be HT20 even if the AP and local hardware support HT40.
MAX-AMSDU may be disabled.
AMPDU-Density may be increased.
AMPDU-Factor may be decreased.
This has been successfully tested with ath9k using patched
wpa_supplicant and iw.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v8: No changes from previous.
:100644 100644 48363c3... 25ea406... M include/linux/ieee80211.h
:100644 100644 a9ded52... 7f4389e... M net/mac80211/cfg.c
:100644 100644 f80a35c... 47b89bb... M net/mac80211/ht.c
:100644 100644 ea10a51... 6afa409... M net/mac80211/ieee80211_i.h
:100644 100644 d4ee6d2... 7be5ad8... M net/mac80211/main.c
:100644 100644 2fbd652... 84d6943... M net/mac80211/mlme.c
:100644 100644 6c53b6d... 3f318df... M net/mac80211/work.c
include/linux/ieee80211.h | 6 +++
net/mac80211/cfg.c | 2 +-
net/mac80211/ht.c | 90 +++++++++++++++++++++++++++++++++++++++++++-
net/mac80211/ieee80211_i.h | 10 ++++-
net/mac80211/main.c | 14 +++++++
net/mac80211/mlme.c | 12 +++++-
net/mac80211/work.c | 35 ++++++++++++-----
7 files changed, 154 insertions(+), 15 deletions(-)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 48363c3..25ea406 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -906,6 +906,12 @@ struct ieee80211_mcs_info {
#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
+/*
+ * Stations supporting 802.11n are required to support
+ * at least the first 8 MCS rates. See section 7.3.2.56.4
+ * and 20.1.1 of the 802.11n spec.
+ */
+#define IEEE80211_HT_MCS_REQ_RATES_STA 8
/*
* 802.11n D5.0 20.3.5 / 20.6 says:
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a9ded52..7f4389e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -778,7 +778,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
}
if (params->ht_capa)
- ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
+ ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
params->ht_capa,
&sta->sta.ht_cap);
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index f80a35c..47b89bb 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -18,7 +18,89 @@
#include "ieee80211_i.h"
#include "rate.h"
-void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
+bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata)
+{
+ if ((sdata->u.mgd.ht_capa_mask.cap_info &
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
+ !(sdata->u.mgd.ht_capa.cap_info &
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40))
+ return true;
+ return false;
+}
+
+void __check_htcap_disable(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta_ht_cap *ht_cap,
+ u16 flag)
+{
+ if (sdata->u.mgd.ht_capa_mask.cap_info & flag) {
+ if (!(sdata->u.mgd.ht_capa.cap_info & flag))
+ ht_cap->cap &= ~flag;
+ }
+}
+
+void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta_ht_cap *ht_cap,
+ int min_rates)
+{
+ u8 *scaps = (u8 *)(&sdata->u.mgd.ht_capa.mcs.rx_mask);
+ u8 *smask = (u8 *)(&sdata->u.mgd.ht_capa_mask.mcs.rx_mask);
+ int i;
+
+ /* NOTE: If you add more over-rides here, update register_hw
+ * ht_capa_mod_msk logic in main.c as well.
+ */
+
+ /* check for HT over-rides, MCS rates first. */
+ for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
+ int q;
+ for (q = 0; q < 8; q++) {
+ /*
+ * We always need to advert at least MCS0-7, to
+ * be a compliant HT station, for instance
+ */
+ if (((i * 8 + q) >= min_rates) &&
+ (smask[i] & (1<<q))) {
+ if (!(scaps[i] & (1<<q))) {
+ /*
+ * Can only disable rates, not force
+ * new ones
+ */
+ ht_cap->mcs.rx_mask[i] &= ~(1<<q);
+ }
+ }
+ }
+ }
+
+ /* Force removal of HT-40 capabilities? */
+ __check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SUP_WIDTH_20_40);
+ __check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SGI_40);
+
+ /* Allow user to disable the max-AMSDU bit. */
+ __check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_MAX_AMSDU);
+
+ /* Allow user to decrease AMPDU factor */
+ if (sdata->u.mgd.ht_capa_mask.ampdu_params_info &
+ IEEE80211_HT_AMPDU_PARM_FACTOR) {
+ u16 n = sdata->u.mgd.ht_capa.ampdu_params_info
+ & IEEE80211_HT_AMPDU_PARM_FACTOR;
+ if (n < ht_cap->ampdu_factor)
+ ht_cap->ampdu_factor = n;
+ }
+
+ /* Allow the user to increase AMPDU density. */
+ if (sdata->u.mgd.ht_capa_mask.ampdu_params_info &
+ IEEE80211_HT_AMPDU_PARM_DENSITY) {
+ u16 n = (sdata->u.mgd.ht_capa.ampdu_params_info &
+ IEEE80211_HT_AMPDU_PARM_DENSITY)
+ >> IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT;
+ if (n > ht_cap->ampdu_density)
+ ht_cap->ampdu_density = n;
+ }
+}
+
+
+void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_supported_band *sband,
struct ieee80211_ht_cap *ht_cap_ie,
struct ieee80211_sta_ht_cap *ht_cap)
{
@@ -102,6 +184,12 @@ void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
/* handle MCS rate 32 too */
if (sband->ht_cap.mcs.rx_mask[32/8] & ht_cap_ie->mcs.rx_mask[32/8] & 1)
ht_cap->mcs.rx_mask[32/8] |= 1;
+
+ /*
+ * If user has specified capability over-rides, take care
+ * of that here.
+ */
+ ieee80211_apply_htcap_overrides(sdata, ht_cap, 0);
}
void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ea10a51..6afa409 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -443,6 +443,9 @@ struct ieee80211_if_managed {
*/
int rssi_min_thold, rssi_max_thold;
int last_ave_beacon_signal;
+ struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
+ struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
+
};
struct ieee80211_if_ibss {
@@ -1179,7 +1182,12 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev);
/* HT */
-void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
+bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata);
+void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta_ht_cap *ht_cap,
+ int min_rates);
+void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_supported_band *sband,
struct ieee80211_ht_cap *ht_cap_ie,
struct ieee80211_sta_ht_cap *ht_cap);
void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index d4ee6d2..7be5ad8 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -560,6 +560,19 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
},
};
+static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = {
+ .ampdu_params_info = IEEE80211_HT_AMPDU_PARM_FACTOR |
+ IEEE80211_HT_AMPDU_PARM_DENSITY,
+
+ .cap_info = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
+ IEEE80211_HT_CAP_MAX_AMSDU |
+ IEEE80211_HT_CAP_SGI_40,
+ .mcs = {
+ .rx_mask = { 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, },
+ },
+};
+
struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
const struct ieee80211_ops *ops)
{
@@ -628,6 +641,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
local->user_power_level = -1;
local->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
local->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
+ wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask;
INIT_LIST_HEAD(&local->interfaces);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2fbd652..84d6943 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -207,6 +207,7 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
channel_type = NL80211_CHAN_HT20;
if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) &&
+ !ieee80111_cfg_override_disables_ht40(sdata) &&
(sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
(hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
@@ -1603,7 +1604,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
- ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
+ ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
elems.ht_cap_elem, &sta->sta.ht_cap);
ap_ht_cap_flags = sta->sta.ht_cap.cap;
@@ -1972,7 +1973,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
- ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
+ ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
elems.ht_cap_elem, &sta->sta.ht_cap);
ap_ht_cap_flags = sta->sta.ht_cap.cap;
@@ -2630,6 +2631,13 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
ifmgd->flags |= IEEE80211_STA_DISABLE_11N;
+ if (req->flags & ASSOC_REQ_DISABLE_HT)
+ ifmgd->flags |= IEEE80211_STA_DISABLE_11N;
+
+ memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa));
+ memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask,
+ sizeof(ifmgd->ht_capa_mask));
+
if (req->ie && req->ie_len) {
memcpy(wk->ie, req->ie, req->ie_len);
wk->ie_len = req->ie_len;
diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index 6c53b6d..3f318df 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -94,7 +94,8 @@ static int ieee80211_compatible_rates(const u8 *supp_rates, int supp_rates_len,
/* frame sending functions */
-static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
+static void ieee80211_add_ht_ie(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb, const u8 *ht_info_ie,
struct ieee80211_supported_band *sband,
struct ieee80211_channel *channel,
enum ieee80211_smps_mode smps)
@@ -102,11 +103,11 @@ static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
struct ieee80211_ht_info *ht_info;
u8 *pos;
u32 flags = channel->flags;
- u16 cap = sband->ht_cap.cap;
+ u16 cap;
__le16 tmp;
+ struct ieee80211_sta_ht_cap ht_cap;
- if (!sband->ht_cap.ht_supported)
- return;
+ BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap));
if (!ht_info_ie)
return;
@@ -114,6 +115,20 @@ static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
if (ht_info_ie[1] < sizeof(struct ieee80211_ht_info))
return;
+ memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap));
+ /*
+ * This is for an association attempt, and stations must
+ * support at least the first 8 MCS rates. See section 20.1.1
+ * of the 802.11n spec for details.
+ */
+ ieee80211_apply_htcap_overrides(sdata, &ht_cap,
+ IEEE80211_HT_MCS_REQ_RATES_STA);
+
+ cap = ht_cap.cap;
+
+ if (!ht_cap.ht_supported)
+ return;
+
ht_info = (struct ieee80211_ht_info *)(ht_info_ie + 2);
/* determine capability flags */
@@ -166,13 +181,13 @@ static void ieee80211_add_ht_ie(struct sk_buff *skb, const u8 *ht_info_ie,
pos += sizeof(u16);
/* AMPDU parameters */
- *pos++ = sband->ht_cap.ampdu_factor |
- (sband->ht_cap.ampdu_density <<
- IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
+ *pos++ = ht_cap.ampdu_factor |
+ (ht_cap.ampdu_density <<
+ IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
/* MCS set */
- memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
- pos += sizeof(sband->ht_cap.mcs);
+ memcpy(pos, &ht_cap.mcs, sizeof(ht_cap.mcs));
+ pos += sizeof(ht_cap.mcs);
/* extended capabilities */
pos += sizeof(__le16);
@@ -356,7 +371,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
if (wk->assoc.use_11n && wk->assoc.wmm_used &&
local->hw.queues >= 4)
- ieee80211_add_ht_ie(skb, wk->assoc.ht_information_ie,
+ ieee80211_add_ht_ie(sdata, skb, wk->assoc.ht_information_ie,
sband, wk->chan, wk->assoc.smps);
/* if present, add any custom non-vendor IEs that go after HT */
--
1.7.3.4
^ permalink raw reply related
* [PATCH v8 1/2] wireless: Support ht-capabilities over-rides.
From: greearb @ 2011-11-08 19:36 UTC (permalink / raw)
To: linux-wireless; +Cc: Ben Greear
From: Ben Greear <greearb@candelatech.com>
This allows users to disable features such as HT, HT40,
and to modify the MCS, AMPDU, and AMSDU settings for
drivers that support it.
The MCS, AMPDU, and AMSDU features that may be disabled are
are reported in the phy-info netlink message as a mask.
Attemping to disable features that are not supported will
take no affect, but will not return errors. This is to aid
backwards compatibility in user-space apps that may not be
clever enough to deal with parsing the the capabilities mask.
This patch only enables the infrastructure. An additional
patch will enable the feature in mac80211.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v8: Fix compile bugs from v7. Must have compiled the
wrong tree while testing that.
:100644 100644 8049bf7... 34c3973... M include/linux/nl80211.h
:100644 100644 92cf1c2... 5598b91... M include/net/cfg80211.h
:100644 100644 b9ec306... 8357ed6... M net/wireless/core.h
:100644 100644 21fc970... bf538e1... M net/wireless/mlme.c
:100644 100644 b3a476f... 31f17c8... M net/wireless/nl80211.c
:100644 100644 6e86d5a... ed9d0e6... M net/wireless/sme.c
include/linux/nl80211.h | 15 +++++++++++++++
include/net/cfg80211.h | 28 ++++++++++++++++++++++++++++
net/wireless/core.h | 10 ++++++++--
net/wireless/mlme.c | 37 ++++++++++++++++++++++++++++++++++---
net/wireless/nl80211.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
net/wireless/sme.c | 7 ++++++-
6 files changed, 134 insertions(+), 7 deletions(-)
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 8049bf7..34c3973 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1109,6 +1109,18 @@ enum nl80211_commands {
* %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
* used for asking the driver to perform a TDLS operation.
*
+ * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable
+ * this feature. Currently, only supported in mac80211 drivers.
+ * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the
+ * ATTR_HT_CAPABILITY to which attention should be paid.
+ * Currently, only mac80211 NICs support this feature.
+ * The values that may be configured are:
+ * MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40
+ * AMPDU density and AMPDU factor.
+ * All values are treated as suggestions and may be ignored
+ * by the driver as required. The actual values may be seen in
+ * the station debugfs ht_caps file.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1337,6 +1349,9 @@ enum nl80211_attrs {
NL80211_ATTR_TDLS_SUPPORT,
NL80211_ATTR_TDLS_EXTERNAL_SETUP,
+ NL80211_ATTR_DISABLE_HT,
+ NL80211_ATTR_HT_CAPABILITY_MASK,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 92cf1c2..5598b91 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1036,6 +1036,15 @@ struct cfg80211_auth_request {
};
/**
+ * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
+ *
+ * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
+ */
+enum cfg80211_assoc_req_flags {
+ ASSOC_REQ_DISABLE_HT = BIT(0),
+};
+
+/**
* struct cfg80211_assoc_request - (Re)Association request data
*
* This structure provides information needed to complete IEEE 802.11
@@ -1046,6 +1055,10 @@ struct cfg80211_auth_request {
* @use_mfp: Use management frame protection (IEEE 802.11w) in this association
* @crypto: crypto settings
* @prev_bssid: previous BSSID, if not %NULL use reassociate frame
+ * @flags: See &enum cfg80211_assoc_req_flags
+ * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
+ * will be used in ht_capa. Un-supported values will be ignored.
+ * @ht_capa_mask: The bits of ht_capa which are to be used.
*/
struct cfg80211_assoc_request {
struct cfg80211_bss *bss;
@@ -1053,6 +1066,9 @@ struct cfg80211_assoc_request {
size_t ie_len;
struct cfg80211_crypto_settings crypto;
bool use_mfp;
+ u32 flags;
+ struct ieee80211_ht_cap ht_capa;
+ struct ieee80211_ht_cap ht_capa_mask;
};
/**
@@ -1151,6 +1167,10 @@ struct cfg80211_ibss_params {
* @key_len: length of WEP key for shared key authentication
* @key_idx: index of WEP key for shared key authentication
* @key: WEP key for shared key authentication
+ * @flags: See &enum cfg80211_assoc_req_flags
+ * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
+ * will be used in ht_capa. Un-supported values will be ignored.
+ * @ht_capa_mask: The bits of ht_capa which are to be used.
*/
struct cfg80211_connect_params {
struct ieee80211_channel *channel;
@@ -1164,6 +1184,9 @@ struct cfg80211_connect_params {
struct cfg80211_crypto_settings crypto;
const u8 *key;
u8 key_len, key_idx;
+ u32 flags;
+ struct ieee80211_ht_cap ht_capa;
+ struct ieee80211_ht_cap ht_capa_mask;
};
/**
@@ -1903,6 +1926,9 @@ struct wiphy_wowlan_support {
* may request, if implemented.
*
* @wowlan: WoWLAN support information
+ *
+ * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
+ * If null, then none can be over-ridden.
*/
struct wiphy {
/* assign these fields before you register the wiphy */
@@ -1983,6 +2009,8 @@ struct wiphy {
/* dir in debugfs: ieee80211/<wiphyname> */
struct dentry *debugfsdir;
+ const struct ieee80211_ht_cap *ht_capa_mod_mask;
+
#ifdef CONFIG_NET_NS
/* the network namespace this phy lives in currently */
struct net *_net;
diff --git a/net/wireless/core.h b/net/wireless/core.h
index b9ec306..8357ed6 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -339,13 +339,17 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
const u8 *bssid, const u8 *prev_bssid,
const u8 *ssid, int ssid_len,
const u8 *ie, int ie_len, bool use_mfp,
- struct cfg80211_crypto_settings *crypt);
+ struct cfg80211_crypto_settings *crypt,
+ u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
+ struct ieee80211_ht_cap *ht_capa_mask);
int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
struct net_device *dev, struct ieee80211_channel *chan,
const u8 *bssid, const u8 *prev_bssid,
const u8 *ssid, int ssid_len,
const u8 *ie, int ie_len, bool use_mfp,
- struct cfg80211_crypto_settings *crypt);
+ struct cfg80211_crypto_settings *crypt,
+ u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
+ struct ieee80211_ht_cap *ht_capa_mask);
int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
struct net_device *dev, const u8 *bssid,
const u8 *ie, int ie_len, u16 reason,
@@ -377,6 +381,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, bool no_cck,
u64 *cookie);
+void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
+ const struct ieee80211_ht_cap *ht_capa_mask);
/* SME */
int __cfg80211_connect(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 21fc970..bf538e1 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -501,13 +501,32 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
return err;
}
+/* Do a logical ht_capa &= ht_capa_mask. */
+void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
+ const struct ieee80211_ht_cap *ht_capa_mask)
+{
+ int i;
+ u8 *p1, *p2;
+ if (!ht_capa_mask) {
+ memset(ht_capa, 0, sizeof(*ht_capa));
+ return;
+ }
+
+ p1 = (u8*)(ht_capa);
+ p2 = (u8*)(ht_capa_mask);
+ for (i = 0; i<sizeof(*ht_capa); i++)
+ p1[i] &= p2[i];
+}
+
int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct ieee80211_channel *chan,
const u8 *bssid, const u8 *prev_bssid,
const u8 *ssid, int ssid_len,
const u8 *ie, int ie_len, bool use_mfp,
- struct cfg80211_crypto_settings *crypt)
+ struct cfg80211_crypto_settings *crypt,
+ u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
+ struct ieee80211_ht_cap *ht_capa_mask)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_assoc_request req;
@@ -537,6 +556,15 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
memcpy(&req.crypto, crypt, sizeof(req.crypto));
req.use_mfp = use_mfp;
req.prev_bssid = prev_bssid;
+ req.flags = assoc_flags;
+ if (ht_capa)
+ memcpy(&req.ht_capa, ht_capa, sizeof(req.ht_capa));
+ if (ht_capa_mask)
+ memcpy(&req.ht_capa_mask, ht_capa_mask,
+ sizeof(req.ht_capa_mask));
+ cfg80211_oper_and_ht_capa(&req.ht_capa_mask,
+ rdev->wiphy.ht_capa_mod_mask);
+
req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
if (!req.bss) {
@@ -574,14 +602,17 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
const u8 *bssid, const u8 *prev_bssid,
const u8 *ssid, int ssid_len,
const u8 *ie, int ie_len, bool use_mfp,
- struct cfg80211_crypto_settings *crypt)
+ struct cfg80211_crypto_settings *crypt,
+ u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
+ struct ieee80211_ht_cap *ht_capa_mask)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
int err;
wdev_lock(wdev);
err = __cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid,
- ssid, ssid_len, ie, ie_len, use_mfp, crypt);
+ ssid, ssid_len, ie, ie_len, use_mfp, crypt,
+ assoc_flags, ht_capa, ht_capa_mask);
wdev_unlock(wdev);
return err;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b3a476f..31f17c8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -196,6 +196,10 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_TDLS_OPERATION] = { .type = NLA_U8 },
[NL80211_ATTR_TDLS_SUPPORT] = { .type = NLA_FLAG },
[NL80211_ATTR_TDLS_EXTERNAL_SETUP] = { .type = NLA_FLAG },
+ [NL80211_ATTR_DISABLE_HT] = { .type = NLA_FLAG },
+ [NL80211_ATTR_HT_CAPABILITY_MASK] = {
+ .len = NL80211_HT_CAPABILITY_LEN
+ },
};
/* policy for the key attributes */
@@ -1007,6 +1011,11 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
if (nl80211_put_iface_combinations(&dev->wiphy, msg))
goto nla_put_failure;
+ if (dev->wiphy.ht_capa_mod_mask)
+ NLA_PUT(msg, NL80211_ATTR_HT_CAPABILITY_MASK,
+ sizeof(*dev->wiphy.ht_capa_mod_mask),
+ dev->wiphy.ht_capa_mod_mask);
+
return genlmsg_end(msg, hdr);
nla_put_failure:
@@ -4359,6 +4368,9 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
const u8 *bssid, *ssid, *ie = NULL, *prev_bssid = NULL;
int err, ssid_len, ie_len = 0;
bool use_mfp = false;
+ u32 flags = 0;
+ struct ieee80211_ht_cap *ht_capa = NULL;
+ struct ieee80211_ht_cap *ht_capa_mask = NULL;
if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
return -EINVAL;
@@ -4402,11 +4414,25 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_PREV_BSSID])
prev_bssid = nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]);
+ if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT]))
+ flags |= ASSOC_REQ_DISABLE_HT;
+
+ if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK])
+ ht_capa_mask =
+ nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]);
+
+ if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) {
+ if (!ht_capa_mask)
+ return -EINVAL;
+ ht_capa = nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]);
+ }
+
err = nl80211_crypto_settings(rdev, info, &crypto, 1);
if (!err)
err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid,
ssid, ssid_len, ie, ie_len, use_mfp,
- &crypto);
+ &crypto, flags, ht_capa,
+ ht_capa_mask);
return err;
}
@@ -4896,6 +4922,22 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
return PTR_ERR(connkeys);
}
+ if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT]))
+ connect.flags |= ASSOC_REQ_DISABLE_HT;
+
+ if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK])
+ memcpy(&connect.ht_capa_mask,
+ nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]),
+ sizeof(connect.ht_capa_mask));
+
+ if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) {
+ if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK])
+ return -EINVAL;
+ memcpy(&connect.ht_capa,
+ nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]),
+ sizeof(connect.ht_capa));
+ }
+
err = cfg80211_connect(rdev, dev, &connect, connkeys);
if (err)
kfree(connkeys);
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 6e86d5a..ed9d0e6 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -189,7 +189,9 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
prev_bssid,
params->ssid, params->ssid_len,
params->ie, params->ie_len,
- false, ¶ms->crypto);
+ false, ¶ms->crypto,
+ params->flags, ¶ms->ht_capa,
+ ¶ms->ht_capa_mask);
if (err)
__cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
NULL, 0,
@@ -773,6 +775,9 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
wdev->connect_keys = NULL;
}
+ cfg80211_oper_and_ht_capa(&connect->ht_capa_mask,
+ rdev->wiphy.ht_capa_mod_mask);
+
if (connkeys && connkeys->def >= 0) {
int idx;
u32 cipher;
--
1.7.3.4
^ permalink raw reply related
* Re: [PATCH v7 1/2] wireless: Support ht-capabilities over-rides.
From: Ben Greear @ 2011-11-08 19:17 UTC (permalink / raw)
Cc: linux-wireless
In-Reply-To: <1320778857-3073-1-git-send-email-greearb@candelatech.com>
On 11/08/2011 11:00 AM, greearb@candelatech.com wrote:
> From: Ben Greear<greearb@candelatech.com>
>
> This allows users to disable features such as HT, HT40,
> and to modify the MCS, AMPDU, and AMSDU settings for
> drivers that support it.
>
> The MCS, AMPDU, and AMSDU features that may be disabled are
> are reported in the phy-info netlink message as a mask.
>
> Attemping to disable features that are not supported will
> take no affect, but will not return errors. This is to aid
> backwards compatibility in user-space apps that may not be
> clever enough to deal with parsing the the capabilities mask.
>
> This patch only enables the infrastructure. An additional
> patch will enable the feature in mac80211.
>
> Signed-off-by: Ben Greear<greearb@candelatech.com>
> ---
>
> v7: Add detailed comments about what is supported in the
> HT_CAPABILITY_MASK attribute.
>
> Add call to cfg80211_oper_and_ht_capa() in the
> __cfg80211_connect path to make sure non mac80211
> drivers get proper masking.
Damn, I messed this up. Hold for v8.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [PATCH] wireless: remove wext sysfs
From: Johannes Berg @ 2011-11-08 19:04 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
From: Johannes Berg <johannes.berg@intel.com>
The only user of this was hal prior to its 0.5.12
release which happened over two years ago, so I'm
sure this can be removed without issues.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
Documentation/feature-removal-schedule.txt | 10 ---
net/core/net-sysfs.c | 74 -----------------------------
net/wireless/Kconfig | 12 ----
3 files changed, 96 deletions(-)
--- a/Documentation/feature-removal-schedule.txt 2011-11-08 20:00:18.000000000 +0100
+++ b/Documentation/feature-removal-schedule.txt 2011-11-08 20:01:41.000000000 +0100
@@ -296,16 +296,6 @@ Who: Ravikiran Thirumalai <kiran@scalex8
---------------------------
-What: Code that is now under CONFIG_WIRELESS_EXT_SYSFS
- (in net/core/net-sysfs.c)
-When: After the only user (hal) has seen a release with the patches
- for enough time, probably some time in 2010.
-Why: Over 1K .text/.data size reduction, data is available in other
- ways (ioctls)
-Who: Johannes Berg <johannes@sipsolutions.net>
-
----------------------------
-
What: sysfs ui for changing p4-clockmod parameters
When: September 2009
Why: See commits 129f8ae9b1b5be94517da76009ea956e89104ce8 and
--- a/net/core/net-sysfs.c 2011-11-08 20:00:19.000000000 +0100
+++ b/net/core/net-sysfs.c 2011-11-08 20:01:41.000000000 +0100
@@ -416,72 +416,6 @@ static struct attribute_group netstat_gr
.name = "statistics",
.attrs = netstat_attrs,
};
-
-#ifdef CONFIG_WIRELESS_EXT_SYSFS
-/* helper function that does all the locking etc for wireless stats */
-static ssize_t wireless_show(struct device *d, char *buf,
- ssize_t (*format)(const struct iw_statistics *,
- char *))
-{
- struct net_device *dev = to_net_dev(d);
- const struct iw_statistics *iw;
- ssize_t ret = -EINVAL;
-
- if (!rtnl_trylock())
- return restart_syscall();
- if (dev_isalive(dev)) {
- iw = get_wireless_stats(dev);
- if (iw)
- ret = (*format)(iw, buf);
- }
- rtnl_unlock();
-
- return ret;
-}
-
-/* show function template for wireless fields */
-#define WIRELESS_SHOW(name, field, format_string) \
-static ssize_t format_iw_##name(const struct iw_statistics *iw, char *buf) \
-{ \
- return sprintf(buf, format_string, iw->field); \
-} \
-static ssize_t show_iw_##name(struct device *d, \
- struct device_attribute *attr, char *buf) \
-{ \
- return wireless_show(d, buf, format_iw_##name); \
-} \
-static DEVICE_ATTR(name, S_IRUGO, show_iw_##name, NULL)
-
-WIRELESS_SHOW(status, status, fmt_hex);
-WIRELESS_SHOW(link, qual.qual, fmt_dec);
-WIRELESS_SHOW(level, qual.level, fmt_dec);
-WIRELESS_SHOW(noise, qual.noise, fmt_dec);
-WIRELESS_SHOW(nwid, discard.nwid, fmt_dec);
-WIRELESS_SHOW(crypt, discard.code, fmt_dec);
-WIRELESS_SHOW(fragment, discard.fragment, fmt_dec);
-WIRELESS_SHOW(misc, discard.misc, fmt_dec);
-WIRELESS_SHOW(retries, discard.retries, fmt_dec);
-WIRELESS_SHOW(beacon, miss.beacon, fmt_dec);
-
-static struct attribute *wireless_attrs[] = {
- &dev_attr_status.attr,
- &dev_attr_link.attr,
- &dev_attr_level.attr,
- &dev_attr_noise.attr,
- &dev_attr_nwid.attr,
- &dev_attr_crypt.attr,
- &dev_attr_fragment.attr,
- &dev_attr_retries.attr,
- &dev_attr_misc.attr,
- &dev_attr_beacon.attr,
- NULL
-};
-
-static struct attribute_group wireless_group = {
- .name = "wireless",
- .attrs = wireless_attrs,
-};
-#endif
#endif /* CONFIG_SYSFS */
#ifdef CONFIG_RPS
@@ -1295,14 +1229,6 @@ int netdev_register_kobject(struct net_d
groups++;
*groups++ = &netstat_group;
-#ifdef CONFIG_WIRELESS_EXT_SYSFS
- if (net->ieee80211_ptr)
- *groups++ = &wireless_group;
-#ifdef CONFIG_WIRELESS_EXT
- else if (net->wireless_handlers)
- *groups++ = &wireless_group;
-#endif
-#endif
#endif /* CONFIG_SYSFS */
error = device_add(dev);
--- a/net/wireless/Kconfig 2011-11-08 20:00:18.000000000 +0100
+++ b/net/wireless/Kconfig 2011-11-08 20:01:41.000000000 +0100
@@ -119,18 +119,6 @@ config CFG80211_WEXT
Enable this option if you need old userspace for wireless
extensions with cfg80211-based drivers.
-config WIRELESS_EXT_SYSFS
- bool "Wireless extensions sysfs files"
- default y
- depends on WEXT_CORE && SYSFS
- help
- This option enables the deprecated wireless statistics
- files in /sys/class/net/*/wireless/. The same information
- is available via the ioctls as well.
-
- Say Y if you have programs using it, like old versions of
- hal.
-
config LIB80211
tristate "Common routines for IEEE802.11 drivers"
default n
^ permalink raw reply
* [PATCH v2] mac80211/cfg80211: report monitor channel in wireless extensions
From: Johannes Berg @ 2011-11-08 19:01 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
In-Reply-To: <1320778327.24797.36.camel@jlt3.sipsolutions.net>
From: Johannes Berg <johannes.berg@intel.com>
Just add API to get the channel & report it. Trivial really.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
v2: fix signal -> single (thanks Ben)
I'm not sure why this is so hard that the aircrack people
couldn't figure out what to do ...
include/net/cfg80211.h | 5 +++++
net/mac80211/cfg.c | 8 ++++++++
net/wireless/wext-compat.c | 12 ++++++++++++
3 files changed, 25 insertions(+)
--- a/include/net/cfg80211.h 2011-11-08 19:37:45.000000000 +0100
+++ b/include/net/cfg80211.h 2011-11-08 20:00:42.000000000 +0100
@@ -1342,6 +1342,9 @@ struct cfg80211_gtk_rekey_data {
* doesn't verify much. Note, however, that the passed netdev may be
* %NULL as well if the user requested changing the channel for the
* device itself, or for a monitor interface.
+ * @get_channel: Get the current operating channel, should return %NULL if
+ * there's no single defined operating channel if for example the
+ * device implements channel hopping for multi-channel virtual interfaces.
*
* @scan: Request to do a scan. If returning zero, the scan request is given
* the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1627,6 +1630,8 @@ struct cfg80211_ops {
int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
const u8 *peer, u64 *cookie);
+
+ struct ieee80211_channel *(get_channel)(struct wiphy *wiphy);
};
/*
--- a/net/wireless/wext-compat.c 2011-11-08 19:37:45.000000000 +0100
+++ b/net/wireless/wext-compat.c 2011-11-08 19:49:33.000000000 +0100
@@ -818,12 +818,24 @@ static int cfg80211_wext_giwfreq(struct
struct iw_freq *freq, char *extra)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+ struct ieee80211_channel *chan;
switch (wdev->iftype) {
case NL80211_IFTYPE_STATION:
return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
case NL80211_IFTYPE_ADHOC:
return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
+ case NL80211_IFTYPE_MONITOR:
+ if (!rdev->ops->get_channel)
+ return -EINVAL;
+
+ chan = rdev->ops->get_channel(wdev->wiphy);
+ if (!chan)
+ return -EINVAL;
+ freq->m = chan->center_freq;
+ freq->e = 6;
+ return 0;
default:
if (!wdev->channel)
return -EINVAL;
--- a/net/mac80211/cfg.c 2011-11-08 19:37:45.000000000 +0100
+++ b/net/mac80211/cfg.c 2011-11-08 19:49:33.000000000 +0100
@@ -2579,6 +2579,13 @@ static int ieee80211_probe_client(struct
return 0;
}
+static const struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+
+ return local->oper_channel;
+}
+
struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -2645,4 +2652,5 @@ struct cfg80211_ops mac80211_config_ops
.tdls_oper = ieee80211_tdls_oper,
.tdls_mgmt = ieee80211_tdls_mgmt,
.probe_client = ieee80211_probe_client,
+ .get_channel = ieee80211_get_channel,
};
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox