* [PATCH 0/10] d80211: move away from wmaster towards wiphy
@ 2006-11-17 22:27 Johannes Berg
2006-11-17 22:50 ` [PATCH] d80211: remove useless driver name field Johannes Berg
` (6 more replies)
0 siblings, 7 replies; 57+ messages in thread
From: Johannes Berg @ 2006-11-17 22:27 UTC (permalink / raw)
To: netdev
Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen,
Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn
[-- Attachment #1: Type: text/plain, Size: 1642 bytes --]
Hi,
Since it looks like we'll be able to move the qdisc stuff over to a new
wiphy concept the master device is getting completely useless. Joy :)
Here's a series of patches to migrate d80211 away from the wmaster and
more towards a wiphy concept. This series targets the driver API.
Since I have no hope that netdev will like my patches, the whole series
is available at http://johannes.sipsolutions.net/patches/d80211-wiphy/
(and this time I made sure it's accessible :), also as
http://johannes.sipsolutions.net/patches/d80211-wiphy.tar.bz2)
d80211: clean up some stupid list and loop code
d80211: reduce mdev usage
d80211: reduce mdev usage
d80211: reduce mdev usage, fix ieee80211_rx_mgmt
d80211: reduce master ieee80211_ptr deref in scan routines
d80211: change the cookie to be opaque
These have been submitted previously and I've used them as stepping
stones. I removed the while (1) from the first one again in favour of
for (;;).
d80211: move hw descriptor into wiphy structure
Another stepping stone in a way, moves the ieee80211_hw *hw into wiphy
to drop some exported symbols.
d80211: add a perm_addr hardware property
another patch from my original series... puts the perm_addr property in
that will be moved around in the next patch
d80211: split ieee80211_hw
Most interesting one :) This one splits up ieee80211_hw into
ieee80211_ops and moves everything that could possibly be card-dependent
(as opposed to driver dependent) into ieee80211_wiphy.
d80211: introduce IEEE80211_HW_FRAG flag
just a fix for the previous one.
No driver updates for now, sorry.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 57+ messages in thread* [PATCH] d80211: remove useless driver name field 2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg @ 2006-11-17 22:50 ` Johannes Berg 2006-11-20 18:32 ` Jouni Malinen 2006-11-17 23:24 ` [PATCH 0/10] d80211: move away from wmaster towards wiphy Pavel Roskin ` (5 subsequent siblings) 6 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-17 22:50 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn struct ieee80211_ops has a driver name field that's never used. Remove it. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- applies after the 10 patches --- wireless-dev.orig/include/net/d80211.h 2006-11-17 23:37:10.249703408 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-17 23:37:21.709703408 +0100 @@ -531,9 +531,6 @@ struct ieee80211_wiphy { * about supported hardware features and to pass function pointers to callback * functions. */ struct ieee80211_ops { - /* Driver name */ - char *name; - /* Handler that 802.11 module calls for each transmitted frame. * skb contains the buffer starting from the IEEE 802.11 header. * The low-level driver should send the frame out based on ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: remove useless driver name field 2006-11-17 22:50 ` [PATCH] d80211: remove useless driver name field Johannes Berg @ 2006-11-20 18:32 ` Jouni Malinen 2006-11-20 18:40 ` Johannes Berg 2006-11-20 18:44 ` Michael Wu 0 siblings, 2 replies; 57+ messages in thread From: Jouni Malinen @ 2006-11-20 18:32 UTC (permalink / raw) To: Johannes Berg Cc: netdev, Jiri Benc, John W. Linville, Simon Barber, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Fri, Nov 17, 2006 at 11:50:35PM +0100, Johannes Berg wrote: > struct ieee80211_ops has a driver name field that's never used. > Remove it. > struct ieee80211_ops { > - /* Driver name */ > - char *name; > - Is this the same name field that was in struct ieee80211_hw? It was used and the main reason was to allow rate control algorithms to be implemented in a way which allows hardware specific features (e.g., different TX/RX status data) to be used to optimize rate selection. I would not remove this field unless there is another way of allowing something like this to be done in the rate control modules. -- Jouni Malinen PGP id EFC895FA ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: remove useless driver name field 2006-11-20 18:32 ` Jouni Malinen @ 2006-11-20 18:40 ` Johannes Berg 2006-11-20 22:21 ` Christoph Hellwig 2006-11-20 18:44 ` Michael Wu 1 sibling, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-20 18:40 UTC (permalink / raw) To: Jouni Malinen Cc: netdev, Jiri Benc, John W. Linville, Simon Barber, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 916 bytes --] On Mon, 2006-11-20 at 10:32 -0800, Jouni Malinen wrote: > On Fri, Nov 17, 2006 at 11:50:35PM +0100, Johannes Berg wrote: > > > struct ieee80211_ops has a driver name field that's never used. > > Remove it. > > > struct ieee80211_ops { > > - /* Driver name */ > > - char *name; > > - > > Is this the same name field that was in struct ieee80211_hw? Yes, it moved here during the shuffle in patch 6. > It was used > and the main reason was to allow rate control algorithms to be > implemented in a way which allows hardware specific features (e.g., > different TX/RX status data) to be used to optimize rate selection. I > would not remove this field unless there is another way of allowing > something like this to be done in the rate control modules. Oh, I hadn't found any references to it but I guess those rate control modules are internal. I'm fine with leaving it in. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: remove useless driver name field 2006-11-20 18:40 ` Johannes Berg @ 2006-11-20 22:21 ` Christoph Hellwig 2006-11-20 22:33 ` Johannes Berg 0 siblings, 1 reply; 57+ messages in thread From: Christoph Hellwig @ 2006-11-20 22:21 UTC (permalink / raw) To: Johannes Berg Cc: Jouni Malinen, netdev, Jiri Benc, John W. Linville, Simon Barber, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Mon, Nov 20, 2006 at 07:40:00PM +0100, Johannes Berg wrote: > On Mon, 2006-11-20 at 10:32 -0800, Jouni Malinen wrote: > > On Fri, Nov 17, 2006 at 11:50:35PM +0100, Johannes Berg wrote: > > > > > struct ieee80211_ops has a driver name field that's never used. > > > Remove it. > > > > > struct ieee80211_ops { > > > - /* Driver name */ > > > - char *name; > > > - > > > > Is this the same name field that was in struct ieee80211_hw? > > Yes, it moved here during the shuffle in patch 6. > > > It was used > > and the main reason was to allow rate control algorithms to be > > implemented in a way which allows hardware specific features (e.g., > > different TX/RX status data) to be used to optimize rate selection. I > > would not remove this field unless there is another way of allowing > > something like this to be done in the rate control modules. > > Oh, I hadn't found any references to it but I guess those rate control > modules are internal. I'm fine with leaving it in. NACK. We don't leave unused junk in tree. Especially not to allow implementing layering violations in non-public code. ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: remove useless driver name field 2006-11-20 22:21 ` Christoph Hellwig @ 2006-11-20 22:33 ` Johannes Berg 0 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-20 22:33 UTC (permalink / raw) To: Christoph Hellwig Cc: Jouni Malinen, netdev, Jiri Benc, John W. Linville, Simon Barber, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 252 bytes --] On Mon, 2006-11-20 at 22:21 +0000, Christoph Hellwig wrote: > NACK. We don't leave unused junk in tree. Especially not to allow > implementing layering violations in non-public code. No worries, patch is already in Jiri's tree :) johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: remove useless driver name field 2006-11-20 18:32 ` Jouni Malinen 2006-11-20 18:40 ` Johannes Berg @ 2006-11-20 18:44 ` Michael Wu 1 sibling, 0 replies; 57+ messages in thread From: Michael Wu @ 2006-11-20 18:44 UTC (permalink / raw) To: Jouni Malinen Cc: Johannes Berg, netdev, Jiri Benc, John W. Linville, Simon Barber, Hong Liu, David Kimdon, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 702 bytes --] On Monday 20 November 2006 13:32, Jouni Malinen wrote: > Is this the same name field that was in struct ieee80211_hw? It was used > and the main reason was to allow rate control algorithms to be > implemented in a way which allows hardware specific features (e.g., > different TX/RX status data) to be used to optimize rate selection. I > would not remove this field unless there is another way of allowing > something like this to be done in the rate control modules. But there's no code in the tree that actually uses it. Also, for drivers that properly use SET_NETDEV_DEV, it was accessible by: ndev->class_dev.dev->driver->name Or, with these patches applied: hw->dev->driver->name -Michael Wu [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 0/10] d80211: move away from wmaster towards wiphy 2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg 2006-11-17 22:50 ` [PATCH] d80211: remove useless driver name field Johannes Berg @ 2006-11-17 23:24 ` Pavel Roskin 2006-11-18 0:16 ` Johannes Berg ` (4 subsequent siblings) 6 siblings, 0 replies; 57+ messages in thread From: Pavel Roskin @ 2006-11-17 23:24 UTC (permalink / raw) To: Johannes Berg; +Cc: netdev Hello Johannes, On Fri, 2006-11-17 at 23:27 +0100, Johannes Berg wrote: > Since it looks like we'll be able to move the qdisc stuff over to a new > wiphy concept the master device is getting completely useless. Joy :) Could you please provide details about the solution? Maybe a link? Here's what I would consider: 1) Accept wiphy as a network device. This would be a rare case of polymorphism in the kernel, which would make me feel uneasy. 2) Introduce a notion of the "secondary queue" of the device, which would be the master queue for the virtual d80211 network devices. This could be extended to other virtual interfaces (e.g. VLAN). Virtual devices sharing the hardware would have the same secondary queue. In the case of VLAN, the secondary queue of one VLAN device would be the primary queue of the physical device. 3) Have a way to create the master device on demand from wiphy or a virtual device specifically for the purpose of manipulating its queue. 4) Introduce hidden network devices, seen by tc but not by ifconfig, route et al. Make the master hidden. I wonder if you invented something better than that. > d80211: clean up some stupid list and loop code > d80211: reduce mdev usage > d80211: reduce mdev usage > d80211: reduce mdev usage, fix ieee80211_rx_mgmt > d80211: reduce master ieee80211_ptr deref in scan routines I think these are pretty uncontroversial, especially the loop code. The rest may need some wider and longer discussion (at least give driver maintainers and the top kernel folks a chance to look at what you are suggesting). -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 0/10] d80211: move away from wmaster towards wiphy 2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg 2006-11-17 22:50 ` [PATCH] d80211: remove useless driver name field Johannes Berg 2006-11-17 23:24 ` [PATCH 0/10] d80211: move away from wmaster towards wiphy Pavel Roskin @ 2006-11-18 0:16 ` Johannes Berg 2006-11-18 23:53 ` [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Johannes Berg ` (3 subsequent siblings) 6 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-18 0:16 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn > No driver updates for now, sorry. Ah well, here we go :) bcm43xx patch to go with this. I noticed one bug in my other patches, if you have already downloaded them please do so again. This thing will conflict with lots of things Michael has in his tree, but just as a starting point... Working fine here :) Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/Makefile 2006-11-18 01:08:58.639703408 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/Makefile 2006-11-18 01:09:16.419703408 +0100 @@ -7,6 +7,6 @@ bcm43xx-d80211-obj-$(CONFIG_BCM43XX_D802 bcm43xx-d80211-objs := bcm43xx_main.o bcm43xx_ilt.o \ bcm43xx_radio.o bcm43xx_phy.o \ bcm43xx_power.o bcm43xx_sysfs.o \ - bcm43xx_leds.o bcm43xx_ethtool.o \ + bcm43xx_leds.o \ bcm43xx_xmit.o \ $(bcm43xx-d80211-obj-y) --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h 2006-11-18 01:08:58.699703408 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h 2006-11-18 01:09:16.419703408 +0100 @@ -679,10 +679,9 @@ struct bcm43xx_private { /* The Sonics Silicon Backplane. */ struct ssb ssb; - struct ieee80211_hw *ieee; + struct ieee80211_wiphy *wiphy; struct ieee80211_low_level_stats ieee_stats; - struct net_device *net_dev; unsigned int irq; spinlock_t irq_lock; @@ -770,9 +769,9 @@ struct bcm43xx_private { static inline -struct bcm43xx_private * bcm43xx_priv(struct net_device *dev) +struct bcm43xx_private * bcm43xx_priv(struct ieee80211_wiphy *wiphy) { - return ieee80211_dev_hw_data(dev); + return wiphy->priv; } static inline @@ -854,13 +853,7 @@ struct device; static inline struct bcm43xx_private * dev_to_bcm(struct device *dev) { - struct net_device *net_dev; - struct bcm43xx_private *bcm; - - net_dev = dev_get_drvdata(dev); - bcm = bcm43xx_priv(net_dev); - - return bcm; + return dev_get_drvdata(dev); } /* Is the device operating in a specified mode (IEEE80211_IF_TYPE_XXX). */ --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-18 01:08:58.789703408 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-18 01:09:16.419703408 +0100 @@ -285,7 +285,7 @@ void bcm43xx_debugfs_add_device(struct b { struct bcm43xx_dfsentry *e; struct bcm43xx_txstatus_log *log; - char devdir[IFNAMSIZ]; + char devdir[16]; assert(bcm); e = kzalloc(sizeof(*e), GFP_KERNEL); @@ -308,7 +308,7 @@ void bcm43xx_debugfs_add_device(struct b bcm->dfsentry = e; - strncpy(devdir, bcm->net_dev->name, ARRAY_SIZE(devdir)); + snprintf(devdir, sizeof(devdir), "wiphy%d", bcm->wiphy->index); e->subdir = debugfs_create_dir(devdir, fs.root); e->dentry_tsf = debugfs_create_file("tsf", 0666, e->subdir, bcm, &tsf_fops); --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c 2006-11-18 01:08:58.819703408 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c 2006-11-18 01:09:16.429703408 +0100 @@ -525,7 +525,6 @@ static int setup_rx_descbuffer(struct bc ring->rx_buffersize, 0); meta->skb = skb; meta->dmaaddr = dmaaddr; - skb->dev = ring->bcm->net_dev; ring->ops->fill_descriptor(ring, desc, dmaaddr, ring->rx_buffersize, 0, 0, 0); @@ -1091,7 +1090,7 @@ int bcm43xx_dma_tx(struct bcm43xx_privat ring->nr_tx_packets++; if (free_slots(ring) < SLOTS_PER_PACKET) { /* FIXME: we currently only have one queue */ - ieee80211_stop_queue(bcm->net_dev, 0); + ieee80211_stop_queue(bcm->wiphy, 0); ring->stopped = 1; } @@ -1130,7 +1129,7 @@ void bcm43xx_dma_handle_txstatus(struct if (status->acked) meta->txstat.flags |= IEEE80211_TX_STATUS_ACK; meta->txstat.retry_count = status->frame_count - 1; - ieee80211_tx_status_irqsafe(bcm->net_dev, meta->skb, &(meta->txstat)); + ieee80211_tx_status_irqsafe(bcm->wiphy, meta->skb, &(meta->txstat)); /* skb is freed by ieee80211_tx_status_irqsafe() */ } else { /* No need to call free_descriptor_buffer here, as @@ -1151,7 +1150,7 @@ void bcm43xx_dma_handle_txstatus(struct if (ring->stopped) { assert(free_slots(ring) >= SLOTS_PER_PACKET); /* FIXME: we currently only have one queue */ - ieee80211_wake_queue(bcm->net_dev, 0); + ieee80211_wake_queue(bcm->wiphy, 0); ring->stopped = 0; } } --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_ethtool.c 2006-11-18 01:08:58.889703408 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* - - Broadcom BCM43xx wireless driver - - ethtool support - - Copyright (c) 2006 Jason Lunz <lunz@falooley.org> - - Some code in this file is derived from the 8139too.c driver - Copyright (C) 2002 Jeff Garzik - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "bcm43xx.h" -#include "bcm43xx_ethtool.h" - -#include <linux/netdevice.h> -#include <linux/pci.h> -#include <linux/string.h> -#include <linux/version.h> -#include <linux/utsrelease.h> - - -static void bcm43xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) -{ - struct bcm43xx_private *bcm = bcm43xx_priv(dev); - - strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - strncpy(info->version, UTS_RELEASE, sizeof(info->version)); - strncpy(info->bus_info, pci_name(bcm->ssb.pci_dev), ETHTOOL_BUSINFO_LEN); -} - -struct ethtool_ops bcm43xx_ethtool_ops = { - .get_drvinfo = bcm43xx_get_drvinfo, - .get_link = ethtool_op_get_link, -}; --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_ethtool.h 2006-11-18 01:08:58.939703408 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -#ifndef BCM43xx_ETHTOOL_H_ -#define BCM43xx_ETHTOOL_H_ - -#include <linux/ethtool.h> - -extern struct ethtool_ops bcm43xx_ethtool_ops; - -#endif /* BCM43xx_ETHTOOL_H_ */ --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c 2006-11-18 01:08:59.029703408 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c 2006-11-18 01:09:16.439703408 +0100 @@ -50,7 +50,6 @@ #include "bcm43xx_pio.h" #include "bcm43xx_power.h" #include "bcm43xx_sysfs.h" -#include "bcm43xx_ethtool.h" #include "bcm43xx_xmit.h" #include "bcm43xx_sysfs.h" @@ -114,8 +113,8 @@ MODULE_PARM_DESC(fwpostfix, "Postfix for //#define DEBUG_ENABLE_PCILOG -static int bcm43xx_net_stop(struct net_device *net_dev); -static int bcm43xx_net_open(struct net_device *net_dev); +static int bcm43xx_net_stop(struct ieee80211_wiphy *wiphy); +static int bcm43xx_net_open(struct ieee80211_wiphy *wiphy); /* Detailed list maintained at: * http://openfacts.berlios.de/index-en.phtml?title=Bcm43xxDevices @@ -491,7 +490,7 @@ static void bcm43xx_measure_channel_chan spin_unlock_irqrestore(&bcm->irq_lock, flags); assert(stop > start); - bcm->ieee->channel_change_time = stop - start; + bcm->wiphy->channel_change_time = stop - start; } static @@ -2573,7 +2572,7 @@ static void bcm43xx_periodic_work_handle /* Periodic work will take a long time, so we want it to * be preemtible. */ - ieee80211_stop_queues(bcm->net_dev); + ieee80211_stop_queues(bcm->wiphy); spin_lock_irqsave(&bcm->irq_lock, flags); bcm43xx_mac_suspend(bcm); if (bcm43xx_using_pio(bcm)) @@ -2597,7 +2596,7 @@ static void bcm43xx_periodic_work_handle if (bcm43xx_using_pio(bcm)) bcm43xx_pio_thaw_txqueues(bcm); bcm43xx_mac_enable(bcm); - ieee80211_start_queues(bcm->net_dev); + ieee80211_start_queues(bcm->wiphy); } mmiowb(); spin_unlock_irqrestore(&bcm->irq_lock, flags); @@ -2848,19 +2847,19 @@ static void bcm43xx_chipset_detach(struc static void bcm43xx_free_modes(struct bcm43xx_private *bcm) { - struct ieee80211_hw *ieee = bcm->ieee; + struct ieee80211_wiphy *wiphy = bcm->wiphy; int i; - for (i = 0; i < ieee->num_modes; i++) { - kfree(ieee->modes[i].channels); - kfree(ieee->modes[i].rates); + for (i = 0; i < wiphy->num_modes; i++) { + kfree(wiphy->modes[i].channels); + kfree(wiphy->modes[i].rates); } - kfree(ieee->modes); - ieee->modes = NULL; - ieee->num_modes = 0; + kfree(wiphy->modes); + wiphy->modes = NULL; + wiphy->num_modes = 0; } -static int bcm43xx_append_mode(struct ieee80211_hw *ieee, +static int bcm43xx_append_mode(struct ieee80211_wiphy *wiphy, int mode_id, int nr_channels, const struct ieee80211_channel *channels, @@ -2872,7 +2871,7 @@ static int bcm43xx_append_mode(struct ie struct ieee80211_hw_modes *mode; int err = -ENOMEM; - mode = &(ieee->modes[ieee->num_modes]); + mode = &(wiphy->modes[wiphy->num_modes]); mode->mode = mode_id; mode->num_channels = nr_channels; @@ -2893,7 +2892,7 @@ static int bcm43xx_append_mode(struct ie sizeof(*rates2) * nr_rates2); } - ieee->num_modes++; + wiphy->num_modes++; err = 0; out: return err; @@ -2906,17 +2905,17 @@ err_free_channels: static int bcm43xx_setup_modes(struct bcm43xx_private *bcm) { int err = -ENOMEM; - struct ieee80211_hw *ieee = bcm->ieee; + struct ieee80211_wiphy *wiphy = bcm->wiphy; struct ssb_core *core; struct bcm43xx_corepriv_80211 *wlpriv; int i, nr_modes; nr_modes = bcm->nr_80211_available; - ieee->modes = kzalloc(sizeof(*(ieee->modes)) * nr_modes, + wiphy->modes = kzalloc(sizeof(*(wiphy->modes)) * nr_modes, GFP_KERNEL); - if (!ieee->modes) + if (!wiphy->modes) goto out; - ieee->num_modes = 0; + wiphy->num_modes = 0; for (i = 0; i < bcm->nr_80211_available; i++) { core = bcm->wlcores[i]; @@ -2924,7 +2923,7 @@ static int bcm43xx_setup_modes(struct bc switch (wlpriv->phy.type) { case BCM43xx_PHYTYPE_A: - err = bcm43xx_append_mode(bcm->ieee, MODE_IEEE80211A, + err = bcm43xx_append_mode(bcm->wiphy, MODE_IEEE80211A, ARRAY_SIZE(bcm43xx_a_chantable), bcm43xx_a_chantable, ARRAY_SIZE(bcm43xx_ofdm_ratetable), @@ -2932,7 +2931,7 @@ static int bcm43xx_setup_modes(struct bc 0, NULL); break; case BCM43xx_PHYTYPE_B: - err = bcm43xx_append_mode(bcm->ieee, MODE_IEEE80211B, + err = bcm43xx_append_mode(bcm->wiphy, MODE_IEEE80211B, ARRAY_SIZE(bcm43xx_bg_chantable), bcm43xx_bg_chantable, ARRAY_SIZE(bcm43xx_cck_ratetable), @@ -2940,7 +2939,7 @@ static int bcm43xx_setup_modes(struct bc 0, NULL); break; case BCM43xx_PHYTYPE_G: - err = bcm43xx_append_mode(bcm->ieee, MODE_IEEE80211G, + err = bcm43xx_append_mode(bcm->wiphy, MODE_IEEE80211G, ARRAY_SIZE(bcm43xx_bg_chantable), bcm43xx_bg_chantable, ARRAY_SIZE(bcm43xx_ofdm_ratetable), @@ -3117,7 +3116,7 @@ int bcm43xx_select_wireless_core(struct return -ESRCH; /* No such PHYTYPE on this board. */ /* Disable all network traffic. */ - ieee80211_stop_queues(bcm->net_dev); + ieee80211_stop_queues(bcm->wiphy); if (bcm->wlcore) { /* We already selected a wl core in the past. @@ -3180,11 +3179,11 @@ bcm->wlcore = active_core; goto error; bcm43xx_macfilter_clear(bcm, BCM43xx_MACFILTER_ASSOC); - bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->net_dev->dev_addr)); + bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->wiphy->perm_addr)); bcm43xx_security_init(bcm); bcm43xx_measure_channel_change_time(bcm); - ieee80211_update_hw(bcm->net_dev, bcm->ieee); - ieee80211_start_queues(bcm->net_dev); + ieee80211_update_wiphy(bcm->wiphy); + ieee80211_start_queues(bcm->wiphy); /* Let's go! Be careful after enabling the IRQs. * Don't switch cores, for example. @@ -3329,9 +3328,9 @@ static int bcm43xx_ssb_suspend(struct ss int err; struct bcm43xx_private *bcm = ssb_to_bcm43xx(ssb); - ieee80211_stop_queues(bcm->net_dev); + ieee80211_stop_queues(bcm->wiphy); - err = bcm43xx_net_stop(bcm->net_dev); + err = bcm43xx_net_stop(bcm->wiphy); if (!err) mutex_lock(&bcm->mutex); @@ -3344,7 +3343,7 @@ static int bcm43xx_ssb_resume(struct ssb struct bcm43xx_private *bcm = ssb_to_bcm43xx(ssb); mutex_unlock(&bcm->mutex); - err = bcm43xx_net_open(bcm->net_dev); + err = bcm43xx_net_open(bcm->wiphy); return err; } @@ -3352,7 +3351,6 @@ static int bcm43xx_ssb_resume(struct ssb static int bcm43xx_attach_board(struct bcm43xx_private *bcm, struct pci_dev *pci_dev) { - struct net_device *net_dev = bcm->net_dev; int err; int i; u32 coremask; @@ -3376,7 +3374,6 @@ static int bcm43xx_attach_board(struct b err = -EIO; goto err_pci_release; } - net_dev->base_addr = (unsigned long)mmio; err = ssb_init(&bcm->ssb, pci_dev, mmio, bcm43xx_ssb_suspend, @@ -3449,9 +3446,9 @@ bcm->wlcore = bcm->wlcores[i]; /* Set the MAC address in the networking subsystem */ if (is_valid_ether_addr(bcm->sprom.r1.et1mac)) - memcpy(bcm->net_dev->dev_addr, bcm->sprom.r1.et1mac, 6); + memcpy(bcm->wiphy->perm_addr, bcm->sprom.r1.et1mac, 6); else - memcpy(bcm->net_dev->dev_addr, bcm->sprom.r1.il0mac, 6); + memcpy(bcm->wiphy->perm_addr, bcm->sprom.r1.il0mac, 6); bcm43xx_setup_modes(bcm); assert(err == 0); @@ -3478,12 +3475,12 @@ err_pci_disable: goto out; } -/* hard_start_xmit() callback in struct ieee80211_device */ -static int bcm43xx_net_hard_start_xmit(struct net_device *net_dev, +/* hard_start_xmit() callback in struct ieee80211_ops */ +static int bcm43xx_net_hard_start_xmit(struct ieee80211_wiphy *wiphy, struct sk_buff *skb, struct ieee80211_tx_control *ctl) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); int err = -ENODEV; unsigned long flags; @@ -3501,9 +3498,9 @@ static int bcm43xx_net_hard_start_xmit(s return NETDEV_TX_OK; } -static int bcm43xx_net_reset(struct net_device *net_dev) +static int bcm43xx_net_reset(struct ieee80211_wiphy *wiphy) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); unsigned long flags; spin_lock_irqsave(&bcm->irq_lock, flags); @@ -3513,10 +3510,10 @@ static int bcm43xx_net_reset(struct net_ return 0; } -static int bcm43xx_net_config(struct net_device *net_dev, +static int bcm43xx_net_config(struct ieee80211_wiphy *wiphy, struct ieee80211_conf *conf) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); struct bcm43xx_radioinfo *radio; struct bcm43xx_phyinfo *phy; unsigned long flags; @@ -3619,13 +3616,13 @@ out_unlock_mutex: return err; } -static int bcm43xx_net_set_key(struct net_device *net_dev, +static int bcm43xx_net_set_key(struct ieee80211_wiphy *wiphy, set_key_cmd cmd, u8 *addr, struct ieee80211_key_conf *key, int aid) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); unsigned long flags; u8 algorithm; u8 index; @@ -3742,17 +3739,17 @@ out: return err; } -static int bcm43xx_net_conf_tx(struct net_device *net_dev, +static int bcm43xx_net_conf_tx(struct ieee80211_wiphy *wiphy, int queue, const struct ieee80211_tx_queue_params *params) { return 0; } -static int bcm43xx_net_get_tx_stats(struct net_device *net_dev, +static int bcm43xx_net_get_tx_stats(struct ieee80211_wiphy *wiphy, struct ieee80211_tx_queue_stats *stats) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); unsigned long flags; int err = -ENODEV; @@ -3769,10 +3766,10 @@ static int bcm43xx_net_get_tx_stats(stru return err; } -static int bcm43xx_net_get_stats(struct net_device *net_dev, +static int bcm43xx_net_get_stats(struct ieee80211_wiphy *wiphy, struct ieee80211_low_level_stats *stats) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); unsigned long flags; spin_lock_irqsave(&bcm->irq_lock, flags); @@ -3782,29 +3779,16 @@ static int bcm43xx_net_get_stats(struct return 0; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void bcm43xx_net_poll_controller(struct net_device *net_dev) +static int bcm43xx_net_open(struct ieee80211_wiphy *wiphy) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); - unsigned long flags; - - local_irq_save(flags); - if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) - bcm43xx_interrupt_handler(bcm->irq, bcm); - local_irq_restore(flags); -} -#endif /* CONFIG_NET_POLL_CONTROLLER */ - -static int bcm43xx_net_open(struct net_device *net_dev) -{ - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); return bcm43xx_init_board(bcm); } -static int bcm43xx_net_stop(struct net_device *net_dev) +static int bcm43xx_net_stop(struct ieee80211_wiphy *wiphy) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); int err; if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { @@ -3817,10 +3801,10 @@ static int bcm43xx_net_stop(struct net_d return 0; } -static int bcm43xx_add_interface(struct net_device *net_dev, +static int bcm43xx_add_interface(struct ieee80211_wiphy *wiphy, struct ieee80211_if_init_conf *conf) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); unsigned long flags; int err = -EOPNOTSUPP; @@ -3857,10 +3841,10 @@ out_unlock: return err; } -static void bcm43xx_remove_interface(struct net_device *net_dev, +static void bcm43xx_remove_interface(struct ieee80211_wiphy *wiphy, struct ieee80211_if_init_conf *conf) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); unsigned long flags; mutex_lock(&bcm->mutex); @@ -3882,11 +3866,11 @@ static void bcm43xx_remove_interface(str MAC_ARG(conf->mac_addr)); } -static int bcm43xx_config_interface(struct net_device *net_dev, +static int bcm43xx_config_interface(struct ieee80211_wiphy *wiphy, int if_id, struct ieee80211_if_conf *conf) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); unsigned long flags; mutex_lock(&bcm->mutex); @@ -3907,11 +3891,11 @@ static int bcm43xx_config_interface(stru return 0; } -static void bcm43xx_set_multicast_list(struct net_device *net_dev, +static void bcm43xx_set_multicast_list(struct ieee80211_wiphy *wiphy, unsigned short netflags, int mc_count) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(wiphy); unsigned long flags; spin_lock_irqsave(&bcm->irq_lock, flags); @@ -3923,22 +3907,11 @@ static void bcm43xx_set_multicast_list(s spin_unlock_irqrestore(&bcm->irq_lock, flags); } -/* Initialization of struct net_device, just after allocation. */ -static void bcm43xx_netdev_setup(struct net_device *net_dev) -{ -#ifdef CONFIG_NET_POLL_CONTROLLER - net_dev->poll_controller = bcm43xx_net_poll_controller; -#endif - SET_ETHTOOL_OPS(net_dev, &bcm43xx_ethtool_ops); -} - static int bcm43xx_init_private(struct bcm43xx_private *bcm, - struct net_device *net_dev, - struct pci_dev *pci_dev, - struct ieee80211_hw *ieee) + struct ieee80211_wiphy *wiphy, + struct pci_dev *pci_dev) { - bcm->ieee = ieee; - bcm->net_dev = net_dev; + bcm->wiphy = wiphy; bcm->bad_frames_preempt = modparam_bad_frames_preempt; spin_lock_init(&bcm->irq_lock); spin_lock_init(&bcm->leds_lock); @@ -3953,12 +3926,27 @@ static int bcm43xx_init_private(struct b return 0; } +static struct ieee80211_ops bcm43xx_wiphy_ops = { + .tx = bcm43xx_net_hard_start_xmit, + .open = bcm43xx_net_open, + .stop = bcm43xx_net_stop, + .add_interface = bcm43xx_add_interface, + .remove_interface = bcm43xx_remove_interface, + .reset = bcm43xx_net_reset, + .config = bcm43xx_net_config, + .config_interface = bcm43xx_config_interface, + .set_multicast_list = bcm43xx_set_multicast_list, + .set_key = bcm43xx_net_set_key, + .get_stats = bcm43xx_net_get_stats, + .get_tx_stats = bcm43xx_net_get_tx_stats, + .conf_tx = bcm43xx_net_conf_tx, +}; + static int __devinit bcm43xx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { - struct net_device *net_dev; + struct ieee80211_wiphy *wiphy; struct bcm43xx_private *bcm; - struct ieee80211_hw *ieee; int err = -ENOMEM; #ifdef DEBUG_SINGLE_DEVICE_ONLY @@ -3966,52 +3954,36 @@ static int __devinit bcm43xx_init_one(st return -ENODEV; #endif - ieee = kzalloc(sizeof(*ieee), GFP_KERNEL); - if (!ieee) - goto out; - ieee->version = IEEE80211_VERSION; - ieee->name = KBUILD_MODNAME; - ieee->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | - IEEE80211_HW_MONITOR_DURING_OPER | - IEEE80211_HW_DEVICE_HIDES_WEP | - IEEE80211_HW_WEP_INCLUDE_IV; - ieee->maxssi = BCM43xx_RX_MAX_SSI; - ieee->tx = bcm43xx_net_hard_start_xmit; - ieee->open = bcm43xx_net_open; - ieee->stop = bcm43xx_net_stop; - ieee->add_interface = bcm43xx_add_interface; - ieee->remove_interface = bcm43xx_remove_interface; - ieee->reset = bcm43xx_net_reset; - ieee->config = bcm43xx_net_config; - ieee->config_interface = bcm43xx_config_interface; - ieee->set_multicast_list = bcm43xx_set_multicast_list; - ieee->set_key = bcm43xx_net_set_key; - ieee->get_stats = bcm43xx_net_get_stats; - ieee->queues = 1; - ieee->get_tx_stats = bcm43xx_net_get_tx_stats; - ieee->conf_tx = bcm43xx_net_conf_tx; - - net_dev = ieee80211_alloc_hw(sizeof(*bcm), bcm43xx_netdev_setup); - if (!net_dev) { + wiphy = ieee80211_alloc_wiphy(sizeof(*bcm), &bcm43xx_wiphy_ops); + if (!wiphy) { printk(KERN_ERR PFX "could not allocate ieee80211 device %s\n", pci_name(pdev)); - goto err_free_ieee; + return -ENOMEM; } + + /* fill hw info */ + wiphy->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | + IEEE80211_HW_MONITOR_DURING_OPER | + IEEE80211_HW_DEVICE_HIDES_WEP | + IEEE80211_HW_WEP_INCLUDE_IV; + wiphy->maxssi = BCM43xx_RX_MAX_SSI; + wiphy->queues = 1; + wiphy->dev = &pdev->dev; + /* initialize the bcm43xx_private struct */ - bcm = bcm43xx_priv(net_dev); + bcm = bcm43xx_priv(wiphy); memset(bcm, 0, sizeof(*bcm)); - err = bcm43xx_init_private(bcm, net_dev, pdev, ieee); + err = bcm43xx_init_private(bcm, wiphy, pdev); if (err) - goto err_free_netdev; + goto err_free_wiphy; - pci_set_drvdata(pdev, net_dev); - SET_NETDEV_DEV(net_dev, &pdev->dev); + pci_set_drvdata(pdev, bcm); err = bcm43xx_attach_board(bcm, pdev); if (err) - goto err_free_netdev; - err = ieee80211_register_hw(net_dev, ieee); + goto err_free_wiphy; + err = ieee80211_register_wiphy(wiphy); if (err) goto err_detach_board; @@ -4023,28 +3995,24 @@ out: err_detach_board: bcm43xx_detach_board(bcm); -err_free_netdev: - ieee80211_free_hw(net_dev); -err_free_ieee: - kfree(ieee); +err_free_wiphy: + ieee80211_free_wiphy(wiphy); goto out; } static void __devexit bcm43xx_remove_one(struct pci_dev *pdev) { - struct net_device *net_dev = pci_get_drvdata(pdev); - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); - struct ieee80211_hw *ieee = bcm->ieee; + struct bcm43xx_private *bcm = pci_get_drvdata(pdev); + struct ieee80211_wiphy *wiphy = bcm->wiphy; bcm43xx_debugfs_remove_device(bcm); - ieee80211_unregister_hw(net_dev); + ieee80211_unregister_wiphy(wiphy); bcm43xx_detach_board(bcm); if (bcm->cached_beacon) kfree_skb(bcm->cached_beacon); bcm->cached_beacon = NULL; - ieee80211_free_hw(net_dev); - kfree(ieee); + ieee80211_free_wiphy(wiphy); } /* Hard-reset the chip. Do not call this directly. @@ -4088,13 +4056,12 @@ void bcm43xx_controller_restart(struct b static int bcm43xx_suspend(struct pci_dev *pdev, pm_message_t state) { - struct net_device *net_dev = pci_get_drvdata(pdev); - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = pci_get_drvdata(pdev); int err; dprintk(KERN_INFO PFX "Suspending...\n"); - ieee80211_stop_queues(bcm->net_dev); + ieee80211_stop_queues(bcm->wiphy); bcm->was_initialized = 0; if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { bcm->was_initialized = 1; @@ -4120,8 +4087,7 @@ static int bcm43xx_suspend(struct pci_de static int bcm43xx_resume(struct pci_dev *pdev) { - struct net_device *net_dev = pci_get_drvdata(pdev); - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = pci_get_drvdata(pdev); int err; dprintk(KERN_INFO PFX "Resuming...\n"); @@ -4139,7 +4105,7 @@ static int bcm43xx_resume(struct pci_dev printk(KERN_ERR PFX "Resume failed!\n"); return err; } - ieee80211_start_queues(bcm->net_dev); + ieee80211_start_queues(bcm->wiphy); dprintk(KERN_INFO PFX "Device resumed.\n"); --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c 2006-11-18 01:08:59.059703408 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c 2006-11-18 01:09:16.439703408 +0100 @@ -503,7 +503,7 @@ void bcm43xx_pio_handle_txstatus(struct if (status->acked) packet->txstat.flags |= IEEE80211_TX_STATUS_ACK; packet->txstat.retry_count = status->frame_count - 1; - ieee80211_tx_status_irqsafe(bcm->net_dev, packet->skb, + ieee80211_tx_status_irqsafe(bcm->wiphy, packet->skb, &(packet->txstat)); packet->skb = NULL; --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c 2006-11-18 01:08:59.179703408 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c 2006-11-18 01:09:16.439703408 +0100 @@ -714,7 +714,7 @@ void bcm43xx_rx(struct bcm43xx_private * } bcm->stats.last_rx = jiffies; - ieee80211_rx_irqsafe(bcm->net_dev, skb, &status); + ieee80211_rx_irqsafe(bcm->wiphy, skb, &status); } void bcm43xx_handle_txstatus(struct bcm43xx_private *bcm, ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT 2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg ` (2 preceding siblings ...) 2006-11-18 0:16 ` Johannes Berg @ 2006-11-18 23:53 ` Johannes Berg 2006-11-19 16:16 ` Michael Buesch 2006-11-19 0:04 ` [PATCH] d80211: remove calib_int Johannes Berg ` (2 subsequent siblings) 6 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-18 23:53 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn There's no point in trying to tell a driver globally whether sw or hw crypto is used, if it's sw then we just don't give it keys... Besides, these weren't ever used! Remove IEEE80211_CONF_SW_DECRYPT and IEEE80211_CONF_SW_ENCRYPT. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- Some more absolutely useless code in d80211.... Patch applies after the other ones, it's now number 13 in my series. include/net/d80211.h | 6 ++---- net/d80211/ieee80211.c | 9 +++------ net/d80211/ieee80211_ioctl.c | 4 +--- net/d80211/wpa.c | 27 +++++++-------------------- 4 files changed, 13 insertions(+), 33 deletions(-) --- wireless-dev.orig/include/net/d80211.h 2006-11-19 00:41:30.489520302 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 00:41:46.509520302 +0100 @@ -244,11 +244,9 @@ struct ieee80211_conf { int beacon_int; -#define IEEE80211_CONF_SW_ENCRYPT (1<<0) -#define IEEE80211_CONF_SW_DECRYPT (1<<1) -#define IEEE80211_CONF_SHORT_SLOT_TIME (1<<2) /* use IEEE 802.11g Short Slot +#define IEEE80211_CONF_SHORT_SLOT_TIME (1<<0) /* use IEEE 802.11g Short Slot * Time */ -#define IEEE80211_CONF_SSID_HIDDEN (1<<3) /* do not broadcast the ssid */ +#define IEEE80211_CONF_SSID_HIDDEN (1<<1) /* do not broadcast the ssid */ u32 flags; /* configuration flags defined above */ u8 power_level; /* transmit power limit for current --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 00:12:10.719520302 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 00:43:28.799520302 +0100 @@ -516,8 +516,7 @@ ieee80211_tx_h_fragment(struct ieee80211 static int wep_encrypt_skb(struct ieee80211_txrx_data *tx, struct sk_buff *skb) { - if (tx->key->force_sw_encrypt || - (tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT)) { + if (tx->key->force_sw_encrypt) { if (ieee80211_wep_encrypt(tx->local, skb, tx->key)) return -1; } else { @@ -3268,8 +3267,7 @@ ieee80211_rx_h_wep_weak_iv_detection(str /* Check for weak IVs, if hwaccel did not remove IV from the frame */ if ((rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) || - rx->key->force_sw_encrypt || - (rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT)) { + rx->key->force_sw_encrypt) { u8 *iv = ieee80211_wep_is_weak_iv(rx->skb, rx->key); if (iv) { rx->sta->wep_weak_iv_count++; @@ -3301,8 +3299,7 @@ ieee80211_rx_h_wep_decrypt(struct ieee80 } if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) || - rx->key->force_sw_encrypt || - (rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + rx->key->force_sw_encrypt) { if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { printk(KERN_DEBUG "%s: RX WEP frame, decrypt " "failed\n", rx->dev->name); --- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-11-19 00:12:11.339520302 +0100 +++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-11-19 00:42:58.779520302 +0100 @@ -492,9 +492,7 @@ int ieee80211_set_hw_encryption(struct n key->force_sw_encrypt = 1; if (key && local->ops->set_key && - (!(local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT) || - !(local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) && - (keyconf = ieee80211_key_data2conf(local, key)) != NULL) { + (keyconf = ieee80211_key_data2conf(local, key))) { if (local->ops->set_key(local_to_wiphy(local), SET_KEY, addr, keyconf, sta ? sta->aid : 0)) { rc = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; --- wireless-dev.orig/net/d80211/wpa.c 2006-11-19 00:12:13.019520302 +0100 +++ wireless-dev/net/d80211/wpa.c 2006-11-19 00:45:16.999520302 +0100 @@ -104,7 +104,6 @@ ieee80211_tx_h_michael_mic_add(struct ie #endif /* CONFIG_HOSTAPD_WPA_TESTING */ if (!tx->key->force_sw_encrypt && - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) && !tx->fragmented && !(tx->local->wiphy.flags & IEEE80211_HW_TKIP_INCLUDE_MMIC) && !wpa_test) { @@ -186,8 +185,7 @@ ieee80211_rx_h_michael_mic_verify(struct #endif /* CONFIG_HOSTAPD_WPA_TESTING */ if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && - !rx->key->force_sw_encrypt && - !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + !rx->key->force_sw_encrypt) { if (rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) { if (skb->len < MICHAEL_MIC_LEN) return TXRX_DROP; @@ -297,9 +295,7 @@ static int tkip_encrypt_skb(struct ieee8 hdrlen = ieee80211_get_hdrlen(fc); len = skb->len - hdrlen; - tailneed = (!tx->key->force_sw_encrypt && - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) - ? 0 : TKIP_ICV_LEN; + tailneed = !tx->key->force_sw_encrypt ? 0 : TKIP_ICV_LEN; if ((skb_headroom(skb) < TKIP_IV_LEN || skb_tailroom(skb) < tailneed)) { I802_DEBUG_INC(tx->local->tx_expand_skb_head); @@ -331,8 +327,7 @@ iv_inc: skip_iv_inc: #endif /* CONFIG_HOSTAPD_WPA_TESTING */ - if (!tx->key->force_sw_encrypt && - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) + if (!tx->key->force_sw_encrypt #ifdef CONFIG_HOSTAPD_WPA_TESTING && !tx->wpa_test #endif /* CONFIG_HOSTAPD_WPA_TESTING */ @@ -427,7 +422,6 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8 #endif /* CONFIG_HOSTAPD_WPA_TESTING */ if (!tx->key->force_sw_encrypt && - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) && !(tx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) && !wpa_test) { /* hwaccel - with no need for preallocated room for IV/ICV */ @@ -506,8 +500,7 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8 #endif /* CONFIG_HOSTAPD_WPA_TESTING */ if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && - !rx->key->force_sw_encrypt && - !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + !rx->key->force_sw_encrypt) { if (!(rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV)) { /* Hardware takes care of all processing, including * replay protection, so no need to continue here. */ @@ -651,9 +644,7 @@ static int ccmp_encrypt_skb(struct ieee8 hdrlen = ieee80211_get_hdrlen(fc); len = skb->len - hdrlen; - tailneed = (!key->force_sw_encrypt && - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) - ? 0 : CCMP_MIC_LEN; + tailneed = !key->force_sw_encrypt ? 0 : CCMP_MIC_LEN; if ((skb_headroom(skb) < CCMP_HDR_LEN || skb_tailroom(skb) < tailneed)) { @@ -693,8 +684,7 @@ skip_pn_inc: ccmp_pn2hdr(pos, pn, key->keyidx); - if (!key->force_sw_encrypt && - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + if (!key->force_sw_encrypt) { /* hwaccel - with preallocated room for CCMP header */ tx->u.tx.control->key_idx = key->hw_key_idx; return 0; @@ -749,7 +739,6 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8 ieee80211_tx_set_iswep(tx); if (!tx->key->force_sw_encrypt && - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) && !(tx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV)) { /* hwaccel - with no need for preallocated room for CCMP " * header or MIC fields */ @@ -802,7 +791,6 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8 if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && !key->force_sw_encrypt && - !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) && !(rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV)) return TXRX_CONTINUE; @@ -823,8 +811,7 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8 } if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && - !key->force_sw_encrypt && - !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + !key->force_sw_encrypt) { /* hwaccel has already decrypted frame and verified MIC */ } else { u8 *scratch, *b_0, *aad; ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT 2006-11-18 23:53 ` [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Johannes Berg @ 2006-11-19 16:16 ` Michael Buesch 0 siblings, 0 replies; 57+ messages in thread From: Michael Buesch @ 2006-11-19 16:16 UTC (permalink / raw) To: Johannes Berg Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Ivo van Doorn, netdev On Sunday 19 November 2006 00:53, Johannes Berg wrote: > There's no point in trying to tell a driver globally whether sw or hw > crypto is used, if it's sw then we just don't give it keys... > > Besides, these weren't ever used! > Remove IEEE80211_CONF_SW_DECRYPT and IEEE80211_CONF_SW_ENCRYPT. > > Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Michael Buesch <mb@bu3sch.de> These two conf options are really useless. So yes, please remove them. > --- > Some more absolutely useless code in d80211.... > > Patch applies after the other ones, it's now number 13 in my series. > > include/net/d80211.h | 6 ++---- > net/d80211/ieee80211.c | 9 +++------ > net/d80211/ieee80211_ioctl.c | 4 +--- > net/d80211/wpa.c | 27 +++++++-------------------- > 4 files changed, 13 insertions(+), 33 deletions(-) > > --- wireless-dev.orig/include/net/d80211.h 2006-11-19 00:41:30.489520302 +0100 > +++ wireless-dev/include/net/d80211.h 2006-11-19 00:41:46.509520302 +0100 > @@ -244,11 +244,9 @@ struct ieee80211_conf { > > int beacon_int; > > -#define IEEE80211_CONF_SW_ENCRYPT (1<<0) > -#define IEEE80211_CONF_SW_DECRYPT (1<<1) > -#define IEEE80211_CONF_SHORT_SLOT_TIME (1<<2) /* use IEEE 802.11g Short Slot > +#define IEEE80211_CONF_SHORT_SLOT_TIME (1<<0) /* use IEEE 802.11g Short Slot > * Time */ > -#define IEEE80211_CONF_SSID_HIDDEN (1<<3) /* do not broadcast the ssid */ > +#define IEEE80211_CONF_SSID_HIDDEN (1<<1) /* do not broadcast the ssid */ > u32 flags; /* configuration flags defined above */ > > u8 power_level; /* transmit power limit for current > --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 00:12:10.719520302 +0100 > +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 00:43:28.799520302 +0100 > @@ -516,8 +516,7 @@ ieee80211_tx_h_fragment(struct ieee80211 > > static int wep_encrypt_skb(struct ieee80211_txrx_data *tx, struct sk_buff *skb) > { > - if (tx->key->force_sw_encrypt || > - (tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT)) { > + if (tx->key->force_sw_encrypt) { > if (ieee80211_wep_encrypt(tx->local, skb, tx->key)) > return -1; > } else { > @@ -3268,8 +3267,7 @@ ieee80211_rx_h_wep_weak_iv_detection(str > > /* Check for weak IVs, if hwaccel did not remove IV from the frame */ > if ((rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) || > - rx->key->force_sw_encrypt || > - (rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT)) { > + rx->key->force_sw_encrypt) { > u8 *iv = ieee80211_wep_is_weak_iv(rx->skb, rx->key); > if (iv) { > rx->sta->wep_weak_iv_count++; > @@ -3301,8 +3299,7 @@ ieee80211_rx_h_wep_decrypt(struct ieee80 > } > > if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) || > - rx->key->force_sw_encrypt || > - (rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { > + rx->key->force_sw_encrypt) { > if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { > printk(KERN_DEBUG "%s: RX WEP frame, decrypt " > "failed\n", rx->dev->name); > --- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-11-19 00:12:11.339520302 +0100 > +++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-11-19 00:42:58.779520302 +0100 > @@ -492,9 +492,7 @@ int ieee80211_set_hw_encryption(struct n > key->force_sw_encrypt = 1; > > if (key && local->ops->set_key && > - (!(local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT) || > - !(local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) && > - (keyconf = ieee80211_key_data2conf(local, key)) != NULL) { > + (keyconf = ieee80211_key_data2conf(local, key))) { > if (local->ops->set_key(local_to_wiphy(local), SET_KEY, addr, > keyconf, sta ? sta->aid : 0)) { > rc = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; > --- wireless-dev.orig/net/d80211/wpa.c 2006-11-19 00:12:13.019520302 +0100 > +++ wireless-dev/net/d80211/wpa.c 2006-11-19 00:45:16.999520302 +0100 > @@ -104,7 +104,6 @@ ieee80211_tx_h_michael_mic_add(struct ie > #endif /* CONFIG_HOSTAPD_WPA_TESTING */ > > if (!tx->key->force_sw_encrypt && > - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) && > !tx->fragmented && > !(tx->local->wiphy.flags & IEEE80211_HW_TKIP_INCLUDE_MMIC) && > !wpa_test) { > @@ -186,8 +185,7 @@ ieee80211_rx_h_michael_mic_verify(struct > #endif /* CONFIG_HOSTAPD_WPA_TESTING */ > > if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && > - !rx->key->force_sw_encrypt && > - !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { > + !rx->key->force_sw_encrypt) { > if (rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) { > if (skb->len < MICHAEL_MIC_LEN) > return TXRX_DROP; > @@ -297,9 +295,7 @@ static int tkip_encrypt_skb(struct ieee8 > hdrlen = ieee80211_get_hdrlen(fc); > len = skb->len - hdrlen; > > - tailneed = (!tx->key->force_sw_encrypt && > - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) > - ? 0 : TKIP_ICV_LEN; > + tailneed = !tx->key->force_sw_encrypt ? 0 : TKIP_ICV_LEN; > if ((skb_headroom(skb) < TKIP_IV_LEN || > skb_tailroom(skb) < tailneed)) { > I802_DEBUG_INC(tx->local->tx_expand_skb_head); > @@ -331,8 +327,7 @@ iv_inc: > skip_iv_inc: > #endif /* CONFIG_HOSTAPD_WPA_TESTING */ > > - if (!tx->key->force_sw_encrypt && > - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) > + if (!tx->key->force_sw_encrypt > #ifdef CONFIG_HOSTAPD_WPA_TESTING > && !tx->wpa_test > #endif /* CONFIG_HOSTAPD_WPA_TESTING */ > @@ -427,7 +422,6 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8 > #endif /* CONFIG_HOSTAPD_WPA_TESTING */ > > if (!tx->key->force_sw_encrypt && > - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) && > !(tx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) && > !wpa_test) { > /* hwaccel - with no need for preallocated room for IV/ICV */ > @@ -506,8 +500,7 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8 > #endif /* CONFIG_HOSTAPD_WPA_TESTING */ > > if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && > - !rx->key->force_sw_encrypt && > - !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { > + !rx->key->force_sw_encrypt) { > if (!(rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV)) { > /* Hardware takes care of all processing, including > * replay protection, so no need to continue here. */ > @@ -651,9 +644,7 @@ static int ccmp_encrypt_skb(struct ieee8 > hdrlen = ieee80211_get_hdrlen(fc); > len = skb->len - hdrlen; > > - tailneed = (!key->force_sw_encrypt && > - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) > - ? 0 : CCMP_MIC_LEN; > + tailneed = !key->force_sw_encrypt ? 0 : CCMP_MIC_LEN; > > if ((skb_headroom(skb) < CCMP_HDR_LEN || > skb_tailroom(skb) < tailneed)) { > @@ -693,8 +684,7 @@ skip_pn_inc: > > ccmp_pn2hdr(pos, pn, key->keyidx); > > - if (!key->force_sw_encrypt && > - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { > + if (!key->force_sw_encrypt) { > /* hwaccel - with preallocated room for CCMP header */ > tx->u.tx.control->key_idx = key->hw_key_idx; > return 0; > @@ -749,7 +739,6 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8 > ieee80211_tx_set_iswep(tx); > > if (!tx->key->force_sw_encrypt && > - !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) && > !(tx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV)) { > /* hwaccel - with no need for preallocated room for CCMP " > * header or MIC fields */ > @@ -802,7 +791,6 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8 > > if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && > !key->force_sw_encrypt && > - !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) && > !(rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV)) > return TXRX_CONTINUE; > > @@ -823,8 +811,7 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8 > } > > if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && > - !key->force_sw_encrypt && > - !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { > + !key->force_sw_encrypt) { > /* hwaccel has already decrypted frame and verified MIC */ > } else { > u8 *scratch, *b_0, *aad; > > > -- Greetings Michael. ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH] d80211: remove calib_int 2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg ` (3 preceding siblings ...) 2006-11-18 23:53 ` [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Johannes Berg @ 2006-11-19 0:04 ` Johannes Berg 2006-11-19 0:21 ` [PATCH] d80211: fix scan issues with new ops Johannes Berg 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg 6 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 0:04 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn The calibration interval is far too hardware dependent to be useful as a generic stack setting and some hardware doesn't even have that parameter. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- Again, applies after my other patches.. I think we want this one and probably some way to have driver-private settings later. include/net/d80211.h | 2 -- net/d80211/ieee80211.c | 1 - net/d80211/ieee80211_ioctl.c | 10 ---------- net/d80211/ieee80211_sysfs.c | 2 -- 4 files changed, 15 deletions(-) --- wireless-dev.orig/include/net/d80211.h 2006-11-19 00:54:57.539520302 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 00:55:03.229520302 +0100 @@ -259,8 +259,6 @@ struct ieee80211_conf { * 1 = Ant0, * 2 = Ant1 */ - int calib_int; /* hw/radio calibration interval in - * seconds */ int antenna_def; int antenna_mode; --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 00:55:21.929520302 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 00:55:36.679520302 +0100 @@ -4473,7 +4473,6 @@ struct ieee80211_wiphy *ieee80211_alloc_ local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; local->short_retry_limit = 7; local->long_retry_limit = 4; - local->wiphy.conf.calib_int = 60; local->wiphy.conf.radio_enabled = 1; local->rate_ctrl_num_up = RATE_CONTROL_NUM_UP; local->rate_ctrl_num_down = RATE_CONTROL_NUM_DOWN; --- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-11-19 00:55:22.049520302 +0100 +++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-11-19 00:55:49.879520302 +0100 @@ -2480,12 +2480,6 @@ static int ieee80211_ioctl_prism2_param( ret = -EINVAL; break; - case PRISM2_PARAM_CALIB_INT: - local->wiphy.conf.calib_int = value; - if (ieee80211_hw_config(local)) - ret = -EINVAL; - break; - case PRISM2_PARAM_ANTENNA_MODE: local->wiphy.conf.antenna_mode = value; if (ieee80211_hw_config(local)) @@ -2687,10 +2681,6 @@ static int ieee80211_ioctl_get_prism2_pa *param = local->wiphy.conf.antenna_sel; break; - case PRISM2_PARAM_CALIB_INT: - *param = local->wiphy.conf.calib_int; - break; - case PRISM2_PARAM_ANTENNA_MODE: *param = local->wiphy.conf.antenna_mode; break; --- wireless-dev.orig/net/d80211/ieee80211_sysfs.c 2006-11-19 00:55:22.169520302 +0100 +++ wireless-dev/net/d80211/ieee80211_sysfs.c 2006-11-19 00:55:58.189520302 +0100 @@ -154,7 +154,6 @@ IEEE80211_LOCAL_SHOW(channel, wiphy.conf IEEE80211_LOCAL_SHOW(frequency, wiphy.conf.freq, "%d"); IEEE80211_LOCAL_SHOW(radar_detect, wiphy.conf.radar_detect, "%d"); IEEE80211_LOCAL_SHOW(antenna_sel, wiphy.conf.antenna_sel, "%d"); -IEEE80211_LOCAL_SHOW(calib_int, wiphy.conf.calib_int, "%d"); IEEE80211_LOCAL_SHOW(bridge_packets, bridge_packets, "%d"); IEEE80211_LOCAL_SHOW(key_tx_rx_threshold, key_tx_rx_threshold, "%d"); IEEE80211_LOCAL_SHOW(rts_threshold, rts_threshold, "%d"); @@ -220,7 +219,6 @@ static struct class_device_attribute iee __ATTR(frequency, S_IRUGO, ieee80211_local_show_frequency, NULL), __ATTR(radar_detect, S_IRUGO, ieee80211_local_show_radar_detect, NULL), __ATTR(antenna_sel, S_IRUGO, ieee80211_local_show_antenna_sel, NULL), - __ATTR(calib_int, S_IRUGO, ieee80211_local_show_calib_int, NULL), __ATTR(bridge_packets, S_IRUGO, ieee80211_local_show_bridge_packets, NULL), __ATTR(key_tx_rx_threshold, S_IRUGO, ieee80211_local_show_key_tx_rx_threshold, NULL), __ATTR(rts_threshold, S_IRUGO, ieee80211_local_show_rts_threshold, NULL), ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH] d80211: fix scan issues with new ops 2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg ` (4 preceding siblings ...) 2006-11-19 0:04 ` [PATCH] d80211: remove calib_int Johannes Berg @ 2006-11-19 0:21 ` Johannes Berg 2006-11-19 15:56 ` David Kimdon 2006-11-19 16:15 ` Michael Buesch 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg 6 siblings, 2 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 0:21 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn If hardware shall do scanning, the hw_scan operation must be set. However, if the driver is for multiple cards that may or may not do hardware scanning, it'll need a flag. Similar issues arise with passive_scan(). This patch introduces flags to fix these issues. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- more fallout from my earlier patches... this time it's the scanning ops that were still used as flags as well as ops. --- wireless-dev.orig/include/net/d80211.h 2006-11-19 01:08:12.439520302 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 01:14:14.859520302 +0100 @@ -504,6 +504,12 @@ struct ieee80211_wiphy { /* do hardware fragmentation */ #define IEEE80211_HW_FRAG (1<<15) + /* hardware does scanning instead of software */ +#define IEEE80211_HW_PASSIVE_SCAN (1<<16) + + /* hardware does scanning instead of software */ +#define IEEE80211_HW_SCAN (1<<17) + u32 flags; /* hardware flags defined above */ /* Set to the size of a needed device specific skb headroom for TX skbs. */ @@ -627,7 +633,8 @@ struct ieee80211_ops { struct ieee80211_scan_conf *conf); /* Ask the hardware to service the scan request, no need to start - * the scan state machine in stack. */ + * the scan state machine in stack. + * This callback goes along with the IEEE80211_HW_SCAN flag */ int (*hw_scan)(struct ieee80211_wiphy *wiphy, u8 *ssid, size_t len); --- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-11-19 01:07:49.509520302 +0100 +++ wireless-dev/net/d80211/ieee80211_sta.c 2006-11-19 01:18:49.879520302 +0100 @@ -2552,7 +2552,7 @@ int ieee80211_sta_req_scan(struct net_de printk(KERN_DEBUG "%s: starting scan\n", dev->name); - if (local->ops->hw_scan) { + if (local->ops->hw_scan && local->wiphy.flags & IEEE80211_HW_SCAN) { int rc = local->ops->hw_scan(local_to_wiphy(local), ssid, ssid_len); if (!rc) { --- wireless-dev.orig/net/d80211/ieee80211_scan.c 2006-11-19 01:18:19.249520302 +0100 +++ wireless-dev/net/d80211/ieee80211_scan.c 2006-11-19 01:18:22.599520302 +0100 @@ -114,7 +114,8 @@ static void ieee80211_scan_start(struct struct ieee80211_channel *chan = NULL; int ret; - if (!local->hw->passive_scan) { + if (!local->ops->passive_scan || + !(local->wiphy.flags & IEEE80211_HW_PASSIVE_SCAN)) { printk(KERN_DEBUG "%s: Scan handler called, yet the hardware " "does not support passive scanning. Disabled.\n", local->mdev->name); ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 0:21 ` [PATCH] d80211: fix scan issues with new ops Johannes Berg @ 2006-11-19 15:56 ` David Kimdon 2006-11-19 16:34 ` Johannes Berg 2006-11-19 16:15 ` Michael Buesch 1 sibling, 1 reply; 57+ messages in thread From: David Kimdon @ 2006-11-19 15:56 UTC (permalink / raw) To: Johannes Berg Cc: netdev, Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Sun, Nov 19, 2006 at 01:21:13AM +0100, Johannes Berg wrote: > If hardware shall do scanning, the hw_scan operation must be set. However, > if the driver is for multiple cards that may or may not do hardware > scanning, it'll need a flag. What is wrong with the driver setting the function pointer to NULL for the cards that do not support scanning? Where does this requirment come from that the function pointers in struct ieee80211_wiphy be identical for all cards? -David ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 15:56 ` David Kimdon @ 2006-11-19 16:34 ` Johannes Berg 2006-11-19 16:50 ` Johannes Berg 2006-11-19 16:55 ` David Kimdon 0 siblings, 2 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 16:34 UTC (permalink / raw) To: David Kimdon Cc: netdev, Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 484 bytes --] On Sun, 2006-11-19 at 07:56 -0800, David Kimdon wrote: > What is wrong with the driver setting the function pointer to NULL for > the cards that do not support scanning? Where does this requirment > come from that the function pointers in struct ieee80211_wiphy be > identical for all cards? Well I want to allow drivers to make assign the 33 function pointers in a static structure, and differences between cards must then be handled in the non-static part. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 16:34 ` Johannes Berg @ 2006-11-19 16:50 ` Johannes Berg 2006-11-19 16:55 ` David Kimdon 1 sibling, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 16:50 UTC (permalink / raw) To: David Kimdon Cc: netdev, Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 459 bytes --] On Sun, 2006-11-19 at 17:34 +0100, Johannes Berg wrote: > Well I want to allow drivers to make assign the 33 function pointers in > a static structure, and differences between cards must then be handled > in the non-static part. Uh, that didn't come out too well. The point is that ieee80211_ops can be static after these changes which is a whopping 33 function pointers or so :) And only at the expense of having a few new flags. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 16:34 ` Johannes Berg 2006-11-19 16:50 ` Johannes Berg @ 2006-11-19 16:55 ` David Kimdon 2006-11-19 16:57 ` Johannes Berg 1 sibling, 1 reply; 57+ messages in thread From: David Kimdon @ 2006-11-19 16:55 UTC (permalink / raw) To: Johannes Berg Cc: David Kimdon, netdev, Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, Michael Wu, Michael Buesch, Ivo van Doorn On Sun, Nov 19, 2006 at 05:34:49PM +0100, Johannes Berg wrote: > On Sun, 2006-11-19 at 07:56 -0800, David Kimdon wrote: > > > What is wrong with the driver setting the function pointer to NULL for > > the cards that do not support scanning? Where does this requirment > > come from that the function pointers in struct ieee80211_wiphy be > > identical for all cards? > > Well I want to allow drivers to make assign the 33 function pointers in > a static structure, and differences between cards must then be handled > in the non-static part. ok. I am concerned that making this split between per driver and per card is difficult to get right. Setting or not setting a function pointer for an operation is fairly standard practice and I don't see the value in introducing yet another way to indicate support. -David ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 16:55 ` David Kimdon @ 2006-11-19 16:57 ` Johannes Berg 2006-11-19 17:25 ` David Kimdon 0 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-19 16:57 UTC (permalink / raw) To: David Kimdon Cc: netdev, Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 606 bytes --] On Sun, 2006-11-19 at 08:55 -0800, David Kimdon wrote: > ok. I am concerned that making this split between per driver and per > card is difficult to get right. Setting or not setting a function > pointer for an operation is fairly standard practice and I don't see > the value in introducing yet another way to indicate support. I guess we can punt this patch until some driver shows up that actually has some cards that need the function and some that don't. I'm actually guessing such a driver won't exist but wanted this for completeness in the split between _wiphy and _ops. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 16:57 ` Johannes Berg @ 2006-11-19 17:25 ` David Kimdon 2006-11-19 17:54 ` Johannes Berg 0 siblings, 1 reply; 57+ messages in thread From: David Kimdon @ 2006-11-19 17:25 UTC (permalink / raw) To: Johannes Berg Cc: David Kimdon, netdev, Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, Michael Wu, Michael Buesch, Ivo van Doorn On Sun, Nov 19, 2006 at 05:57:39PM +0100, Johannes Berg wrote: > On Sun, 2006-11-19 at 08:55 -0800, David Kimdon wrote: > > > ok. I am concerned that making this split between per driver and per > > card is difficult to get right. Setting or not setting a function > > pointer for an operation is fairly standard practice and I don't see > > the value in introducing yet another way to indicate support. > > I guess we can punt this patch until some driver shows up that actually > has some cards that need the function and some that don't. I'm actually > guessing such a driver won't exist but wanted this for completeness in > the split between _wiphy and _ops. Perhaps that is a split that we do not need? I don't see the problem that 'd80211: split ieee80211_hw' is solving. I do see what it is doing, but maybe I am missing something . . . > > johannes ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 17:25 ` David Kimdon @ 2006-11-19 17:54 ` Johannes Berg 0 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 17:54 UTC (permalink / raw) To: David Kimdon Cc: netdev, Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 474 bytes --] On Sun, 2006-11-19 at 09:25 -0800, David Kimdon wrote: > Perhaps that is a split that we do not need? I don't see the problem > that 'd80211: split ieee80211_hw' is solving. I do see what it is > doing, but maybe I am missing something . . . Oh, I just figured that on 64-bit systems the _ops part is something like 264 bytes that we needlessly allocate for every device when in reality it doesn't really change between cards for a single driver. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 0:21 ` [PATCH] d80211: fix scan issues with new ops Johannes Berg 2006-11-19 15:56 ` David Kimdon @ 2006-11-19 16:15 ` Michael Buesch 2006-11-19 16:35 ` Johannes Berg 1 sibling, 1 reply; 57+ messages in thread From: Michael Buesch @ 2006-11-19 16:15 UTC (permalink / raw) To: Johannes Berg Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Ivo van Doorn, netdev On Sunday 19 November 2006 01:21, Johannes Berg wrote: > If hardware shall do scanning, the hw_scan operation must be set. However, > if the driver is for multiple cards that may or may not do hardware > scanning, it'll need a flag. > > Similar issues arise with passive_scan(). > > This patch introduces flags to fix these issues. > > Signed-off-by: Johannes Berg <johannes@sipsolutions.net> > > --- > more fallout from my earlier patches... this time it's the scanning ops > that were still used as flags as well as ops. > > --- wireless-dev.orig/include/net/d80211.h 2006-11-19 01:08:12.439520302 +0100 > +++ wireless-dev/include/net/d80211.h 2006-11-19 01:14:14.859520302 +0100 > @@ -504,6 +504,12 @@ struct ieee80211_wiphy { > /* do hardware fragmentation */ > #define IEEE80211_HW_FRAG (1<<15) > > + /* hardware does scanning instead of software */ > +#define IEEE80211_HW_PASSIVE_SCAN (1<<16) > + > + /* hardware does scanning instead of software */ > +#define IEEE80211_HW_SCAN (1<<17) > + > u32 flags; /* hardware flags defined above */ > > /* Set to the size of a needed device specific skb headroom for TX skbs. */ > @@ -627,7 +633,8 @@ struct ieee80211_ops { > struct ieee80211_scan_conf *conf); > > /* Ask the hardware to service the scan request, no need to start > - * the scan state machine in stack. */ > + * the scan state machine in stack. > + * This callback goes along with the IEEE80211_HW_SCAN flag */ > int (*hw_scan)(struct ieee80211_wiphy *wiphy, u8 *ssid, > size_t len); > > --- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-11-19 01:07:49.509520302 +0100 > +++ wireless-dev/net/d80211/ieee80211_sta.c 2006-11-19 01:18:49.879520302 +0100 > @@ -2552,7 +2552,7 @@ int ieee80211_sta_req_scan(struct net_de > > printk(KERN_DEBUG "%s: starting scan\n", dev->name); > > - if (local->ops->hw_scan) { > + if (local->ops->hw_scan && local->wiphy.flags & IEEE80211_HW_SCAN) { Please wrap this into () (Hm, actually, the compiler should complain on this...) > int rc = local->ops->hw_scan(local_to_wiphy(local), > ssid, ssid_len); > if (!rc) { > --- wireless-dev.orig/net/d80211/ieee80211_scan.c 2006-11-19 01:18:19.249520302 +0100 > +++ wireless-dev/net/d80211/ieee80211_scan.c 2006-11-19 01:18:22.599520302 +0100 > @@ -114,7 +114,8 @@ static void ieee80211_scan_start(struct > struct ieee80211_channel *chan = NULL; > int ret; > > - if (!local->hw->passive_scan) { > + if (!local->ops->passive_scan || > + !(local->wiphy.flags & IEEE80211_HW_PASSIVE_SCAN)) { > printk(KERN_DEBUG "%s: Scan handler called, yet the hardware " > "does not support passive scanning. Disabled.\n", > local->mdev->name); > > > -- Greetings Michael. ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: fix scan issues with new ops 2006-11-19 16:15 ` Michael Buesch @ 2006-11-19 16:35 ` Johannes Berg 0 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 16:35 UTC (permalink / raw) To: Michael Buesch Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Ivo van Doorn, netdev [-- Attachment #1: Type: text/plain, Size: 231 bytes --] On Sun, 2006-11-19 at 17:15 +0100, Michael Buesch wrote: > > - if (local->ops->hw_scan) { > > + if (local->ops->hw_scan && local->wiphy.flags & IEEE80211_HW_SCAN) { > > Please wrap this into () Good point :) johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 0/13] move d80211 away from netdev towards wiphy 2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg ` (5 preceding siblings ...) 2006-11-19 0:21 ` [PATCH] d80211: fix scan issues with new ops Johannes Berg @ 2006-11-19 19:18 ` Johannes Berg 2006-11-19 19:22 ` [PATCH 1/13] d80211: clean up some stupid list and loop code Johannes Berg ` (13 more replies) 6 siblings, 14 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:18 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 417 bytes --] This is a repost of the whole patchset modified according to various comments. I've folded patches 6, 7 and 8 into one driver API update patch that is smaller than the three combined. Unfortunately, it's still very large. I've also changed the introduction of ieee80211_wiphy, in fact the patch doesn't introduce it at all it just moves some stuff into ieee80211_hw and the operations out of it. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 1/13] d80211: clean up some stupid list and loop code 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg @ 2006-11-19 19:22 ` Johannes Berg 2006-11-20 11:01 ` Jiri Benc 2006-11-19 19:23 ` [PATCH 2/13] d80211: reduce mdev usage Johannes Berg ` (12 subsequent siblings) 13 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:22 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn "for (; condition ;)"?? Ever heard of while loops? Also clean up some list handling (still. *sigh*) Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-11-19 20:13:52.269275208 +0100 +++ wireless-dev/net/d80211/ieee80211_sta.c 2006-11-19 20:13:54.109275208 +0100 @@ -1314,16 +1314,10 @@ void ieee80211_rx_bss_list_init(struct n void ieee80211_rx_bss_list_deinit(struct net_device *dev) { struct ieee80211_local *local = dev->ieee80211_ptr; - struct ieee80211_sta_bss *bss; - struct list_head *ptr; + struct ieee80211_sta_bss *bss, *tmp; - for (;;) { - ptr = local->sta_bss_list.next; - if (!ptr || ptr == &local->sta_bss_list) - break; - bss = list_entry(ptr, struct ieee80211_sta_bss, list); + list_for_each_entry_safe(bss, tmp, &local->sta_bss_list, list) ieee80211_rx_bss_put(dev, bss); - } } --- wireless-dev.orig/net/d80211/sta_info.c 2006-11-19 20:13:52.339275208 +0100 +++ wireless-dev/net/d80211/sta_info.c 2006-11-19 20:13:54.119275208 +0100 @@ -324,16 +324,13 @@ static void sta_info_cleanup_expire_buff static void sta_info_cleanup(unsigned long data) { struct ieee80211_local *local = (struct ieee80211_local *) data; - struct list_head *ptr; + struct sta_info *sta, *tmp; spin_lock_bh(&local->sta_lock); - ptr = local->sta_list.next; - while (ptr && ptr != &local->sta_list) { - struct sta_info *sta = (struct sta_info *) ptr; + list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { __sta_info_get(sta); sta_info_cleanup_expire_buffered(local, sta); sta_info_put(sta); - ptr = ptr->next; } spin_unlock_bh(&local->sta_lock); @@ -411,14 +408,11 @@ int sta_info_start(struct ieee80211_loca void sta_info_stop(struct ieee80211_local *local) { - struct list_head *ptr; + struct sta_info *sta, *tmp; del_timer(&local->sta_cleanup); - ptr = local->sta_list.next; - while (ptr && ptr != &local->sta_list) { - struct sta_info *sta = (struct sta_info *) ptr; - ptr = ptr->next; + list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { /* sta_info_free must be called with 0 as the last * parameter to ensure all sysfs sta entries are * unregistered. We don't need locking at this --- wireless-dev.orig/net/d80211/wme.c 2006-11-19 20:13:52.399275208 +0100 +++ wireless-dev/net/d80211/wme.c 2006-11-19 20:13:54.119275208 +0100 @@ -211,8 +211,7 @@ static inline int classify80211(struct s skb->priority = classify_1d(skb, qd); /* incase we are a client verify acm is not set for this ac */ - for (; unlikely(local->wmm_acm & BIT(skb->priority)); ) - { + while (unlikely(local->wmm_acm & BIT(skb->priority))) { if (wme_downgrade_ac(skb)) { /* No AC with lower priority has acm=0, * drop packet. */ ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 1/13] d80211: clean up some stupid list and loop code 2006-11-19 19:22 ` [PATCH 1/13] d80211: clean up some stupid list and loop code Johannes Berg @ 2006-11-20 11:01 ` Jiri Benc 2006-11-20 11:58 ` Johannes Berg 0 siblings, 1 reply; 57+ messages in thread From: Jiri Benc @ 2006-11-20 11:01 UTC (permalink / raw) To: Johannes Berg Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Sun, 19 Nov 2006 20:22:20 +0100, Johannes Berg wrote: > --- wireless-dev.orig/net/d80211/sta_info.c 2006-11-19 20:13:52.339275208 +0100 > +++ wireless-dev/net/d80211/sta_info.c 2006-11-19 20:13:54.119275208 +0100 > @@ -324,16 +324,13 @@ static void sta_info_cleanup_expire_buff > static void sta_info_cleanup(unsigned long data) > { > struct ieee80211_local *local = (struct ieee80211_local *) data; > - struct list_head *ptr; > + struct sta_info *sta, *tmp; > > spin_lock_bh(&local->sta_lock); > - ptr = local->sta_list.next; > - while (ptr && ptr != &local->sta_list) { > - struct sta_info *sta = (struct sta_info *) ptr; > + list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { There is no need for _safe here. > __sta_info_get(sta); > sta_info_cleanup_expire_buffered(local, sta); > sta_info_put(sta); > - ptr = ptr->next; > } > spin_unlock_bh(&local->sta_lock); > Thanks, Jiri -- Jiri Benc SUSE Labs ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 1/13] d80211: clean up some stupid list and loop code 2006-11-20 11:01 ` Jiri Benc @ 2006-11-20 11:58 ` Johannes Berg 2006-11-20 18:55 ` Johannes Berg 0 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-20 11:58 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Mon, 2006-11-20 at 12:01 +0100, Jiri Benc wrote: > > + list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { > > There is no need for _safe here. Ok, wasn't sure about that one so I left it safe (it was before I think). I'll remove it when I respin. johannes ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 1/13] d80211: clean up some stupid list and loop code 2006-11-20 11:58 ` Johannes Berg @ 2006-11-20 18:55 ` Johannes Berg 0 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-20 18:55 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn "for (; condition ;)"?? Ever heard of while loops? Also clean up some list handling (still. *sigh*) Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- respun to remove list_for_each_entry in one place where it isn't needed. --- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-11-19 20:13:52.269275208 +0100 +++ wireless-dev/net/d80211/ieee80211_sta.c 2006-11-20 19:13:04.959598504 +0100 @@ -1314,16 +1314,10 @@ void ieee80211_rx_bss_list_init(struct n void ieee80211_rx_bss_list_deinit(struct net_device *dev) { struct ieee80211_local *local = dev->ieee80211_ptr; - struct ieee80211_sta_bss *bss; - struct list_head *ptr; + struct ieee80211_sta_bss *bss, *tmp; - for (;;) { - ptr = local->sta_bss_list.next; - if (!ptr || ptr == &local->sta_bss_list) - break; - bss = list_entry(ptr, struct ieee80211_sta_bss, list); + list_for_each_entry_safe(bss, tmp, &local->sta_bss_list, list) ieee80211_rx_bss_put(dev, bss); - } } --- wireless-dev.orig/net/d80211/sta_info.c 2006-11-19 20:13:52.339275208 +0100 +++ wireless-dev/net/d80211/sta_info.c 2006-11-20 19:13:35.839598504 +0100 @@ -324,16 +324,13 @@ static void sta_info_cleanup_expire_buff static void sta_info_cleanup(unsigned long data) { struct ieee80211_local *local = (struct ieee80211_local *) data; - struct list_head *ptr; + struct sta_info *sta; spin_lock_bh(&local->sta_lock); - ptr = local->sta_list.next; - while (ptr && ptr != &local->sta_list) { - struct sta_info *sta = (struct sta_info *) ptr; + list_for_each_entry(sta, &local->sta_list, list) { __sta_info_get(sta); sta_info_cleanup_expire_buffered(local, sta); sta_info_put(sta); - ptr = ptr->next; } spin_unlock_bh(&local->sta_lock); @@ -411,14 +408,11 @@ int sta_info_start(struct ieee80211_loca void sta_info_stop(struct ieee80211_local *local) { - struct list_head *ptr; + struct sta_info *sta, *tmp; del_timer(&local->sta_cleanup); - ptr = local->sta_list.next; - while (ptr && ptr != &local->sta_list) { - struct sta_info *sta = (struct sta_info *) ptr; - ptr = ptr->next; + list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { /* sta_info_free must be called with 0 as the last * parameter to ensure all sysfs sta entries are * unregistered. We don't need locking at this --- wireless-dev.orig/net/d80211/wme.c 2006-11-19 20:13:52.399275208 +0100 +++ wireless-dev/net/d80211/wme.c 2006-11-20 19:13:03.229598504 +0100 @@ -211,8 +211,7 @@ static inline int classify80211(struct s skb->priority = classify_1d(skb, qd); /* incase we are a client verify acm is not set for this ac */ - for (; unlikely(local->wmm_acm & BIT(skb->priority)); ) - { + while (unlikely(local->wmm_acm & BIT(skb->priority))) { if (wme_downgrade_ac(skb)) { /* No AC with lower priority has acm=0, * drop packet. */ ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 2/13] d80211: reduce mdev usage 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg 2006-11-19 19:22 ` [PATCH 1/13] d80211: clean up some stupid list and loop code Johannes Berg @ 2006-11-19 19:23 ` Johannes Berg 2006-11-19 19:23 ` [PATCH 3/13] " Johannes Berg ` (11 subsequent siblings) 13 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:23 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn This patch reduces mdev usage by replacing struct net_device * arguments that are never used except for dereferencing to get struct ieee80211_local from ieee80211_ptr by struct ieee80211_local directly. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 20:13:51.869275208 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 20:13:55.359275208 +0100 @@ -130,9 +130,8 @@ static int rate_list_match(int *rate_lis } -void ieee80211_prepare_rates(struct net_device *dev) +void ieee80211_prepare_rates(struct ieee80211_local *local) { - struct ieee80211_local *local = dev->ieee80211_ptr; int i; for (i = 0; i < local->num_curr_rates; i++) { @@ -1905,9 +1904,8 @@ int ieee80211_if_config_beacon(struct ne return __ieee80211_if_config(dev, skb); } -int ieee80211_hw_config(struct net_device *dev) +int ieee80211_hw_config(struct ieee80211_local *local) { - struct ieee80211_local *local = dev->ieee80211_ptr; int i, ret = 0; #ifdef CONFIG_D80211_VERBOSE_DEBUG @@ -1917,7 +1915,7 @@ int ieee80211_hw_config(struct net_devic #endif /* CONFIG_D80211_VERBOSE_DEBUG */ if (local->hw->config) - ret = local->hw->config(dev, &local->conf); + ret = local->hw->config(local->mdev, &local->conf); for (i = 0; i < local->hw->num_modes; i++) { struct ieee80211_hw_modes *mode = &local->hw->modes[i]; @@ -1927,7 +1925,7 @@ int ieee80211_hw_config(struct net_devic } local->curr_rates = mode->rates; local->num_curr_rates = mode->num_rates; - ieee80211_prepare_rates(dev); + ieee80211_prepare_rates(local); break; } } @@ -4251,16 +4249,6 @@ int ieee80211_if_update_wds(struct net_d return 0; } - -static void ieee80211_if_init(struct net_device *dev) -{ - struct ieee80211_local *local = dev->ieee80211_ptr; - - spin_lock_init(&local->sub_if_lock); - INIT_LIST_HEAD(&local->sub_if_list); -} - - /* Must not be called for mdev and apdev */ void ieee80211_if_setup(struct net_device *dev) { @@ -4424,6 +4412,9 @@ struct net_device *ieee80211_alloc_hw(si init_timer(&local->scan.timer); /* clear it out */ + spin_lock_init(&local->sub_if_lock); + INIT_LIST_HEAD(&local->sub_if_list); + spin_lock_init(&local->generic_lock); init_timer(&local->stat_timer); local->stat_timer.function = ieee80211_stat_refresh; @@ -4432,8 +4423,6 @@ struct net_device *ieee80211_alloc_hw(si sta_info_init(local); - ieee80211_if_init(mdev); - mdev->hard_start_xmit = ieee80211_master_start_xmit; mdev->wireless_handlers = (struct iw_handler_def *) &ieee80211_iw_master_handler_def; @@ -4600,7 +4589,7 @@ int ieee80211_update_hw(struct net_devic local->conf.phymode = hw->modes[0].mode; local->curr_rates = hw->modes[0].rates; local->num_curr_rates = hw->modes[0].num_rates; - ieee80211_prepare_rates(dev); + ieee80211_prepare_rates(local); local->conf.freq = local->hw->modes[0].channels[0].freq; local->conf.channel = local->hw->modes[0].channels[0].chan; @@ -4625,7 +4614,7 @@ void ieee80211_unregister_hw(struct net_ rtnl_lock(); local->reg_state = IEEE80211_DEV_UNREGISTERED; if (local->apdev) - ieee80211_if_del_mgmt(local->apdev); + ieee80211_if_del_mgmt(local); sysfs_remove_link(&local->class_dev.kobj, "master"); --- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-11-19 20:13:51.889275208 +0100 +++ wireless-dev/net/d80211/ieee80211_i.h 2006-11-19 20:13:55.359275208 +0100 @@ -562,7 +562,7 @@ static inline void bss_tim_clear(struct /* ieee80211.c */ void ieee80211_release_hw(struct ieee80211_local *local); -int ieee80211_hw_config(struct net_device *dev); +int ieee80211_hw_config(struct ieee80211_local *local); int ieee80211_if_config(struct net_device *dev); int ieee80211_if_config_beacon(struct net_device *dev); struct ieee80211_key_conf * @@ -574,7 +574,7 @@ void ieee80211_key_free(struct ieee80211 void ieee80211_key_release(struct kobject *kobj); void ieee80211_rx_mgmt(struct net_device *dev, struct sk_buff *skb, struct ieee80211_rx_status *status, u32 msg_type); -void ieee80211_prepare_rates(struct net_device *dev); +void ieee80211_prepare_rates(struct ieee80211_local *local); void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx); int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr); void ieee80211_if_setup(struct net_device *dev); @@ -662,8 +662,8 @@ int ieee80211_if_remove(struct net_devic void ieee80211_if_free(struct net_device *dev); void ieee80211_if_flush(struct net_device *dev); void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata); -int ieee80211_if_add_mgmt(struct net_device *dev); -void ieee80211_if_del_mgmt(struct net_device *dev); +int ieee80211_if_add_mgmt(struct ieee80211_local *local); +void ieee80211_if_del_mgmt(struct ieee80211_local *local); /* ieee80211_sysfs.c */ int ieee80211_sysfs_add_netdevice(struct net_device *dev); --- wireless-dev.orig/net/d80211/ieee80211_iface.c 2006-11-19 20:13:51.929275208 +0100 +++ wireless-dev/net/d80211/ieee80211_iface.c 2006-11-19 20:13:55.359275208 +0100 @@ -107,14 +107,12 @@ fail: return ret; } -int ieee80211_if_add_mgmt(struct net_device *dev) +int ieee80211_if_add_mgmt(struct ieee80211_local *local) { struct net_device *ndev; - struct ieee80211_local *local = dev->ieee80211_ptr; - struct ieee80211_sub_if_data *sdata, *nsdata; + struct ieee80211_sub_if_data *nsdata; int ret; - sdata = IEEE80211_DEV_TO_SUB_IF(dev); ASSERT_RTNL(); ndev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), "", @@ -126,12 +124,8 @@ int ieee80211_if_add_mgmt(struct net_dev goto fail; ndev->ieee80211_ptr = local; - memcpy(ndev->dev_addr, dev->dev_addr, ETH_ALEN); - ndev->base_addr = dev->base_addr; - ndev->irq = dev->irq; - ndev->mem_start = dev->mem_start; - ndev->mem_end = dev->mem_end; - SET_NETDEV_DEV(ndev, dev->class_dev.dev); + memcpy(ndev->dev_addr, local->mdev->dev_addr, ETH_ALEN); + SET_NETDEV_DEV(ndev, local->mdev->class_dev.dev); nsdata = IEEE80211_DEV_TO_SUB_IF(ndev); nsdata->type = IEEE80211_IF_TYPE_MGMT; @@ -158,9 +152,8 @@ fail: return ret; } -void ieee80211_if_del_mgmt(struct net_device *dev) +void ieee80211_if_del_mgmt(struct ieee80211_local *local) { - struct ieee80211_local *local = dev->ieee80211_ptr; struct net_device *apdev; ASSERT_RTNL(); @@ -377,7 +370,7 @@ void ieee80211_if_del(struct net_device rtnl_lock(); if (sdata->type == IEEE80211_IF_TYPE_MGMT) - ieee80211_if_del_mgmt(local->mdev); + ieee80211_if_del_mgmt(local); else __ieee80211_if_del(local, sdata); rtnl_unlock(); --- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-11-19 20:13:51.979275208 +0100 +++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-11-19 20:13:55.369275208 +0100 @@ -411,7 +411,7 @@ static int ieee80211_ioctl_get_info_sta( struct net_device_stats *stats; sdata = IEEE80211_DEV_TO_SUB_IF(dev); - stats = ieee80211_dev_stats(sdata->master); + stats = ieee80211_dev_stats(local->mdev); param->u.get_info_sta.rx_bytes = stats->rx_bytes; param->u.get_info_sta.tx_bytes = stats->tx_bytes; /* go through all STAs and get STA with lowest max. rate */ @@ -992,7 +992,7 @@ static int ieee80211_ioctl_set_rate_sets /* TODO: should update STA TX rates and remove STAs if they * do not have any remaining supported rates after the change */ - ieee80211_prepare_rates(dev); + ieee80211_prepare_rates(local); } return 0; @@ -1298,7 +1298,7 @@ static int ieee80211_ioctl_set_radio_ena { struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev); conf->radio_enabled = val; - return ieee80211_hw_config(dev); + return ieee80211_hw_config(dev->ieee80211_ptr); } static int @@ -1841,7 +1841,7 @@ int ieee80211_ioctl_siwfreq(struct net_d if (set) { local->sta_scanning = 0; /* Abort possible scan */ - return ieee80211_hw_config(dev); + return ieee80211_hw_config(local); } return -EINVAL; @@ -2378,7 +2378,7 @@ static int ieee80211_ioctl_prism2_param( case PRISM2_PARAM_BEACON_INT: local->conf.beacon_int = value; - if (ieee80211_hw_config(dev)) + if (ieee80211_hw_config(local)) ret = -EINVAL; break; @@ -2437,7 +2437,7 @@ static int ieee80211_ioctl_prism2_param( local->conf.flags |= IEEE80211_CONF_SHORT_SLOT_TIME; else local->conf.flags &= ~IEEE80211_CONF_SHORT_SLOT_TIME; - if (ieee80211_hw_config(dev)) + if (ieee80211_hw_config(local)) ret = -EINVAL; break; @@ -2464,19 +2464,19 @@ static int ieee80211_ioctl_prism2_param( case PRISM2_PARAM_ANTENNA_SEL: local->conf.antenna_sel = value; - if (ieee80211_hw_config(dev)) + if (ieee80211_hw_config(local)) ret = -EINVAL; break; case PRISM2_PARAM_CALIB_INT: local->conf.calib_int = value; - if (ieee80211_hw_config(dev)) + if (ieee80211_hw_config(local)) ret = -EINVAL; break; case PRISM2_PARAM_ANTENNA_MODE: local->conf.antenna_mode = value; - if (ieee80211_hw_config(dev)) + if (ieee80211_hw_config(local)) ret = -EINVAL; break; @@ -2590,10 +2590,10 @@ static int ieee80211_ioctl_prism2_param( case PRISM2_PARAM_MGMT_IF: if (value == 1) { if (!local->apdev) - ret = ieee80211_if_add_mgmt(local->mdev); + ret = ieee80211_if_add_mgmt(local); } else if (value == 0) { if (local->apdev) - ieee80211_if_del_mgmt(local->mdev); + ieee80211_if_del_mgmt(local); } else ret = -EINVAL; break; --- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-11-19 20:13:54.109275208 +0100 +++ wireless-dev/net/d80211/ieee80211_sta.c 2006-11-19 20:13:55.369275208 +0100 @@ -2372,7 +2372,7 @@ static int ieee80211_sta_restore_oper_ch local->conf.freq = local->scan_oper_freq; local->conf.phymode = local->scan_oper_phymode; local->conf.antenna_max = local->scan_oper_antenna_max; - return ieee80211_hw_config(dev); + return ieee80211_hw_config(local); } @@ -2471,7 +2471,7 @@ static void ieee80211_sta_scan_work(void local->conf.freq = chan->freq; local->conf.phymode = mode->mode; local->conf.antenna_max = chan->antenna_max; - if (ieee80211_hw_config(dev)) { + if (ieee80211_hw_config(local)) { printk(KERN_DEBUG "%s: failed to set channel " "%d (%d MHz) for scan\n", dev->name, chan->chan, chan->freq); ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 3/13] d80211: reduce mdev usage 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg 2006-11-19 19:22 ` [PATCH 1/13] d80211: clean up some stupid list and loop code Johannes Berg 2006-11-19 19:23 ` [PATCH 2/13] d80211: reduce mdev usage Johannes Berg @ 2006-11-19 19:23 ` Johannes Berg 2006-11-19 19:26 ` [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt Johannes Berg ` (10 subsequent siblings) 13 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:23 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn This patch reduces mdev usage by replacing struct net_device * arguments that are never used except for dereferencing to get struct ieee80211_local from ieee80211_ptr by struct ieee80211_local directly. Also removes ->master from sub_if_data. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-11-19 20:13:55.359275208 +0100 +++ wireless-dev/net/d80211/ieee80211_i.h 2006-11-19 20:13:56.069275208 +0100 @@ -289,7 +289,6 @@ struct ieee80211_sub_if_data { unsigned int type; struct net_device *dev; - struct net_device *master; struct ieee80211_local *local; int mc_count; --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 20:13:55.359275208 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 20:13:56.079275208 +0100 @@ -1569,7 +1569,7 @@ static int ieee80211_subif_start_xmit(st pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT); pkt_data->do_not_encrypt = no_encrypt; - skb->dev = sdata->master; + skb->dev = local->mdev; sdata->stats.tx_packets++; sdata->stats.tx_bytes += skb->len; @@ -1625,7 +1625,7 @@ ieee80211_mgmt_start_xmit(struct sk_buff pkt_data->pkt_probe_resp = 1; skb->priority = 20; /* use hardcoded priority for mgmt TX queue */ - skb->dev = sdata->master; + skb->dev = sdata->local->mdev; /* * We're using the protocol field of the the frame control header @@ -2031,12 +2031,12 @@ static void ieee80211_set_multicast_list sdata->mc_count = dev->mc_count; } if (local->hw->set_multicast_list) { - flags = sdata->master->flags; + flags = local->mdev->flags; if (local->iff_allmultis) flags |= IFF_ALLMULTI; if (local->iff_promiscs) flags |= IFF_PROMISC; - local->hw->set_multicast_list(sdata->master, flags, + local->hw->set_multicast_list(local->mdev, flags, local->mc_count); } } @@ -2229,7 +2229,7 @@ static int ieee80211_open(struct net_dev conf.if_id = dev->ifindex; conf.type = sdata->type; conf.mac_addr = dev->dev_addr; - res = local->hw->add_interface(sdata->master, &conf); + res = local->hw->add_interface(local->mdev, &conf); if (res) { if (sdata->type == IEEE80211_IF_TYPE_MNTR) ieee80211_start_hard_monitor(local); @@ -2245,12 +2245,12 @@ static int ieee80211_open(struct net_dev if (local->open_count == 0) { res = 0; if (local->hw->open) - res = local->hw->open(sdata->master); + res = local->hw->open(local->mdev); if (res == 0) { - res = dev_open(sdata->master); + res = dev_open(local->mdev); if (res) { if (local->hw->stop) - local->hw->stop(sdata->master); + local->hw->stop(local->mdev); } else if (local->apdev) dev_open(local->apdev); } @@ -2259,7 +2259,7 @@ static int ieee80211_open(struct net_dev local->hw->remove_interface(dev, &conf); return res; } - ieee80211_init_scan(sdata->master); + ieee80211_init_scan(local->mdev); } local->open_count++; @@ -2296,12 +2296,12 @@ static int ieee80211_stop(struct net_dev local->open_count--; if (local->open_count == 0) { - ieee80211_stop_scan(sdata->master); - dev_close(sdata->master); + ieee80211_stop_scan(local->mdev); + dev_close(local->mdev); if (local->apdev) dev_close(local->apdev); if (local->hw->stop) - local->hw->stop(sdata->master); + local->hw->stop(local->mdev); } if (local->hw->remove_interface) { struct ieee80211_if_init_conf conf; @@ -2309,7 +2309,7 @@ static int ieee80211_stop(struct net_dev conf.if_id = dev->ifindex; conf.type = sdata->type; conf.mac_addr = dev->dev_addr; - local->hw->remove_interface(sdata->master, &conf); + local->hw->remove_interface(local->mdev, &conf); } ieee80211_if_shutdown(dev); @@ -3660,7 +3660,7 @@ void __ieee80211_rx(struct net_device *d continue; rx.u.rx.ra_match = 0; } - if (sdata->dev == sdata->master && + if (sdata->dev == local->mdev && !rx.u.rx.in_scan) /* do not receive anything via * master device when not scanning */ @@ -4438,7 +4438,6 @@ struct net_device *ieee80211_alloc_hw(si sdata = IEEE80211_DEV_TO_SUB_IF(mdev); sdata->type = IEEE80211_IF_TYPE_AP; sdata->dev = mdev; - sdata->master = mdev; sdata->local = local; sdata->u.ap.force_unicast_rateidx = -1; sdata->u.ap.max_ratectrl_rateidx = -1; @@ -4676,8 +4675,7 @@ void ieee80211_release_hw(struct ieee802 int ieee80211_netif_oper(struct net_device *sdev, Netif_Oper op) { struct ieee80211_local *local = sdev->ieee80211_ptr; - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sdev); - struct net_device *dev = sdata->master; + struct net_device *dev = local->mdev; switch (op) { case NETIF_ATTACH: --- wireless-dev.orig/net/d80211/ieee80211_iface.c 2006-11-19 20:13:55.359275208 +0100 +++ wireless-dev/net/d80211/ieee80211_iface.c 2006-11-19 20:13:56.079275208 +0100 @@ -80,7 +80,6 @@ int ieee80211_if_add(struct net_device * sdata = IEEE80211_DEV_TO_SUB_IF(ndev); sdata->type = IEEE80211_IF_TYPE_AP; - sdata->master = local->mdev; sdata->dev = ndev; sdata->local = local; sdata_parent = IEEE80211_DEV_TO_SUB_IF(dev); @@ -129,7 +128,6 @@ int ieee80211_if_add_mgmt(struct ieee802 nsdata = IEEE80211_DEV_TO_SUB_IF(ndev); nsdata->type = IEEE80211_IF_TYPE_MGMT; - nsdata->master = local->mdev; nsdata->dev = ndev; nsdata->local = local; ieee80211_if_sdata_init(nsdata); @@ -195,7 +193,7 @@ void ieee80211_if_set_type(struct net_de ifsta->create_ibss = 1; ifsta->wmm_enabled = 1; - msdata = IEEE80211_DEV_TO_SUB_IF(sdata->master); + msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev); sdata->bss = &msdata->u.ap; break; } @@ -326,9 +324,6 @@ int ieee80211_if_remove(struct net_devic ASSERT_RTNL(); - /* Make sure not to touch sdata->master since it may - * have already been deleted, etc. */ - list_for_each_entry_safe(sdata, n, &local->sub_if_list, list) { if ((sdata->type == id || id == -1) && strcmp(name, sdata->dev->name) == 0 && --- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-11-19 20:13:55.369275208 +0100 +++ wireless-dev/net/d80211/ieee80211_sta.c 2006-11-19 20:13:56.079275208 +0100 @@ -390,7 +390,7 @@ static void ieee80211_sta_tx(struct net_ struct ieee80211_tx_packet_data *pkt_data; sdata = IEEE80211_DEV_TO_SUB_IF(dev); - skb->dev = sdata->master; + skb->dev = sdata->local->mdev; skb->mac.raw = skb->nh.raw = skb->h.raw = skb->data; pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (2 preceding siblings ...) 2006-11-19 19:23 ` [PATCH 3/13] " Johannes Berg @ 2006-11-19 19:26 ` Johannes Berg 2006-11-20 12:08 ` Jiri Benc 2006-11-19 19:27 ` [PATCH 5/13] d80211: reduce master ieee80211_ptr deref in scan routines Johannes Berg ` (9 subsequent siblings) 13 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:26 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn This patch reduces mdev usage by replacing struct net_device * arguments that are never used except for dereferencing to get struct ieee80211_local from ieee80211_ptr by struct ieee80211_local directly. Also, this patch changes ieee80211_rx_mgmt to no longer be callable when local->apdev is NULL. All callers are updated accordingly, in most cases actually increasing performance by not allocating skbs when they won't be given to anyone anyway. Instead of abusing ieee80211_rx_mgmt also introduce ieee80211_rx_monitor. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 20:13:56.079275208 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 20:13:56.719275208 +0100 @@ -210,9 +210,16 @@ static void ieee80211_key_threshold_noti struct ieee80211_key *key, struct sta_info *sta) { + struct ieee80211_local *local = dev->ieee80211_ptr; struct sk_buff *skb; struct ieee80211_msg_key_notification *msg; + /* if no one will get it anyway, don't even allocate it. + * unlikely because this is only relevant for APs + * where the device must be open... */ + if (unlikely(!local->apdev)) + return; + skb = dev_alloc_skb(sizeof(struct ieee80211_frame_info) + sizeof(struct ieee80211_msg_key_notification)); if (!skb) @@ -230,7 +237,7 @@ static void ieee80211_key_threshold_noti key->tx_rx_count = 0; - ieee80211_rx_mgmt(dev, skb, NULL, + ieee80211_rx_mgmt(local, skb, NULL, ieee80211_msg_key_threshold_notification); } @@ -2526,45 +2533,11 @@ ieee80211_get_rate(struct ieee80211_loca return NULL; } - void -ieee80211_rx_mgmt(struct net_device *dev, struct sk_buff *skb, - struct ieee80211_rx_status *status, u32 msg_type) +ieee80211_fill_frame_info(struct ieee80211_local *local, + struct ieee80211_frame_info *fi, + struct ieee80211_rx_status *status) { - struct ieee80211_local *local = dev->ieee80211_ptr; - struct ieee80211_frame_info *fi; - size_t hlen; - struct ieee80211_sub_if_data *sdata; - - if (msg_type != ieee80211_msg_monitor) - dev = local->apdev; - if (!dev) { - dev_kfree_skb(skb); - return; - } - skb->dev = dev; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if (skb_headroom(skb) < sizeof(struct ieee80211_frame_info)) { - I802_DEBUG_INC(local->rx_expand_skb_head); - if (pskb_expand_head(skb, sizeof(struct ieee80211_frame_info), - 0, GFP_ATOMIC)) { - dev_kfree_skb(skb); - return; - } - } - - hlen = sizeof(struct ieee80211_frame_info); - if (msg_type == ieee80211_msg_monitor) - hlen -= sizeof(fi->msg_type); - - fi = (struct ieee80211_frame_info *) skb_push(skb, hlen); - memset(fi, 0, hlen); - if (msg_type != ieee80211_msg_monitor) - fi->msg_type = htonl(msg_type); - fi->version = htonl(IEEE80211_FI_VERSION); - fi->length = htonl(hlen); if (status) { struct timespec ts; struct ieee80211_rate *rate; @@ -2615,27 +2588,104 @@ ieee80211_rx_mgmt(struct net_device *dev fi->ssi_noise = 0x00000000; fi->encoding = 0; } else { + /* clear everything because we really don't know. + * the msg_type field isn't present on monitor frames + * so we don't know whether it will be present or not, + * but it's ok to not clear it since it'll be assigned + * anyway */ + memset(fi, 0, sizeof(*fi) - sizeof(fi->msg_type)); + fi->ssi_type = htonl(ieee80211_ssi_none); } + fi->version = htonl(IEEE80211_FI_VERSION); + fi->length = cpu_to_be32(sizeof(*fi) - sizeof(fi->msg_type)); +} + +/* this routine is actually not just for this, but also + * for pushing fake 'management' frames into userspace. + * it shall be replaced by a netlink-based system. */ +void +ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb, + struct ieee80211_rx_status *status, u32 msg_type) +{ + struct ieee80211_frame_info *fi; + const size_t hlen = sizeof(struct ieee80211_frame_info); + struct ieee80211_sub_if_data *sdata; + + skb->dev = local->apdev; + + sdata = IEEE80211_DEV_TO_SUB_IF(local->apdev); + + if (skb_headroom(skb) < hlen) { + I802_DEBUG_INC(local->rx_expand_skb_head); + if (pskb_expand_head(skb, hlen, 0, GFP_ATOMIC)) { + dev_kfree_skb(skb); + return; + } + } + + fi = (struct ieee80211_frame_info *) skb_push(skb, hlen); - sdata->stats.rx_packets++; - sdata->stats.rx_bytes += skb->len; + ieee80211_fill_frame_info(local, fi, status); + fi->msg_type = htonl(msg_type); - skb->mac.raw = skb->data; + sdata->stats.rx_packets++; + sdata->stats.rx_bytes += skb->len; + + skb->mac.raw = skb->data; skb->ip_summed = CHECKSUM_UNNECESSARY; skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = __constant_htons(ETH_P_802_2); + skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); + netif_rx(skb); } +void +ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, + struct ieee80211_rx_status *status) +{ + struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_frame_info *fi; + struct ieee80211_sub_if_data *sdata; + const size_t hlen = sizeof(struct ieee80211_frame_info) + - sizeof(fi->msg_type); + + skb->dev = dev; + + sdata = IEEE80211_DEV_TO_SUB_IF(dev); + + if (skb_headroom(skb) < hlen) { + I802_DEBUG_INC(local->rx_expand_skb_head); + if (pskb_expand_head(skb, hlen, 0, GFP_ATOMIC)) { + dev_kfree_skb(skb); + return; + } + } + + fi = (struct ieee80211_frame_info *) skb_push(skb, hlen); + + ieee80211_fill_frame_info(local, fi, status); + sdata->stats.rx_packets++; + sdata->stats.rx_bytes += skb->len; + + skb->mac.raw = skb->data; + skb->ip_summed = CHECKSUM_UNNECESSARY; + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = htons(ETH_P_802_2); + memset(skb->cb, 0, sizeof(skb->cb)); + netif_rx(skb); +} int ieee80211_radar_status(struct net_device *dev, int channel, int radar, int radar_type) { + struct ieee80211_local *local = dev->ieee80211_ptr; struct sk_buff *skb; struct ieee80211_radar_info *msg; + if (!local->apdev) + return 0; + skb = dev_alloc_skb(sizeof(struct ieee80211_frame_info) + sizeof(struct ieee80211_radar_info)); @@ -2649,7 +2699,7 @@ int ieee80211_radar_status(struct net_de msg->radar = radar; msg->radar_type = radar_type; - ieee80211_rx_mgmt(dev, skb, NULL, ieee80211_msg_radar); + ieee80211_rx_mgmt(local, skb, NULL, ieee80211_msg_radar); return 0; } EXPORT_SYMBOL(ieee80211_radar_status); @@ -2657,9 +2707,15 @@ EXPORT_SYMBOL(ieee80211_radar_status); int ieee80211_set_aid_for_sta(struct net_device *dev, u8 *peer_address, u16 aid) { + struct ieee80211_local *local = dev->ieee80211_ptr; struct sk_buff *skb; struct ieee80211_msg_set_aid_for_sta *msg; + /* unlikely because if this event only happens for APs, + * which require an open ap device. */ + if (unlikely(!local->apdev)) + return 0; + skb = dev_alloc_skb(sizeof(struct ieee80211_frame_info) + sizeof(struct ieee80211_msg_set_aid_for_sta)); @@ -2672,7 +2728,7 @@ int ieee80211_set_aid_for_sta(struct net memcpy(msg->sta_address, peer_address, ETH_ALEN); msg->aid = aid; - ieee80211_rx_mgmt(dev, skb, NULL, ieee80211_msg_set_aid_for_sta); + ieee80211_rx_mgmt(local, skb, NULL, ieee80211_msg_set_aid_for_sta); return 0; } EXPORT_SYMBOL(ieee80211_set_aid_for_sta); @@ -3007,8 +3063,7 @@ static ieee80211_txrx_result ieee80211_rx_h_monitor(struct ieee80211_txrx_data *rx) { if (rx->sdata->type == IEEE80211_IF_TYPE_MNTR) { - ieee80211_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status, - ieee80211_msg_monitor); + ieee80211_rx_monitor(rx->dev, rx->skb, rx->u.rx.status); return TXRX_QUEUED; } @@ -3080,7 +3135,10 @@ ieee80211_rx_h_check(struct ieee80211_tx return TXRX_DROP; } - ieee80211_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status, + if (!rx->local->apdev) + return TXRX_DROP; + + ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status, ieee80211_msg_sta_not_assoc); return TXRX_QUEUED; } @@ -3116,8 +3174,10 @@ ieee80211_rx_h_check(struct ieee80211_tx MAC_ARG(hdr->addr1), MAC_ARG(hdr->addr2), MAC_ARG(hdr->addr3)); + if (!rx->local->apdev) + return TXRX_DROP; ieee80211_rx_mgmt( - rx->dev, rx->skb, rx->u.rx.status, + rx->local, rx->skb, rx->u.rx.status, ieee80211_msg_wep_frame_unknown_key); return TXRX_QUEUED; } @@ -3267,7 +3327,9 @@ ieee80211_rx_h_802_1x_pae(struct ieee802 rx->sdata->type != IEEE80211_IF_TYPE_STA && rx->u.rx.ra_match) { /* Pass both encrypted and unencrypted EAPOL frames to user * space for processing. */ - ieee80211_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status, + if (!rx->local->apdev) + return TXRX_DROP; + ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status, ieee80211_msg_normal); return TXRX_QUEUED; } @@ -3328,7 +3390,9 @@ ieee80211_rx_h_mgmt(struct ieee80211_txr ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status); } else { /* Management frames are sent to hostapd for processing */ - ieee80211_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status, + if (!rx->local->apdev) + return TXRX_DROP; + ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status, ieee80211_msg_normal); } return TXRX_QUEUED; @@ -3368,7 +3432,10 @@ ieee80211_rx_h_passive_scan(struct ieee8 rx->skb->len > FCS_LEN) skb_trim(rx->skb, rx->skb->len - FCS_LEN); - ieee80211_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status, + if (!rx->local->apdev) + return TXRX_DROP; + ieee80211_rx_mgmt(rx->local, rx->skb, + rx->u.rx.status, ieee80211_msg_passive_scan); return TXRX_QUEUED; } else { @@ -3502,7 +3569,9 @@ static void ieee80211_rx_michael_mic_rep /* TODO: consider verifying the MIC error report with software * implementation if we get too many spurious reports from the * hardware. */ - ieee80211_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status, + if (!rx->local->apdev) + goto ignore; + ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status, ieee80211_msg_michael_mic_failure); return; @@ -4148,7 +4217,8 @@ void ieee80211_tx_status(struct net_devi local->dot11FailedCount++; } - if (!(status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS)) { + if (!(status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS) + || unlikely(!local->apdev)) { dev_kfree_skb(skb); return; } @@ -4167,7 +4237,7 @@ void ieee80211_tx_status(struct net_devi skb = skb2; /* Send frame to hostapd */ - ieee80211_rx_mgmt(dev, skb, NULL, msg_type); + ieee80211_rx_mgmt(local, skb, NULL, msg_type); } EXPORT_SYMBOL(ieee80211_tx_status); --- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-11-19 20:13:56.069275208 +0100 +++ wireless-dev/net/d80211/ieee80211_i.h 2006-11-19 20:13:56.719275208 +0100 @@ -571,7 +571,7 @@ struct ieee80211_key *ieee80211_key_allo int idx, size_t key_len, gfp_t flags); void ieee80211_key_free(struct ieee80211_key *key); void ieee80211_key_release(struct kobject *kobj); -void ieee80211_rx_mgmt(struct net_device *dev, struct sk_buff *skb, +void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb, struct ieee80211_rx_status *status, u32 msg_type); void ieee80211_prepare_rates(struct ieee80211_local *local); void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx); --- wireless-dev.orig/net/d80211/wpa.c 2006-11-19 20:13:51.199275208 +0100 +++ wireless-dev/net/d80211/wpa.c 2006-11-19 20:13:56.719275208 +0100 @@ -267,7 +267,10 @@ ieee80211_rx_h_michael_mic_verify(struct kfree(buf); } while (0); - ieee80211_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status, + if (!rx->local->apdev) + return TXRX_DROP; + + ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status, ieee80211_msg_michael_mic_failure); return TXRX_QUEUED; --- wireless-dev.orig/include/net/d80211_common.h 2006-11-19 20:13:51.249275208 +0100 +++ wireless-dev/include/net/d80211_common.h 2006-11-19 20:13:56.719275208 +0100 @@ -50,7 +50,7 @@ enum ieee80211_msg_type { ieee80211_msg_passive_scan = 3, ieee80211_msg_wep_frame_unknown_key = 4, ieee80211_msg_michael_mic_failure = 5, - ieee80211_msg_monitor = 6, + /* hole at 6, was monitor but never sent to userspace */ ieee80211_msg_sta_not_assoc = 7, ieee80211_msg_set_aid_for_sta = 8 /* used by Intersil MVC driver */, ieee80211_msg_key_threshold_notification = 9, ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt 2006-11-19 19:26 ` [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt Johannes Berg @ 2006-11-20 12:08 ` Jiri Benc 2006-11-20 12:25 ` Johannes Berg 0 siblings, 1 reply; 57+ messages in thread From: Jiri Benc @ 2006-11-20 12:08 UTC (permalink / raw) To: Johannes Berg Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Sun, 19 Nov 2006 20:26:41 +0100, Johannes Berg wrote: > @@ -2615,27 +2588,104 @@ ieee80211_rx_mgmt(struct net_device *dev > fi->ssi_noise = 0x00000000; > fi->encoding = 0; > } else { > + /* clear everything because we really don't know. > + * the msg_type field isn't present on monitor frames > + * so we don't know whether it will be present or not, > + * but it's ok to not clear it since it'll be assigned > + * anyway */ > + memset(fi, 0, sizeof(*fi) - sizeof(fi->msg_type)); offsetof(ieee80211_frame_info, msg_type)? But it doesn't matter, this is going to go away (hopefully soon) anyway. Thanks, Jiri -- Jiri Benc SUSE Labs ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt 2006-11-20 12:08 ` Jiri Benc @ 2006-11-20 12:25 ` Johannes Berg 0 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-20 12:25 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Mon, 2006-11-20 at 13:08 +0100, Jiri Benc wrote: > offsetof(ieee80211_frame_info, msg_type)? Hm, I guess I could do that. I could just zero out the whole struct too I think. > But it doesn't matter, this > is going to go away (hopefully soon) anyway. Right. If you don't mind I'll leave it as-is assuming that msg_type is the last field; I'll hopefully be able to subsume this into cfg80211 soonish. johannes ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 5/13] d80211: reduce master ieee80211_ptr deref in scan routines 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (3 preceding siblings ...) 2006-11-19 19:26 ` [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt Johannes Berg @ 2006-11-19 19:27 ` Johannes Berg 2006-11-19 19:28 ` [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw Johannes Berg ` (8 subsequent siblings) 13 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:27 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn This patch changes a bunch of prototypes to have struct ieee80211_local* instead of struct net_device* where that makes sense. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 20:13:56.719275208 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 20:13:57.379275208 +0100 @@ -2266,7 +2266,7 @@ static int ieee80211_open(struct net_dev local->hw->remove_interface(dev, &conf); return res; } - ieee80211_init_scan(local->mdev); + ieee80211_init_scan(local); } local->open_count++; @@ -2303,7 +2303,7 @@ static int ieee80211_stop(struct net_dev local->open_count--; if (local->open_count == 0) { - ieee80211_stop_scan(local->mdev); + ieee80211_stop_scan(local); dev_close(local->mdev); if (local->apdev) dev_close(local->apdev); --- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-11-19 20:13:56.719275208 +0100 +++ wireless-dev/net/d80211/ieee80211_i.h 2006-11-19 20:13:57.379275208 +0100 @@ -593,8 +593,8 @@ int ieee80211_set_hw_encryption(struct n struct ieee80211_key *key); /* ieee80211_scan.c */ -void ieee80211_init_scan(struct net_device *dev); -void ieee80211_stop_scan(struct net_device *dev); +void ieee80211_init_scan(struct ieee80211_local *local); +void ieee80211_stop_scan(struct ieee80211_local *local); --- wireless-dev.orig/net/d80211/ieee80211_scan.c 2006-11-19 20:13:50.889275208 +0100 +++ wireless-dev/net/d80211/ieee80211_scan.c 2006-11-19 20:13:57.379275208 +0100 @@ -105,10 +105,9 @@ static void next_chan_all_modes(struct i } -static void ieee80211_scan_start(struct net_device *dev, +static void ieee80211_scan_start(struct ieee80211_local *local, struct ieee80211_scan_conf *conf) { - struct ieee80211_local *local = dev->ieee80211_ptr; int old_mode_idx = local->scan.mode_idx; int old_chan_idx = local->scan.chan_idx; struct ieee80211_hw_modes *mode = NULL; @@ -118,7 +117,7 @@ static void ieee80211_scan_start(struct if (!local->hw->passive_scan) { printk(KERN_DEBUG "%s: Scan handler called, yet the hardware " "does not support passive scanning. Disabled.\n", - dev->name); + local->mdev->name); return; } @@ -136,7 +135,7 @@ static void ieee80211_scan_start(struct if (!local->scan.skb) { printk(KERN_DEBUG "%s: Scan start called even though scan.skb " - "is not set\n", dev->name); + "is not set\n", local->mdev->name); } if (local->scan.our_mode_only) { @@ -163,7 +162,7 @@ static void ieee80211_scan_start(struct #if 0 printk(KERN_DEBUG "%s: Doing scan on mode: %d freq: %d chan: %d " "for %d ms\n", - dev->name, conf->scan_phymode, conf->scan_freq, + local->mdev->name, conf->scan_phymode, conf->scan_freq, conf->scan_channel, conf->scan_time); #endif local->scan.rx_packets = 0; @@ -171,9 +170,9 @@ static void ieee80211_scan_start(struct local->scan.freq = chan->freq; local->scan.in_scan = 1; - ieee80211_netif_oper(dev, NETIF_STOP); + ieee80211_netif_oper(local->mdev, NETIF_STOP); - ret = local->hw->passive_scan(dev, IEEE80211_SCAN_START, conf); + ret = local->hw->passive_scan(local->mdev, IEEE80211_SCAN_START, conf); if (ret == 0) { long usec = local->hw->channel_change_time + @@ -185,7 +184,7 @@ static void ieee80211_scan_start(struct local->scan.in_scan = 0; if (conf->skb) dev_kfree_skb(conf->skb); - ieee80211_netif_oper(dev, NETIF_WAKE); + ieee80211_netif_oper(local->mdev, NETIF_WAKE); if (ret == -EAGAIN) { local->scan.timer.expires = jiffies + (local->scan.interval * HZ / 100); @@ -193,7 +192,7 @@ static void ieee80211_scan_start(struct local->scan.chan_idx = old_chan_idx; } else { printk(KERN_DEBUG "%s: Got unknown error from " - "passive_scan %d\n", dev->name, ret); + "passive_scan %d\n", local->mdev->name, ret); local->scan.timer.expires = jiffies + (local->scan.interval * HZ); } @@ -204,10 +203,9 @@ static void ieee80211_scan_start(struct } -static void ieee80211_scan_stop(struct net_device *dev, +static void ieee80211_scan_stop(struct ieee80211_local *local, struct ieee80211_scan_conf *conf) { - struct ieee80211_local *local = dev->ieee80211_ptr; struct ieee80211_hw_modes *mode; struct ieee80211_channel *chan; int wait; @@ -228,12 +226,12 @@ static void ieee80211_scan_stop(struct n chan = &mode->channels[local->scan.chan_idx]; - local->hw->passive_scan(dev, IEEE80211_SCAN_END, conf); + local->hw->passive_scan(local->mdev, IEEE80211_SCAN_END, conf); #ifdef CONFIG_D80211_VERBOSE_DEBUG printk(KERN_DEBUG "%s: Did scan on mode: %d freq: %d chan: %d " "GOT: %d Beacon: %d (%d)\n", - dev->name, + local->mdev->name, mode->mode, chan->freq, chan->chan, local->scan.rx_packets, local->scan.rx_beacon, local->scan.tries); @@ -241,7 +239,7 @@ static void ieee80211_scan_stop(struct n local->scan.num_scans++; local->scan.in_scan = 0; - ieee80211_netif_oper(dev, NETIF_WAKE); + ieee80211_netif_oper(local->mdev, NETIF_WAKE); local->scan.tries = 0; /* Use random interval of scan.interval .. 2 * scan.interval */ @@ -253,10 +251,9 @@ static void ieee80211_scan_stop(struct n } -static void ieee80211_scan_handler(unsigned long uldev) +static void ieee80211_scan_handler(unsigned long ullocal) { - struct net_device *dev = (struct net_device *) uldev; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = (struct ieee80211_local *) ullocal; struct ieee80211_scan_conf conf; if (local->scan.interval == 0 && !local->scan.in_scan) { @@ -276,15 +273,14 @@ static void ieee80211_scan_handler(unsig conf.running_antenna_max = local->conf.antenna_max; if (local->scan.in_scan == 0) - ieee80211_scan_start(dev, &conf); + ieee80211_scan_start(local, &conf); else - ieee80211_scan_stop(dev, &conf); + ieee80211_scan_stop(local, &conf); } -void ieee80211_init_scan(struct net_device *dev) +void ieee80211_init_scan(struct ieee80211_local *local) { - struct ieee80211_local *local = dev->ieee80211_ptr; struct ieee80211_hdr hdr; u16 fc; int len = 10; @@ -296,7 +292,7 @@ void ieee80211_init_scan(struct net_devi memset(&local->scan.tx_control, 0, sizeof(local->scan.tx_control)); printk(KERN_DEBUG "%s: Does not support passive scan, " - "disabled\n", dev->name); + "disabled\n", local->mdev->name); return; } @@ -304,7 +300,7 @@ void ieee80211_init_scan(struct net_devi local->scan.our_mode_only = 1; local->scan.time = 10000; local->scan.timer.function = ieee80211_scan_handler; - local->scan.timer.data = (unsigned long) dev; + local->scan.timer.data = (unsigned long) local; local->scan.timer.expires = jiffies + local->scan.interval * HZ; add_timer(&local->scan.timer); @@ -313,7 +309,7 @@ void ieee80211_init_scan(struct net_devi local->scan.skb = alloc_skb(len, GFP_KERNEL); if (!local->scan.skb) { printk(KERN_WARNING "%s: Failed to allocate CTS packet for " - "passive scan\n", dev->name); + "passive scan\n", local->mdev->name); return; } @@ -322,7 +318,7 @@ void ieee80211_init_scan(struct net_devi hdr.duration_id = cpu_to_le16(2 * local->hw->channel_change_time + local->scan.time); - memcpy(hdr.addr1, dev->dev_addr, ETH_ALEN); /* DA */ + memcpy(hdr.addr1, local->mdev->dev_addr, ETH_ALEN); /* DA */ hdr.seq_ctrl = 0; memcpy(skb_put(local->scan.skb, len), &hdr, len); @@ -333,15 +329,14 @@ void ieee80211_init_scan(struct net_devi memset(&extra, 0, sizeof(extra)); extra.endidx = local->num_curr_rates; local->scan.tx_control.tx_rate = - rate_control_get_rate(local, dev, local->scan.skb, &extra)->val; + rate_control_get_rate(local, local->mdev, + local->scan.skb, &extra)->val; local->scan.tx_control.flags |= IEEE80211_TXCTL_NO_ACK; } -void ieee80211_stop_scan(struct net_device *dev) +void ieee80211_stop_scan(struct ieee80211_local *local) { - struct ieee80211_local *local = dev->ieee80211_ptr; - if (local->hw->passive_scan) { del_timer_sync(&local->scan.timer); dev_kfree_skb(local->scan.skb); ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (4 preceding siblings ...) 2006-11-19 19:27 ` [PATCH 5/13] d80211: reduce master ieee80211_ptr deref in scan routines Johannes Berg @ 2006-11-19 19:28 ` Johannes Berg 2006-11-20 17:57 ` Jiri Benc 2006-11-20 22:45 ` Johannes Berg 2006-11-19 19:29 ` [PATCH 7/13] d80211: add a perm_addr hardware property Johannes Berg ` (7 subsequent siblings) 13 siblings, 2 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:28 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 1370 bytes --] Traditionally, drivers were given a struct net_device * in order to identify the wireless device. This was the master device, but I'm trying to cut down it's use. Now, there long was a comment that this might change. That time has come, this patch gives back a struct ieee80211_hw pointer. Currently, struct ieee80211_hw contains both static data (almost all of the function pointers except one) and data that could possibly be per-device even for a single driver. Hence patch also introduces struct ieee80211_ops and moves the function pointers from ieee80211_hw into it. This makes ieee80211_hw be the pure hardware description and allows drivers to make have their ieee80211_ops static, thereby reducing the struct size significantly. Note that the patch changes the meaning of ieee80211_hw, previously it was allocated by the driver and given to the stack as a hardware description, now it is allocated by ieee80211alloc_hw() and then the driver fills it before calling ieee80211_register_hw(). A later patch fixes the FIXME introduced here where hw fragmentation is checked by having a function assigned or not---if functions are supposed to be assigned now for all hw we need a new flag for that if some driver has boards that can and other boards that cannot support it. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Patch attached due to size. [-- Attachment #2: 006-d80211-driver-api.patch.bz2 --] [-- Type: application/x-bzip, Size: 24485 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw 2006-11-19 19:28 ` [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw Johannes Berg @ 2006-11-20 17:57 ` Jiri Benc 2006-11-20 18:04 ` Johannes Berg 2006-11-20 18:52 ` Johannes Berg 2006-11-20 22:45 ` Johannes Berg 1 sibling, 2 replies; 57+ messages in thread From: Jiri Benc @ 2006-11-20 17:57 UTC (permalink / raw) To: Johannes Berg Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Sun, 19 Nov 2006 20:28:42 +0100, Johannes Berg wrote: > Note that the patch changes the meaning of ieee80211_hw, previously it > was allocated by the driver and given to the stack as a hardware > description, now it is allocated by ieee80211alloc_hw() and then the > driver fills it before calling ieee80211_register_hw(). If you are at it, why not to rename ieee80211_hw to some better name? We need to rename ieee80211_local and I think ieee80211_hw would be very good name for it. What about renaming of ieee80211_hw to ieee80211_dev? > A later patch fixes the FIXME introduced here where hw fragmentation is > checked by having a function assigned or not---if functions are supposed to > be assigned now for all hw we need a new flag for that if some driver has > boards that can and other boards that cannot support it. Setting set_frag_threshold when the card doesn't do fragmentation makes no sense. Not setting set_frag_threshold when the card needs to do fragmentation in hardware makes no sense as well. Therefore assigning/not assigning of set_frag_threshold gives the same information as the flag. > -/* Configuration block used by the low-level driver to tell the 802.11 code > - * about supported hardware features and to pass function pointers to callback > - * functions. */ > +/* this is driver-visible part of the per-hw state the stack keeps. > + * if you change something in here, call */ Call what? > - /* ieee80211 drivers must assign this instead of the callback in > + /* This replaces the callback that would usually be in > * &struct net_device. dev->flags, dev->mc_count and dev->mc_list must You probably want to delete the last "must". > - * not be used; use passed parameters and ieee80211_get_mc_list_item() > - * instead. */ > - void (*set_multicast_list)(struct net_device *dev, > + * are replaced by the parameters and ieee80211_get_mc_list_item(). */ > + void (*set_multicast_list)(struct ieee80211_hw *hw, > unsigned short flags, int mc_count); Thanks, Jiri -- Jiri Benc SUSE Labs ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw 2006-11-20 17:57 ` Jiri Benc @ 2006-11-20 18:04 ` Johannes Berg 2006-11-20 18:52 ` Johannes Berg 1 sibling, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-20 18:04 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 1965 bytes --] On Mon, 2006-11-20 at 18:57 +0100, Jiri Benc wrote: > If you are at it, why not to rename ieee80211_hw to some better name? > We need to rename ieee80211_local and I think ieee80211_hw would be > very good name for it. What about renaming of ieee80211_hw to > ieee80211_dev? Heh. I called it ieee80211_wiphy in the first series (don't look) but then David said he'd prefer keeping the name to reduce diff size. It did reduce the diff size a bit so I kept it for now. > Setting set_frag_threshold when the card doesn't do fragmentation makes > no sense. Not setting set_frag_threshold when the card needs to do > fragmentation in hardware makes no sense as well. Therefore > assigning/not assigning of set_frag_threshold gives the same > information as the flag. Well, I guessed that some optimisations with the p54 memory allocator might be possible if it knows what the maximum frame size is (due to fragmentation smaller than max MPDU size). But yeah, that's basically handwaving. The point was to make the 33 function pointers independent of the actual hardware and only dependent on the driver so that ieee80211_ops can be static to reduce size of the hw description struct. > > -/* Configuration block used by the low-level driver to tell the 802.11 code > > - * about supported hardware features and to pass function pointers to callback > > - * functions. */ > > +/* this is driver-visible part of the per-hw state the stack keeps. > > + * if you change something in here, call */ > > Call what? Heh. Call this function (update_hw) to notify the stack. > > - /* ieee80211 drivers must assign this instead of the callback in > > + /* This replaces the callback that would usually be in > > * &struct net_device. dev->flags, dev->mc_count and dev->mc_list must > > You probably want to delete the last "must". Actually, the comment should be rewritting since dev-> makes no sense any more. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw 2006-11-20 17:57 ` Jiri Benc 2006-11-20 18:04 ` Johannes Berg @ 2006-11-20 18:52 ` Johannes Berg 1 sibling, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-20 18:52 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1.1: Type: text/plain, Size: 42 bytes --] Attached a respun version. johannes [-- Attachment #1.2: 006-d80211-driver-api.patch.bz2 --] [-- Type: application/x-bzip, Size: 24587 bytes --] [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw 2006-11-19 19:28 ` [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw Johannes Berg 2006-11-20 17:57 ` Jiri Benc @ 2006-11-20 22:45 ` Johannes Berg 2006-11-21 17:48 ` [PATCH] d80211: use ieee80211_hw.dev Johannes Berg 1 sibling, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-20 22:45 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 195 bytes --] Mostly to remind myself to send a patch tomorrow... I introduce ieee80211_hw->dev (struct device *) but don't actually use it. Of course, I should use it in the proper places :) johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH] d80211: use ieee80211_hw.dev 2006-11-20 22:45 ` Johannes Berg @ 2006-11-21 17:48 ` Johannes Berg 0 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-21 17:48 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn This fixes up my earlier patches by actually using the dev field in struct ieee80211_hw. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- Jiri, please apply. This is a fix and restores the behaviour we had before when drivers did SET_NETDEV_DEV on the master device. I think it might make sense to actually point the device link from virtual interfaces to the wiphy instead of the actual device. I know we have a wiphy link but now all userspace must be updated to check for wiphy links, and I'd expect userspace to follow the device links until it comes to a sink in the device graph if it wants the actual physical device... so having the device link point to the wiphy would make the hierarchical relation clear. --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-21 18:15:33.649658585 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-21 18:20:04.159658585 +0100 @@ -4561,7 +4561,10 @@ int ieee80211_register_hw(struct ieee802 rtnl_unlock(); goto fail_dev; } + memcpy(local->mdev->dev_addr, local->hw.perm_addr, ETH_ALEN); + SET_NETDEV_DEV(local->mdev, local->hw.dev); + result = register_netdevice(local->mdev); if (result < 0) { rtnl_unlock(); --- wireless-dev.orig/net/d80211/ieee80211_iface.c 2006-11-21 18:14:39.999658585 +0100 +++ wireless-dev/net/d80211/ieee80211_iface.c 2006-11-21 18:19:52.499658585 +0100 @@ -76,7 +76,7 @@ int ieee80211_if_add(struct net_device * ndev->mem_start = dev->mem_start; ndev->mem_end = dev->mem_end; ndev->flags = dev->flags & IFF_MULTICAST; - SET_NETDEV_DEV(ndev, dev->class_dev.dev); + SET_NETDEV_DEV(ndev, local->hw.dev); sdata = IEEE80211_DEV_TO_SUB_IF(ndev); sdata->type = IEEE80211_IF_TYPE_AP; @@ -124,7 +124,7 @@ int ieee80211_if_add_mgmt(struct ieee802 ndev->ieee80211_ptr = local; memcpy(ndev->dev_addr, local->hw.perm_addr, ETH_ALEN); - SET_NETDEV_DEV(ndev, local->mdev->class_dev.dev); + SET_NETDEV_DEV(ndev, local->hw.dev); nsdata = IEEE80211_DEV_TO_SUB_IF(ndev); nsdata->type = IEEE80211_IF_TYPE_MGMT; ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 7/13] d80211: add a perm_addr hardware property 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (5 preceding siblings ...) 2006-11-19 19:28 ` [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw Johannes Berg @ 2006-11-19 19:29 ` Johannes Berg 2006-11-19 23:20 ` Johannes Berg 2006-11-19 19:29 ` [PATCH 8/13] d80211: introduce IEEE80211_HW_FRAG flag Johannes Berg ` (6 subsequent siblings) 13 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:29 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn After removing knowledge of the master net_dev from drivers, they'll still need a way to tell us which MAC address they have. This is that way, the perm_addr is initially used for all devices. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/include/net/d80211.h 2006-11-19 20:13:58.029275208 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 20:13:59.349275208 +0100 @@ -11,6 +11,7 @@ #define D80211_H #include <linux/kernel.h> +#include <linux/if_ether.h> #include <linux/skbuff.h> #include <linux/wireless.h> #include <linux/device.h> @@ -439,6 +440,9 @@ struct ieee80211_hw { struct device *dev; + /* permanent mac address */ + u8 perm_addr[ETH_ALEN]; + /* TODO: frame_type 802.11/802.3, sw_encryption requirements */ /* Some wireless LAN chipsets generate beacons in the hardware/firmware --- wireless-dev.orig/net/d80211/ieee80211_iface.c 2006-11-19 20:13:58.069275208 +0100 +++ wireless-dev/net/d80211/ieee80211_iface.c 2006-11-19 20:13:59.359275208 +0100 @@ -70,7 +70,7 @@ int ieee80211_if_add(struct net_device * snprintf(ndev->name, IFNAMSIZ, "%s", name); } - memcpy(ndev->dev_addr, local->mdev->dev_addr, ETH_ALEN); + memcpy(ndev->dev_addr, local->wiphy.perm_addr, ETH_ALEN); ndev->base_addr = dev->base_addr; ndev->irq = dev->irq; ndev->mem_start = dev->mem_start; @@ -123,7 +123,7 @@ int ieee80211_if_add_mgmt(struct ieee802 goto fail; ndev->ieee80211_ptr = local; - memcpy(ndev->dev_addr, local->mdev->dev_addr, ETH_ALEN); + memcpy(ndev->dev_addr, local->wiphy.perm_addr, ETH_ALEN); SET_NETDEV_DEV(ndev, local->mdev->class_dev.dev); nsdata = IEEE80211_DEV_TO_SUB_IF(ndev); --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 20:13:58.039275208 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 20:13:59.359275208 +0100 @@ -4565,6 +4565,7 @@ int ieee80211_register_hw(struct ieee802 rtnl_unlock(); goto fail_dev; } + memcpy(local->mdev->dev_addr, local->wiphy.perm_addr, ETH_ALEN); result = register_netdevice(local->mdev); if (result < 0) { rtnl_unlock(); ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 7/13] d80211: add a perm_addr hardware property 2006-11-19 19:29 ` [PATCH 7/13] d80211: add a perm_addr hardware property Johannes Berg @ 2006-11-19 23:20 ` Johannes Berg 2006-11-20 18:54 ` Johannes Berg 0 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-19 23:20 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 299 bytes --] On Sun, 2006-11-19 at 20:29 +0100, Johannes Berg wrote: > + memcpy(ndev->dev_addr, local->wiphy.perm_addr, ETH_ALEN); > + memcpy(local->mdev->dev_addr, local->wiphy.perm_addr, ETH_ALEN); ugh, somehow I messed up. that should be local->hw.perm_addr of course. Same in patch 8. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 7/13] d80211: add a perm_addr hardware property 2006-11-19 23:20 ` Johannes Berg @ 2006-11-20 18:54 ` Johannes Berg 0 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-20 18:54 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn After removing knowledge of the master net_dev from drivers, they'll still need a way to tell us which MAC address they have. This is that way, the perm_addr is initially used for all devices. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- resend with the wiphy thing fixed. not sure how that slipped in --- wireless-dev.orig/include/net/d80211.h 2006-11-20 19:40:04.879598504 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-20 19:40:33.139598504 +0100 @@ -11,6 +11,7 @@ #define D80211_H #include <linux/kernel.h> +#include <linux/if_ether.h> #include <linux/skbuff.h> #include <linux/wireless.h> #include <linux/device.h> @@ -440,6 +441,9 @@ struct ieee80211_hw { struct device *dev; + /* permanent mac address */ + u8 perm_addr[ETH_ALEN]; + /* TODO: frame_type 802.11/802.3, sw_encryption requirements */ /* Some wireless LAN chipsets generate beacons in the hardware/firmware --- wireless-dev.orig/net/d80211/ieee80211_iface.c 2006-11-20 19:37:14.669598504 +0100 +++ wireless-dev/net/d80211/ieee80211_iface.c 2006-11-20 19:40:33.139598504 +0100 @@ -70,7 +70,7 @@ int ieee80211_if_add(struct net_device * snprintf(ndev->name, IFNAMSIZ, "%s", name); } - memcpy(ndev->dev_addr, local->mdev->dev_addr, ETH_ALEN); + memcpy(ndev->dev_addr, local->hw.perm_addr, ETH_ALEN); ndev->base_addr = dev->base_addr; ndev->irq = dev->irq; ndev->mem_start = dev->mem_start; @@ -123,7 +123,7 @@ int ieee80211_if_add_mgmt(struct ieee802 goto fail; ndev->ieee80211_ptr = local; - memcpy(ndev->dev_addr, local->mdev->dev_addr, ETH_ALEN); + memcpy(ndev->dev_addr, local->hw.perm_addr, ETH_ALEN); SET_NETDEV_DEV(ndev, local->mdev->class_dev.dev); nsdata = IEEE80211_DEV_TO_SUB_IF(ndev); --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-20 19:37:14.729598504 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-20 19:40:33.149598504 +0100 @@ -4565,6 +4565,7 @@ int ieee80211_register_hw(struct ieee802 rtnl_unlock(); goto fail_dev; } + memcpy(local->mdev->dev_addr, local->hw.perm_addr, ETH_ALEN); result = register_netdevice(local->mdev); if (result < 0) { rtnl_unlock(); ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 8/13] d80211: introduce IEEE80211_HW_FRAG flag 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (6 preceding siblings ...) 2006-11-19 19:29 ` [PATCH 7/13] d80211: add a perm_addr hardware property Johannes Berg @ 2006-11-19 19:29 ` Johannes Berg 2006-11-19 19:30 ` [PATCH 9/13] d80211: remove useless driver name field Johannes Berg ` (5 subsequent siblings) 13 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:29 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn This introduces the promised IEEE80211_HW_FRAG used to determine whether the hardware can do fragmentation or not. It actually makes sense to split this capability flag out from the function pointer, maybe some hardware wants to be notified about the fragmentation threshold even though it doesn't do fragmentation itself. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/include/net/d80211.h 2006-11-19 20:13:59.349275208 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 20:14:00.039275208 +0100 @@ -505,6 +505,9 @@ struct ieee80211_hw { * per-packet RC4 key with each TX frame when doing hwcrypto */ #define IEEE80211_HW_TKIP_REQ_PHASE2_KEY (1<<14) + /* do hardware fragmentation */ +#define IEEE80211_HW_FRAG (1<<15) + u32 flags; /* hardware flags defined above */ /* Set to the size of a needed device specific skb headroom for TX skbs. */ @@ -658,8 +661,6 @@ struct ieee80211_ops { int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); /* Configuration of fragmentation threshold (if device needs it) */ - /* FIXME: if this is set, then d80211 will never do fragmentation! - * hence, this really needs to be a flag in _hw!! */ int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); /* Configuration of retry limits (if device needs it) */ --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 20:13:59.359275208 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 20:14:00.039275208 +0100 @@ -1079,7 +1079,7 @@ __ieee80211_tx_prepare(struct ieee80211_ tx->fragmented = local->fragmentation_threshold < IEEE80211_MAX_FRAG_THRESHOLD && tx->u.tx.unicast && skb->len + FCS_LEN > local->fragmentation_threshold && - (!local->ops->set_frag_threshold); + (!(local->wiphy.flags & IEEE80211_HW_FRAG)); if (!tx->sta) control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK; else if (tx->sta->clear_dst_mask) { ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 9/13] d80211: remove useless driver name field 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (7 preceding siblings ...) 2006-11-19 19:29 ` [PATCH 8/13] d80211: introduce IEEE80211_HW_FRAG flag Johannes Berg @ 2006-11-19 19:30 ` Johannes Berg 2006-11-19 19:31 ` [PATCH 10/13] bcm43xx: update to new d80211 driver API Johannes Berg ` (4 subsequent siblings) 13 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:30 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn struct ieee80211_ops has a driver name field that's never used. Remove it. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/include/net/d80211.h 2006-11-19 20:14:00.039275208 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 20:14:00.639275208 +0100 @@ -531,9 +531,6 @@ struct ieee80211_hw { * about supported hardware features and to pass function pointers to callback * functions. */ struct ieee80211_ops { - /* Driver name */ - char *name; - /* Handler that 802.11 module calls for each transmitted frame. * skb contains the buffer starting from the IEEE 802.11 header. * The low-level driver should send the frame out based on ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 10/13] bcm43xx: update to new d80211 driver API 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (8 preceding siblings ...) 2006-11-19 19:30 ` [PATCH 9/13] d80211: remove useless driver name field Johannes Berg @ 2006-11-19 19:31 ` Johannes Berg 2006-11-19 19:43 ` Michael Buesch 2006-11-19 19:31 ` [PATCH 11/13] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Johannes Berg ` (3 subsequent siblings) 13 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:31 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn Updates bcm43xx. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/Makefile 2006-11-19 20:12:47.459275208 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/Makefile 2006-11-19 20:14:01.189275208 +0100 @@ -7,6 +7,6 @@ bcm43xx-d80211-obj-$(CONFIG_BCM43XX_D802 bcm43xx-d80211-objs := bcm43xx_main.o bcm43xx_ilt.o \ bcm43xx_radio.o bcm43xx_phy.o \ bcm43xx_power.o bcm43xx_sysfs.o \ - bcm43xx_leds.o bcm43xx_ethtool.o \ + bcm43xx_leds.o \ bcm43xx_xmit.o \ $(bcm43xx-d80211-obj-y) --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h 2006-11-19 20:12:47.539275208 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h 2006-11-19 20:14:01.189275208 +0100 @@ -682,7 +682,6 @@ struct bcm43xx_private { struct ieee80211_hw *ieee; struct ieee80211_low_level_stats ieee_stats; - struct net_device *net_dev; unsigned int irq; spinlock_t irq_lock; @@ -770,9 +769,9 @@ struct bcm43xx_private { static inline -struct bcm43xx_private * bcm43xx_priv(struct net_device *dev) +struct bcm43xx_private * bcm43xx_priv(struct ieee80211_hw *hw) { - return ieee80211_dev_hw_data(dev); + return hw->priv; } static inline @@ -854,13 +853,7 @@ struct device; static inline struct bcm43xx_private * dev_to_bcm(struct device *dev) { - struct net_device *net_dev; - struct bcm43xx_private *bcm; - - net_dev = dev_get_drvdata(dev); - bcm = bcm43xx_priv(net_dev); - - return bcm; + return dev_get_drvdata(dev); } /* Is the device operating in a specified mode (IEEE80211_IF_TYPE_XXX). */ --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-19 20:12:47.629275208 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-19 20:14:01.189275208 +0100 @@ -285,7 +285,7 @@ void bcm43xx_debugfs_add_device(struct b { struct bcm43xx_dfsentry *e; struct bcm43xx_txstatus_log *log; - char devdir[IFNAMSIZ]; + char devdir[16]; assert(bcm); e = kzalloc(sizeof(*e), GFP_KERNEL); @@ -308,7 +308,7 @@ void bcm43xx_debugfs_add_device(struct b bcm->dfsentry = e; - strncpy(devdir, bcm->net_dev->name, ARRAY_SIZE(devdir)); + snprintf(devdir, sizeof(devdir), "wiphy%d", bcm->ieee->index); e->subdir = debugfs_create_dir(devdir, fs.root); e->dentry_tsf = debugfs_create_file("tsf", 0666, e->subdir, bcm, &tsf_fops); --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c 2006-11-19 20:12:47.709275208 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c 2006-11-19 20:14:01.199275208 +0100 @@ -525,7 +525,6 @@ static int setup_rx_descbuffer(struct bc ring->rx_buffersize, 0); meta->skb = skb; meta->dmaaddr = dmaaddr; - skb->dev = ring->bcm->net_dev; ring->ops->fill_descriptor(ring, desc, dmaaddr, ring->rx_buffersize, 0, 0, 0); @@ -1091,7 +1090,7 @@ int bcm43xx_dma_tx(struct bcm43xx_privat ring->nr_tx_packets++; if (free_slots(ring) < SLOTS_PER_PACKET) { /* FIXME: we currently only have one queue */ - ieee80211_stop_queue(bcm->net_dev, 0); + ieee80211_stop_queue(bcm->ieee, 0); ring->stopped = 1; } @@ -1130,7 +1129,7 @@ void bcm43xx_dma_handle_txstatus(struct if (status->acked) meta->txstat.flags |= IEEE80211_TX_STATUS_ACK; meta->txstat.retry_count = status->frame_count - 1; - ieee80211_tx_status_irqsafe(bcm->net_dev, meta->skb, &(meta->txstat)); + ieee80211_tx_status_irqsafe(bcm->ieee, meta->skb, &(meta->txstat)); /* skb is freed by ieee80211_tx_status_irqsafe() */ } else { /* No need to call free_descriptor_buffer here, as @@ -1151,7 +1150,7 @@ void bcm43xx_dma_handle_txstatus(struct if (ring->stopped) { assert(free_slots(ring) >= SLOTS_PER_PACKET); /* FIXME: we currently only have one queue */ - ieee80211_wake_queue(bcm->net_dev, 0); + ieee80211_wake_queue(bcm->ieee, 0); ring->stopped = 0; } } --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_ethtool.c 2006-11-19 20:12:47.849275208 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* - - Broadcom BCM43xx wireless driver - - ethtool support - - Copyright (c) 2006 Jason Lunz <lunz@falooley.org> - - Some code in this file is derived from the 8139too.c driver - Copyright (C) 2002 Jeff Garzik - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "bcm43xx.h" -#include "bcm43xx_ethtool.h" - -#include <linux/netdevice.h> -#include <linux/pci.h> -#include <linux/string.h> -#include <linux/version.h> -#include <linux/utsrelease.h> - - -static void bcm43xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) -{ - struct bcm43xx_private *bcm = bcm43xx_priv(dev); - - strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - strncpy(info->version, UTS_RELEASE, sizeof(info->version)); - strncpy(info->bus_info, pci_name(bcm->ssb.pci_dev), ETHTOOL_BUSINFO_LEN); -} - -struct ethtool_ops bcm43xx_ethtool_ops = { - .get_drvinfo = bcm43xx_get_drvinfo, - .get_link = ethtool_op_get_link, -}; --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_ethtool.h 2006-11-19 20:12:47.869275208 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -#ifndef BCM43xx_ETHTOOL_H_ -#define BCM43xx_ETHTOOL_H_ - -#include <linux/ethtool.h> - -extern struct ethtool_ops bcm43xx_ethtool_ops; - -#endif /* BCM43xx_ETHTOOL_H_ */ --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c 2006-11-19 20:12:48.009275208 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c 2006-11-19 20:14:01.199275208 +0100 @@ -50,7 +50,6 @@ #include "bcm43xx_pio.h" #include "bcm43xx_power.h" #include "bcm43xx_sysfs.h" -#include "bcm43xx_ethtool.h" #include "bcm43xx_xmit.h" #include "bcm43xx_sysfs.h" @@ -114,8 +113,8 @@ MODULE_PARM_DESC(fwpostfix, "Postfix for //#define DEBUG_ENABLE_PCILOG -static int bcm43xx_net_stop(struct net_device *net_dev); -static int bcm43xx_net_open(struct net_device *net_dev); +static int bcm43xx_net_stop(struct ieee80211_hw *hw); +static int bcm43xx_net_open(struct ieee80211_hw *hw); /* Detailed list maintained at: * http://openfacts.berlios.de/index-en.phtml?title=Bcm43xxDevices @@ -2573,7 +2572,7 @@ static void bcm43xx_periodic_work_handle /* Periodic work will take a long time, so we want it to * be preemtible. */ - ieee80211_stop_queues(bcm->net_dev); + ieee80211_stop_queues(bcm->ieee); spin_lock_irqsave(&bcm->irq_lock, flags); bcm43xx_mac_suspend(bcm); if (bcm43xx_using_pio(bcm)) @@ -2597,7 +2596,7 @@ static void bcm43xx_periodic_work_handle if (bcm43xx_using_pio(bcm)) bcm43xx_pio_thaw_txqueues(bcm); bcm43xx_mac_enable(bcm); - ieee80211_start_queues(bcm->net_dev); + ieee80211_start_queues(bcm->ieee); } mmiowb(); spin_unlock_irqrestore(&bcm->irq_lock, flags); @@ -2848,19 +2847,19 @@ static void bcm43xx_chipset_detach(struc static void bcm43xx_free_modes(struct bcm43xx_private *bcm) { - struct ieee80211_hw *ieee = bcm->ieee; + struct ieee80211_hw *hw = bcm->ieee; int i; - for (i = 0; i < ieee->num_modes; i++) { - kfree(ieee->modes[i].channels); - kfree(ieee->modes[i].rates); + for (i = 0; i < hw->num_modes; i++) { + kfree(hw->modes[i].channels); + kfree(hw->modes[i].rates); } - kfree(ieee->modes); - ieee->modes = NULL; - ieee->num_modes = 0; + kfree(hw->modes); + hw->modes = NULL; + hw->num_modes = 0; } -static int bcm43xx_append_mode(struct ieee80211_hw *ieee, +static int bcm43xx_append_mode(struct ieee80211_hw *hw, int mode_id, int nr_channels, const struct ieee80211_channel *channels, @@ -2872,7 +2871,7 @@ static int bcm43xx_append_mode(struct ie struct ieee80211_hw_modes *mode; int err = -ENOMEM; - mode = &(ieee->modes[ieee->num_modes]); + mode = &(hw->modes[hw->num_modes]); mode->mode = mode_id; mode->num_channels = nr_channels; @@ -2893,7 +2892,7 @@ static int bcm43xx_append_mode(struct ie sizeof(*rates2) * nr_rates2); } - ieee->num_modes++; + hw->num_modes++; err = 0; out: return err; @@ -2906,17 +2905,17 @@ err_free_channels: static int bcm43xx_setup_modes(struct bcm43xx_private *bcm) { int err = -ENOMEM; - struct ieee80211_hw *ieee = bcm->ieee; + struct ieee80211_hw *hw = bcm->ieee; struct ssb_core *core; struct bcm43xx_corepriv_80211 *wlpriv; int i, nr_modes; nr_modes = bcm->nr_80211_available; - ieee->modes = kzalloc(sizeof(*(ieee->modes)) * nr_modes, + hw->modes = kzalloc(sizeof(*(hw->modes)) * nr_modes, GFP_KERNEL); - if (!ieee->modes) + if (!hw->modes) goto out; - ieee->num_modes = 0; + hw->num_modes = 0; for (i = 0; i < bcm->nr_80211_available; i++) { core = bcm->wlcores[i]; @@ -3117,7 +3116,7 @@ int bcm43xx_select_wireless_core(struct return -ESRCH; /* No such PHYTYPE on this board. */ /* Disable all network traffic. */ - ieee80211_stop_queues(bcm->net_dev); + ieee80211_stop_queues(bcm->ieee); if (bcm->wlcore) { /* We already selected a wl core in the past. @@ -3180,11 +3179,11 @@ bcm->wlcore = active_core; goto error; bcm43xx_macfilter_clear(bcm, BCM43xx_MACFILTER_ASSOC); - bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->net_dev->dev_addr)); + bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->ieee->perm_addr)); bcm43xx_security_init(bcm); bcm43xx_measure_channel_change_time(bcm); - ieee80211_update_hw(bcm->net_dev, bcm->ieee); - ieee80211_start_queues(bcm->net_dev); + ieee80211_update_hw(bcm->ieee); + ieee80211_start_queues(bcm->ieee); /* Let's go! Be careful after enabling the IRQs. * Don't switch cores, for example. @@ -3329,9 +3328,9 @@ static int bcm43xx_ssb_suspend(struct ss int err; struct bcm43xx_private *bcm = ssb_to_bcm43xx(ssb); - ieee80211_stop_queues(bcm->net_dev); + ieee80211_stop_queues(bcm->ieee); - err = bcm43xx_net_stop(bcm->net_dev); + err = bcm43xx_net_stop(bcm->ieee); if (!err) mutex_lock(&bcm->mutex); @@ -3344,7 +3343,7 @@ static int bcm43xx_ssb_resume(struct ssb struct bcm43xx_private *bcm = ssb_to_bcm43xx(ssb); mutex_unlock(&bcm->mutex); - err = bcm43xx_net_open(bcm->net_dev); + err = bcm43xx_net_open(bcm->ieee); return err; } @@ -3352,7 +3351,6 @@ static int bcm43xx_ssb_resume(struct ssb static int bcm43xx_attach_board(struct bcm43xx_private *bcm, struct pci_dev *pci_dev) { - struct net_device *net_dev = bcm->net_dev; int err; int i; u32 coremask; @@ -3376,7 +3374,6 @@ static int bcm43xx_attach_board(struct b err = -EIO; goto err_pci_release; } - net_dev->base_addr = (unsigned long)mmio; err = ssb_init(&bcm->ssb, pci_dev, mmio, bcm43xx_ssb_suspend, @@ -3449,9 +3446,9 @@ bcm->wlcore = bcm->wlcores[i]; /* Set the MAC address in the networking subsystem */ if (is_valid_ether_addr(bcm->sprom.r1.et1mac)) - memcpy(bcm->net_dev->dev_addr, bcm->sprom.r1.et1mac, 6); + memcpy(bcm->ieee->perm_addr, bcm->sprom.r1.et1mac, 6); else - memcpy(bcm->net_dev->dev_addr, bcm->sprom.r1.il0mac, 6); + memcpy(bcm->ieee->perm_addr, bcm->sprom.r1.il0mac, 6); bcm43xx_setup_modes(bcm); assert(err == 0); @@ -3478,12 +3475,12 @@ err_pci_disable: goto out; } -/* hard_start_xmit() callback in struct ieee80211_device */ -static int bcm43xx_net_hard_start_xmit(struct net_device *net_dev, +/* hard_start_xmit() callback in struct ieee80211_ops */ +static int bcm43xx_net_hard_start_xmit(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_tx_control *ctl) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); int err = -ENODEV; unsigned long flags; @@ -3501,9 +3498,9 @@ static int bcm43xx_net_hard_start_xmit(s return NETDEV_TX_OK; } -static int bcm43xx_net_reset(struct net_device *net_dev) +static int bcm43xx_net_reset(struct ieee80211_hw *hw) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); unsigned long flags; spin_lock_irqsave(&bcm->irq_lock, flags); @@ -3513,10 +3510,10 @@ static int bcm43xx_net_reset(struct net_ return 0; } -static int bcm43xx_net_config(struct net_device *net_dev, +static int bcm43xx_net_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); struct bcm43xx_radioinfo *radio; struct bcm43xx_phyinfo *phy; unsigned long flags; @@ -3619,13 +3616,13 @@ out_unlock_mutex: return err; } -static int bcm43xx_net_set_key(struct net_device *net_dev, +static int bcm43xx_net_set_key(struct ieee80211_hw *hw, set_key_cmd cmd, u8 *addr, struct ieee80211_key_conf *key, int aid) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); unsigned long flags; u8 algorithm; u8 index; @@ -3742,17 +3739,17 @@ out: return err; } -static int bcm43xx_net_conf_tx(struct net_device *net_dev, +static int bcm43xx_net_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params) { return 0; } -static int bcm43xx_net_get_tx_stats(struct net_device *net_dev, +static int bcm43xx_net_get_tx_stats(struct ieee80211_hw *hw, struct ieee80211_tx_queue_stats *stats) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); unsigned long flags; int err = -ENODEV; @@ -3769,10 +3766,10 @@ static int bcm43xx_net_get_tx_stats(stru return err; } -static int bcm43xx_net_get_stats(struct net_device *net_dev, +static int bcm43xx_net_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); unsigned long flags; spin_lock_irqsave(&bcm->irq_lock, flags); @@ -3782,29 +3779,16 @@ static int bcm43xx_net_get_stats(struct return 0; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void bcm43xx_net_poll_controller(struct net_device *net_dev) +static int bcm43xx_net_open(struct ieee80211_hw *hw) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); - unsigned long flags; - - local_irq_save(flags); - if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) - bcm43xx_interrupt_handler(bcm->irq, bcm); - local_irq_restore(flags); -} -#endif /* CONFIG_NET_POLL_CONTROLLER */ - -static int bcm43xx_net_open(struct net_device *net_dev) -{ - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); return bcm43xx_init_board(bcm); } -static int bcm43xx_net_stop(struct net_device *net_dev) +static int bcm43xx_net_stop(struct ieee80211_hw *hw) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); int err; if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { @@ -3817,10 +3801,10 @@ static int bcm43xx_net_stop(struct net_d return 0; } -static int bcm43xx_add_interface(struct net_device *net_dev, +static int bcm43xx_add_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); unsigned long flags; int err = -EOPNOTSUPP; @@ -3857,10 +3841,10 @@ out_unlock: return err; } -static void bcm43xx_remove_interface(struct net_device *net_dev, +static void bcm43xx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); unsigned long flags; mutex_lock(&bcm->mutex); @@ -3882,11 +3866,11 @@ static void bcm43xx_remove_interface(str MAC_ARG(conf->mac_addr)); } -static int bcm43xx_config_interface(struct net_device *net_dev, +static int bcm43xx_config_interface(struct ieee80211_hw *hw, int if_id, struct ieee80211_if_conf *conf) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); unsigned long flags; mutex_lock(&bcm->mutex); @@ -3907,11 +3891,11 @@ static int bcm43xx_config_interface(stru return 0; } -static void bcm43xx_set_multicast_list(struct net_device *net_dev, +static void bcm43xx_set_multicast_list(struct ieee80211_hw *hw, unsigned short netflags, int mc_count) { - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = bcm43xx_priv(hw); unsigned long flags; spin_lock_irqsave(&bcm->irq_lock, flags); @@ -3923,22 +3907,11 @@ static void bcm43xx_set_multicast_list(s spin_unlock_irqrestore(&bcm->irq_lock, flags); } -/* Initialization of struct net_device, just after allocation. */ -static void bcm43xx_netdev_setup(struct net_device *net_dev) -{ -#ifdef CONFIG_NET_POLL_CONTROLLER - net_dev->poll_controller = bcm43xx_net_poll_controller; -#endif - SET_ETHTOOL_OPS(net_dev, &bcm43xx_ethtool_ops); -} - static int bcm43xx_init_private(struct bcm43xx_private *bcm, - struct net_device *net_dev, - struct pci_dev *pci_dev, - struct ieee80211_hw *ieee) + struct ieee80211_hw *hw, + struct pci_dev *pci_dev) { - bcm->ieee = ieee; - bcm->net_dev = net_dev; + bcm->ieee = hw; bcm->bad_frames_preempt = modparam_bad_frames_preempt; spin_lock_init(&bcm->irq_lock); spin_lock_init(&bcm->leds_lock); @@ -3953,12 +3926,27 @@ static int bcm43xx_init_private(struct b return 0; } +static struct ieee80211_ops bcm43xx_hw_ops = { + .tx = bcm43xx_net_hard_start_xmit, + .open = bcm43xx_net_open, + .stop = bcm43xx_net_stop, + .add_interface = bcm43xx_add_interface, + .remove_interface = bcm43xx_remove_interface, + .reset = bcm43xx_net_reset, + .config = bcm43xx_net_config, + .config_interface = bcm43xx_config_interface, + .set_multicast_list = bcm43xx_set_multicast_list, + .set_key = bcm43xx_net_set_key, + .get_stats = bcm43xx_net_get_stats, + .get_tx_stats = bcm43xx_net_get_tx_stats, + .conf_tx = bcm43xx_net_conf_tx, +}; + static int __devinit bcm43xx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { - struct net_device *net_dev; + struct ieee80211_hw *hw; struct bcm43xx_private *bcm; - struct ieee80211_hw *ieee; int err = -ENOMEM; #ifdef DEBUG_SINGLE_DEVICE_ONLY @@ -3966,52 +3954,36 @@ static int __devinit bcm43xx_init_one(st return -ENODEV; #endif - ieee = kzalloc(sizeof(*ieee), GFP_KERNEL); - if (!ieee) - goto out; - ieee->version = IEEE80211_VERSION; - ieee->name = KBUILD_MODNAME; - ieee->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | - IEEE80211_HW_MONITOR_DURING_OPER | - IEEE80211_HW_DEVICE_HIDES_WEP | - IEEE80211_HW_WEP_INCLUDE_IV; - ieee->maxssi = BCM43xx_RX_MAX_SSI; - ieee->tx = bcm43xx_net_hard_start_xmit; - ieee->open = bcm43xx_net_open; - ieee->stop = bcm43xx_net_stop; - ieee->add_interface = bcm43xx_add_interface; - ieee->remove_interface = bcm43xx_remove_interface; - ieee->reset = bcm43xx_net_reset; - ieee->config = bcm43xx_net_config; - ieee->config_interface = bcm43xx_config_interface; - ieee->set_multicast_list = bcm43xx_set_multicast_list; - ieee->set_key = bcm43xx_net_set_key; - ieee->get_stats = bcm43xx_net_get_stats; - ieee->queues = 1; - ieee->get_tx_stats = bcm43xx_net_get_tx_stats; - ieee->conf_tx = bcm43xx_net_conf_tx; - - net_dev = ieee80211_alloc_hw(sizeof(*bcm), bcm43xx_netdev_setup); - if (!net_dev) { + hw = ieee80211_alloc_hw(sizeof(*bcm), &bcm43xx_hw_ops); + if (!hw) { printk(KERN_ERR PFX "could not allocate ieee80211 device %s\n", pci_name(pdev)); - goto err_free_ieee; + return -ENOMEM; } + + /* fill hw info */ + hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | + IEEE80211_HW_MONITOR_DURING_OPER | + IEEE80211_HW_DEVICE_HIDES_WEP | + IEEE80211_HW_WEP_INCLUDE_IV; + hw->maxssi = BCM43xx_RX_MAX_SSI; + hw->queues = 1; + hw->dev = &pdev->dev; + /* initialize the bcm43xx_private struct */ - bcm = bcm43xx_priv(net_dev); + bcm = bcm43xx_priv(hw); memset(bcm, 0, sizeof(*bcm)); - err = bcm43xx_init_private(bcm, net_dev, pdev, ieee); + err = bcm43xx_init_private(bcm, hw, pdev); if (err) - goto err_free_netdev; + goto err_free_hw; - pci_set_drvdata(pdev, net_dev); - SET_NETDEV_DEV(net_dev, &pdev->dev); + pci_set_drvdata(pdev, bcm); err = bcm43xx_attach_board(bcm, pdev); if (err) - goto err_free_netdev; - err = ieee80211_register_hw(net_dev, ieee); + goto err_free_hw; + err = ieee80211_register_hw(hw); if (err) goto err_detach_board; @@ -4023,28 +3995,24 @@ out: err_detach_board: bcm43xx_detach_board(bcm); -err_free_netdev: - ieee80211_free_hw(net_dev); -err_free_ieee: - kfree(ieee); +err_free_hw: + ieee80211_free_hw(hw); goto out; } static void __devexit bcm43xx_remove_one(struct pci_dev *pdev) { - struct net_device *net_dev = pci_get_drvdata(pdev); - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); - struct ieee80211_hw *ieee = bcm->ieee; + struct bcm43xx_private *bcm = pci_get_drvdata(pdev); + struct ieee80211_hw *hw = bcm->ieee; bcm43xx_debugfs_remove_device(bcm); - ieee80211_unregister_hw(net_dev); + ieee80211_unregister_hw(hw); bcm43xx_detach_board(bcm); if (bcm->cached_beacon) kfree_skb(bcm->cached_beacon); bcm->cached_beacon = NULL; - ieee80211_free_hw(net_dev); - kfree(ieee); + ieee80211_free_hw(hw); } /* Hard-reset the chip. Do not call this directly. @@ -4088,13 +4056,12 @@ void bcm43xx_controller_restart(struct b static int bcm43xx_suspend(struct pci_dev *pdev, pm_message_t state) { - struct net_device *net_dev = pci_get_drvdata(pdev); - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = pci_get_drvdata(pdev); int err; dprintk(KERN_INFO PFX "Suspending...\n"); - ieee80211_stop_queues(bcm->net_dev); + ieee80211_stop_queues(bcm->ieee); bcm->was_initialized = 0; if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { bcm->was_initialized = 1; @@ -4120,8 +4087,7 @@ static int bcm43xx_suspend(struct pci_de static int bcm43xx_resume(struct pci_dev *pdev) { - struct net_device *net_dev = pci_get_drvdata(pdev); - struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); + struct bcm43xx_private *bcm = pci_get_drvdata(pdev); int err; dprintk(KERN_INFO PFX "Resuming...\n"); @@ -4139,7 +4105,7 @@ static int bcm43xx_resume(struct pci_dev printk(KERN_ERR PFX "Resume failed!\n"); return err; } - ieee80211_start_queues(bcm->net_dev); + ieee80211_start_queues(bcm->ieee); dprintk(KERN_INFO PFX "Device resumed.\n"); --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c 2006-11-19 20:12:48.039275208 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c 2006-11-19 20:14:01.209275208 +0100 @@ -503,7 +503,7 @@ void bcm43xx_pio_handle_txstatus(struct if (status->acked) packet->txstat.flags |= IEEE80211_TX_STATUS_ACK; packet->txstat.retry_count = status->frame_count - 1; - ieee80211_tx_status_irqsafe(bcm->net_dev, packet->skb, + ieee80211_tx_status_irqsafe(bcm->ieee, packet->skb, &(packet->txstat)); packet->skb = NULL; --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c 2006-11-19 20:12:48.199275208 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c 2006-11-19 20:14:01.209275208 +0100 @@ -714,7 +714,7 @@ void bcm43xx_rx(struct bcm43xx_private * } bcm->stats.last_rx = jiffies; - ieee80211_rx_irqsafe(bcm->net_dev, skb, &status); + ieee80211_rx_irqsafe(bcm->ieee, skb, &status); } void bcm43xx_handle_txstatus(struct bcm43xx_private *bcm, ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 10/13] bcm43xx: update to new d80211 driver API 2006-11-19 19:31 ` [PATCH 10/13] bcm43xx: update to new d80211 driver API Johannes Berg @ 2006-11-19 19:43 ` Michael Buesch 2006-11-19 19:52 ` Johannes Berg 0 siblings, 1 reply; 57+ messages in thread From: Michael Buesch @ 2006-11-19 19:43 UTC (permalink / raw) To: Johannes Berg Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Ivo van Doorn, netdev On Sunday 19 November 2006 20:31, Johannes Berg wrote: > --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-19 20:12:47.629275208 +0100 > +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-19 20:14:01.189275208 +0100 > @@ -285,7 +285,7 @@ void bcm43xx_debugfs_add_device(struct b > { > struct bcm43xx_dfsentry *e; > struct bcm43xx_txstatus_log *log; > - char devdir[IFNAMSIZ]; > + char devdir[16]; What's the purpose of this? > assert(bcm); > e = kzalloc(sizeof(*e), GFP_KERNEL); > @@ -308,7 +308,7 @@ void bcm43xx_debugfs_add_device(struct b > > bcm->dfsentry = e; > > - strncpy(devdir, bcm->net_dev->name, ARRAY_SIZE(devdir)); > + snprintf(devdir, sizeof(devdir), "wiphy%d", bcm->ieee->index); > e->subdir = debugfs_create_dir(devdir, fs.root); > e->dentry_tsf = debugfs_create_file("tsf", 0666, e->subdir, > bcm, &tsf_fops); > +static struct ieee80211_ops bcm43xx_hw_ops = { > + .tx = bcm43xx_net_hard_start_xmit, > + .open = bcm43xx_net_open, > + .stop = bcm43xx_net_stop, > + .add_interface = bcm43xx_add_interface, > + .remove_interface = bcm43xx_remove_interface, > + .reset = bcm43xx_net_reset, > + .config = bcm43xx_net_config, > + .config_interface = bcm43xx_config_interface, > + .set_multicast_list = bcm43xx_set_multicast_list, > + .set_key = bcm43xx_net_set_key, > + .get_stats = bcm43xx_net_get_stats, > + .get_tx_stats = bcm43xx_net_get_tx_stats, > + .conf_tx = bcm43xx_net_conf_tx, > +}; I like that being a seperate and static struct. -- Greetings Michael. ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 10/13] bcm43xx: update to new d80211 driver API 2006-11-19 19:43 ` Michael Buesch @ 2006-11-19 19:52 ` Johannes Berg 0 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:52 UTC (permalink / raw) To: Michael Buesch Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Ivo van Doorn, netdev [-- Attachment #1: Type: text/plain, Size: 723 bytes --] On Sun, 2006-11-19 at 20:43 +0100, Michael Buesch wrote: > On Sunday 19 November 2006 20:31, Johannes Berg wrote: > > > --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-19 20:12:47.629275208 +0100 > > +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-19 20:14:01.189275208 +0100 > > @@ -285,7 +285,7 @@ void bcm43xx_debugfs_add_device(struct b > > { > > struct bcm43xx_dfsentry *e; > > struct bcm43xx_txstatus_log *log; > > - char devdir[IFNAMSIZ]; > > + char devdir[16]; > > What's the purpose of this? Well since there's no interface name printed into that string any more but the wiphy%d I figured I'd not use IFNAMSIZ. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 11/13] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (9 preceding siblings ...) 2006-11-19 19:31 ` [PATCH 10/13] bcm43xx: update to new d80211 driver API Johannes Berg @ 2006-11-19 19:31 ` Johannes Berg 2006-11-19 19:32 ` [PATCH 12/13] d80211: remove calib_int Johannes Berg ` (2 subsequent siblings) 13 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:31 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn There's no point in trying to tell a driver globally whether sw or hw crypto is used, if it's sw then we just don't give it keys... Besides, these weren't ever used! Remove IEEE80211_CONF_SW_DECRYPT and IEEE80211_CONF_SW_ENCRYPT. Acked-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/include/net/d80211.h 2006-11-19 20:14:00.639275208 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 20:14:02.289275208 +0100 @@ -244,11 +244,9 @@ struct ieee80211_conf { int beacon_int; -#define IEEE80211_CONF_SW_ENCRYPT (1<<0) -#define IEEE80211_CONF_SW_DECRYPT (1<<1) -#define IEEE80211_CONF_SHORT_SLOT_TIME (1<<2) /* use IEEE 802.11g Short Slot +#define IEEE80211_CONF_SHORT_SLOT_TIME (1<<0) /* use IEEE 802.11g Short Slot * Time */ -#define IEEE80211_CONF_SSID_HIDDEN (1<<3) /* do not broadcast the ssid */ +#define IEEE80211_CONF_SSID_HIDDEN (1<<1) /* do not broadcast the ssid */ u32 flags; /* configuration flags defined above */ u8 power_level; /* transmit power limit for current --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 20:14:00.039275208 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 20:14:02.299275208 +0100 @@ -516,8 +516,7 @@ ieee80211_tx_h_fragment(struct ieee80211 static int wep_encrypt_skb(struct ieee80211_txrx_data *tx, struct sk_buff *skb) { - if (tx->key->force_sw_encrypt || - (tx->local->hw.conf.flags & IEEE80211_CONF_SW_ENCRYPT)) { + if (tx->key->force_sw_encrypt) { if (ieee80211_wep_encrypt(tx->local, skb, tx->key)) return -1; } else { @@ -3268,8 +3267,7 @@ ieee80211_rx_h_wep_weak_iv_detection(str /* Check for weak IVs, if hwaccel did not remove IV from the frame */ if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) || - rx->key->force_sw_encrypt || - (rx->local->hw.conf.flags & IEEE80211_CONF_SW_ENCRYPT)) { + rx->key->force_sw_encrypt) { u8 *iv = ieee80211_wep_is_weak_iv(rx->skb, rx->key); if (iv) { rx->sta->wep_weak_iv_count++; @@ -3301,8 +3299,7 @@ ieee80211_rx_h_wep_decrypt(struct ieee80 } if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) || - rx->key->force_sw_encrypt || - (rx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + rx->key->force_sw_encrypt) { if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { printk(KERN_DEBUG "%s: RX WEP frame, decrypt " "failed\n", rx->dev->name); --- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-11-19 20:13:58.049275208 +0100 +++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-11-19 20:14:02.299275208 +0100 @@ -492,9 +492,7 @@ int ieee80211_set_hw_encryption(struct n key->force_sw_encrypt = 1; if (key && local->ops->set_key && - (!(local->hw.conf.flags & IEEE80211_CONF_SW_ENCRYPT) || - !(local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT)) && - (keyconf = ieee80211_key_data2conf(local, key)) != NULL) { + (keyconf = ieee80211_key_data2conf(local, key))) { if (local->ops->set_key(local_to_hw(local), SET_KEY, addr, keyconf, sta ? sta->aid : 0)) { rc = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; --- wireless-dev.orig/net/d80211/wpa.c 2006-11-19 20:13:58.069275208 +0100 +++ wireless-dev/net/d80211/wpa.c 2006-11-19 20:14:02.309275208 +0100 @@ -104,7 +104,6 @@ ieee80211_tx_h_michael_mic_add(struct ie #endif /* CONFIG_HOSTAPD_WPA_TESTING */ if (!tx->key->force_sw_encrypt && - !(tx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT) && !tx->fragmented && !(tx->local->hw.flags & IEEE80211_HW_TKIP_INCLUDE_MMIC) && !wpa_test) { @@ -186,8 +185,7 @@ ieee80211_rx_h_michael_mic_verify(struct #endif /* CONFIG_HOSTAPD_WPA_TESTING */ if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && - !rx->key->force_sw_encrypt && - !(rx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + !rx->key->force_sw_encrypt) { if (rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) { if (skb->len < MICHAEL_MIC_LEN) return TXRX_DROP; @@ -297,9 +295,7 @@ static int tkip_encrypt_skb(struct ieee8 hdrlen = ieee80211_get_hdrlen(fc); len = skb->len - hdrlen; - tailneed = (!tx->key->force_sw_encrypt && - !(tx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT)) - ? 0 : TKIP_ICV_LEN; + tailneed = !tx->key->force_sw_encrypt ? 0 : TKIP_ICV_LEN; if ((skb_headroom(skb) < TKIP_IV_LEN || skb_tailroom(skb) < tailneed)) { I802_DEBUG_INC(tx->local->tx_expand_skb_head); @@ -331,8 +327,7 @@ iv_inc: skip_iv_inc: #endif /* CONFIG_HOSTAPD_WPA_TESTING */ - if (!tx->key->force_sw_encrypt && - !(tx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT) + if (!tx->key->force_sw_encrypt #ifdef CONFIG_HOSTAPD_WPA_TESTING && !tx->wpa_test #endif /* CONFIG_HOSTAPD_WPA_TESTING */ @@ -427,7 +422,6 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8 #endif /* CONFIG_HOSTAPD_WPA_TESTING */ if (!tx->key->force_sw_encrypt && - !(tx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT) && !(tx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) && !wpa_test) { /* hwaccel - with no need for preallocated room for IV/ICV */ @@ -506,8 +500,7 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8 #endif /* CONFIG_HOSTAPD_WPA_TESTING */ if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && - !rx->key->force_sw_encrypt && - !(rx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + !rx->key->force_sw_encrypt) { if (!(rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV)) { /* Hardware takes care of all processing, including * replay protection, so no need to continue here. */ @@ -651,9 +644,7 @@ static int ccmp_encrypt_skb(struct ieee8 hdrlen = ieee80211_get_hdrlen(fc); len = skb->len - hdrlen; - tailneed = (!key->force_sw_encrypt && - !(tx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT)) - ? 0 : CCMP_MIC_LEN; + tailneed = !key->force_sw_encrypt ? 0 : CCMP_MIC_LEN; if ((skb_headroom(skb) < CCMP_HDR_LEN || skb_tailroom(skb) < tailneed)) { @@ -693,8 +684,7 @@ skip_pn_inc: ccmp_pn2hdr(pos, pn, key->keyidx); - if (!key->force_sw_encrypt && - !(tx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + if (!key->force_sw_encrypt) { /* hwaccel - with preallocated room for CCMP header */ tx->u.tx.control->key_idx = key->hw_key_idx; return 0; @@ -749,7 +739,6 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8 ieee80211_tx_set_iswep(tx); if (!tx->key->force_sw_encrypt && - !(tx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT) && !(tx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV)) { /* hwaccel - with no need for preallocated room for CCMP " * header or MIC fields */ @@ -802,7 +791,6 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8 if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && !key->force_sw_encrypt && - !(rx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT) && !(rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV)) return TXRX_CONTINUE; @@ -823,8 +811,7 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8 } if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && - !key->force_sw_encrypt && - !(rx->local->hw.conf.flags & IEEE80211_CONF_SW_DECRYPT)) { + !key->force_sw_encrypt) { /* hwaccel has already decrypted frame and verified MIC */ } else { u8 *scratch, *b_0, *aad; ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 12/13] d80211: remove calib_int 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (10 preceding siblings ...) 2006-11-19 19:31 ` [PATCH 11/13] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Johannes Berg @ 2006-11-19 19:32 ` Johannes Berg 2006-11-19 19:33 ` [PATCH 13/13] d80211: fix scan issues with new ops Johannes Berg 2006-11-19 23:32 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg 13 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:32 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn The calibration interval is far too hardware dependent to be useful as a generic stack setting and some hardware doesn't even have that parameter. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/include/net/d80211.h 2006-11-19 20:14:02.289275208 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 20:14:02.959275208 +0100 @@ -259,8 +259,6 @@ struct ieee80211_conf { * 1 = Ant0, * 2 = Ant1 */ - int calib_int; /* hw/radio calibration interval in - * seconds */ int antenna_def; int antenna_mode; --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-19 20:14:02.299275208 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-19 20:14:02.959275208 +0100 @@ -4473,7 +4473,6 @@ struct ieee80211_hw *ieee80211_alloc_hw( local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; local->short_retry_limit = 7; local->long_retry_limit = 4; - local->hw.conf.calib_int = 60; local->hw.conf.radio_enabled = 1; local->rate_ctrl_num_up = RATE_CONTROL_NUM_UP; local->rate_ctrl_num_down = RATE_CONTROL_NUM_DOWN; --- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-11-19 20:14:02.299275208 +0100 +++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-11-19 20:14:02.969275208 +0100 @@ -2480,12 +2480,6 @@ static int ieee80211_ioctl_prism2_param( ret = -EINVAL; break; - case PRISM2_PARAM_CALIB_INT: - local->hw.conf.calib_int = value; - if (ieee80211_hw_config(local)) - ret = -EINVAL; - break; - case PRISM2_PARAM_ANTENNA_MODE: local->hw.conf.antenna_mode = value; if (ieee80211_hw_config(local)) @@ -2687,10 +2681,6 @@ static int ieee80211_ioctl_get_prism2_pa *param = local->hw.conf.antenna_sel; break; - case PRISM2_PARAM_CALIB_INT: - *param = local->hw.conf.calib_int; - break; - case PRISM2_PARAM_ANTENNA_MODE: *param = local->hw.conf.antenna_mode; break; --- wireless-dev.orig/net/d80211/ieee80211_sysfs.c 2006-11-19 20:13:58.059275208 +0100 +++ wireless-dev/net/d80211/ieee80211_sysfs.c 2006-11-19 20:14:02.969275208 +0100 @@ -154,7 +154,6 @@ IEEE80211_LOCAL_SHOW(channel, hw.conf.ch IEEE80211_LOCAL_SHOW(frequency, hw.conf.freq, "%d"); IEEE80211_LOCAL_SHOW(radar_detect, hw.conf.radar_detect, "%d"); IEEE80211_LOCAL_SHOW(antenna_sel, hw.conf.antenna_sel, "%d"); -IEEE80211_LOCAL_SHOW(calib_int, hw.conf.calib_int, "%d"); IEEE80211_LOCAL_SHOW(bridge_packets, bridge_packets, "%d"); IEEE80211_LOCAL_SHOW(key_tx_rx_threshold, key_tx_rx_threshold, "%d"); IEEE80211_LOCAL_SHOW(rts_threshold, rts_threshold, "%d"); @@ -220,7 +219,6 @@ static struct class_device_attribute iee __ATTR(frequency, S_IRUGO, ieee80211_local_show_frequency, NULL), __ATTR(radar_detect, S_IRUGO, ieee80211_local_show_radar_detect, NULL), __ATTR(antenna_sel, S_IRUGO, ieee80211_local_show_antenna_sel, NULL), - __ATTR(calib_int, S_IRUGO, ieee80211_local_show_calib_int, NULL), __ATTR(bridge_packets, S_IRUGO, ieee80211_local_show_bridge_packets, NULL), __ATTR(key_tx_rx_threshold, S_IRUGO, ieee80211_local_show_key_tx_rx_threshold, NULL), __ATTR(rts_threshold, S_IRUGO, ieee80211_local_show_rts_threshold, NULL), ^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 13/13] d80211: fix scan issues with new ops 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (11 preceding siblings ...) 2006-11-19 19:32 ` [PATCH 12/13] d80211: remove calib_int Johannes Berg @ 2006-11-19 19:33 ` Johannes Berg 2006-11-19 23:32 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg 13 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-19 19:33 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn If hardware shall do scanning, the hw_scan operation must be set. However, if the driver is for multiple cards that may or may not do hardware scanning, it'll need a flag. Similar issues arise with passive_scan(). This patch introduces flags to fix these issues. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- wireless-dev.orig/include/net/d80211.h 2006-11-19 20:14:02.959275208 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-19 20:14:03.619275208 +0100 @@ -504,6 +504,12 @@ struct ieee80211_hw { /* do hardware fragmentation */ #define IEEE80211_HW_FRAG (1<<15) + /* hardware does scanning instead of software */ +#define IEEE80211_HW_PASSIVE_SCAN (1<<16) + + /* hardware does scanning instead of software */ +#define IEEE80211_HW_SCAN (1<<17) + u32 flags; /* hardware flags defined above */ /* Set to the size of a needed device specific skb headroom for TX skbs. */ @@ -625,7 +631,8 @@ struct ieee80211_ops { struct ieee80211_scan_conf *conf); /* Ask the hardware to service the scan request, no need to start - * the scan state machine in stack. */ + * the scan state machine in stack. + * This callback goes along with the IEEE80211_HW_SCAN flag. */ int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); /* return low-level statistics */ --- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-11-19 20:13:58.049275208 +0100 +++ wireless-dev/net/d80211/ieee80211_sta.c 2006-11-19 20:14:03.619275208 +0100 @@ -2552,7 +2552,7 @@ int ieee80211_sta_req_scan(struct net_de printk(KERN_DEBUG "%s: starting scan\n", dev->name); - if (local->ops->hw_scan) { + if (local->ops->hw_scan && (local->hw.flags & IEEE80211_HW_SCAN)) { int rc = local->ops->hw_scan(local_to_hw(local), ssid, ssid_len); if (!rc) { --- wireless-dev.orig/net/d80211/ieee80211_scan.c 2006-11-19 20:13:58.049275208 +0100 +++ wireless-dev/net/d80211/ieee80211_scan.c 2006-11-19 20:14:03.629275208 +0100 @@ -114,7 +114,8 @@ static void ieee80211_scan_start(struct struct ieee80211_channel *chan = NULL; int ret; - if (!local->ops->passive_scan) { + if (!local->ops->passive_scan || + !(local->hw.flags & IEEE80211_HW_PASSIVE_SCAN)) { printk(KERN_DEBUG "%s: Scan handler called, yet the hardware " "does not support passive scanning. Disabled.\n", local->mdev->name); ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 0/13] move d80211 away from netdev towards wiphy 2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg ` (12 preceding siblings ...) 2006-11-19 19:33 ` [PATCH 13/13] d80211: fix scan issues with new ops Johannes Berg @ 2006-11-19 23:32 ` Johannes Berg 2006-11-20 19:14 ` Jiri Benc 13 siblings, 1 reply; 57+ messages in thread From: Johannes Berg @ 2006-11-19 23:32 UTC (permalink / raw) To: netdev Cc: Jiri Benc, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn Alright, a bit more thought later :) Michael noted that letting people rename their wiphys is probably a good idea to have stable based on the permanent mac address or such. Will actually require moving the perm_addr field from struct ieee80211_hw into struct wiphy (as below) too so that it's possible to query it generically :) Since d80211 also should relinquish control of this to cfg80211 I decided that it was a good idea to make cfg80211 handle the wiphy stuff. Also, I think cfg80211 should create /sys/class/ieee80211/<wiphy> to allow renaming to follow through in sysfs. My plan would be to do this: struct ieee80211_hw { - /* these are assigned by d80211, don't write */ - int index; + /* points to the cfg80211 wiphy for this piece */ + struct wiphy *wiphy; + + /* assigned by d80211, don't write */ struct ieee80211_conf conf; along with the patch below. In d80211, I'd then allocate ieee80211_hw and ieee80211_local along with struct wiphy by doing wiphy_new() with the right size instead of allocating it along with the master dev. Thoughts? --- wireless-dev.orig/include/net/cfg80211.h 2006-11-20 00:16:34.999275208 +0100 +++ wireless-dev/include/net/cfg80211.h 2006-11-20 00:23:01.569275208 +0100 @@ -7,9 +7,10 @@ #include <linux/netdevice.h> #include <net/genetlink.h> #include <linux/wireless.h> +#include <linux/device.h> /* - * 802.11 configuration in-kernel interface + * 802.11 configuration and wiphy management in-kernel interface * * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> */ @@ -164,28 +165,65 @@ struct cfg80211_ops { int (*next_bssid)(void *data, u8 *bssid)); }; +#define WIPHYNAMESIZE 16 + /** - * cfg80211_register - register a wiphy with cfg80211 + * struct wiphy * - * register a given method structure with the cfg80211 system - * and associate the 'priv' pointer with it. + * @wiphy_index: the wiphy index assigned to this item + * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> + * @name: name of this wiphy + */ +struct wiphy { + int wiphy_index; + struct class_device class_dev; + char name[WIPHYNAMESIZE]; + void *priv; +}; + +/** + * wiphy_priv - return priv from wiphy + */ +static inline void *wiphy_priv(struct wiphy *wiphy) +{ + /* no fancy alignment for now... should probably do that */ + return (char *)wiphy + sizeof(struct wiphy); +} + +/** + * wiphy_new - create a new wiphy for use with cfg80211 * - * Returns a non-negative wiphy index or a negative error code. + * create a new wiphy and associate the given operations with it. + * @sizeof_priv bytes are allocated for private use. * - * NOTE: for proper operation, this priv pointer MUST also be - * assigned to each &struct net_device's @ieee80211_ptr member! + * the returned structure's driver-private pointer must be assigned + * to each netdev's ieee80211_ptr for proper operation. */ -extern int cfg80211_register(struct cfg80211_ops *ops, void *priv); +struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv); /** - * cfg80211_unregister - deregister a wiphy from cfg80211 + * wiphy_register - register a wiphy with cfg80211 + * + * register the given wiphy + * + * Returns a non-negative wiphy index or a negative error code. + */ +extern int wiphy_register(struct wiphy *wiphy); + +/** + * wiphy_unregister - deregister a wiphy from cfg80211 * * unregister a device with the given priv pointer. * After this call, no more requests can be made with this priv * pointer, but the call may sleep to wait for an outstanding * request that is being handled. */ -extern void cfg80211_unregister(void *priv); +extern void wiphy_unregister(struct wiphy *wiphy); + +/** + * cfg80211_free - free wiphy + */ +extern void wiphy_free(struct wiphy *wiphy); /* helper functions specific to nl80211 */ extern void *nl80211hdr_put(struct sk_buff *skb, u32 pid, --- wireless-dev.orig/net/wireless/core.c 2006-11-20 00:16:35.059275208 +0100 +++ wireless-dev/net/wireless/core.c 2006-11-20 00:23:01.569275208 +0100 @@ -33,7 +33,7 @@ static struct cfg80211_registered_driver return NULL; list_for_each_entry(drv, &cfg80211_drv_list, list) { - if (drv->priv == priv) { + if (drv_priv(drv) == priv) { result = drv; break; } @@ -48,7 +48,7 @@ static struct cfg80211_registered_driver struct cfg80211_registered_driver *result = NULL, *drv; list_for_each_entry(drv, &cfg80211_drv_list, list) { - if (drv->wiphy == wiphy) { + if (drv->wiphy.wiphy_index == wiphy) { result = drv; break; } @@ -146,41 +146,56 @@ void cfg80211_put_drv(struct cfg80211_re /* exported functions */ -int cfg80211_register(struct cfg80211_ops *ops, void *priv) +struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv) { - struct cfg80211_registered_driver *drv; - int res; + struct cfg80211_registered_driver *result; - if (!priv || !ops->list_interfaces) - return -EINVAL; + int size = sizeof(struct cfg80211_registered_driver) + + sizeof_priv; - mutex_lock(&cfg80211_drv_mutex); + if (!ops->list_interfaces) + return NULL; - if (cfg80211_drv_by_priv(priv)) { - res = -EALREADY; - goto out_unlock; - } + result = kzalloc(size, GFP_KERNEL); + if (!result) + return NULL; - drv = kzalloc(sizeof(struct cfg80211_registered_driver), GFP_KERNEL); - if (!drv) { - res = -ENOMEM; - goto out_unlock; - } + result->wiphy.priv = drv_priv(result); + + result->ops = ops; + mutex_init(&result->mtx); + + return &result->wiphy; +} +EXPORT_SYMBOL_GPL(wiphy_new); + +int wiphy_register(struct wiphy *wiphy) +{ + struct cfg80211_registered_driver *drv = wiphy_to_drv(wiphy); + int res; - drv->ops = ops; - drv->priv = priv; + mutex_lock(&cfg80211_drv_mutex); if (unlikely(wiphy_counter<0)) { /* ugh, wrapped! */ - kfree(drv); res = -ENOSPC; goto out_unlock; } - mutex_init(&drv->mtx); - drv->wiphy = wiphy_counter; + drv->wiphy.wiphy_index = wiphy_counter; list_add(&drv->list, &cfg80211_drv_list); /* return wiphy number */ - res = drv->wiphy; + res = drv->wiphy.wiphy_index; + + /* give it a proper name */ + snprintf(drv->wiphy.name, sizeof(drv->wiphy.name), + "wiphy%d", drv->wiphy.wiphy_index); + + /* TODO: + * - allocate class device for /sys/class/ieee80211 + * - move code over from d80211 to do all that + * - allow renaming of devices via netlink/whatever + * and keep name up to date + */ /* now increase counter for the next time */ wiphy_counter++; @@ -189,20 +204,13 @@ int cfg80211_register(struct cfg80211_op mutex_unlock(&cfg80211_drv_mutex); return res; } -EXPORT_SYMBOL_GPL(cfg80211_register); +EXPORT_SYMBOL_GPL(wiphy_register); -void cfg80211_unregister(void *priv) +void wiphy_unregister(struct wiphy *wiphy) { - struct cfg80211_registered_driver *drv; + struct cfg80211_registered_driver *drv = wiphy_to_drv(wiphy); mutex_lock(&cfg80211_drv_mutex); - drv = cfg80211_drv_by_priv(priv); - if (!drv) { - printk(KERN_ERR "deregistering cfg80211 backend that " - " was never registered!\n"); - mutex_unlock(&cfg80211_drv_mutex); - return; - } /* hold registered driver mutex during list removal as well * to make sure no commands are in progress at the moment */ @@ -211,11 +219,17 @@ void cfg80211_unregister(void *priv) mutex_unlock(&drv->mtx); mutex_unlock(&cfg80211_drv_mutex); +} +EXPORT_SYMBOL_GPL(wiphy_unregister); + +void wiphy_free(struct wiphy *wiphy) +{ + struct cfg80211_registered_driver *drv = wiphy_to_drv(wiphy); mutex_destroy(&drv->mtx); kfree(drv); } -EXPORT_SYMBOL_GPL(cfg80211_unregister); +EXPORT_SYMBOL_GPL(wiphy_free); /* module initialisation/exit functions */ --- wireless-dev.orig/net/wireless/core.h 2006-11-20 00:16:35.109275208 +0100 +++ wireless-dev/net/wireless/core.h 2006-11-20 00:23:01.569275208 +0100 @@ -13,16 +13,25 @@ struct cfg80211_registered_driver { struct cfg80211_ops *ops; - int wiphy; - void *priv; struct list_head list; /* we hold this mutex during any call so that * we cannot do multiple calls at once, and also * to avoid the deregister call to proceed while * any call is in progress */ struct mutex mtx; + struct wiphy wiphy; }; +static inline struct cfg80211_registered_driver *wiphy_to_drv(struct wiphy *wiphy) +{ + return container_of(wiphy, struct cfg80211_registered_driver, wiphy); +} + +static inline void *drv_priv(struct cfg80211_registered_driver *drv) +{ + return wiphy_priv(&drv->wiphy); +} + extern struct mutex cfg80211_drv_mutex; extern struct list_head cfg80211_drv_list; --- wireless-dev.orig/net/wireless/nl80211.c 2006-11-20 00:16:35.269275208 +0100 +++ wireless-dev/net/wireless/nl80211.c 2006-11-20 00:23:01.579275208 +0100 @@ -112,7 +112,7 @@ static int nl80211_get_cmdlist(struct sk goto put_drv; } - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy.wiphy_index); start = nla_nest_start(msg, NL80211_ATTR_CMDS); if (!start) @@ -178,7 +178,7 @@ static int nl80211_get_wiphys(struct sk_ indexstart = nla_nest_start(msg, idx++); if (!indexstart) goto nla_put_failure; - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy.wiphy_index); nla_nest_end(msg, indexstart); } mutex_unlock(&cfg80211_drv_mutex); @@ -248,7 +248,7 @@ static int nl80211_get_intfs(struct sk_b goto put_drv; } - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy.wiphy_index); start = nla_nest_start(msg, NL80211_ATTR_INTERFACE_LIST); if (!start) { @@ -258,7 +258,7 @@ static int nl80211_get_intfs(struct sk_b cb.skb = msg; cb.idx = 1; - err = drv->ops->list_interfaces(drv->priv, &cb, addifidx); + err = drv->ops->list_interfaces(drv_priv(drv), &cb, addifidx); if (err) goto msg_free; @@ -300,7 +300,7 @@ static int nl80211_do_inject(struct sk_b goto unlock; } - err = drv->ops->inject_packet(drv->priv, + err = drv->ops->inject_packet(drv_priv(drv), nla_data(info->attrs[NL80211_ATTR_FRAME]), nla_len(info->attrs[NL80211_ATTR_FRAME]), flags, @@ -334,7 +334,7 @@ static int nl80211_add_virt_intf(struct goto unlock; } - err = drv->ops->add_virtual_intf(drv->priv, + err = drv->ops->add_virtual_intf(drv_priv(drv), nla_data(info->attrs[NL80211_ATTR_IFNAME]), type); unlock: @@ -359,7 +359,7 @@ static int nl80211_del_virt_intf(struct goto out; } - err = drv->ops->del_virtual_intf(drv->priv, ifindex); + err = drv->ops->del_virtual_intf(drv_priv(drv), ifindex); out: cfg80211_put_drv(drv); @@ -421,7 +421,7 @@ static int nl80211_configure(struct sk_b config.channel = nla_get_u32(attr); } - err = drv->ops->configure(drv->priv, dev, &config); + err = drv->ops->configure(drv_priv(drv), dev, &config); out: cfg80211_put_drv(drv); dev_put(dev); @@ -448,7 +448,7 @@ static int nl80211_get_config(struct sk_ memset(&config, 0, sizeof(config)); - drv->ops->get_config(drv->priv, dev, &config); + drv->ops->get_config(drv_priv(drv), dev, &config); hdr = nl80211msg_new(&msg, info->snd_pid, info->snd_seq, 0, NL80211_CMD_NEW_CONFIG); @@ -514,7 +514,7 @@ static int nl80211_set_roaming(struct sk goto out; } - err = drv->ops->set_roaming(drv->priv, dev, roaming_control); + err = drv->ops->set_roaming(drv_priv(drv), dev, roaming_control); out: cfg80211_put_drv(drv); dev_put(dev); @@ -538,7 +538,7 @@ static int nl80211_get_roaming(struct sk goto out_put_drv; } - err = drv->ops->get_roaming(drv->priv, dev); + err = drv->ops->get_roaming(drv_priv(drv), dev); if (err < 0) goto out_put_drv; @@ -586,7 +586,7 @@ static int nl80211_set_fixed_bssid(struc goto out; } - err = drv->ops->set_fixed_bssid(drv->priv, dev, bssid); + err = drv->ops->set_fixed_bssid(drv_priv(drv), dev, bssid); out: cfg80211_put_drv(drv); dev_put(dev); @@ -611,7 +611,7 @@ static int nl80211_get_fixed_bssid(struc goto out_put_drv; } - err = drv->ops->get_fixed_bssid(drv->priv, dev, bssid); + err = drv->ops->get_fixed_bssid(drv_priv(drv), dev, bssid); if (err < 0) goto out_put_drv; @@ -657,7 +657,7 @@ static int nl80211_get_association(struc goto out_put_drv; } - err = drv->ops->get_association(drv->priv, dev, bssid); + err = drv->ops->get_association(drv_priv(drv), dev, bssid); if (err < 0) goto out_put_drv; @@ -716,7 +716,7 @@ static int nl80211_assoc_deauth(struct s goto out; } - err = act(drv->priv, dev); + err = act(drv_priv(drv), dev); out: cfg80211_put_drv(drv); dev_put(dev); @@ -778,7 +778,7 @@ static int nl80211_get_auth_list(struct cb.skb = msg; cb.idx = 1; - err = drv->ops->get_auth_list(drv->priv, dev, &cb, add_bssid); + err = drv->ops->get_auth_list(drv_priv(drv), dev, &cb, add_bssid); if (err) goto msg_free; @@ -874,7 +874,7 @@ static int nl80211_initiate_scan(struct params.channels = channels; params.n_channels = count; - err = drv->ops->initiate_scan(drv->priv, dev, ¶ms); + err = drv->ops->initiate_scan(drv_priv(drv), dev, ¶ms); kfree(channels); out: --- wireless-dev.orig/net/wireless/wext-compat.c 2006-11-20 00:16:35.169275208 +0100 +++ wireless-dev/net/wireless/wext-compat.c 2006-11-20 00:23:01.579275208 +0100 @@ -121,7 +121,7 @@ static int cfg80211_wx_set_commit(struct goto out; } - err = drv->ops->configure(drv->priv, net_dev, + err = drv->ops->configure(drv_priv(drv), net_dev, net_dev->cfg80211_wext_pending_config); kfree(net_dev->cfg80211_wext_pending_config); @@ -532,7 +532,7 @@ static int cfg80211_wx_set_essid(struct err = -ENOSYS; if (!drv->ops->configure || !drv->ops->get_config_valid) goto out; - if (!(drv->ops->get_config_valid(drv->priv, net_dev) + if (!(drv->ops->get_config_valid(drv_priv(drv), net_dev) & CFG80211_CFG_VALID_SSID)) goto out; ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 0/13] move d80211 away from netdev towards wiphy 2006-11-19 23:32 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg @ 2006-11-20 19:14 ` Jiri Benc 2006-11-22 19:18 ` [RFC 0/3] more power to cfg80211 Johannes Berg 0 siblings, 1 reply; 57+ messages in thread From: Jiri Benc @ 2006-11-20 19:14 UTC (permalink / raw) To: Johannes Berg Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Mon, 20 Nov 2006 00:32:23 +0100, Johannes Berg wrote: > Since d80211 also should relinquish control of this to cfg80211 I > decided that it was a good idea to make cfg80211 handle the wiphy stuff. > Also, I think cfg80211 should create /sys/class/ieee80211/<wiphy> to > allow renaming to follow through in sysfs. Sounds good. Jiri -- Jiri Benc SUSE Labs ^ permalink raw reply [flat|nested] 57+ messages in thread
* [RFC 0/3] more power to cfg80211 2006-11-20 19:14 ` Jiri Benc @ 2006-11-22 19:18 ` Johannes Berg 2006-11-22 19:22 ` [RFC 1/3] cfg80211: handle wiphy, use wiphy in netdev, do wiphy sysfs Johannes Berg ` (3 more replies) 0 siblings, 4 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-22 19:18 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn [-- Attachment #1: Type: text/plain, Size: 1410 bytes --] The following patches are mostly proof-of-concept code for moving over stuff to cfg80211 (like the wiphy thing). I've changed net_dev->ieee80211_ptr to be of struct wiphy because it allows accessing the wiphy by netdev easily then, and since wireless drivers are (after these patches) expected to register with cfg80211 anyway it doesn't really change much. They need wiphy_priv() then but it's tiny. There's lots left, cfg80211 could put some default things into sysfs, we could notify it of added/removed netdevs (it knows when userspace does this, but not when the driver does by default) and put links from class/ieee80211/<wiphy>/dev:eth1 -> ../../net/eth1 and things like that. I'm not really sure this is the best thing we can do so I'm posting this for some review before I actually dive in and do those modifications. Also, I need to put back a symlink from class/ieee80211/<wiphy>/device to the hardware device. Just discovered that I apparently forgot :) The patches are tested and work fine but we lose functionality, I removed the possibility to create and remove virtual interfaces in d80211 because I wanted to put it into cfg80211 already (well, just needs the d80211 cfg handler...) but then didn't put it in so far. If you feel this is something worth pursuing please shout and I'll fix these issues and submit the patches for actual inclusion. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 190 bytes --] ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [RFC 1/3] cfg80211: handle wiphy, use wiphy in netdev, do wiphy sysfs 2006-11-22 19:18 ` [RFC 0/3] more power to cfg80211 Johannes Berg @ 2006-11-22 19:22 ` Johannes Berg 2006-11-22 19:24 ` [RFC 2/3] d80211: use new wiphy stuff from cfg80211 Johannes Berg ` (2 subsequent siblings) 3 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-22 19:22 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn This patch makes cfg80211 handle wiphy related stuff. I introduced struct wiphy, put a pointer to it into net_dev->ieee80211_ptr instead of letting everyone do their own (last hunk of this patch; this gets us free net_dev -> wiphy mapping) and generally added code here that was similar in d80211. --- wireless-dev.orig/include/net/cfg80211.h 2006-11-22 01:11:09.403927956 +0100 +++ wireless-dev/include/net/cfg80211.h 2006-11-22 20:02:14.889711991 +0100 @@ -7,14 +7,44 @@ #include <linux/netdevice.h> #include <net/genetlink.h> #include <linux/wireless.h> +#include <linux/device.h> /* - * 802.11 configuration in-kernel interface + * 802.11 configuration and wiphy management in-kernel interface * * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> */ /** + * struct wiphy + * + * @wiphy_index: the wiphy index assigned to this item + * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> + * @name: name of this wiphy + */ +struct wiphy { + /* assign these fields before you register the wiphy */ + + /* permanent MAC address */ + u8 perm_addr[ETH_ALEN]; + + /* the actual hardware */ + struct device *dev; + + /* fields below are read-only, assigned by cfg80211 */ + + /* index assigned to this wiphy */ + int wiphy_index; + /* dir in /sys/class/ieee80211/ */ + struct class_device class_dev; + /* pointer to priv */ + void *priv; +}; + +#define WIPHY_PRIV_ALIGN 32 +#define WIPHY_PRIV_ALIGN_CONST (WIPHY_PRIV_ALIGN-1) + +/** * struct cfg80211_config - description of a configuration (request) */ struct cfg80211_config { @@ -118,74 +148,97 @@ struct scan_params { * is to be passed to that callback */ struct cfg80211_ops { - int (*list_interfaces)(void *priv, void *data, + int (*list_interfaces)(struct wiphy *wiphy, void *data, int (*one)(void *data, int ifindex)); - int (*inject_packet)(void *priv, void *frame, int framelen, + int (*inject_packet)(struct wiphy *wiphy, void *frame, int framelen, u32 flags, int queue); - int (*add_virtual_intf)(void *priv, char *name, + int (*add_virtual_intf)(struct wiphy *wiphy, char *name, unsigned int type); - int (*del_virtual_intf)(void *priv, int ifindex); + int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); - int (*configure)(void *priv, struct net_device *dev, + int (*configure)(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_config *cfg); - void (*get_config)(void *priv, struct net_device *dev, + void (*get_config)(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_config *cfg); - u32 (*get_config_valid)(void *priv, struct net_device *dev); + u32 (*get_config_valid)(struct wiphy *wiphy, + struct net_device *dev); - int (*reassociate)(void *priv, struct net_device *dev); - int (*disassociate)(void *priv, struct net_device *dev); - int (*deauth)(void *priv, struct net_device *dev); + int (*reassociate)(struct wiphy *wiphy, struct net_device *dev); + int (*disassociate)(struct wiphy *wiphy, struct net_device *dev); + int (*deauth)(struct wiphy *wiphy, struct net_device *dev); - int (*initiate_scan)(void *priv, struct net_device *dev, + int (*initiate_scan)(struct wiphy *wiphy, struct net_device *dev, struct scan_params *params); - int (*set_roaming)(void *priv, struct net_device *dev, + int (*set_roaming)(struct wiphy *wiphy, struct net_device *dev, int roaming_control); - int (*get_roaming)(void *priv, struct net_device *dev); - int (*set_fixed_bssid)(void *priv, struct net_device *dev, + int (*get_roaming)(struct wiphy *wiphy, struct net_device *dev); + int (*set_fixed_bssid)(struct wiphy *wiphy, struct net_device *dev, u8 *bssid); - int (*get_fixed_bssid)(void *priv, struct net_device *dev, + int (*get_fixed_bssid)(struct wiphy *wiphy, struct net_device *dev, u8 *bssid); - int (*get_association)(void *priv, struct net_device *dev, + int (*get_association)(struct wiphy *wiphy, struct net_device *dev, u8 *bssid); - int (*get_auth_list)(void *priv, struct net_device *dev, + int (*get_auth_list)(struct wiphy *wiphy, struct net_device *dev, void *data, int (*next_bssid)(void *data, u8 *bssid)); }; /** - * cfg80211_register - register a wiphy with cfg80211 + * wiphy_priv - return priv from wiphy + */ +static inline void *wiphy_priv(struct wiphy *wiphy) +{ + return (char *)wiphy + + ((sizeof(struct wiphy)+WIPHY_PRIV_ALIGN_CONST) + & ~WIPHY_PRIV_ALIGN_CONST); +} + +/** + * wiphy_new - create a new wiphy for use with cfg80211 * - * register a given method structure with the cfg80211 system - * and associate the 'priv' pointer with it. + * create a new wiphy and associate the given operations with it. + * @sizeof_priv bytes are allocated for private use. * - * Returns a non-negative wiphy index or a negative error code. + * the returned structure's driver-private pointer must be assigned + * to each netdev's ieee80211_ptr for proper operation. + */ +struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv); + +/** + * wiphy_register - register a wiphy with cfg80211 * - * NOTE: for proper operation, this priv pointer MUST also be - * assigned to each &struct net_device's @ieee80211_ptr member! + * register the given wiphy + * + * Returns a non-negative wiphy index or a negative error code. */ -extern int cfg80211_register(struct cfg80211_ops *ops, void *priv); +extern int wiphy_register(struct wiphy *wiphy); /** - * cfg80211_unregister - deregister a wiphy from cfg80211 + * wiphy_unregister - deregister a wiphy from cfg80211 * * unregister a device with the given priv pointer. * After this call, no more requests can be made with this priv * pointer, but the call may sleep to wait for an outstanding * request that is being handled. */ -extern void cfg80211_unregister(void *priv); +extern void wiphy_unregister(struct wiphy *wiphy); + +/** + * cfg80211_free - free wiphy + */ +extern void wiphy_free(struct wiphy *wiphy); /* helper functions specific to nl80211 */ extern void *nl80211hdr_put(struct sk_buff *skb, u32 pid, --- wireless-dev.orig/net/wireless/core.c 2006-11-22 01:11:09.463927956 +0100 +++ wireless-dev/net/wireless/core.c 2006-11-22 20:00:34.869711991 +0100 @@ -14,41 +14,22 @@ #include <linux/mutex.h> #include <linux/list.h> +#include "sysfs.h" + MODULE_AUTHOR("Johannes Berg"); MODULE_LICENSE("GPL"); -/* RCU might be appropriate here since we usually - * only read the list, and that can happen quite - * often because we need to do it for each command */ LIST_HEAD(cfg80211_drv_list); DEFINE_MUTEX(cfg80211_drv_mutex); static int wiphy_counter; -/* requires nl80211_drv_mutex to be held! */ -static struct cfg80211_registered_driver *cfg80211_drv_by_priv(void *priv) -{ - struct cfg80211_registered_driver *result = NULL, *drv; - - if (!priv) - return NULL; - - list_for_each_entry(drv, &cfg80211_drv_list, list) { - if (drv->priv == priv) { - result = drv; - break; - } - } - - return result; -} - /* requires cfg80211_drv_mutex to be held! */ static struct cfg80211_registered_driver *cfg80211_drv_by_wiphy(int wiphy) { struct cfg80211_registered_driver *result = NULL, *drv; list_for_each_entry(drv, &cfg80211_drv_list, list) { - if (drv->wiphy == wiphy) { + if (drv->wiphy.wiphy_index == wiphy) { result = drv; break; } @@ -75,8 +56,8 @@ __cfg80211_drv_from_info(struct genl_inf if (info->attrs[NL80211_ATTR_IFINDEX]) { ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); dev = dev_get_by_index(ifindex); - if (dev) { - byifidx = cfg80211_drv_by_priv(dev->ieee80211_ptr); + if (dev && dev->ieee80211_ptr) { + byifidx = wiphy_to_drv(dev->ieee80211_ptr); dev_put(dev); } err = -ENODEV; @@ -127,11 +108,13 @@ cfg80211_get_drv_from_ifindex(int ifinde dev = dev_get_by_index(ifindex); if (!dev) goto out; - drv = cfg80211_drv_by_priv(dev->ieee80211_ptr); - if (drv) + + if (dev->ieee80211_ptr) { + drv = wiphy_to_drv(dev->ieee80211_ptr); mutex_lock(&drv->mtx); - else + } else { drv = ERR_PTR(-ENODEV); + } dev_put(dev); out: mutex_unlock(&cfg80211_drv_mutex); @@ -146,63 +129,78 @@ void cfg80211_put_drv(struct cfg80211_re /* exported functions */ -int cfg80211_register(struct cfg80211_ops *ops, void *priv) +struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv) { - struct cfg80211_registered_driver *drv; - int res; + struct cfg80211_registered_driver *result; + int alloc_size; + void *p; - if (!priv || !ops->list_interfaces) - return -EINVAL; + if (!ops->list_interfaces) + return NULL; - mutex_lock(&cfg80211_drv_mutex); + /* ensure 32-byte alignment of result and priv */ + alloc_size = (sizeof(*result) + WIPHY_PRIV_ALIGN_CONST) + & ~WIPHY_PRIV_ALIGN_CONST; + alloc_size += sizeof_priv + WIPHY_PRIV_ALIGN_CONST; - if (cfg80211_drv_by_priv(priv)) { - res = -EALREADY; - goto out_unlock; - } + p = kzalloc(alloc_size, GFP_KERNEL); + if (!p) + return NULL; - drv = kzalloc(sizeof(struct cfg80211_registered_driver), GFP_KERNEL); - if (!drv) { - res = -ENOMEM; - goto out_unlock; - } + result = (struct cfg80211_registered_driver *) + (((long)p + WIPHY_PRIV_ALIGN_CONST) & + ~WIPHY_PRIV_ALIGN_CONST); + + result->padded = (char *)result - (char *)p; + result->wiphy.priv = wiphy_priv(&result->wiphy); - drv->ops = ops; - drv->priv = priv; + result->ops = ops; + mutex_init(&result->mtx); + + return &result->wiphy; +} +EXPORT_SYMBOL_GPL(wiphy_new); + +int wiphy_register(struct wiphy *wiphy) +{ + struct cfg80211_registered_driver *drv = wiphy_to_drv(wiphy); + int res; + + mutex_lock(&cfg80211_drv_mutex); if (unlikely(wiphy_counter<0)) { /* ugh, wrapped! */ - kfree(drv); res = -ENOSPC; goto out_unlock; } - mutex_init(&drv->mtx); - drv->wiphy = wiphy_counter; + drv->wiphy.wiphy_index = wiphy_counter; list_add(&drv->list, &cfg80211_drv_list); - /* return wiphy number */ - res = drv->wiphy; + + /* give it a proper name */ + snprintf(drv->wiphy.class_dev.class_id, BUS_ID_SIZE, + "wiphy%d", drv->wiphy.wiphy_index); + + res = wiphy_sysfs_add(&drv->wiphy); + if (res) + goto out_unlock; /* now increase counter for the next time */ wiphy_counter++; + /* return wiphy number */ + res = drv->wiphy.wiphy_index; + out_unlock: mutex_unlock(&cfg80211_drv_mutex); return res; } -EXPORT_SYMBOL_GPL(cfg80211_register); +EXPORT_SYMBOL_GPL(wiphy_register); -void cfg80211_unregister(void *priv) +void wiphy_unregister(struct wiphy *wiphy) { - struct cfg80211_registered_driver *drv; + struct cfg80211_registered_driver *drv = wiphy_to_drv(wiphy); mutex_lock(&cfg80211_drv_mutex); - drv = cfg80211_drv_by_priv(priv); - if (!drv) { - printk(KERN_ERR "deregistering cfg80211 backend that " - " was never registered!\n"); - mutex_unlock(&cfg80211_drv_mutex); - return; - } /* hold registered driver mutex during list removal as well * to make sure no commands are in progress at the moment */ @@ -210,24 +208,43 @@ void cfg80211_unregister(void *priv) list_del(&drv->list); mutex_unlock(&drv->mtx); + wiphy_sysfs_del(&drv->wiphy); + mutex_unlock(&cfg80211_drv_mutex); +} +EXPORT_SYMBOL_GPL(wiphy_unregister); - mutex_destroy(&drv->mtx); - kfree(drv); +void wiphy_free(struct wiphy *wiphy) +{ + class_device_put(&wiphy->class_dev); } -EXPORT_SYMBOL_GPL(cfg80211_unregister); +EXPORT_SYMBOL_GPL(wiphy_free); /* module initialisation/exit functions */ static int cfg80211_init(void) { + int err; + #ifdef CONFIG_CFG80211_WEXT_COMPAT cfg80211_core_ops.get_drv_from_ifidx = cfg80211_get_drv_from_ifindex; cfg80211_core_ops.put_drv = cfg80211_put_drv; cfg80211_core_ops.module = THIS_MODULE; cfg80211_core_ops.loaded = 1; #endif - return nl80211_init(); + err = nl80211_init(); + if (err) + return err; + + err = wiphy_sysfs_init(); + if (err) + goto out_fail_sysfs; + + return 0; + + out_fail_sysfs: + nl80211_exit(); + return err; } static void cfg80211_exit(void) @@ -238,6 +255,7 @@ static void cfg80211_exit(void) cfg80211_core_ops.get_drv_from_ifidx = NULL; cfg80211_core_ops.put_drv = NULL; #endif + wiphy_sysfs_exit(); nl80211_exit(); } --- wireless-dev.orig/net/wireless/core.h 2006-11-22 01:11:09.493927956 +0100 +++ wireless-dev/net/wireless/core.h 2006-11-22 01:11:48.113927956 +0100 @@ -13,16 +13,21 @@ struct cfg80211_registered_driver { struct cfg80211_ops *ops; - int wiphy; - void *priv; + int padded; struct list_head list; /* we hold this mutex during any call so that * we cannot do multiple calls at once, and also * to avoid the deregister call to proceed while * any call is in progress */ struct mutex mtx; + struct wiphy wiphy; }; +static inline struct cfg80211_registered_driver *wiphy_to_drv(struct wiphy *wiphy) +{ + return container_of(wiphy, struct cfg80211_registered_driver, wiphy); +} + extern struct mutex cfg80211_drv_mutex; extern struct list_head cfg80211_drv_list; --- wireless-dev.orig/net/wireless/nl80211.c 2006-11-22 01:11:09.543927956 +0100 +++ wireless-dev/net/wireless/nl80211.c 2006-11-22 01:11:48.123927956 +0100 @@ -112,7 +112,7 @@ static int nl80211_get_cmdlist(struct sk goto put_drv; } - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy.wiphy_index); start = nla_nest_start(msg, NL80211_ATTR_CMDS); if (!start) @@ -178,7 +178,7 @@ static int nl80211_get_wiphys(struct sk_ indexstart = nla_nest_start(msg, idx++); if (!indexstart) goto nla_put_failure; - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy.wiphy_index); nla_nest_end(msg, indexstart); } mutex_unlock(&cfg80211_drv_mutex); @@ -248,7 +248,7 @@ static int nl80211_get_intfs(struct sk_b goto put_drv; } - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, drv->wiphy.wiphy_index); start = nla_nest_start(msg, NL80211_ATTR_INTERFACE_LIST); if (!start) { @@ -258,7 +258,7 @@ static int nl80211_get_intfs(struct sk_b cb.skb = msg; cb.idx = 1; - err = drv->ops->list_interfaces(drv->priv, &cb, addifidx); + err = drv->ops->list_interfaces(&drv->wiphy, &cb, addifidx); if (err) goto msg_free; @@ -300,7 +300,7 @@ static int nl80211_do_inject(struct sk_b goto unlock; } - err = drv->ops->inject_packet(drv->priv, + err = drv->ops->inject_packet(&drv->wiphy, nla_data(info->attrs[NL80211_ATTR_FRAME]), nla_len(info->attrs[NL80211_ATTR_FRAME]), flags, @@ -334,7 +334,7 @@ static int nl80211_add_virt_intf(struct goto unlock; } - err = drv->ops->add_virtual_intf(drv->priv, + err = drv->ops->add_virtual_intf(&drv->wiphy, nla_data(info->attrs[NL80211_ATTR_IFNAME]), type); unlock: @@ -359,7 +359,7 @@ static int nl80211_del_virt_intf(struct goto out; } - err = drv->ops->del_virtual_intf(drv->priv, ifindex); + err = drv->ops->del_virtual_intf(&drv->wiphy, ifindex); out: cfg80211_put_drv(drv); @@ -421,7 +421,7 @@ static int nl80211_configure(struct sk_b config.channel = nla_get_u32(attr); } - err = drv->ops->configure(drv->priv, dev, &config); + err = drv->ops->configure(&drv->wiphy, dev, &config); out: cfg80211_put_drv(drv); dev_put(dev); @@ -448,7 +448,7 @@ static int nl80211_get_config(struct sk_ memset(&config, 0, sizeof(config)); - drv->ops->get_config(drv->priv, dev, &config); + drv->ops->get_config(&drv->wiphy, dev, &config); hdr = nl80211msg_new(&msg, info->snd_pid, info->snd_seq, 0, NL80211_CMD_NEW_CONFIG); @@ -514,7 +514,7 @@ static int nl80211_set_roaming(struct sk goto out; } - err = drv->ops->set_roaming(drv->priv, dev, roaming_control); + err = drv->ops->set_roaming(&drv->wiphy, dev, roaming_control); out: cfg80211_put_drv(drv); dev_put(dev); @@ -538,7 +538,7 @@ static int nl80211_get_roaming(struct sk goto out_put_drv; } - err = drv->ops->get_roaming(drv->priv, dev); + err = drv->ops->get_roaming(&drv->wiphy, dev); if (err < 0) goto out_put_drv; @@ -586,7 +586,7 @@ static int nl80211_set_fixed_bssid(struc goto out; } - err = drv->ops->set_fixed_bssid(drv->priv, dev, bssid); + err = drv->ops->set_fixed_bssid(&drv->wiphy, dev, bssid); out: cfg80211_put_drv(drv); dev_put(dev); @@ -611,7 +611,7 @@ static int nl80211_get_fixed_bssid(struc goto out_put_drv; } - err = drv->ops->get_fixed_bssid(drv->priv, dev, bssid); + err = drv->ops->get_fixed_bssid(&drv->wiphy, dev, bssid); if (err < 0) goto out_put_drv; @@ -657,7 +657,7 @@ static int nl80211_get_association(struc goto out_put_drv; } - err = drv->ops->get_association(drv->priv, dev, bssid); + err = drv->ops->get_association(&drv->wiphy, dev, bssid); if (err < 0) goto out_put_drv; @@ -691,7 +691,7 @@ static int nl80211_assoc_deauth(struct s struct cfg80211_registered_driver *drv; int err; struct net_device *dev; - int (*act)(void *priv, struct net_device *dev); + int (*act)(struct wiphy *wiphy, struct net_device *dev); err = get_drv_dev_by_info_ifindex(info, &drv, &dev); if (err) @@ -716,7 +716,7 @@ static int nl80211_assoc_deauth(struct s goto out; } - err = act(drv->priv, dev); + err = act(&drv->wiphy, dev); out: cfg80211_put_drv(drv); dev_put(dev); @@ -778,7 +778,7 @@ static int nl80211_get_auth_list(struct cb.skb = msg; cb.idx = 1; - err = drv->ops->get_auth_list(drv->priv, dev, &cb, add_bssid); + err = drv->ops->get_auth_list(&drv->wiphy, dev, &cb, add_bssid); if (err) goto msg_free; @@ -874,7 +874,7 @@ static int nl80211_initiate_scan(struct params.channels = channels; params.n_channels = count; - err = drv->ops->initiate_scan(drv->priv, dev, ¶ms); + err = drv->ops->initiate_scan(&drv->wiphy, dev, ¶ms); kfree(channels); out: --- wireless-dev.orig/net/wireless/wext-compat.c 2006-11-22 01:11:09.593927956 +0100 +++ wireless-dev/net/wireless/wext-compat.c 2006-11-22 01:11:48.123927956 +0100 @@ -121,7 +121,7 @@ static int cfg80211_wx_set_commit(struct goto out; } - err = drv->ops->configure(drv->priv, net_dev, + err = drv->ops->configure(&drv->wiphy, net_dev, net_dev->cfg80211_wext_pending_config); kfree(net_dev->cfg80211_wext_pending_config); @@ -532,7 +532,7 @@ static int cfg80211_wx_set_essid(struct err = -ENOSYS; if (!drv->ops->configure || !drv->ops->get_config_valid) goto out; - if (!(drv->ops->get_config_valid(drv->priv, net_dev) + if (!(drv->ops->get_config_valid(&drv->wiphy, net_dev) & CFG80211_CFG_VALID_SSID)) goto out; --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ wireless-dev/net/wireless/sysfs.c 2006-11-22 01:11:48.123927956 +0100 @@ -0,0 +1,63 @@ +/* + * This file provides /sys/class/ieee80211/<wiphy name>/ + * and some default attributes. + * + * Copyright 2005-2006 Jiri Benc <jbenc@suse.cz> + * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> + * + * This file is GPLv2 as found in COPYING. + */ + +#include <net/cfg80211.h> +#include <linux/device.h> +#include "core.h" +static inline struct cfg80211_registered_driver *cdev_to_drv( + struct class_device *cdev) +{ + return container_of(cdev, struct cfg80211_registered_driver, wiphy.class_dev); +} + +static void wiphy_class_dev_release(struct class_device *cdev) +{ + struct cfg80211_registered_driver *drv = cdev_to_drv(cdev); + + mutex_destroy(&drv->mtx); + kfree((char*)drv - drv->padded); +} + +static int wiphy_uevent(struct class_device *cdev, char **envp, + int num_envp, char *buf, int size) +{ + return 0; +} + +static struct class ieee80211_class = { + .name = "ieee80211", + .release = wiphy_class_dev_release, +#ifdef CONFIG_HOTPLUG + .uevent = wiphy_uevent, +#endif +}; + +int wiphy_sysfs_init(void) +{ + return class_register(&ieee80211_class); +} + +void wiphy_sysfs_exit(void) +{ + class_unregister(&ieee80211_class); +} + +int wiphy_sysfs_add(struct wiphy *wiphy) +{ + wiphy->class_dev.class = &ieee80211_class; + wiphy->class_dev.class_data = wiphy; + class_device_initialize(&wiphy->class_dev); + return class_device_add(&wiphy->class_dev); +} + +void wiphy_sysfs_del(struct wiphy *wiphy) +{ + class_device_del(&wiphy->class_dev); +} --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ wireless-dev/net/wireless/sysfs.h 2006-11-22 01:11:48.133927956 +0100 @@ -0,0 +1,10 @@ +#ifndef __WIRELESS_SYSFS_H +#define __WIRELESS_SYSFS_H + +extern int wiphy_sysfs_init(void); +extern void wiphy_sysfs_exit(void); + +extern int wiphy_sysfs_add(struct wiphy *wiphy); +extern void wiphy_sysfs_del(struct wiphy *wiphy); + +#endif /* __WIRELESS_SYSFS_H */ --- wireless-dev.orig/net/wireless/Makefile 2006-11-22 01:11:09.743927956 +0100 +++ wireless-dev/net/wireless/Makefile 2006-11-22 01:11:48.133927956 +0100 @@ -1,7 +1,7 @@ obj-$(CONFIG_CFG80211) += cfg80211.o cfg80211-objs := \ - core.o nl80211.o + core.o nl80211.o sysfs.o obj-$(CONFIG_WIRELESS_EXT) += wext-old.o --- wireless-dev.orig/include/linux/netdevice.h 2006-11-22 19:56:00.209711991 +0100 +++ wireless-dev/include/linux/netdevice.h 2006-11-22 19:56:37.529711991 +0100 @@ -42,6 +42,8 @@ struct divert_blk; struct vlan_group; struct ethtool_ops; struct netpoll_info; +/* 802.11 specific */ +struct wiphy; /* source back-compat hooks */ #define SET_ETHTOOL_OPS(netdev,ops) \ ( (netdev)->ethtool_ops = (ops) ) @@ -390,7 +392,7 @@ struct net_device void *ip6_ptr; /* IPv6 specific data */ void *ec_ptr; /* Econet specific data */ void *ax25_ptr; /* AX.25 specific data */ - void *ieee80211_ptr; /* IEEE 802.11 specific data */ + struct wiphy *ieee80211_ptr; /* IEEE 802.11 specific data */ /* * Cache line mostly used on receive path (including eth_type_trans()) ^ permalink raw reply [flat|nested] 57+ messages in thread
* [RFC 2/3] d80211: use new wiphy stuff from cfg80211 2006-11-22 19:18 ` [RFC 0/3] more power to cfg80211 Johannes Berg 2006-11-22 19:22 ` [RFC 1/3] cfg80211: handle wiphy, use wiphy in netdev, do wiphy sysfs Johannes Berg @ 2006-11-22 19:24 ` Johannes Berg 2006-11-22 19:25 ` [RFC 3/3] bcm43xx: API update Johannes Berg 2006-12-11 13:03 ` [RFC 0/3] more power to cfg80211 Jiri Benc 3 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-22 19:24 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn This patch lets d80211 use the new wiphy stuff from cfg80211. Patch is large because cfg80211 requires the net_dev->ieee80211_ptr now. --- wireless-dev.orig/include/net/d80211.h 2006-11-22 20:10:20.029711991 +0100 +++ wireless-dev/include/net/d80211.h 2006-11-22 20:11:11.659711991 +0100 @@ -15,6 +15,7 @@ #include <linux/skbuff.h> #include <linux/wireless.h> #include <linux/device.h> +#include <net/cfg80211.h> #include "d80211_shared.h" /* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be @@ -425,21 +426,20 @@ typedef enum { * If you change something in here, call ieee80211_update_hw() to * notify the stack about the change. */ struct ieee80211_hw { - /* these are assigned by d80211, don't write */ - int index; + /* points to the cfg80211 wiphy for this piece. + * Note that you must fill in the perm_addr and dev + * fields of this structure. */ + struct wiphy *wiphy; + + /* assigned by d80211, don't write */ struct ieee80211_conf conf; /* Pointer to the private area that was - * allocated with this struct for you. */ + * allocated with this struct for you.*/ void *priv; /* The rest is information about your hardware */ - struct device *dev; - - /* permanent mac address */ - u8 perm_addr[ETH_ALEN]; - /* TODO: frame_type 802.11/802.3, sw_encryption requirements */ /* Some wireless LAN chipsets generate beacons in the hardware/firmware @@ -521,6 +521,16 @@ struct ieee80211_hw { int queues; }; +static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) +{ + hw->wiphy->dev = dev; +} + +static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) +{ + memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); +} + /* Configuration block used by the low-level driver to tell the 802.11 code * about supported hardware features and to pass function pointers to callback * functions. */ --- wireless-dev.orig/net/d80211/ieee80211.c 2006-11-22 20:10:20.089711991 +0100 +++ wireless-dev/net/d80211/ieee80211.c 2006-11-22 20:11:11.669711991 +0100 @@ -21,6 +21,7 @@ #include <net/iw_handler.h> #include <linux/compiler.h> #include <linux/bitmap.h> +#include <net/cfg80211.h> #include <net/d80211_common.h> #include <net/d80211_mgmt.h> @@ -32,6 +33,8 @@ #include "wme.h" #include "aes_ccm.h" #include "ieee80211_led.h" +#include "ieee80211_cfg.h" +#include "ieee80211_sysfs.h" /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ @@ -210,7 +213,7 @@ static void ieee80211_key_threshold_noti struct ieee80211_key *key, struct sta_info *sta) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sk_buff *skb; struct ieee80211_msg_key_notification *msg; @@ -1057,7 +1060,7 @@ __ieee80211_tx_prepare(struct ieee80211_ struct net_device *dev, struct ieee80211_tx_control *control) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; int hdrlen; @@ -1100,7 +1103,7 @@ __ieee80211_tx_prepare(struct ieee80211_ static int inline is_ieee80211_device(struct net_device *dev, struct net_device *master) { - return (dev->ieee80211_ptr == master->ieee80211_ptr); + return (wiphy_priv(dev->ieee80211_ptr) == wiphy_priv(master->ieee80211_ptr)); } /* Device in tx->dev has a reference added; use dev_put(tx->dev) when @@ -1197,7 +1200,7 @@ static int __ieee80211_tx(struct ieee802 static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, struct ieee80211_tx_control *control, int mgmt) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; ieee80211_tx_handler *handler; struct ieee80211_txrx_data tx; @@ -1427,7 +1430,7 @@ static int ieee80211_master_start_xmit(s static int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_tx_packet_data *pkt_data; struct ieee80211_sub_if_data *sdata; int ret = 1, head_need; @@ -1869,7 +1872,7 @@ static int __ieee80211_if_config(struct struct sk_buff *beacon) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_if_conf conf; if (!local->ops->config_interface || !netif_running(dev)) @@ -1902,7 +1905,7 @@ int ieee80211_if_config(struct net_devic int ieee80211_if_config_beacon(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sk_buff *skb; if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) @@ -1981,7 +1984,7 @@ static int ieee80211_change_mtu_apdev(st static void ieee80211_tx_timeout(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); printk(KERN_WARNING "%s: resetting interface.\n", dev->name); @@ -2005,7 +2008,7 @@ static int ieee80211_set_mac_address(str static void ieee80211_set_multicast_list(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); unsigned short flags; @@ -2083,7 +2086,7 @@ static struct net_device_stats *ieee8021 void ieee80211_if_shutdown(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ASSERT_RTNL(); @@ -2123,7 +2126,7 @@ static inline int identical_mac_addr_all static int ieee80211_master_open(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; int res = -EOPNOTSUPP; @@ -2139,7 +2142,7 @@ static int ieee80211_master_open(struct static int ieee80211_master_stop(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; tasklet_disable(&local->tx_pending_tasklet); @@ -2152,7 +2155,7 @@ static int ieee80211_master_stop(struct static int ieee80211_mgmt_open(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (!netif_running(local->mdev)) return -EOPNOTSUPP; @@ -2199,7 +2202,7 @@ static void ieee80211_start_hard_monitor static int ieee80211_open(struct net_device *dev) { struct ieee80211_sub_if_data *sdata, *nsdata; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_if_init_conf conf; int res; @@ -2279,7 +2282,7 @@ static int ieee80211_open(struct net_dev static int ieee80211_stop(struct net_device *dev) { struct ieee80211_sub_if_data *sdata; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); sdata = IEEE80211_DEV_TO_SUB_IF(dev); @@ -2640,7 +2643,7 @@ void ieee80211_rx_monitor(struct net_device *dev, struct sk_buff *skb, struct ieee80211_rx_status *status) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_frame_info *fi; struct ieee80211_sub_if_data *sdata; const size_t hlen = sizeof(struct ieee80211_frame_info) @@ -2747,7 +2750,7 @@ static void ap_sta_ps_start(struct net_d static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sk_buff *skb; int sent = 0; struct ieee80211_sub_if_data *sdata; @@ -4297,7 +4300,7 @@ static ieee80211_tx_handler ieee80211_tx int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct sta_info *sta; @@ -4386,7 +4389,7 @@ int ieee80211_init_rate_ctrl_alg(struct "algorithm\n", local->mdev->name); return -ENOENT; } - res = rate_control_add_attrs(ref, &local->class_dev.kobj); + res = rate_control_add_attrs(ref, &local->hw.wiphy->class_dev.kobj); if (res < 0) { printk(KERN_DEBUG "%s: Failed to register sysfs attributes " "for rate control\n", local->mdev->name); @@ -4397,7 +4400,7 @@ int ieee80211_init_rate_ctrl_alg(struct old = local->rate_ctrl; local->rate_ctrl = ref; if (old) { - rate_control_remove_attrs(ref, &local->class_dev.kobj); + rate_control_remove_attrs(ref, &local->hw.wiphy->class_dev.kobj); rate_control_put(old); sta_info_flush(local, NULL); } @@ -4416,51 +4419,61 @@ static void rate_control_deinitialize(st ref = local->rate_ctrl; local->rate_ctrl = NULL; - rate_control_remove_attrs(ref, &local->class_dev.kobj); + rate_control_remove_attrs(ref, &local->hw.wiphy->class_dev.kobj); rate_control_put(ref); } struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, - struct ieee80211_ops *ops) + struct ieee80211_ops *ops) { struct net_device *mdev; struct ieee80211_local *local; struct ieee80211_sub_if_data *sdata; int priv_size; - - local = ieee80211_dev_alloc(GFP_KERNEL); - if (!local) - return NULL; - - local->ops = ops; + struct wiphy *wiphy; /* Ensure 32-byte alignment of our private data and hw private data. - * Each net_device is followed by a sub_if_data which is used for - * interface specific information. + * We use the wiphy priv data for both our ieee80211_local and for + * the driver's private data * - * Sample memory map looks something like: - * - * 0000 ***************** - * * net_dev * - * 0160 ***************** - * * sub_if * - * 0b80 ***************** - * * hw_priv * - * 1664 ***************** - */ - priv_size = ((sizeof(struct ieee80211_sub_if_data) + + * In memory it'll be like this: + * + * +-------------------------+ + * | struct wiphy | + * +-------------------------+ + * | struct ieee80211_local | + * +-------------------------+ + * | driver's private data | + * +-------------------------+ + * + */ + priv_size = ((sizeof(struct ieee80211_local) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST) + priv_data_len; - mdev = alloc_netdev(priv_size, "wmaster%d", ether_setup); + + wiphy = wiphy_new(&d80211_config_ops, priv_size); + + if (!wiphy) + return NULL; + + local = wiphy->priv; + local->hw.wiphy = wiphy; + + local->hw.priv = (char *)local + + ((sizeof(struct ieee80211_local) + + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); + + local->ops = ops; + + /* for now, mdev needs sub_if_data :/ */ + mdev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), + "wmaster%d", ether_setup); if (!mdev) { - ieee80211_dev_free(local); + wiphy_free(wiphy); return NULL; } - mdev->ieee80211_ptr = local; - local->hw.priv = (char *)mdev->priv + - ((sizeof(struct ieee80211_sub_if_data) + - NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); + mdev->ieee80211_ptr = wiphy; local->mdev = mdev; local->rx_pre_handlers = ieee80211_rx_pre_handlers; @@ -4534,11 +4547,9 @@ int ieee80211_register_hw(struct ieee802 struct net_device *sta_dev; int result; - result = ieee80211_dev_alloc_index(local); + result = wiphy_register(local->hw.wiphy); if (result < 0) - return -1; - - local->class_dev.dev = local->hw.dev; + return result; result = ieee80211_dev_sysfs_add(local); if (result < 0) @@ -4562,21 +4573,14 @@ int ieee80211_register_hw(struct ieee802 goto fail_dev; } - memcpy(local->mdev->dev_addr, local->hw.perm_addr, ETH_ALEN); - SET_NETDEV_DEV(local->mdev, local->hw.dev); + memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN); + SET_NETDEV_DEV(local->mdev, local->hw.wiphy->dev); result = register_netdevice(local->mdev); if (result < 0) { rtnl_unlock(); goto fail_dev; } - result = sysfs_create_link(&local->class_dev.kobj, - &local->mdev->class_dev.kobj, - "master"); - if (result < 0) { - rtnl_unlock(); - goto fail_masterlink; - } result = ieee80211_sysfs_add_netdevice(local->mdev); if (result < 0) { rtnl_unlock(); @@ -4620,15 +4624,13 @@ fail_wep: fail_rate: ieee80211_sysfs_remove_netdevice(local->mdev); fail_if_sysfs: - sysfs_remove_link(&local->class_dev.kobj, "master"); -fail_masterlink: unregister_netdev(local->mdev); fail_dev: sta_info_stop(local); fail_sta_info: ieee80211_dev_sysfs_del(local); fail_sysfs: - ieee80211_dev_free_index(local); + wiphy_unregister(local->hw.wiphy); return result; } EXPORT_SYMBOL(ieee80211_register_hw); @@ -4677,8 +4679,6 @@ void ieee80211_unregister_hw(struct ieee if (local->apdev) ieee80211_if_del_mgmt(local); - sysfs_remove_link(&local->class_dev.kobj, "master"); - list_for_each_entry_safe(sdata, tmp, &local->sub_if_list, list) __ieee80211_if_del(local, sdata); @@ -4714,7 +4714,7 @@ void ieee80211_unregister_hw(struct ieee skb_queue_purge(&local->skb_queue); skb_queue_purge(&local->skb_queue_unreliable); - ieee80211_dev_free_index(local); + wiphy_unregister(local->hw.wiphy); ieee80211_led_exit(local); } EXPORT_SYMBOL(ieee80211_unregister_hw); @@ -4725,15 +4725,10 @@ void ieee80211_free_hw(struct ieee80211_ ieee80211_if_free(local->mdev); ieee80211_wep_free(local); - ieee80211_dev_free(local); + wiphy_free(local->hw.wiphy); } EXPORT_SYMBOL(ieee80211_free_hw); -void ieee80211_release_hw(struct ieee80211_local *local) -{ - kfree(local); -} - /* Perform netif operations on all configured interfaces */ int ieee80211_netif_oper(struct ieee80211_hw *hw, Netif_Oper op) { @@ -4831,22 +4826,13 @@ static int __init ieee80211_init(void) BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); - if ((ret = ieee80211_sysfs_init())) { - printk(KERN_WARNING "ieee80211_init: sysfs initialization " - "failed\n"); + ret = ieee80211_wme_register(); + if (ret) { + printk(KERN_DEBUG "ieee80211_init: failed to " + "initialize WME (err=%d)\n", ret); return ret; } - { - ret = ieee80211_wme_register(); - if (ret) { - printk(KERN_DEBUG "ieee80211_init: failed to " - "initialize WME (err=%d)\n", ret); - ieee80211_sysfs_deinit(); - return ret; - } - } - return 0; } @@ -4854,7 +4840,6 @@ static int __init ieee80211_init(void) static void __exit ieee80211_exit(void) { ieee80211_wme_unregister(); - ieee80211_sysfs_deinit(); } --- wireless-dev.orig/net/d80211/Makefile 2006-11-22 20:10:20.109711991 +0100 +++ wireless-dev/net/d80211/Makefile 2006-11-22 20:11:11.669711991 +0100 @@ -10,7 +10,6 @@ obj-$(CONFIG_D80211) += 80211.o rc80211_ wpa.o \ ieee80211_scan.o \ ieee80211_sta.o \ - ieee80211_dev.o \ ieee80211_iface.o \ ieee80211_rate.o \ ieee80211_sysfs.o \ @@ -19,6 +18,7 @@ obj-$(CONFIG_D80211) += 80211.o rc80211_ tkip.o \ aes_ccm.o \ wme.o \ + ieee80211_cfg.o \ $(80211-objs-y) ifeq ($(CONFIG_NET_SCHED),) --- wireless-dev.orig/net/d80211/ieee80211_dev.c 2006-11-22 20:10:20.119711991 +0100 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/kernel.h> -#include <linux/interrupt.h> -#include <linux/if.h> -#include <linux/if_ether.h> -#include <linux/netdevice.h> -#include <net/d80211.h> -#include "ieee80211_i.h" -#include "ieee80211_led.h" - -struct ieee80211_dev_list { - struct list_head list; - int dev_index; - struct ieee80211_local *local; -}; - -static LIST_HEAD(dev_list); -static DEFINE_SPINLOCK(dev_list_lock); - - -/* Caller must hold dev_list_lock */ -static struct ieee80211_dev_list *__ieee80211_dev_find(int index) -{ - struct ieee80211_dev_list *dev_item; - - list_for_each_entry(dev_item, &dev_list, list) { - if (dev_item->dev_index == index) - return dev_item; - } - return NULL; -} - -int ieee80211_dev_alloc_index(struct ieee80211_local *local) -{ - struct ieee80211_dev_list *dev_item, *new; - int index = 0; - - new = kmalloc(sizeof(struct ieee80211_dev_list), GFP_KERNEL); - if (!new) - return -ENOMEM; - new->local = local; - spin_lock(&dev_list_lock); - list_for_each_entry(dev_item, &dev_list, list) { - if (index < dev_item->dev_index) - break; - index++; - } - new->dev_index = index; - list_add_tail(&new->list, &dev_item->list); - spin_unlock(&dev_list_lock); - local->hw.index = index; - return index; -} - -void ieee80211_dev_free_index(struct ieee80211_local *local) -{ - struct ieee80211_dev_list *dev_item; - - spin_lock(&dev_list_lock); - dev_item = __ieee80211_dev_find(local->hw.index); - if (dev_item) - list_del(&dev_item->list); - spin_unlock(&dev_list_lock); - if (dev_item) - kfree(dev_item); - local->hw.index = -1; -} - -struct ieee80211_local *ieee80211_dev_find(int index) -{ - struct ieee80211_dev_list *dev_item; - - spin_lock(&dev_list_lock); - dev_item = __ieee80211_dev_find(index); - spin_unlock(&dev_list_lock); - return dev_item ? dev_item->local : NULL; -} - -int ieee80211_dev_find_index(struct ieee80211_local *local) -{ - struct ieee80211_dev_list *dev_item; - int index = -1; - - spin_lock(&dev_list_lock); - list_for_each_entry(dev_item, &dev_list, list) { - if (dev_item->local == local) { - index = dev_item->dev_index; - break; - } - } - spin_unlock(&dev_list_lock); - return index; -} - -struct ieee80211_local *ieee80211_dev_alloc(gfp_t flags) -{ - struct ieee80211_local *local; - - local = kzalloc(sizeof(struct ieee80211_local), flags); - if (!local) - return NULL; - local->hw.index = -1; - ieee80211_dev_sysfs_init(local); - return local; -} - -void ieee80211_dev_free(struct ieee80211_local *local) -{ - ieee80211_dev_sysfs_put(local); -} --- wireless-dev.orig/net/d80211/ieee80211_iface.c 2006-11-22 20:10:20.159711991 +0100 +++ wireless-dev/net/d80211/ieee80211_iface.c 2006-11-22 20:11:11.669711991 +0100 @@ -15,6 +15,7 @@ #include <net/d80211_mgmt.h> #include "ieee80211_i.h" #include "sta_info.h" +#include "ieee80211_sysfs.h" void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata) { @@ -41,7 +42,7 @@ int ieee80211_if_add(struct net_device * int format, struct net_device **new_dev) { struct net_device *ndev, *tmp_dev; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = NULL, *sdata_parent; int ret; int i; @@ -52,7 +53,7 @@ int ieee80211_if_add(struct net_device * if (!ndev) return -ENOMEM; - ndev->ieee80211_ptr = local; + ndev->ieee80211_ptr = local->hw.wiphy; if (strlen(name) == 0) { i = 0; do { @@ -70,13 +71,13 @@ int ieee80211_if_add(struct net_device * snprintf(ndev->name, IFNAMSIZ, "%s", name); } - memcpy(ndev->dev_addr, local->hw.perm_addr, ETH_ALEN); + memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN); ndev->base_addr = dev->base_addr; ndev->irq = dev->irq; ndev->mem_start = dev->mem_start; ndev->mem_end = dev->mem_end; ndev->flags = dev->flags & IFF_MULTICAST; - SET_NETDEV_DEV(ndev, local->hw.dev); + SET_NETDEV_DEV(ndev, local->hw.wiphy->dev); sdata = IEEE80211_DEV_TO_SUB_IF(ndev); sdata->type = IEEE80211_IF_TYPE_AP; @@ -122,9 +123,9 @@ int ieee80211_if_add_mgmt(struct ieee802 if (ret < 0) goto fail; - ndev->ieee80211_ptr = local; - memcpy(ndev->dev_addr, local->hw.perm_addr, ETH_ALEN); - SET_NETDEV_DEV(ndev, local->hw.dev); + ndev->ieee80211_ptr = local->hw.wiphy; + memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN); + SET_NETDEV_DEV(ndev, local->hw.wiphy->dev); nsdata = IEEE80211_DEV_TO_SUB_IF(ndev); nsdata->type = IEEE80211_IF_TYPE_MGMT; @@ -210,7 +211,7 @@ void ieee80211_if_set_type(struct net_de /* Must be called with rtnl lock held. */ void ieee80211_if_reinit(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct sta_info *sta; int i; @@ -319,7 +320,7 @@ void __ieee80211_if_del(struct ieee80211 /* Must be called with rtnl lock held. */ int ieee80211_if_remove(struct net_device *dev, const char *name, int id) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata, *n; ASSERT_RTNL(); @@ -337,7 +338,7 @@ int ieee80211_if_remove(struct net_devic void ieee80211_if_free(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); /* local->apdev must be NULL when freeing management interface */ @@ -349,7 +350,7 @@ void ieee80211_if_free(struct net_device /* Must be called with rtnl lock held. */ void ieee80211_if_flush(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata, *n; ASSERT_RTNL(); @@ -360,7 +361,7 @@ void ieee80211_if_flush(struct net_devic void ieee80211_if_del(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); rtnl_lock(); --- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-11-22 20:10:20.199711991 +0100 +++ wireless-dev/net/d80211/ieee80211_i.h 2006-11-22 20:11:11.679711991 +0100 @@ -342,8 +342,6 @@ struct ieee80211_local { int monitors; struct iw_statistics wstats; - struct class_device class_dev; - enum { IEEE80211_DEV_UNITIALIZED = 0, IEEE80211_DEV_REGISTERED, @@ -575,7 +573,6 @@ static inline void bss_tim_clear(struct } /* ieee80211.c */ -void ieee80211_release_hw(struct ieee80211_local *local); int ieee80211_hw_config(struct ieee80211_local *local); int ieee80211_if_config(struct net_device *dev); int ieee80211_if_config_beacon(struct net_device *dev); @@ -657,14 +654,6 @@ struct sta_info * ieee80211_ibss_add_sta int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason); int ieee80211_sta_disassociate(struct net_device *dev, u16 reason); -/* ieee80211_dev.c */ -int ieee80211_dev_alloc_index(struct ieee80211_local *local); -void ieee80211_dev_free_index(struct ieee80211_local *local); -struct ieee80211_local *ieee80211_dev_find(int index); -int ieee80211_dev_find_index(struct ieee80211_local *local); -struct ieee80211_local *ieee80211_dev_alloc(gfp_t flags); -void ieee80211_dev_free(struct ieee80211_local *local); - /* ieee80211_iface.c */ int ieee80211_if_add(struct net_device *dev, const char *name, int format, struct net_device **new_dev); @@ -680,17 +669,6 @@ void ieee80211_if_sdata_init(struct ieee int ieee80211_if_add_mgmt(struct ieee80211_local *local); void ieee80211_if_del_mgmt(struct ieee80211_local *local); -/* ieee80211_sysfs.c */ -int ieee80211_sysfs_add_netdevice(struct net_device *dev); -void ieee80211_sysfs_remove_netdevice(struct net_device *dev); -void ieee80211_dev_sysfs_init(struct ieee80211_local *local); -void ieee80211_dev_sysfs_put(struct ieee80211_local *local); -int ieee80211_dev_sysfs_add(struct ieee80211_local *local); -void ieee80211_dev_sysfs_del(struct ieee80211_local *local); -int ieee80211_sysfs_init(void); -void ieee80211_sysfs_deinit(void); -int ieee80211_sysfs_change_if_type(struct net_device *dev); - /* ieee80211_sysfs_sta.c */ int ieee80211_sta_kset_sysfs_register(struct ieee80211_local *local); void ieee80211_sta_kset_sysfs_unregister(struct ieee80211_local *local); --- wireless-dev.orig/net/d80211/ieee80211_led.c 2006-11-22 20:10:20.239711991 +0100 +++ wireless-dev/net/d80211/ieee80211_led.c 2006-11-22 20:11:11.679711991 +0100 @@ -39,7 +39,7 @@ void ieee80211_led_init(struct ieee80211 if (!local->rx_led) return; snprintf(local->rx_led_name, sizeof(local->rx_led_name), - "wiphy%drx", local->hw.index); + "wiphy%drx", local->hw.wiphy->wiphy_index); local->rx_led->name = local->rx_led_name; if (led_trigger_register(local->rx_led)) { kfree(local->rx_led); @@ -50,7 +50,7 @@ void ieee80211_led_init(struct ieee80211 if (!local->tx_led) return; snprintf(local->tx_led_name, sizeof(local->tx_led_name), - "wiphy%dtx", local->hw.index); + "wiphy%dtx", local->hw.wiphy->wiphy_index); local->tx_led->name = local->tx_led_name; if (led_trigger_register(local->tx_led)) { kfree(local->tx_led); --- wireless-dev.orig/net/d80211/ieee80211_sysfs.c 2006-11-22 20:10:20.279711991 +0100 +++ wireless-dev/net/d80211/ieee80211_sysfs.c 2006-11-22 20:11:11.679711991 +0100 @@ -13,11 +13,16 @@ #include <linux/netdevice.h> #include <linux/rtnetlink.h> #include <net/d80211.h> +#include <net/cfg80211.h> #include "ieee80211_i.h" #include "ieee80211_rate.h" -#define to_ieee80211_local(class) \ - container_of(class, struct ieee80211_local, class_dev) +static inline struct ieee80211_local *to_ieee80211_local(struct class_device *dev) +{ + struct wiphy *wiphy = container_of(dev, struct wiphy, class_dev); + return wiphy->priv; +} + #define to_net_dev(class) \ container_of(class, struct net_device, class_dev) @@ -65,45 +70,6 @@ static const char *ieee80211_mode_str(in /* attributes in /sys/class/ieee80211/phyX/ */ -static ssize_t store_add_iface(struct class_device *dev, - const char *buf, size_t len) -{ - struct ieee80211_local *local = to_ieee80211_local(dev); - struct net_device *new_dev; - int res; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - if (len > IFNAMSIZ) - return -EINVAL; - res = rtnl_lock_local(local); - if (res) - return res; - res = ieee80211_if_add(local->mdev, buf, 0, &new_dev); - if (res == 0) - ieee80211_if_set_type(new_dev, IEEE80211_IF_TYPE_STA); - rtnl_unlock(); - return res < 0 ? res : len; -} - -static ssize_t store_remove_iface(struct class_device *dev, - const char *buf, size_t len) -{ - struct ieee80211_local *local = to_ieee80211_local(dev); - int res; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - if (len > IFNAMSIZ) - return -EINVAL; - res = rtnl_lock_local(local); - if (res) - return res; - res = ieee80211_if_remove(local->mdev, buf, -1); - rtnl_unlock(); - return res < 0 ? res : len; -} - static ssize_t store_rate_ctrl_alg(struct class_device *dev, const char *buf, size_t len) { @@ -213,8 +179,6 @@ static ssize_t ieee80211_local_fmt_rate_ __IEEE80211_LOCAL_SHOW(rate_ctrl_alg); static struct class_device_attribute ieee80211_class_dev_attrs[] = { - __ATTR(add_iface, S_IWUGO, NULL, store_add_iface), - __ATTR(remove_iface, S_IWUGO, NULL, store_remove_iface), __ATTR(channel, S_IRUGO, ieee80211_local_show_channel, NULL), __ATTR(frequency, S_IRUGO, ieee80211_local_show_frequency, NULL), __ATTR(radar_detect, S_IRUGO, ieee80211_local_show_radar_detect, NULL), @@ -231,7 +195,6 @@ static struct class_device_attribute iee __ATTR(tx_power_reduction, S_IRUGO, ieee80211_local_show_tx_power_reduction, NULL), __ATTR(modes, S_IRUGO, ieee80211_local_show_modes, NULL), __ATTR(rate_ctrl_alg, S_IRUGO | S_IWUGO, ieee80211_local_show_rate_ctrl_alg, store_rate_ctrl_alg), - {} }; /* attributes in /sys/class/ieee80211/phyX/statistics/ */ @@ -624,72 +587,52 @@ static struct attribute_group ieee80211_ .attrs = ieee80211_monitor_attrs, }; -/* /sys/class/ieee80211/phyX functions */ - -static void ieee80211_class_dev_release(struct class_device *dev) +int ieee80211_dev_sysfs_add(struct ieee80211_local *local) { - ieee80211_release_hw(to_ieee80211_local(dev)); -} + const struct class_device_attribute *attr; + int i, err; -#ifdef CONFIG_HOTPLUG -static int ieee80211_uevent(struct class_device *cd, char **envp, - int num_envp, char *buf, int size) -{ - struct ieee80211_local *local = to_ieee80211_local(cd); + for (i = 0; i < ARRAY_SIZE(ieee80211_class_dev_attrs); i++) { + attr = &ieee80211_class_dev_attrs[i]; + err = sysfs_create_file(&local->hw.wiphy->class_dev.kobj, + &attr->attr); + if (err) + goto unwind; + } - if (num_envp < 2) - return -ENOMEM; - envp[0] = buf; - if (snprintf(buf, size, "IEEE80211_DEV=phy%d", - local->hw.index) + 1 >= size) - return -ENOMEM; - envp[1] = NULL; - return 0; -} -#endif + err = sysfs_create_group(&local->hw.wiphy->class_dev.kobj, + &ieee80211_stats_group); -static struct class ieee80211_class = { - .name = "ieee80211", - .class_dev_attrs = ieee80211_class_dev_attrs, - .release = ieee80211_class_dev_release, -#ifdef CONFIG_HOTPLUG - .uevent = ieee80211_uevent, -#endif -}; + if (err == 0) + return err; -void ieee80211_dev_sysfs_init(struct ieee80211_local *local) -{ - local->class_dev.class = &ieee80211_class; - local->class_dev.class_data = local; - class_device_initialize(&local->class_dev); + unwind: + /* one after the failed/last one */ + i--; + while (i >= 0) { + attr = &ieee80211_class_dev_attrs[i]; + sysfs_remove_file(&local->hw.wiphy->class_dev.kobj, + &attr->attr); + i--; + } + return err; } -void ieee80211_dev_sysfs_put(struct ieee80211_local *local) +void ieee80211_dev_sysfs_del(struct ieee80211_local *local) { - class_device_put(&local->class_dev); -} + const struct class_device_attribute *attr; + int i; -int ieee80211_dev_sysfs_add(struct ieee80211_local *local) -{ - int res; + sysfs_remove_group(&local->hw.wiphy->class_dev.kobj, + &ieee80211_stats_group); - snprintf(local->class_dev.class_id, BUS_ID_SIZE, - "phy%d", local->hw.index); - res = class_device_add(&local->class_dev); - if (res) - return res; - res = sysfs_create_group(&local->class_dev.kobj, - &ieee80211_stats_group); - if (res) - class_device_del(&local->class_dev); - return res; + for (i = 0; i < ARRAY_SIZE(ieee80211_class_dev_attrs); i++) { + attr = &ieee80211_class_dev_attrs[i]; + sysfs_remove_file(&local->hw.wiphy->class_dev.kobj, + &attr->attr); + } } -void ieee80211_dev_sysfs_del(struct ieee80211_local *local) -{ - sysfs_remove_group(&local->class_dev.kobj, &ieee80211_stats_group); - class_device_del(&local->class_dev); -} /* /sys/class/net/X functions */ @@ -748,11 +691,12 @@ int ieee80211_sysfs_change_if_type(struc int ieee80211_sysfs_add_netdevice(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int res; - res = sysfs_create_link(&dev->class_dev.kobj, &local->class_dev.kobj, - "hw"); + res = sysfs_create_link(&dev->class_dev.kobj, + &local->hw.wiphy->class_dev.kobj, + "wiphy"); if (res) goto err_out; res = ieee80211_add_if_group(&dev->class_dev.kobj, dev); @@ -773,15 +717,3 @@ void ieee80211_sysfs_remove_netdevice(st ieee80211_remove_if_group(&dev->class_dev.kobj, dev); sysfs_remove_link(&dev->class_dev.kobj, "hw"); } - -/* general module functions */ - -int ieee80211_sysfs_init(void) -{ - return class_register(&ieee80211_class); -} - -void ieee80211_sysfs_deinit(void) -{ - class_unregister(&ieee80211_class); -} --- wireless-dev.orig/net/d80211/Kconfig 2006-11-22 20:10:20.339711991 +0100 +++ wireless-dev/net/d80211/Kconfig 2006-11-22 20:11:11.679711991 +0100 @@ -3,6 +3,7 @@ config D80211 select CRYPTO select CRYPTO_ARC4 select CRYPTO_AES + select CFG80211 ---help--- This option enables the hardware independent IEEE 802.11 networking stack. --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ wireless-dev/net/d80211/ieee80211_cfg.c 2006-11-22 20:11:11.689711991 +0100 @@ -0,0 +1,32 @@ +/* + * d80211 configuration hooks for cfg80211 + * + * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> + * + * This file is GPLv2 as found in COPYING. + */ + +#include <net/cfg80211.h> +#include "ieee80211_i.h" +#include "ieee80211_cfg.h" + +static int ieee80211_list_interfaces(struct wiphy *wiphy, void *data, + int (*one)(void *data, int ifindex)) +{ + struct ieee80211_local *local = wiphy_priv(wiphy); + struct ieee80211_sub_if_data *subif; + int err; + + spin_lock_bh(&local->sub_if_lock); + list_for_each_entry(subif, &local->sub_if_list, list) { + err = one(data, subif->dev->ifindex); + if (err) + break; + } + spin_unlock_bh(&local->sub_if_lock); + return err; +} + +struct cfg80211_ops d80211_config_ops = { + .list_interfaces = ieee80211_list_interfaces, +}; --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ wireless-dev/net/d80211/ieee80211_cfg.h 2006-11-22 20:11:11.689711991 +0100 @@ -0,0 +1,9 @@ +/* + * d80211 configuration hooks for cfg80211 + */ +#ifndef __IEEE80211_CFG_H +#define __IEEE80211_CFG_H + +extern struct cfg80211_ops d80211_config_ops; + +#endif /* __IEEE80211_CFG_H */ --- wireless-dev.orig/net/d80211/ieee80211_sysfs_sta.c 2006-11-22 20:10:20.439711991 +0100 +++ wireless-dev/net/d80211/ieee80211_sysfs_sta.c 2006-11-22 20:11:11.689711991 +0100 @@ -39,7 +39,7 @@ static ssize_t show_sta_##name(const str #define STA_SHOW_RATE(name, field) \ static ssize_t show_sta_##name(const struct sta_info *sta, char *buf) \ { \ - struct ieee80211_local *local = sta->dev->ieee80211_ptr; \ + struct ieee80211_local *local = wiphy_priv(sta->dev->ieee80211_ptr);\ return sprintf(buf, "%d\n", \ (sta->field >= 0 && \ sta->field < local->num_curr_rates) ? \ @@ -370,7 +370,7 @@ int ieee80211_sta_kset_sysfs_register(st res = kobject_set_name(&local->sta_kset.kobj, "sta"); if (res) return res; - local->sta_kset.kobj.parent = &local->class_dev.kobj; + local->sta_kset.kobj.parent = &local->hw.wiphy->class_dev.kobj; local->sta_kset.ktype = &sta_ktype; return kset_register(&local->sta_kset); } --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ wireless-dev/net/d80211/ieee80211_sysfs.h 2006-11-22 20:11:11.689711991 +0100 @@ -0,0 +1,12 @@ +/* routines exported for sysfs handling */ + +#ifndef __IEEE80211_SYSFS_H +#define __IEEE80211_SYSFS_H + +int ieee80211_sysfs_add_netdevice(struct net_device *dev); +void ieee80211_sysfs_remove_netdevice(struct net_device *dev); +int ieee80211_sysfs_change_if_type(struct net_device *dev); +int ieee80211_dev_sysfs_add(struct ieee80211_local *local); +void ieee80211_dev_sysfs_del(struct ieee80211_local *local); + +#endif /* __IEEE80211_SYSFS_H */ --- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-11-22 20:10:20.469711991 +0100 +++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-11-22 20:11:11.699711991 +0100 @@ -117,7 +117,7 @@ static int ieee80211_ioctl_get_hw_featur struct prism2_hostapd_param *param, int param_len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); u8 *pos = param->u.hw_features.data; int left = param_len - (pos - (u8 *) param); int mode, i; @@ -168,7 +168,7 @@ static int ieee80211_ioctl_get_hw_featur static int ieee80211_ioctl_scan(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (!local->ops->passive_scan) return -EOPNOTSUPP; @@ -208,7 +208,7 @@ static int ieee80211_ioctl_scan(struct n static int ieee80211_ioctl_flush(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); sta_info_flush(local, NULL); return 0; } @@ -263,7 +263,7 @@ static void ieee80211_send_layer2_update static int ieee80211_ioctl_add_sta(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; u32 rates; int i, j; @@ -353,7 +353,7 @@ static int ieee80211_ioctl_add_sta(struc static int ieee80211_ioctl_remove_sta(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; sta = sta_info_get(local, param->sta_addr); @@ -369,7 +369,7 @@ static int ieee80211_ioctl_remove_sta(st static int ieee80211_ioctl_get_dot11counterstable(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_low_level_stats stats; memset(&stats, 0, sizeof(stats)); @@ -401,7 +401,7 @@ static int ieee80211_ioctl_get_dot11coun static int ieee80211_ioctl_get_info_sta(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && @@ -452,7 +452,7 @@ static int ieee80211_ioctl_get_info_sta( static int ieee80211_ioctl_set_flags_sta(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; sta = sta_info_get(local, param->sta_addr); @@ -483,7 +483,7 @@ int ieee80211_set_hw_encryption(struct n struct ieee80211_key *key) { struct ieee80211_key_conf *keyconf = NULL; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int rc = 0; /* default to sw encryption; this will be cleared by low-level @@ -516,7 +516,7 @@ static int ieee80211_set_encryption(stru int idx, int alg, int set_tx_key, int *err, const u8 *_key, size_t key_len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int ret = 0; struct sta_info *sta; struct ieee80211_key *key, *old_key; @@ -789,7 +789,7 @@ static int ieee80211_ioctl_get_encryptio struct prism2_hostapd_param *param, int param_len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int ret = 0; struct sta_info *sta; struct ieee80211_key **key; @@ -907,7 +907,7 @@ static int ieee80211_ioctl_get_encryptio static int ieee80211_ioctl_wpa_trigger(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && @@ -936,7 +936,7 @@ static int ieee80211_ioctl_set_rate_sets struct prism2_hostapd_param *param, int param_len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); u16 *pos = (u16 *) param->u.set_rate_sets.data; int left = param_len - ((u8 *) pos - (u8 *) param); int i, mode, num_supp, num_basic, *supp, *basic, *prev; @@ -1023,7 +1023,7 @@ static int ieee80211_ioctl_add_if(struct ieee80211_if_set_type(new_dev, IEEE80211_IF_TYPE_WDS); res = ieee80211_if_update_wds(new_dev, wds->remote_addr); if (res) - __ieee80211_if_del(dev->ieee80211_ptr, + __ieee80211_if_del(wiphy_priv(dev->ieee80211_ptr), IEEE80211_DEV_TO_SUB_IF(new_dev)); return res; case HOSTAP_IF_VLAN: @@ -1037,7 +1037,7 @@ static int ieee80211_ioctl_add_if(struct #if 0 res = ieee80211_if_update_vlan(new_dev, vlan->id); if (res) - __ieee80211_if_del(dev->ieee80211_ptr, + __ieee80211_if_del(wiphy_priv(dev->ieee80211_ptr), IEEE80211_DEV_TO_SUB_IF(new_dev)); #endif return res; @@ -1104,7 +1104,7 @@ static int ieee80211_ioctl_update_if(str if (param->u.if_info.type == HOSTAP_IF_WDS) { struct hostapd_if_wds *wds = (struct hostapd_if_wds *) param->u.if_info.data; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct net_device *wds_dev = NULL; struct ieee80211_sub_if_data *sdata; @@ -1141,7 +1141,7 @@ static int ieee80211_ioctl_scan_req(stru struct prism2_hostapd_param *param, int param_len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); u8 *pos = param->u.scan_req.ssid; int left = param_len - ((u8 *) pos - (u8 *) param); int len = param->u.scan_req.ssid_len; @@ -1176,7 +1176,7 @@ static int ieee80211_ioctl_sta_get_state static int ieee80211_ioctl_mlme(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; if (local->user_space_mlme) @@ -1199,7 +1199,7 @@ static int ieee80211_ioctl_mlme(struct n static int ieee80211_ioctl_get_load_stats(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); param->u.get_load_stats.channel_use = local->channel_use; /* if (param->u.get_load_stats.flags & LOAD_STATS_CLEAR) @@ -1212,7 +1212,7 @@ static int ieee80211_ioctl_get_load_stat static int ieee80211_ioctl_set_sta_vlan(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; sta = sta_info_get(local, param->sta_addr); @@ -1244,7 +1244,7 @@ static int ieee80211_ioctl_set_sta_vlan( static int ieee80211_set_gen_ie(struct net_device *dev, u8 *ie, size_t len) { struct ieee80211_sub_if_data *sdata; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (local->user_space_mlme) return -EOPNOTSUPP; @@ -1286,7 +1286,7 @@ ieee80211_ioctl_set_generic_info_elem(st static int ieee80211_ioctl_set_regulatory_domain(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_conf *conf = &local->hw.conf; conf->regulatory_domain = param->u.set_regulatory_domain.rd; return 0; @@ -1296,18 +1296,18 @@ static int ieee80211_ioctl_set_regulator static int ieee80211_ioctl_set_radio_enabled(struct net_device *dev, int val) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_conf *conf = &local->hw.conf; conf->radio_enabled = val; - return ieee80211_hw_config(dev->ieee80211_ptr); + return ieee80211_hw_config(wiphy_priv(dev->ieee80211_ptr)); } static int ieee80211_ioctl_set_tx_queue_params(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_tx_queue_params qparam; if (!local->ops->conf_tx) { @@ -1331,7 +1331,7 @@ ieee80211_ioctl_set_tx_queue_params(stru static int ieee80211_ioctl_get_tx_stats(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_tx_queue_stats stats; int ret, i; @@ -1356,7 +1356,7 @@ static int ieee80211_ioctl_get_tx_stats( static int ieee80211_ioctl_set_channel_flag(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_hw_modes *mode = NULL; struct ieee80211_channel *chan = NULL; int i; @@ -1392,7 +1392,7 @@ static int ieee80211_ioctl_set_channel_f static int ieee80211_ioctl_set_quiet_params(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_conf *conf = &local->hw.conf; conf->quiet_duration = param->u.quiet.duration; @@ -1405,7 +1405,7 @@ static int ieee80211_ioctl_set_quiet_par static int ieee80211_ioctl_set_radar_params(struct net_device *dev, struct prism2_hostapd_param *param) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_conf *conf = &local->hw.conf; conf->radar_firpwr_threshold = param->u.radar.radar_firpwr_threshold; @@ -1551,7 +1551,7 @@ static int ieee80211_ioctl_giwname(struc struct iw_request_info *info, char *name, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); switch (local->hw.conf.phymode) { case MODE_IEEE80211A: @@ -1705,7 +1705,7 @@ static void ieee80211_unmask_channel(str static int ieee80211_unmask_channels(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int m, c; for (m = 0; m < local->hw.num_modes; m++) { @@ -1806,7 +1806,7 @@ int ieee80211_ioctl_siwfreq(struct net_d struct iw_request_info *info, struct iw_freq *freq, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int m, c, nfreq, set = 0; /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ @@ -1859,7 +1859,7 @@ static int ieee80211_ioctl_giwfreq(struc struct iw_request_info *info, struct iw_freq *freq, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); /* TODO: in station mode (Managed/Ad-hoc) might need to poll low-level * driver for the current channel with firmware-based management */ @@ -1875,7 +1875,7 @@ static int ieee80211_ioctl_siwessid(stru struct iw_request_info *info, struct iw_point *data, char *ssid) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; size_t len = data->length; @@ -1943,7 +1943,7 @@ static int ieee80211_ioctl_siwap(struct struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; sdata = IEEE80211_DEV_TO_SUB_IF(dev); @@ -1992,7 +1992,7 @@ static int ieee80211_ioctl_siwscan(struc struct iw_request_info *info, struct iw_point *data, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); u8 *ssid = NULL; size_t ssid_len = 0; @@ -2020,7 +2020,7 @@ static int ieee80211_ioctl_giwscan(struc struct iw_point *data, char *extra) { int res; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (local->sta_scanning) return -EAGAIN; res = ieee80211_sta_scan_results(dev, extra, data->length); @@ -2037,7 +2037,7 @@ static int ieee80211_ioctl_siwrts(struct struct iw_request_info *info, struct iw_param *rts, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (rts->disabled) local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; @@ -2060,7 +2060,7 @@ static int ieee80211_ioctl_giwrts(struct struct iw_request_info *info, struct iw_param *rts, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); rts->value = local->rts_threshold; rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD); @@ -2074,7 +2074,7 @@ static int ieee80211_ioctl_siwfrag(struc struct iw_request_info *info, struct iw_param *frag, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (frag->disabled) local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; @@ -2101,7 +2101,7 @@ static int ieee80211_ioctl_giwfrag(struc struct iw_request_info *info, struct iw_param *frag, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); frag->value = local->fragmentation_threshold; frag->disabled = (frag->value >= IEEE80211_MAX_RTS_THRESHOLD); @@ -2115,7 +2115,7 @@ static int ieee80211_ioctl_siwretry(stru struct iw_request_info *info, struct iw_param *retry, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (retry->disabled || (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) @@ -2145,7 +2145,7 @@ static int ieee80211_ioctl_giwretry(stru struct iw_request_info *info, struct iw_param *retry, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); retry->disabled = 0; if ((retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) @@ -2180,7 +2180,7 @@ static void ieee80211_ioctl_unmask_chann static int ieee80211_ioctl_test_mode(struct net_device *dev, int mode) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int ret = -EOPNOTSUPP; if (mode == IEEE80211_TEST_UNMASK_CHANNELS) { @@ -2197,7 +2197,7 @@ static int ieee80211_ioctl_test_mode(str static int ieee80211_ioctl_clear_keys(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_key_conf key; int i; u8 addr[ETH_ALEN]; @@ -2254,7 +2254,7 @@ ieee80211_ioctl_force_unicast_rate(struc struct ieee80211_sub_if_data *sdata, int rate) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int i; if (sdata->type != IEEE80211_IF_TYPE_AP) @@ -2280,7 +2280,7 @@ ieee80211_ioctl_max_ratectrl_rate(struct struct ieee80211_sub_if_data *sdata, int rate) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int i; if (sdata->type != IEEE80211_IF_TYPE_AP) @@ -2368,7 +2368,7 @@ static int ieee80211_ioctl_prism2_param( struct iw_request_info *info, void *wrqu, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; int *i = (int *) extra; int param = *i; @@ -2619,7 +2619,7 @@ static int ieee80211_ioctl_get_prism2_pa struct iw_request_info *info, void *wrqu, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; int *param = (int *) extra; int ret = 0; @@ -2799,7 +2799,7 @@ static int ieee80211_ioctl_test_param(st struct iw_request_info *info, void *wrqu, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int *i = (int *) extra; int param = *i; int value = *(i + 1); @@ -2942,7 +2942,7 @@ static int ieee80211_ioctl_siwauth(struc struct iw_request_info *info, struct iw_param *data, char *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); int ret = 0; @@ -2998,7 +2998,7 @@ static int ieee80211_ioctl_siwauth(struc /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *net_dev) { - struct ieee80211_local *local = net_dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(net_dev->ieee80211_ptr); struct iw_statistics * wstats = &local->wstats; struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(net_dev); struct sta_info *sta; --- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-11-22 20:10:20.509711991 +0100 +++ wireless-dev/net/d80211/ieee80211_sta.c 2006-11-22 20:11:11.709711991 +0100 @@ -230,7 +230,7 @@ static void ieee80211_sta_wmm_params(str struct ieee80211_if_sta *ifsta, u8 *wmm_param, size_t wmm_param_len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_tx_queue_params params; size_t left; int count; @@ -464,7 +464,7 @@ static void ieee80211_authenticate(struc static void ieee80211_send_assoc(struct net_device *dev, struct ieee80211_if_sta *ifsta) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sk_buff *skb; struct ieee80211_mgmt *mgmt; u8 *pos, *ies; @@ -684,7 +684,7 @@ static void ieee80211_associate(struct n static void ieee80211_associated(struct net_device *dev, struct ieee80211_if_sta *ifsta) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; int disassoc; @@ -747,7 +747,7 @@ static void ieee80211_associated(struct static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, u8 *ssid, size_t ssid_len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sk_buff *skb; struct ieee80211_mgmt *mgmt; u8 *pos, *supp_rates, *esupp_rates = NULL; @@ -1077,7 +1077,7 @@ static void ieee80211_rx_mgmt_assoc_resp struct ieee80211_rx_status *rx_status, int reassoc) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; u32 rates; u16 capab_info, status_code, aid; @@ -1208,7 +1208,7 @@ static void ieee80211_rx_mgmt_assoc_resp static void __ieee80211_rx_bss_hash_add(struct net_device *dev, struct ieee80211_sta_bss *bss) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); bss->hnext = local->sta_bss_hash[STA_HASH(bss->bssid)]; local->sta_bss_hash[STA_HASH(bss->bssid)] = bss; } @@ -1218,7 +1218,7 @@ static void __ieee80211_rx_bss_hash_add( static void __ieee80211_rx_bss_hash_del(struct net_device *dev, struct ieee80211_sta_bss *bss) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sta_bss *b, *prev = NULL; b = local->sta_bss_hash[STA_HASH(bss->bssid)]; while (b) { @@ -1239,7 +1239,7 @@ static void __ieee80211_rx_bss_hash_del( static struct ieee80211_sta_bss * ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sta_bss *bss; bss = kmalloc(sizeof(*bss), GFP_ATOMIC); @@ -1262,7 +1262,7 @@ ieee80211_rx_bss_add(struct net_device * static struct ieee80211_sta_bss * ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sta_bss *bss; spin_lock_bh(&local->sta_bss_lock); @@ -1291,7 +1291,7 @@ static void ieee80211_rx_bss_free(struct static void ieee80211_rx_bss_put(struct net_device *dev, struct ieee80211_sta_bss *bss) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (!atomic_dec_and_test(&bss->users)) return; @@ -1305,7 +1305,7 @@ static void ieee80211_rx_bss_put(struct void ieee80211_rx_bss_list_init(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); spin_lock_init(&local->sta_bss_lock); INIT_LIST_HEAD(&local->sta_bss_list); } @@ -1313,7 +1313,7 @@ void ieee80211_rx_bss_list_init(struct n void ieee80211_rx_bss_list_deinit(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sta_bss *bss, *tmp; list_for_each_entry_safe(bss, tmp, &local->sta_bss_list, list) @@ -1327,7 +1327,7 @@ static void ieee80211_rx_bss_info(struct struct ieee80211_rx_status *rx_status, int beacon) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee802_11_elems elems; size_t baselen; int channel, invalid = 0, clen; @@ -1573,7 +1573,7 @@ static void ieee80211_rx_mgmt_beacon(str size_t len, struct ieee80211_rx_status *rx_status) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; struct ieee80211_if_sta *ifsta; int use_protection; @@ -1631,7 +1631,7 @@ static void ieee80211_rx_mgmt_probe_req( size_t len, struct ieee80211_rx_status *rx_status) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); int tx_last_beacon; struct sk_buff *skb; @@ -1784,7 +1784,7 @@ void ieee80211_sta_rx_scan(struct net_de static int ieee80211_sta_active_ibss(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int active = 0; struct sta_info *sta; @@ -1805,7 +1805,7 @@ static int ieee80211_sta_active_ibss(str static void ieee80211_sta_expire(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta, *tmp; spin_lock_bh(&local->sta_lock); @@ -1890,7 +1890,7 @@ void ieee80211_sta_work(void *ptr) static void ieee80211_sta_new_auth(struct net_device *dev, struct ieee80211_if_sta *ifsta) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); if (sdata->type != IEEE80211_IF_TYPE_STA) @@ -1951,7 +1951,7 @@ static int ieee80211_sta_join_ibss(struc struct ieee80211_if_sta *ifsta, struct ieee80211_sta_bss *bss) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct iw_freq rq; int res, rates, i, j; struct sk_buff *skb; @@ -2112,7 +2112,7 @@ static int ieee80211_sta_join_ibss(struc static int ieee80211_sta_create_ibss(struct net_device *dev, struct ieee80211_if_sta *ifsta) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sta_bss *bss; struct ieee80211_sub_if_data *sdata; u8 bssid[ETH_ALEN], *pos; @@ -2169,7 +2169,7 @@ static int ieee80211_sta_create_ibss(str static int ieee80211_sta_find_ibss(struct net_device *dev, struct ieee80211_if_sta *ifsta) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sta_bss *bss; int found = 0; u8 bssid[ETH_ALEN]; @@ -2259,7 +2259,7 @@ int ieee80211_sta_set_ssid(struct net_de { struct ieee80211_sub_if_data *sdata; struct ieee80211_if_sta *ifsta; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (len > IEEE80211_MAX_SSID_LEN) return -EINVAL; @@ -2356,7 +2356,7 @@ int ieee80211_sta_set_bssid(struct net_d static void ieee80211_sta_save_oper_chan(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); local->scan_oper_channel = local->hw.conf.channel; local->scan_oper_channel_val = local->hw.conf.channel_val; local->scan_oper_power_level = local->hw.conf.power_level; @@ -2368,7 +2368,7 @@ static void ieee80211_sta_save_oper_chan static int ieee80211_sta_restore_oper_chan(struct net_device *dev) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); local->hw.conf.channel = local->scan_oper_channel; local->hw.conf.channel_val = local->scan_oper_channel_val; local->hw.conf.power_level = local->scan_oper_power_level; @@ -2429,7 +2429,7 @@ EXPORT_SYMBOL(ieee80211_scan_completed); static void ieee80211_sta_scan_work(void *ptr) { struct net_device *dev = ptr; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_hw_modes *mode; struct ieee80211_channel *chan; @@ -2519,7 +2519,7 @@ static void ieee80211_sta_scan_work(void int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); if (ssid_len > IEEE80211_MAX_SSID_LEN) return -EINVAL; @@ -2587,7 +2587,7 @@ ieee80211_sta_scan_result(struct net_dev struct ieee80211_sta_bss *bss, char *current_ev, char *end_buf) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct iw_event iwe; if (time_after(jiffies, @@ -2755,7 +2755,7 @@ ieee80211_sta_scan_result(struct net_dev int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); char *current_ev = buf; char *end_buf = buf + len; struct ieee80211_sta_bss *bss; @@ -2802,7 +2802,7 @@ struct sta_info * ieee80211_ibss_add_sta struct sk_buff *skb, u8 *bssid, u8 *addr) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct sta_info *sta; struct ieee80211_sub_if_data *sdata = NULL; struct net_device *sta_dev = NULL; --- wireless-dev.orig/net/d80211/rc80211_simple.c 2006-11-22 20:10:20.549711991 +0100 +++ wireless-dev/net/d80211/rc80211_simple.c 2006-11-22 20:11:11.709711991 +0100 @@ -124,7 +124,7 @@ static void rate_control_simple_tx_statu struct sk_buff *skb, struct ieee80211_tx_status *status) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; struct sta_info *sta; struct sta_rate_control *srctrl; @@ -216,7 +216,7 @@ rate_control_simple_get_rate(void *priv, struct sk_buff *skb, struct rate_control_extra *extra) { - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; struct sta_info *sta; --- wireless-dev.orig/net/d80211/wme.c 2006-11-22 20:10:20.609711991 +0100 +++ wireless-dev/net/d80211/wme.c 2006-11-22 20:11:11.719711991 +0100 @@ -175,7 +175,7 @@ static inline int wme_downgrade_ac(struc * negative return value indicates to drop the frame */ static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd) { - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_tx_packet_data *pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; @@ -226,7 +226,7 @@ static inline int classify80211(struct s static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd) { - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_sched_data *q = qdisc_priv(qd); struct ieee80211_tx_packet_data *pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; @@ -313,7 +313,7 @@ static struct sk_buff *wme_qdiscop_deque { struct ieee80211_sched_data *q = qdisc_priv(qd); struct net_device *dev = qd->dev; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; struct sk_buff *skb; struct Qdisc *qdisc; @@ -349,7 +349,7 @@ static struct sk_buff *wme_qdiscop_deque static void wme_qdiscop_reset(struct Qdisc* qd) { struct ieee80211_sched_data *q = qdisc_priv(qd); - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; int queue; @@ -366,7 +366,7 @@ static void wme_qdiscop_reset(struct Qdi static void wme_qdiscop_destroy(struct Qdisc* qd) { struct ieee80211_sched_data *q = qdisc_priv(qd); - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; struct tcf_proto *tp; int queue; @@ -407,7 +407,7 @@ static int wme_qdiscop_init(struct Qdisc { struct ieee80211_sched_data *q = qdisc_priv(qd); struct net_device *dev = qd->dev; - struct ieee80211_local *local = dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr); int queues = local->hw.queues; int err = 0, i; @@ -462,7 +462,7 @@ static int wme_classop_graft(struct Qdis struct Qdisc *new, struct Qdisc **old) { struct ieee80211_sched_data *q = qdisc_priv(qd); - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; unsigned long queue = arg - 1; @@ -486,7 +486,7 @@ static struct Qdisc * wme_classop_leaf(struct Qdisc *qd, unsigned long arg) { struct ieee80211_sched_data *q = qdisc_priv(qd); - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; unsigned long queue = arg - 1; @@ -499,7 +499,7 @@ wme_classop_leaf(struct Qdisc *qd, unsig static unsigned long wme_classop_get(struct Qdisc *qd, u32 classid) { - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; unsigned long queue = TC_H_MIN(classid); @@ -527,7 +527,7 @@ static int wme_classop_change(struct Qdi struct rtattr **tca, unsigned long *arg) { unsigned long cl = *arg; - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; /* printk(KERN_DEBUG "entering %s\n", __func__); */ @@ -545,7 +545,7 @@ static int wme_classop_change(struct Qdi * when we add WMM-SA support - TSPECs may be deleted here */ static int wme_classop_delete(struct Qdisc *qd, unsigned long cl) { - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; /* printk(KERN_DEBUG "entering %s\n", __func__); */ @@ -559,7 +559,7 @@ static int wme_classop_dump_class(struct struct sk_buff *skb, struct tcmsg *tcm) { struct ieee80211_sched_data *q = qdisc_priv(qd); - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; /* printk(KERN_DEBUG "entering %s\n", __func__); */ @@ -574,7 +574,7 @@ static int wme_classop_dump_class(struct static void wme_classop_walk(struct Qdisc *qd, struct qdisc_walker *arg) { - struct ieee80211_local *local = qd->dev->ieee80211_ptr; + struct ieee80211_local *local = wiphy_priv(qd->dev->ieee80211_ptr); struct ieee80211_hw *hw = &local->hw; int queue; /* printk(KERN_DEBUG "entering %s\n", __func__); */ ^ permalink raw reply [flat|nested] 57+ messages in thread
* [RFC 3/3] bcm43xx: API update 2006-11-22 19:18 ` [RFC 0/3] more power to cfg80211 Johannes Berg 2006-11-22 19:22 ` [RFC 1/3] cfg80211: handle wiphy, use wiphy in netdev, do wiphy sysfs Johannes Berg 2006-11-22 19:24 ` [RFC 2/3] d80211: use new wiphy stuff from cfg80211 Johannes Berg @ 2006-11-22 19:25 ` Johannes Berg 2006-12-11 13:03 ` [RFC 0/3] more power to cfg80211 Jiri Benc 3 siblings, 0 replies; 57+ messages in thread From: Johannes Berg @ 2006-11-22 19:25 UTC (permalink / raw) To: Jiri Benc Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn Slight API changes in d80211 due to the introduction of wiphy. --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-22 20:10:14.859711991 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 2006-11-22 20:11:13.679711991 +0100 @@ -308,7 +308,8 @@ void bcm43xx_debugfs_add_device(struct b bcm->dfsentry = e; - snprintf(devdir, sizeof(devdir), "wiphy%d", bcm->ieee->index); + /* FIXME: should cfg80211 provide a debugfs dir that follows the renaming? */ + snprintf(devdir, sizeof(devdir), "wiphy%d", bcm->ieee->wiphy->wiphy_index); e->subdir = debugfs_create_dir(devdir, fs.root); e->dentry_tsf = debugfs_create_file("tsf", 0666, e->subdir, bcm, &tsf_fops); --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c 2006-11-22 20:10:14.969711991 +0100 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c 2006-11-22 20:11:13.689711991 +0100 @@ -3179,7 +3179,8 @@ bcm->wlcore = active_core; goto error; bcm43xx_macfilter_clear(bcm, BCM43xx_MACFILTER_ASSOC); - bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->ieee->perm_addr)); + bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, + (u8 *)(bcm->ieee->wiphy->perm_addr)); bcm43xx_security_init(bcm); bcm43xx_measure_channel_change_time(bcm); ieee80211_update_hw(bcm->ieee); @@ -3446,9 +3447,9 @@ bcm->wlcore = bcm->wlcores[i]; /* Set the MAC address in the networking subsystem */ if (is_valid_ether_addr(bcm->sprom.r1.et1mac)) - memcpy(bcm->ieee->perm_addr, bcm->sprom.r1.et1mac, 6); + SET_IEEE80211_PERM_ADDR(bcm->ieee, bcm->sprom.r1.et1mac); else - memcpy(bcm->ieee->perm_addr, bcm->sprom.r1.il0mac, 6); + SET_IEEE80211_PERM_ADDR(bcm->ieee, bcm->sprom.r1.il0mac); bcm43xx_setup_modes(bcm); assert(err == 0); @@ -3969,7 +3970,7 @@ static int __devinit bcm43xx_init_one(st IEEE80211_HW_WEP_INCLUDE_IV; hw->maxssi = BCM43xx_RX_MAX_SSI; hw->queues = 1; - hw->dev = &pdev->dev; + SET_IEEE80211_DEV(hw, &pdev->dev); /* initialize the bcm43xx_private struct */ bcm = bcm43xx_priv(hw); ^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [RFC 0/3] more power to cfg80211 2006-11-22 19:18 ` [RFC 0/3] more power to cfg80211 Johannes Berg ` (2 preceding siblings ...) 2006-11-22 19:25 ` [RFC 3/3] bcm43xx: API update Johannes Berg @ 2006-12-11 13:03 ` Jiri Benc 3 siblings, 0 replies; 57+ messages in thread From: Jiri Benc @ 2006-12-11 13:03 UTC (permalink / raw) To: Johannes Berg Cc: netdev, John W. Linville, Simon Barber, Jouni Malinen, Hong Liu, David Kimdon, Michael Wu, Michael Buesch, Ivo van Doorn On Wed, 22 Nov 2006 20:18:53 +0100, Johannes Berg wrote: > The following patches are mostly proof-of-concept code for moving over > stuff to cfg80211 (like the wiphy thing). > > I've changed net_dev->ieee80211_ptr to be of struct wiphy because it > allows accessing the wiphy by netdev easily then, and since wireless > drivers are (after these patches) expected to register with cfg80211 > anyway it doesn't really change much. They need wiphy_priv() then but > it's tiny. Sorry for the late answer. I like the concept and think this is a way to go. Thanks, Jiri -- Jiri Benc SUSE Labs ^ permalink raw reply [flat|nested] 57+ messages in thread
end of thread, other threads:[~2006-12-11 13:03 UTC | newest]
Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg
2006-11-17 22:50 ` [PATCH] d80211: remove useless driver name field Johannes Berg
2006-11-20 18:32 ` Jouni Malinen
2006-11-20 18:40 ` Johannes Berg
2006-11-20 22:21 ` Christoph Hellwig
2006-11-20 22:33 ` Johannes Berg
2006-11-20 18:44 ` Michael Wu
2006-11-17 23:24 ` [PATCH 0/10] d80211: move away from wmaster towards wiphy Pavel Roskin
2006-11-18 0:16 ` Johannes Berg
2006-11-18 23:53 ` [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Johannes Berg
2006-11-19 16:16 ` Michael Buesch
2006-11-19 0:04 ` [PATCH] d80211: remove calib_int Johannes Berg
2006-11-19 0:21 ` [PATCH] d80211: fix scan issues with new ops Johannes Berg
2006-11-19 15:56 ` David Kimdon
2006-11-19 16:34 ` Johannes Berg
2006-11-19 16:50 ` Johannes Berg
2006-11-19 16:55 ` David Kimdon
2006-11-19 16:57 ` Johannes Berg
2006-11-19 17:25 ` David Kimdon
2006-11-19 17:54 ` Johannes Berg
2006-11-19 16:15 ` Michael Buesch
2006-11-19 16:35 ` Johannes Berg
2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg
2006-11-19 19:22 ` [PATCH 1/13] d80211: clean up some stupid list and loop code Johannes Berg
2006-11-20 11:01 ` Jiri Benc
2006-11-20 11:58 ` Johannes Berg
2006-11-20 18:55 ` Johannes Berg
2006-11-19 19:23 ` [PATCH 2/13] d80211: reduce mdev usage Johannes Berg
2006-11-19 19:23 ` [PATCH 3/13] " Johannes Berg
2006-11-19 19:26 ` [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt Johannes Berg
2006-11-20 12:08 ` Jiri Benc
2006-11-20 12:25 ` Johannes Berg
2006-11-19 19:27 ` [PATCH 5/13] d80211: reduce master ieee80211_ptr deref in scan routines Johannes Berg
2006-11-19 19:28 ` [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw Johannes Berg
2006-11-20 17:57 ` Jiri Benc
2006-11-20 18:04 ` Johannes Berg
2006-11-20 18:52 ` Johannes Berg
2006-11-20 22:45 ` Johannes Berg
2006-11-21 17:48 ` [PATCH] d80211: use ieee80211_hw.dev Johannes Berg
2006-11-19 19:29 ` [PATCH 7/13] d80211: add a perm_addr hardware property Johannes Berg
2006-11-19 23:20 ` Johannes Berg
2006-11-20 18:54 ` Johannes Berg
2006-11-19 19:29 ` [PATCH 8/13] d80211: introduce IEEE80211_HW_FRAG flag Johannes Berg
2006-11-19 19:30 ` [PATCH 9/13] d80211: remove useless driver name field Johannes Berg
2006-11-19 19:31 ` [PATCH 10/13] bcm43xx: update to new d80211 driver API Johannes Berg
2006-11-19 19:43 ` Michael Buesch
2006-11-19 19:52 ` Johannes Berg
2006-11-19 19:31 ` [PATCH 11/13] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Johannes Berg
2006-11-19 19:32 ` [PATCH 12/13] d80211: remove calib_int Johannes Berg
2006-11-19 19:33 ` [PATCH 13/13] d80211: fix scan issues with new ops Johannes Berg
2006-11-19 23:32 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg
2006-11-20 19:14 ` Jiri Benc
2006-11-22 19:18 ` [RFC 0/3] more power to cfg80211 Johannes Berg
2006-11-22 19:22 ` [RFC 1/3] cfg80211: handle wiphy, use wiphy in netdev, do wiphy sysfs Johannes Berg
2006-11-22 19:24 ` [RFC 2/3] d80211: use new wiphy stuff from cfg80211 Johannes Berg
2006-11-22 19:25 ` [RFC 3/3] bcm43xx: API update Johannes Berg
2006-12-11 13:03 ` [RFC 0/3] more power to cfg80211 Jiri Benc
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).