Skip to contentSkip to conversation

d80211: move away from wmaster towards wiphy

PATCH In review Johannes Berg 8 participants 57 messages Nov 17, 2006 – Dec 11, 2006

Subsystems (4)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

cover d80211: move away from wmaster towards wiphy

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

author maintainer
#1 lore raw

PATCH 1/1 d80211: remove useless driver name field

struct ieee80211_ops has a driver name field that's never used. Remove it.

---
applies after the 10 patches

include/net/d80211.h +0 -3
@@ -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
#2 lore raw

Re: [PATCH] d80211: remove useless driver name field

include/net/d80211.h struct ieee80211_wiphy { · line 536

Quoted 7 lines · Johannes Berg

struct ieee80211_ops has a driver name field that's never used. Remove it.

struct ieee80211_ops {

include/net/d80211.h +0 -3
-	/* 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.

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
author maintainer
#3 lore raw

Re: [PATCH] d80211: remove useless driver name field

Quoted 11 lines · Jouni Malinen

include/net/d80211.h struct ieee80211_wiphy { · line 536

Quoted 7 lines · Johannes Berg

struct ieee80211_ops has a driver name field that's never used. Remove it.

struct ieee80211_ops {

include/net/d80211.h +0 -3
-	/* 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.

Quoted 6 lines

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

#4 lore raw

Re: [PATCH] d80211: remove useless driver name field

Quoted 22 lines · Johannes Berg
Quoted 11 lines · Jouni Malinen

include/net/d80211.h struct ieee80211_wiphy { · line 536

Quoted 7 lines · Johannes Berg

struct ieee80211_ops has a driver name field that's never used. Remove it.

struct ieee80211_ops {

include/net/d80211.h +0 -3
-	/* 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.

Quoted 6 lines

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.

Quoted 2 lines

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.

author maintainer
#5 lore raw

Re: [PATCH] d80211: remove useless driver name field

Quoted 2 lines · Christoph Hellwig

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

#6 lore raw

Re: [PATCH] d80211: remove useless driver name field

In reply to Jouni Malinen
Quoted 6 lines · Jouni Malinen

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

#7 lore raw
In reply to Johannes Berg

Hello Johannes,

Quoted 2 lines · Johannes Berg

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.

Quoted 5 lines

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).

Signature · 2 lines
Regards,
Pavel Roskin
author maintainer
#8 lore raw
In reply to Johannes Berg
Quoted 2 lines

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 :)

drivers/net/wireless/d80211/bcm43xx/Makefile +1 -1
@@ -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)
drivers/net/wireless/d80211/bcm43xx/bcm43xx.h +4 -11
@@ -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). */
drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +2 -2
@@ -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);
drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c +3 -4
@@ -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;
 	}
 }
drivers/net/wireless/d80211/bcm43xx/bcm43xx_ethtool.c deleted +0 -51

51 lines not on this page · raw message

drivers/net/wireless/d80211/bcm43xx/bcm43xx_ethtool.h deleted +0 -8
@@ -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_ */
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +106 -140

554 lines not on this page · raw message

drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c +1 -1
@@ -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;
 
drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c +1 -1
@@ -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,
author maintainer
#9 lore raw

PATCH 1/1 d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT

In reply to Johannes Berg

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.

---
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(-)
include/net/d80211.h +2 -4
@@ -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
net/d80211/ieee80211.c +3 -6
@@ -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);
net/d80211/ieee80211_ioctl.c +1 -3
@@ -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;
net/d80211/wpa.c +7 -20
@@ -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;
Acked-by on v1 1/1
#10 lore raw

Re: [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT

Quoted 7 lines · Johannes Berg

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.

These two conf options are really useless. So yes, please remove them.

Quoted 181 lines

---
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(-)
include/net/d80211.h +2 -4
@@ -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
net/d80211/ieee80211.c +3 -6
@@ -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);
net/d80211/ieee80211_ioctl.c +1 -3
@@ -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;
net/d80211/wpa.c +7 -20
@@ -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;
Signature · 1 line
Greetings Michael.
author maintainer
#11 lore raw

PATCH 1/1 d80211: remove calib_int

In reply to Johannes Berg

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.

---
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(-)
include/net/d80211.h +0 -2
@@ -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;
 
net/d80211/ieee80211.c +0 -1
@@ -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;
net/d80211/ieee80211_ioctl.c +0 -10
@@ -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;
net/d80211/ieee80211_sysfs.c +0 -2
@@ -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),
author maintainer
#12 lore raw

PATCH 1/1 d80211: fix scan issues with new ops

In reply to Johannes Berg

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.

---
more fallout from my earlier patches... this time it's the scanning ops that were still used as flags as well as ops.

include/net/d80211.h +8 -1
@@ -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);
 
net/d80211/ieee80211_sta.c +1 -1
@@ -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) {
net/d80211/ieee80211_scan.c +2 -1
@@ -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);
#13 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

Quoted 3 lines · Johannes Berg

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

author maintainer
#14 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

Quoted 4 lines · David Kimdon

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

author maintainer
#15 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

Quoted 3 lines · Johannes Berg

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

#16 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

In reply to Johannes Berg
Quoted 10 lines · Johannes Berg
Quoted 4 lines · David Kimdon

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

author maintainer
#17 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

Quoted 4 lines · David Kimdon

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

#18 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

Quoted 11 lines · Johannes Berg
Quoted 4 lines · David Kimdon

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 . . .

Quoted 2 lines

johannes

author maintainer
#19 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

Quoted 3 lines · David Kimdon

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

#20 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

In reply to Johannes Berg
Quoted 42 lines · Johannes Berg

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.

---
more fallout from my earlier patches... this time it's the scanning ops that were still used as flags as well as ops.

include/net/d80211.h +8 -1
@@ -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);
 

net/d80211/ieee80211_sta.c int ieee80211_sta_req_scan(struct net_de · line 2555

Quoted 5 lines
net/d80211/ieee80211_sta.c +1 -1
@@ -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...)

Quoted 18 lines
net/d80211/ieee80211_sta.c +0 -0
 		int rc = local->ops->hw_scan(local_to_wiphy(local),
 					    ssid, ssid_len);
 		if (!rc) {
net/d80211/ieee80211_scan.c +2 -1
@@ -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);
Signature · 1 line
Greetings Michael.
author maintainer
#21 lore raw

Re: [PATCH] d80211: fix scan issues with new ops

Quoted 4 lines · Michael Buesch

net/d80211/ieee80211_sta.c int ieee80211_sta_req_scan(struct net_de · line 2555

Quoted 2 lines
net/d80211/ieee80211_sta.c +1 -1
-	if (local->ops->hw_scan) {
+	if (local->ops->hw_scan && local->wiphy.flags & IEEE80211_HW_SCAN) {

Please wrap this into ()

Good point :)

johannes

author maintainer
#22 lore raw

cover move d80211 away from netdev towards wiphy

In reply to Johannes Berg

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

author maintainer
#23 lore raw

PATCH 1/13 d80211: clean up some stupid list and loop code

"for (; condition ;)"??
Ever heard of while loops?

Also clean up some list handling (still. *sigh*)

net/d80211/ieee80211_sta.c +2 -8
@@ -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);
-	}
 }
 
 
net/d80211/sta_info.c +4 -10
@@ -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
net/d80211/wme.c +1 -2
@@ -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. */
#24 lore raw

Re: [PATCH 1/13] d80211: clean up some stupid list and loop code

Quoted 4 lines · Johannes Berg
net/d80211/sta_info.c +0 -0
@@ -324,16 +324,13 @@ static void sta_info_cleanup_expire_buff
 static void sta_info_cleanup(unsigned long data)

net/d80211/sta_info.c static void sta_info_cleanup_expire_buff · line 330

Quoted 10 lines
net/d80211/sta_info.c +2 -4
 {
 	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.

net/d80211/sta_info.c static void sta_info_cleanup_expire_buff · line 336

Quoted 7 lines
net/d80211/sta_info.c +0 -1
 		__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

Signature · 2 lines
Jiri Benc
SUSE Labs
author maintainer
#25 lore raw

Re: [PATCH 1/13] d80211: clean up some stupid list and loop code

Quoted 3 lines · Jiri Benc

Review

Quoted 1 line
(quoted diff) +1 -0
+	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

author maintainer
#26 lore raw

PATCH 1/13 d80211: clean up some stupid list and loop code

"for (; condition ;)"??
Ever heard of while loops?

Also clean up some list handling (still. *sigh*)

---
respun to remove list_for_each_entry in one place where it isn't needed.

net/d80211/ieee80211_sta.c +2 -8
@@ -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);
-	}
 }
 
 
net/d80211/sta_info.c +4 -10
@@ -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
net/d80211/wme.c +1 -2
@@ -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. */
author maintainer
#27 lore raw

PATCH 2/13 d80211: reduce mdev usage

In reply to Johannes Berg

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.

net/d80211/ieee80211.c +9 -20
@@ -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");
 
net/d80211/ieee80211_i.h +4 -4
@@ -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);
net/d80211/ieee80211_iface.c +6 -13
@@ -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();
net/d80211/ieee80211_ioctl.c +11 -11
@@ -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;
net/d80211/ieee80211_sta.c +2 -2
@@ -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);
author maintainer
#28 lore raw

PATCH 3/13 d80211: reduce mdev usage

In reply to Johannes Berg

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.

net/d80211/ieee80211_i.h +0 -1
@@ -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;
net/d80211/ieee80211.c +15 -17
@@ -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:
net/d80211/ieee80211_iface.c +1 -6
@@ -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 &&
net/d80211/ieee80211_sta.c +1 -1
@@ -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;
author maintainer
#29 lore raw

PATCH 4/13 d80211: reduce mdev usage, change ieee80211_rx_mgmt

In reply to Johannes Berg

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.

net/d80211/ieee80211.c +125 -55
@@ -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);
 
net/d80211/ieee80211_i.h +1 -1
@@ -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);
net/d80211/wpa.c +4 -1
@@ -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;
include/net/d80211_common.h +1 -1
@@ -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,
#30 lore raw

Re: [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt

net/d80211/ieee80211.c ieee80211_rx_mgmt(struct net_device *dev · line 2596

Quoted 10 lines · Johannes Berg
net/d80211/ieee80211.c +6 -0
@@ -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

Signature · 2 lines
Jiri Benc
SUSE Labs
author maintainer
#31 lore raw

Re: [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt

Quoted 1 line · Jiri Benc

offsetof(ieee80211_frame_info, msg_type)?

Hm, I guess I could do that. I could just zero out the whole struct too I think.

Quoted 2 lines

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

author maintainer
#32 lore raw

PATCH 5/13 d80211: reduce master ieee80211_ptr deref in scan routines

In reply to Johannes Berg

This patch changes a bunch of prototypes to have struct ieee80211_local* instead of struct net_device* where that makes sense.

net/d80211/ieee80211.c +2 -2
@@ -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);
net/d80211/ieee80211_i.h +2 -2
@@ -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);
 
 
 
net/d80211/ieee80211_scan.c +24 -29

175 lines not on this page · raw message

author maintainer
#33 lore raw

PATCH 6/13 d80211: change the identifier netdev to ieee80211_hw

In reply to Johannes Berg

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.

Patch attached due to size.

#34 lore raw

Re: [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw

Quoted 4 lines · Johannes Berg

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?

Quoted 4 lines

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.

Review

Quoted 5 lines
(quoted diff) +2 -3
-/* 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?

Review

Quoted 3 lines
(quoted diff) +1 -1
-	/* 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".

Review

Quoted 6 lines
(quoted diff) +2 -3
-	 * 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

Signature · 2 lines
Jiri Benc
SUSE Labs
author maintainer
#35 lore raw

Re: [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw

Quoted 4 lines · Jiri Benc

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.

Quoted 5 lines

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.

Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +2 -3
-/* 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.

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +1 -1
-	/* 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

author maintainer
#37 lore raw

Re: [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw

In reply to Johannes Berg

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

author maintainer
#38 lore raw

PATCH 1/1 d80211: use ieee80211_hw.dev

This fixes up my earlier patches by actually using the dev field in struct ieee80211_hw.

---

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.

net/d80211/ieee80211.c +3 -0
@@ -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();
net/d80211/ieee80211_iface.c +2 -2
@@ -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;
author maintainer
#39 lore raw

PATCH 7/13 d80211: add a perm_addr hardware property

In reply to Johannes Berg

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.

include/net/d80211.h +4 -0
@@ -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
net/d80211/ieee80211_iface.c +2 -2
@@ -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);
net/d80211/ieee80211.c +1 -0
@@ -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();
author maintainer
#40 lore raw

Re: [PATCH 7/13] d80211: add a perm_addr hardware property

net/d80211/ieee80211_iface.c int ieee80211_if_add_mgmt(struct ieee802

Quoted 3 lines · Johannes Berg
net/d80211/ieee80211_iface.c +2 -0
+	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

author maintainer
#41 lore raw

PATCH 7/13 d80211: add a perm_addr hardware property

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.

---
resend with the wiphy thing fixed. not sure how that slipped in

include/net/d80211.h +4 -0
@@ -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
net/d80211/ieee80211_iface.c +2 -2
@@ -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);
net/d80211/ieee80211.c +1 -0
@@ -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();
author maintainer
#42 lore raw

PATCH 8/13 d80211: introduce IEEE80211_HW_FRAG flag

In reply to Johannes Berg

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.

include/net/d80211.h +3 -2
@@ -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) */
net/d80211/ieee80211.c +1 -1
@@ -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) {
author maintainer
#43 lore raw

PATCH 9/13 d80211: remove useless driver name field

In reply to Johannes Berg

struct ieee80211_ops has a driver name field that's never used. Remove it.

include/net/d80211.h +0 -3
@@ -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
author maintainer
#44 lore raw

PATCH 10/13 bcm43xx: update to new d80211 driver API

In reply to Johannes Berg

Updates bcm43xx.

drivers/net/wireless/d80211/bcm43xx/Makefile +1 -1
@@ -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)
drivers/net/wireless/d80211/bcm43xx/bcm43xx.h +3 -10
@@ -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). */
drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +2 -2
@@ -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);
drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c +3 -4
@@ -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;
 	}
 }
drivers/net/wireless/d80211/bcm43xx/bcm43xx_ethtool.c deleted +0 -51

51 lines not on this page · raw message

drivers/net/wireless/d80211/bcm43xx/bcm43xx_ethtool.h deleted +0 -8
@@ -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_ */
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +102 -136

522 lines not on this page · raw message

drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c +1 -1
@@ -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;
 
drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c +1 -1
@@ -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,
#45 lore raw

Re: [PATCH 10/13] bcm43xx: update to new d80211 driver API

drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c void bcm43xx_debugfs_add_device(struct b · line 288

Quoted 8 lines · Johannes Berg
drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +1 -1
@@ -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?

Quoted 17 lines
drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +6 -1
 	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,

drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c void bcm43xx_debugfs_add_device(struct b

Quoted 10 lines
drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +10 -0
+	.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.

Signature · 1 line
Greetings Michael.
author maintainer
#46 lore raw

Re: [PATCH 10/13] bcm43xx: update to new d80211 driver API

Quoted 12 lines · Michael Buesch

drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c void bcm43xx_debugfs_add_device(struct b · line 288

Quoted 8 lines · Johannes Berg
drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +1 -1
@@ -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

author maintainer
#47 lore raw

PATCH 11/13 d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT

In reply to Johannes Berg

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.

include/net/d80211.h +2 -4
@@ -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
net/d80211/ieee80211.c +3 -6
@@ -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);
net/d80211/ieee80211_ioctl.c +1 -3
@@ -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;
net/d80211/wpa.c +7 -20
@@ -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;
author maintainer
#48 lore raw

PATCH 12/13 d80211: remove calib_int

In reply to Johannes Berg

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.

include/net/d80211.h +0 -2
@@ -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;
 
net/d80211/ieee80211.c +0 -1
@@ -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;
net/d80211/ieee80211_ioctl.c +0 -10
@@ -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;
net/d80211/ieee80211_sysfs.c +0 -2
@@ -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),
author maintainer
#49 lore raw

PATCH 13/13 d80211: fix scan issues with new ops

In reply to Johannes Berg

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.

include/net/d80211.h +8 -1
@@ -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 */
net/d80211/ieee80211_sta.c +1 -1
@@ -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) {
net/d80211/ieee80211_scan.c +2 -1
@@ -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);
author maintainer
#50 lore raw

Re: [PATCH 0/13] move d80211 away from netdev towards wiphy

In reply to Johannes Berg

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?

include/net/cfg80211.h +48 -10
@@ -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 <[email protected]>
  */
@@ -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,
net/wireless/core.c +48 -34

134 lines not on this page · raw message

net/wireless/core.h +11 -2
@@ -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;
 
net/wireless/nl80211.c +17 -17
@@ -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, &params);
+	err = drv->ops->initiate_scan(drv_priv(drv), dev, &params);
 
 	kfree(channels);
  out:
net/wireless/wext-compat.c +2 -2
@@ -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;
 
#51 lore raw

Re: [PATCH 0/13] move d80211 away from netdev towards wiphy

Quoted 4 lines · Johannes Berg

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

Signature · 2 lines
Jiri Benc
SUSE Labs
author maintainer
#52 lore raw

cover more power to cfg80211

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

author maintainer
#53 lore raw

Re: [RFC 1/3] cfg80211: handle wiphy, use wiphy in netdev, do wiphy sysfs

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.

include/net/cfg80211.h +80 -27
@@ -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 <[email protected]>
  */
 
 /**
+ * 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,
net/wireless/core.c +81 -63

234 lines not on this page · raw message

net/wireless/core.h +7 -2
@@ -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;
 
net/wireless/nl80211.c +18 -18
@@ -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, &params);
+	err = drv->ops->initiate_scan(&drv->wiphy, dev, &params);
 
 	kfree(channels);
  out:
net/wireless/wext-compat.c +2 -2
@@ -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;
 
net/wireless/sysfs.c new file +63 -0

63 lines not on this page · raw message

net/wireless/sysfs.h new file +10 -0
@@ -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 */
net/wireless/Makefile +1 -1
@@ -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
 
include/linux/netdevice.h +3 -1
@@ -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())
author maintainer
#54 lore raw

RFC 2/3 d80211: use new wiphy stuff from cfg80211

In reply to Johannes Berg

This patch lets d80211 use the new wiphy stuff from cfg80211.

Patch is large because cfg80211 requires the net_dev->ieee80211_ptr now.

include/net/d80211.h +18 -8
@@ -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. */
net/d80211/ieee80211.c +71 -86

380 lines not on this page · raw message

net/d80211/Makefile +1 -1
@@ -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),)
net/d80211/ieee80211_dev.c deleted +0 -117

117 lines not on this page · raw message

net/d80211/ieee80211_iface.c +13 -12
@@ -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();
net/d80211/ieee80211_i.h +0 -22
@@ -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);
net/d80211/ieee80211_led.c +2 -2
@@ -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);
net/d80211/ieee80211_sysfs.c +45 -113

214 lines not on this page · raw message

net/d80211/Kconfig +1 -0
@@ -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.
net/d80211/ieee80211_cfg.c new file +32 -0
@@ -0,0 +1,32 @@
+/*
+ * d80211 configuration hooks for cfg80211
+ *
+ * Copyright 2006	Johannes Berg <[email protected]>
+ *
+ * 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,
+};
net/d80211/ieee80211_cfg.h new file +9 -0
@@ -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 */
net/d80211/ieee80211_sysfs_sta.c +2 -2
@@ -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);
 }
net/d80211/ieee80211_sysfs.h new file +12 -0
@@ -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 */
net/d80211/ieee80211_ioctl.c +52 -52

413 lines not on this page · raw message

net/d80211/ieee80211_sta.c +29 -29

232 lines not on this page · raw message

net/d80211/rc80211_simple.c +2 -2
@@ -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;
net/d80211/wme.c +13 -13
@@ -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__); */
author maintainer
#55 lore raw

RFC 3/3 bcm43xx: API update

In reply to Johannes Berg

Slight API changes in d80211 due to the introduction of wiphy.

drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c +2 -1
@@ -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);
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +5 -4
@@ -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);
#56 lore raw

Re: [RFC 0/3] more power to cfg80211

In reply to Johannes Berg
Quoted 8 lines · Johannes Berg

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

Signature · 2 lines
Jiri Benc
SUSE Labs