linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/27] various cleanups and fixes for mac80211 and drivers
@ 2007-08-21 14:59 Johannes Berg
  2007-08-21 14:59 ` [PATCH 01/27] mac80211: fix showing transmitted frames on multiple monitor interfaces Johannes Berg
                   ` (28 more replies)
  0 siblings, 29 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

I've stripped my patch series down to those things that
nobody objected to. The ioctl removal is a bit slimmer
keeping the things Jouni wanted to keep.

This series contains:

 * mac80211: fix showing transmitted frames on multiple monitor interfaces
 * mac80211: fix preamble setting
 * mac80211: avoid copying packets to interfaces that are down
 * mac80211: fix key debugfs
 * mac80211, drivers: remove reset callback
 * ralink drivers: remove IEEE80211_HW_HOST_GEN_BEACON flag
 * mac80211: remove IEEE80211_HW_HOST_GEN_BEACON flag
 * mac80211: remove PRISM2_PARAM_RADIO_ENABLED
 * mac80211: remove PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM
 * ralink drivers: remove IEEE80211_HW_DATA_NULLFUNC_ACK
 * rtl8187: remove IEEE80211_HW_DATA_NULLFUNC_ACK
 * p54: remove IEEE80211_HW_DATA_NULLFUNC_ACK
 * mac80211: remove IEEE80211_HW_DATA_NULLFUNC_ACK
 * mac80211: ratelimit some RX messages
 * mac80211: remove ieee80211_msg_wep_frame_unknown_key
 * mac80211: remove radar stuff
 * mac80211: remove scan struct from hostapd_param
 * mac80211: fix software decryption
 * cfg80211: extend radiotap parser by all remaining fields
 * mac80211: remove unused ioctls (1)
 * mac80211: remove unused ioctls (2)
 * mac80211: remove unused ioctls (3)
 * mac80211: remove unused ioctls (4)
 * mac80211: remove PRISM2_PARAM_KEY_MGMT
 * mac80211: kill key_mgmt, use key_management_enabled
 * mac80211: refactor event sending
 * mac80211: use switch statement in tx code

johannes


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/27] mac80211: fix showing transmitted frames on multiple  monitor interfaces
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 02/27] mac80211: fix preamble setting Johannes Berg
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

Signed-off-by: Johannes Berg <johannes@sipsolutions.net

---
 net/mac80211/ieee80211.c |    1 -
 1 file changed, 1 deletion(-)

--- wireless-dev.orig/net/mac80211/ieee80211.c	2007-08-21 14:39:16.695923881 +0200
+++ wireless-dev/net/mac80211/ieee80211.c	2007-08-21 14:39:41.445923881 +0200
@@ -1190,7 +1190,6 @@ void ieee80211_tx_status(struct ieee8021
 			memset(skb->cb, 0, sizeof(skb->cb));
 			netif_rx(skb);
 			skb = skb2;
-			break;
 		}
 	}
  out:

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 02/27] mac80211: fix preamble setting
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
  2007-08-21 14:59 ` [PATCH 01/27] mac80211: fix showing transmitted frames on multiple monitor interfaces Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 03/27] mac80211: avoid copying packets to interfaces that are down Johannes Berg
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless, Daniel Drake

It looks like in commit 28487a90 the condition was unintentionally
negated by moving some code, fix it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Daniel Drake <dsd@gentoo.org>

---
 net/mac80211/ieee80211_ioctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 14:39:16.465923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 14:39:42.055923881 +0200
@@ -2191,7 +2191,7 @@ static int ieee80211_ioctl_prism2_param(
 		break;
 
 	case PRISM2_PARAM_PREAMBLE:
-		if (sdata->type != IEEE80211_IF_TYPE_AP) {
+		if (sdata->type == IEEE80211_IF_TYPE_AP) {
 			sdata->short_preamble = !!value;
 			ieee80211_erp_info_change_notify(dev, IEEE80211_ERP_CHANGE_PREAMBLE);
 		} else {

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 03/27] mac80211: avoid copying packets to interfaces that  are down
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
  2007-08-21 14:59 ` [PATCH 01/27] mac80211: fix showing transmitted frames on multiple monitor interfaces Johannes Berg
  2007-08-21 14:59 ` [PATCH 02/27] mac80211: fix preamble setting Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 04/27] mac80211: fix key debugfs Johannes Berg
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

David Woodhouse noticed that under some circumstances the number of slab
allocations kept growing. After looking a bit, this seemed to happen
when you had a management mode interface that was *down*.

The reason for this is that when the device is down, all management
frames get queued to the in-kernel MLME (via ieee80211_sta_rx_mgmt) but
then the sta work is invoked but doesn't run when the netif is down.
When you then bring the interface up, all such frames are freed, but if
you change the mode all of them are lost because the skb queue is
reinitialised as soon as you go back to managed mode. The skb queue is
correctly cleared when the interface is brought down, but the code
doesn't account for the fact that it may be filled while it is not up.

This patch should fix the issue by simply ignoring all interfaces that
are down when going through the RX handlers.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/mac80211/ieee80211.c |    9 +++++++++
 net/mac80211/rx.c        |    3 +++
 2 files changed, 12 insertions(+)

--- wireless-dev.orig/net/mac80211/rx.c	2007-08-21 14:39:40.425923881 +0200
+++ wireless-dev/net/mac80211/rx.c	2007-08-21 14:39:42.675923881 +0200
@@ -1521,6 +1521,9 @@ void __ieee80211_rx(struct ieee80211_hw 
 	list_for_each_entry(sdata, &local->sub_if_list, list) {
 		rx.u.rx.ra_match = 1;
 
+		if (!netif_running(sdata->dev))
+			continue;
+
 		prepres = prepare_for_handlers(sdata, bssid, &rx, hdr);
 		/* prepare_for_handlers can change sta */
 		sta = rx.sta;
--- wireless-dev.orig/net/mac80211/ieee80211.c	2007-08-21 14:39:41.445923881 +0200
+++ wireless-dev/net/mac80211/ieee80211.c	2007-08-21 14:39:42.675923881 +0200
@@ -494,7 +494,16 @@ static void ieee80211_if_shutdown(struct
 		sdata->u.sta.state = IEEE80211_DISABLED;
 		del_timer_sync(&sdata->u.sta.timer);
 		del_timer_sync(&sdata->u.sta.admit_timer);
+		/*
+		 * Holding the sub_if_lock for writing here blocks
+		 * out the receive path and makes sure it's not
+		 * currently processing a packet that may get
+		 * added to the queue.
+		 */
+		write_lock_bh(&local->sub_if_lock);
 		skb_queue_purge(&sdata->u.sta.skb_queue);
+		write_unlock_bh(&local->sub_if_lock);
+
 		if (!local->ops->hw_scan &&
 		    local->scan_dev == sdata->dev) {
 			local->sta_scanning = 0;

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 04/27] mac80211: fix key debugfs
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (2 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 03/27] mac80211: avoid copying packets to interfaces that are down Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 05/27] mac80211, drivers: remove reset callback Johannes Berg
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

This fixes two issues with the key debugfs:
 1) key index obviously isn't unique
 2) various missing break statements led to bogus output

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/mac80211/debugfs_key.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- wireless-dev.orig/net/mac80211/debugfs_key.c	2007-08-21 16:17:35.565923881 +0200
+++ wireless-dev/net/mac80211/debugfs_key.c	2007-08-21 16:25:21.405923881 +0200
@@ -77,14 +77,17 @@ static ssize_t key_tx_spec_read(struct f
 	switch (key->alg) {
 	case ALG_WEP:
 		len = scnprintf(buf, sizeof(buf), "\n");
+		break;
 	case ALG_TKIP:
 		len = scnprintf(buf, sizeof(buf), "%08x %04x\n",
 				key->u.tkip.iv32,
 				key->u.tkip.iv16);
+		break;
 	case ALG_CCMP:
 		tpn = key->u.ccmp.tx_pn;
 		len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
 				tpn[0], tpn[1], tpn[2], tpn[3], tpn[4], tpn[5]);
+		break;
 	default:
 		return 0;
 	}
@@ -103,6 +106,7 @@ static ssize_t key_rx_spec_read(struct f
 	switch (key->alg) {
 	case ALG_WEP:
 		len = scnprintf(buf, sizeof(buf), "\n");
+		break;
 	case ALG_TKIP:
 		for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
 			p += scnprintf(p, sizeof(buf)+buf-p,
@@ -110,6 +114,7 @@ static ssize_t key_rx_spec_read(struct f
 				       key->u.tkip.iv32_rx[i],
 				       key->u.tkip.iv16_rx[i]);
 		len = p - buf;
+		break;
 	case ALG_CCMP:
 		for (i = 0; i < NUM_RX_DATA_QUEUES; i++) {
 			rpn = key->u.ccmp.rx_pn[i];
@@ -119,6 +124,7 @@ static ssize_t key_rx_spec_read(struct f
 				       rpn[3], rpn[4], rpn[5]);
 		}
 		len = p - buf;
+		break;
 	default:
 		return 0;
 	}
@@ -164,12 +170,14 @@ KEY_OPS(key);
 void ieee80211_debugfs_key_add(struct ieee80211_local *local,
 			       struct ieee80211_key *key)
 {
+	static int keycount;
 	char buf[20];
 
 	if (!local->debugfs.keys)
 		return;
 
-	sprintf(buf, "%d", key->keyidx);
+	sprintf(buf, "%d", keycount);
+	keycount++;
 	key->debugfs.dir = debugfs_create_dir(buf,
 					local->debugfs.keys);
 
@@ -239,7 +247,7 @@ void ieee80211_debugfs_key_sta_link(stru
 	if (!key->debugfs.dir)
 		return;
 
-	sprintf(buf, "../sta/" MAC_FMT, MAC_ARG(sta->addr));
+	sprintf(buf, "../../stations/" MAC_FMT, MAC_ARG(sta->addr));
 	key->debugfs.stalink =
 		debugfs_create_symlink("station", key->debugfs.dir, buf);
 }

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 05/27] mac80211, drivers: remove reset callback
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (3 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 04/27] mac80211: fix key debugfs Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 06/27] ralink drivers: remove IEEE80211_HW_HOST_GEN_BEACON flag Johannes Berg
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

The callback isn't used so remove it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 drivers/net/wireless/adm8211.c          |   38 --------------------------------
 drivers/net/wireless/b43/main.c         |   18 ---------------
 drivers/net/wireless/rt2x00/rt2400pci.c |    1 
 drivers/net/wireless/rt2x00/rt2500pci.c |    1 
 drivers/net/wireless/rt2x00/rt2500usb.c |    1 
 drivers/net/wireless/rt2x00/rt2x00mac.c |    1 
 drivers/net/wireless/rt2x00/rt61pci.c   |    1 
 drivers/net/wireless/rt2x00/rt73usb.c   |    1 
 include/net/mac80211.h                  |    3 --
 9 files changed, 65 deletions(-)

--- wireless-dev.orig/include/net/mac80211.h	2007-08-21 16:25:19.385923881 +0200
+++ wireless-dev/include/net/mac80211.h	2007-08-21 16:25:25.135923881 +0200
@@ -570,9 +570,6 @@ struct ieee80211_ops {
 	int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb,
 		  struct ieee80211_tx_control *control);
 
-	/* Handler for performing hardware reset. */
-	int (*reset)(struct ieee80211_hw *hw);
-
 	/* Handler that is called when any netdevice attached to the hardware
 	 * device is set UP for the first time. This can be used, e.g., to
 	 * enable interrupts and beacon sending. */
--- wireless-dev.orig/drivers/net/wireless/adm8211.c	2007-08-21 16:23:23.115923881 +0200
+++ wireless-dev/drivers/net/wireless/adm8211.c	2007-08-21 16:25:25.145923881 +0200
@@ -1643,43 +1643,6 @@ static int adm8211_stop(struct ieee80211
 	return 0;
 }
 
-static int adm8211_reset(struct ieee80211_hw *dev)
-{
-	struct adm8211_priv *priv = dev->priv;
-	int retval = 0;
-
-	priv->nar = 0;
-	ADM8211_CSR_WRITE(NAR, 0);
-	ADM8211_CSR_WRITE(IER, 0);
-	ADM8211_CSR_READ(NAR);
-
-	adm8211_free_rings(dev);
-
-	retval = adm8211_hw_reset(dev);
-	if (retval) {
-		printk(KERN_ERR "%s: hardware reset failed\n",
-		       wiphy_name(dev->wiphy));
-		goto fail;
-	}
-
-	retval = adm8211_init_rings(dev);
-	if (retval) {
-		printk(KERN_ERR "%s: failed to initialize rings\n",
-		       wiphy_name(dev->wiphy));
-		goto fail;
-	}
-
-	adm8211_hw_init(dev);
-	adm8211_rf_set_channel(dev, priv->channel);
-
-	ADM8211_CSR_WRITE(IER, ADM8211_INTMASK);
-	adm8211_update_mode(dev);
-	ADM8211_CSR_WRITE(RDR, 0);
-
-fail:
-	return retval;
-}
-
 static void adm8211_calc_durations(int *dur, int *plcp, size_t payload_len, int len,
 				   int plcp_signal, int short_preamble)
 {
@@ -1878,7 +1841,6 @@ static int adm8211_alloc_rings(struct ie
 
 static const struct ieee80211_ops adm8211_ops = {
 	.tx			= adm8211_tx,
-	.reset			= adm8211_reset,
 	.open			= adm8211_open,
 	.stop			= adm8211_stop,
 	.add_interface		= adm8211_add_interface,
--- wireless-dev.orig/drivers/net/wireless/b43/main.c	2007-08-21 16:23:23.145923881 +0200
+++ wireless-dev/drivers/net/wireless/b43/main.c	2007-08-21 16:25:25.155923881 +0200
@@ -2617,23 +2617,6 @@ static int b43_get_stats(struct ieee8021
 	return 0;
 }
 
-static int b43_dev_reset(struct ieee80211_hw *hw)
-{
-	struct b43_wl *wl = hw_to_b43_wl(hw);
-	struct b43_wldev *dev;
-	int err = -ENODEV;
-
-	mutex_lock(&wl->mutex);
-	dev = wl->current_dev;
-	if (dev) {
-		b43_controller_restart(dev, "Reset by ieee80211 subsystem");
-		err = 0;
-	}
-	mutex_unlock(&wl->mutex);
-
-	return 0;
-}
-
 static const char *phymode_to_string(unsigned int phymode)
 {
 	switch (phymode) {
@@ -3566,7 +3549,6 @@ static const struct ieee80211_ops b43_hw
 	.conf_tx = b43_conf_tx,
 	.add_interface = b43_add_interface,
 	.remove_interface = b43_remove_interface,
-	.reset = b43_dev_reset,
 	.config = b43_dev_config,
 	.config_interface = b43_config_interface,
 	.set_multicast_list = b43_set_multicast_list,
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2400pci.c	2007-08-21 16:23:23.165923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2400pci.c	2007-08-21 16:25:25.155923881 +0200
@@ -1592,7 +1592,6 @@ static int rt2400pci_tx_last_beacon(stru
 
 static const struct ieee80211_ops rt2400pci_mac80211_ops = {
 	.tx			= rt2x00mac_tx,
-	.reset			= rt2x00mac_reset,
 	.add_interface		= rt2x00mac_add_interface,
 	.remove_interface	= rt2x00mac_remove_interface,
 	.config			= rt2x00mac_config,
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2500pci.c	2007-08-21 16:23:23.195923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2500pci.c	2007-08-21 16:25:25.165923881 +0200
@@ -1883,7 +1883,6 @@ static int rt2500pci_tx_last_beacon(stru
 
 static const struct ieee80211_ops rt2500pci_mac80211_ops = {
 	.tx			= rt2x00mac_tx,
-	.reset			= rt2x00mac_reset,
 	.add_interface		= rt2x00mac_add_interface,
 	.remove_interface	= rt2x00mac_remove_interface,
 	.config			= rt2x00mac_config,
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2500usb.c	2007-08-21 16:23:23.215923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2500usb.c	2007-08-21 16:25:25.165923881 +0200
@@ -1560,7 +1560,6 @@ static int rt2500usb_probe_hw(struct rt2
  */
 static const struct ieee80211_ops rt2500usb_mac80211_ops = {
 	.tx			= rt2x00mac_tx,
-	.reset			= rt2x00mac_reset,
 	.add_interface		= rt2x00mac_add_interface,
 	.remove_interface	= rt2x00mac_remove_interface,
 	.config			= rt2x00mac_config,
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2x00mac.c	2007-08-21 16:23:23.235923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2x00mac.c	2007-08-21 16:25:25.165923881 +0200
@@ -167,7 +167,6 @@ exit:
 
 	return retval;
 }
-EXPORT_SYMBOL_GPL(rt2x00mac_reset);
 
 int rt2x00mac_add_interface(struct ieee80211_hw *hw,
 			    struct ieee80211_if_init_conf *conf)
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt61pci.c	2007-08-21 16:23:23.255923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt61pci.c	2007-08-21 16:25:25.175923881 +0200
@@ -2246,7 +2246,6 @@ static void rt61pci_reset_tsf(struct iee
 
 static const struct ieee80211_ops rt61pci_mac80211_ops = {
 	.tx			= rt2x00mac_tx,
-	.reset			= rt2x00mac_reset,
 	.add_interface		= rt2x00mac_add_interface,
 	.remove_interface	= rt2x00mac_remove_interface,
 	.config			= rt2x00mac_config,
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt73usb.c	2007-08-21 16:23:23.295923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt73usb.c	2007-08-21 16:25:25.175923881 +0200
@@ -1854,7 +1854,6 @@ static void rt73usb_reset_tsf(struct iee
 
 static const struct ieee80211_ops rt73usb_mac80211_ops = {
 	.tx			= rt2x00mac_tx,
-	.reset			= rt2x00mac_reset,
 	.add_interface		= rt2x00mac_add_interface,
 	.remove_interface	= rt2x00mac_remove_interface,
 	.config			= rt2x00mac_config,

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 06/27] ralink drivers: remove IEEE80211_HW_HOST_GEN_BEACON  flag
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (4 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 05/27] mac80211, drivers: remove reset callback Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 07/27] mac80211: " Johannes Berg
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville
  Cc: Jiri Benc, Michael Wu, linux-wireless, rt2400-devel,
	Ivo van Doorn

There's no point in setting that flag, the drivers can simply
call ieee80211_beacon_get() if they need a beacon.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: rt2400-devel@lists.sourceforge.net
Cc: Ivo van Doorn <ivdoorn@gmail.com>

---
 drivers/net/wireless/rt2x00/rt2400pci.c |    1 -
 drivers/net/wireless/rt2x00/rt2500pci.c |    1 -
 drivers/net/wireless/rt2x00/rt61pci.c   |    1 -
 3 files changed, 3 deletions(-)

--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2400pci.c	2007-08-21 16:25:25.155923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2400pci.c	2007-08-21 16:25:27.765923881 +0200
@@ -1448,7 +1448,6 @@ static void rt2400pci_probe_hw_mode(stru
 	 * Initialize all hw fields.
 	 */
 	rt2x00dev->hw->flags =
-	    IEEE80211_HW_HOST_GEN_BEACON |
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
 	    IEEE80211_HW_DATA_NULLFUNC_ACK |
 	    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2500pci.c	2007-08-21 16:25:25.165923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2500pci.c	2007-08-21 16:25:27.765923881 +0200
@@ -1746,7 +1746,6 @@ static void rt2500pci_probe_hw_mode(stru
 	 * Initialize all hw fields.
 	 */
 	rt2x00dev->hw->flags =
-	    IEEE80211_HW_HOST_GEN_BEACON |
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
 	    IEEE80211_HW_DATA_NULLFUNC_ACK |
 	    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt61pci.c	2007-08-21 16:25:25.175923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt61pci.c	2007-08-21 16:25:27.765923881 +0200
@@ -2119,7 +2119,6 @@ static void rt61pci_probe_hw_mode(struct
 	 * Initialize all hw fields.
 	 */
 	rt2x00dev->hw->flags =
-	    IEEE80211_HW_HOST_GEN_BEACON |
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
 	    IEEE80211_HW_DATA_NULLFUNC_ACK |
 	    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 07/27] mac80211: remove IEEE80211_HW_HOST_GEN_BEACON flag
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (5 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 06/27] ralink drivers: remove IEEE80211_HW_HOST_GEN_BEACON flag Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 08/27] mac80211: remove PRISM2_PARAM_RADIO_ENABLED Johannes Berg
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

The flag is never checked because drivers can simply call
ieee80211_beacon_get() regardless of setting this flag.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 include/net/mac80211.h |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

--- wireless-dev.orig/include/net/mac80211.h	2007-08-21 16:25:25.135923881 +0200
+++ wireless-dev/include/net/mac80211.h	2007-08-21 16:25:30.415923881 +0200
@@ -462,14 +462,13 @@ struct ieee80211_hw {
 
 	/* TODO: frame_type 802.11/802.3, sw_encryption requirements */
 
-	/* Some wireless LAN chipsets generate beacons in the hardware/firmware
-	 * and others rely on host generated beacons. This option is used to
-	 * configure the upper layer IEEE 802.11 module to generate beacons.
-	 * The low-level driver can use ieee80211_beacon_get() to fetch the
-	 * next beacon frame. */
-#define IEEE80211_HW_HOST_GEN_BEACON (1<<0)
+/* hole at 0 */
 
-	/* The device needs to be supplied with a beacon template only. */
+	/*
+	 * The device only needs to be supplied with a beacon template.
+	 * If you need the host to generate each beacon then don't use
+	 * this flag and use ieee80211_beacon_get().
+	 */
 #define IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE (1<<1)
 
 	/* Some devices handle decryption internally and do not

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 08/27] mac80211: remove PRISM2_PARAM_RADIO_ENABLED
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (6 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 07/27] mac80211: " Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 09/27] mac80211: remove PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM Johannes Berg
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

This now is unused in hostapd/wpa_supplicant.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/hostapd_ioctl.h   |    1 -
 net/mac80211/ieee80211_ioctl.c |   14 --------------
 2 files changed, 15 deletions(-)

--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 14:39:01.695923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 14:40:10.365923881 +0200
@@ -37,7 +37,6 @@ enum {
 	PRISM2_PARAM_PREAMBLE = 1003,
 	PRISM2_PARAM_SHORT_SLOT_TIME = 1006,
 	PRISM2_PARAM_NEXT_MODE = 1008,
-	PRISM2_PARAM_RADIO_ENABLED = 1010,
 	PRISM2_PARAM_ANTENNA_MODE = 1013,
 	PRISM2_PARAM_PRIVACY_INVOKED = 1014,
 	PRISM2_PARAM_BROADCAST_SSID = 1015,
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 14:39:42.055923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 14:40:10.375923881 +0200
@@ -1157,16 +1157,6 @@ static int ieee80211_ioctl_set_regulator
 }
 
 
-static int ieee80211_ioctl_set_radio_enabled(struct net_device *dev,
-					     int val)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	struct ieee80211_conf *conf = &local->hw.conf;
-
-	conf->radio_enabled = val;
-	return ieee80211_hw_config(wdev_priv(dev->ieee80211_ptr));
-}
-
 static int
 ieee80211_ioctl_set_tx_queue_params(struct net_device *dev,
 				    struct prism2_hostapd_param *param)
@@ -2227,10 +2217,6 @@ static int ieee80211_ioctl_prism2_param(
 		local->next_mode = value;
 		break;
 
-	case PRISM2_PARAM_RADIO_ENABLED:
-		ret = ieee80211_ioctl_set_radio_enabled(dev, value);
-		break;
-
 	case PRISM2_PARAM_ANTENNA_MODE:
 		local->hw.conf.antenna_mode = value;
 		if (ieee80211_hw_config(local))

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 09/27] mac80211: remove PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (7 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 08/27] mac80211: remove PRISM2_PARAM_RADIO_ENABLED Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 10/27] ralink drivers: remove IEEE80211_HW_DATA_NULLFUNC_ACK Johannes Berg
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

This is now unused in hostapd/wpa_supplicant, it uses SIOCSIWGENIE.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/hostapd_ioctl.h   |    5 -----
 net/mac80211/ieee80211_ioctl.c |   20 --------------------
 2 files changed, 25 deletions(-)

--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 14:40:10.365923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 14:40:10.985923881 +0200
@@ -84,7 +84,6 @@ enum {
 	PRISM2_HOSTAPD_GET_DOT11COUNTERSTABLE = 1008,
 	PRISM2_HOSTAPD_GET_LOAD_STATS = 1009,
 	PRISM2_HOSTAPD_SET_STA_VLAN = 1010,
-	PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM = 1011,
 	PRISM2_HOSTAPD_SET_CHANNEL_FLAG = 1012,
 	PRISM2_HOSTAPD_SET_REGULATORY_DOMAIN = 1013,
 	PRISM2_HOSTAPD_SET_TX_QUEUE_PARAMS = 1014,
@@ -199,10 +198,6 @@ struct prism2_hostapd_param {
 			int vlan_id;
 		} set_sta_vlan;
 		struct {
-			u8 len;
-			u8 data[0] ALIGNED;
-		} set_generic_info_elem;
-		struct {
 			u16 mode; /* MODE_* */
 			u16 chan;
 			u32 flag;
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 14:40:10.375923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 14:40:10.985923881 +0200
@@ -1131,22 +1131,6 @@ static int ieee80211_set_gen_ie(struct n
 }
 
 
-static int
-ieee80211_ioctl_set_generic_info_elem(struct net_device *dev,
-				      struct prism2_hostapd_param *param,
-				      int param_len)
-{
-	u8 *pos = param->u.set_generic_info_elem.data;
-	int left = param_len - ((u8 *) pos - (u8 *) param);
-	int len = param->u.set_generic_info_elem.len;
-
-	if (left < len)
-		return -EINVAL;
-
-	return ieee80211_set_gen_ie(dev, pos, len);
-}
-
-
 static int ieee80211_ioctl_set_regulatory_domain(struct net_device *dev,
 					    struct prism2_hostapd_param *param)
 {
@@ -1338,10 +1322,6 @@ static int ieee80211_ioctl_priv_hostapd(
 	case PRISM2_HOSTAPD_SET_STA_VLAN:
 		ret = ieee80211_ioctl_set_sta_vlan(dev, param);
 		break;
-	case PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM:
-		ret = ieee80211_ioctl_set_generic_info_elem(dev, param,
-							    p->length);
-		break;
 	case PRISM2_HOSTAPD_SET_CHANNEL_FLAG:
 		ret = ieee80211_ioctl_set_channel_flag(dev, param);
 		break;

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 10/27] ralink drivers: remove IEEE80211_HW_DATA_NULLFUNC_ACK
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (8 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 09/27] mac80211: remove PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 11/27] rtl8187: " Johannes Berg
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville
  Cc: Jiri Benc, Michael Wu, linux-wireless, rt2400-devel,
	Ivo van Doorn

The flag will be removed from mac80211 because it is unused.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: rt2400-devel@lists.sourceforge.net
Cc: Ivo van Doorn <ivdoorn@gmail.com>

---
 drivers/net/wireless/rt2x00/rt2400pci.c |    1 -
 drivers/net/wireless/rt2x00/rt2500pci.c |    1 -
 drivers/net/wireless/rt2x00/rt2500usb.c |    1 -
 drivers/net/wireless/rt2x00/rt61pci.c   |    1 -
 drivers/net/wireless/rt2x00/rt73usb.c   |    1 -
 5 files changed, 5 deletions(-)

--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2400pci.c	2007-08-21 14:40:09.045923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2400pci.c	2007-08-21 14:40:11.605923881 +0200
@@ -1449,7 +1449,6 @@ static void rt2400pci_probe_hw_mode(stru
 	 */
 	rt2x00dev->hw->flags =
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-	    IEEE80211_HW_DATA_NULLFUNC_ACK |
 	    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
 	    IEEE80211_HW_MONITOR_DURING_OPER |
 	    IEEE80211_HW_NO_PROBE_FILTERING;
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2500pci.c	2007-08-21 14:40:09.055923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2500pci.c	2007-08-21 14:40:11.615923881 +0200
@@ -1747,7 +1747,6 @@ static void rt2500pci_probe_hw_mode(stru
 	 */
 	rt2x00dev->hw->flags =
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-	    IEEE80211_HW_DATA_NULLFUNC_ACK |
 	    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
 	    IEEE80211_HW_MONITOR_DURING_OPER |
 	    IEEE80211_HW_NO_PROBE_FILTERING;
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt2500usb.c	2007-08-21 14:40:07.405923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt2500usb.c	2007-08-21 14:40:11.685923881 +0200
@@ -1468,7 +1468,6 @@ static void rt2500usb_probe_hw_mode(stru
 	    IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
 	    IEEE80211_HW_RX_INCLUDES_FCS |
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-	    IEEE80211_HW_DATA_NULLFUNC_ACK |
 	    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
 	    IEEE80211_HW_MONITOR_DURING_OPER |
 	    IEEE80211_HW_NO_PROBE_FILTERING;
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt61pci.c	2007-08-21 14:40:09.055923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt61pci.c	2007-08-21 14:40:11.685923881 +0200
@@ -2120,7 +2120,6 @@ static void rt61pci_probe_hw_mode(struct
 	 */
 	rt2x00dev->hw->flags =
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-	    IEEE80211_HW_DATA_NULLFUNC_ACK |
 	    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
 	    IEEE80211_HW_MONITOR_DURING_OPER |
 	    IEEE80211_HW_NO_PROBE_FILTERING;
--- wireless-dev.orig/drivers/net/wireless/rt2x00/rt73usb.c	2007-08-21 14:40:07.425923881 +0200
+++ wireless-dev/drivers/net/wireless/rt2x00/rt73usb.c	2007-08-21 14:40:11.695923881 +0200
@@ -1714,7 +1714,6 @@ static void rt73usb_probe_hw_mode(struct
 	rt2x00dev->hw->flags =
 	    IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-	    IEEE80211_HW_DATA_NULLFUNC_ACK |
 	    IEEE80211_HW_NO_TKIP_WMM_HWACCEL |
 	    IEEE80211_HW_MONITOR_DURING_OPER |
 	    IEEE80211_HW_NO_PROBE_FILTERING;

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 11/27] rtl8187: remove IEEE80211_HW_DATA_NULLFUNC_ACK
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (9 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 10/27] ralink drivers: remove IEEE80211_HW_DATA_NULLFUNC_ACK Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 12/27] p54: " Johannes Berg
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Michael Wu <flamingice@sourmilk.net>

---
 drivers/net/wireless/rtl8187_dev.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- wireless-dev.orig/drivers/net/wireless/rtl8187_dev.c	2007-08-21 14:39:00.825923881 +0200
+++ wireless-dev/drivers/net/wireless/rtl8187_dev.c	2007-08-21 14:40:12.535923881 +0200
@@ -606,8 +606,7 @@ static int __devinit rtl8187_probe(struc
 	priv->mode = IEEE80211_IF_TYPE_MGMT;
 	dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
 		     IEEE80211_HW_RX_INCLUDES_FCS |
-		     IEEE80211_HW_WEP_INCLUDE_IV |
-		     IEEE80211_HW_DATA_NULLFUNC_ACK;
+		     IEEE80211_HW_WEP_INCLUDE_IV;
 	dev->extra_tx_headroom = sizeof(struct rtl8187_tx_hdr);
 	dev->queues = 1;
 	dev->max_rssi = 65;

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 12/27] p54: remove IEEE80211_HW_DATA_NULLFUNC_ACK
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (10 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 11/27] rtl8187: " Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 13/27] mac80211: " Johannes Berg
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless, developers

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Michael Wu <flamingice@sourmilk.net>
Cc: developers@islsm.org

---
 drivers/net/wireless/p54common.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- wireless-dev.orig/drivers/net/wireless/p54common.c	2007-08-21 14:39:00.575923881 +0200
+++ wireless-dev/drivers/net/wireless/p54common.c	2007-08-21 14:40:13.525923881 +0200
@@ -893,9 +893,7 @@ struct ieee80211_hw *p54_init_common(siz
 	priv->modes[0].channels = priv->channels;
 	dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | /* not sure */
 		    IEEE80211_HW_RX_INCLUDES_FCS |
-		    IEEE80211_HW_WEP_INCLUDE_IV |
-		    IEEE80211_HW_DATA_NULLFUNC_ACK; /* TODO: check */
-		    /* IEEE80211_HW_MONITOR_DURING_OPER FIXME: check */
+		    IEEE80211_HW_WEP_INCLUDE_IV;
 	dev->channel_change_time = 1000;	/* TODO: find actual value */
 	dev->max_rssi = 100;
 

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 13/27] mac80211: remove IEEE80211_HW_DATA_NULLFUNC_ACK
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (11 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 12/27] p54: " Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 14/27] mac80211: ratelimit some RX messages Johannes Berg
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Jiri Benc <jbenc@suse.cz>
Cc: Michael Wu <flamingice@sourmilk.net>

---
 include/net/mac80211.h         |    3 +--
 net/mac80211/hostapd_ioctl.h   |    2 --
 net/mac80211/ieee80211_ioctl.c |    2 --
 3 files changed, 1 insertion(+), 6 deletions(-)

--- wireless-dev.orig/include/net/mac80211.h	2007-08-21 14:40:09.755923881 +0200
+++ wireless-dev/include/net/mac80211.h	2007-08-21 14:40:14.185923881 +0200
@@ -490,8 +490,7 @@ struct ieee80211_hw {
 
 #define IEEE80211_HW_WEP_INCLUDE_IV (1<<5)
 
-	/* will data nullfunc frames get proper TX status callback */
-#define IEEE80211_HW_DATA_NULLFUNC_ACK (1<<6)
+/* hole at 6 */
 
 	/* Force software encryption for TKIP packets if WMM is enabled. */
 #define IEEE80211_HW_NO_TKIP_WMM_HWACCEL (1<<7)
--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 14:40:10.985923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 14:40:14.195923881 +0200
@@ -265,8 +265,6 @@ struct prism2_hostapd_param {
 #define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6
 #define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7
 
-#define HOSTAP_HW_FLAG_NULLFUNC_OK BIT(0)
-
 enum {
 	IEEE80211_KEY_MGMT_NONE = 0,
 	IEEE80211_KEY_MGMT_IEEE8021X = 1,
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 14:40:10.985923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 14:40:14.195923881 +0200
@@ -112,8 +112,6 @@ static int ieee80211_ioctl_get_hw_featur
 	struct ieee80211_hw_mode *mode;
 
 	param->u.hw_features.flags = 0;
-	if (local->hw.flags & IEEE80211_HW_DATA_NULLFUNC_ACK)
-		param->u.hw_features.flags |= HOSTAP_HW_FLAG_NULLFUNC_OK;
 
 	param->u.hw_features.num_modes = 0;
 	list_for_each_entry(mode, &local->modes_list, list) {

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 14/27] mac80211: ratelimit some RX messages
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (12 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 13/27] mac80211: " Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 15/27] mac80211: remove ieee80211_msg_wep_frame_unknown_key Johannes Berg
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

Many if not all of these messages can be triggered by sending
a few rogue frames which is trivially done and then we overflow
our logs.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/mac80211/rx.c |  134 ++++++++++++++++++++++++++++++++----------------------
 1 file changed, 81 insertions(+), 53 deletions(-)

--- wireless-dev.orig/net/mac80211/rx.c	2007-08-21 14:42:05.415923881 +0200
+++ wireless-dev/net/mac80211/rx.c	2007-08-21 14:49:06.855923881 +0200
@@ -343,13 +343,16 @@ ieee80211_rx_h_load_key(struct ieee80211
 			if (!rx->key) {
 				if (!rx->u.rx.ra_match)
 					return TXRX_DROP;
-				printk(KERN_DEBUG "%s: RX WEP frame with "
-				       "unknown keyidx %d (A1=" MAC_FMT " A2="
-				       MAC_FMT " A3=" MAC_FMT ")\n",
-				       rx->dev->name, keyidx,
-				       MAC_ARG(hdr->addr1),
-				       MAC_ARG(hdr->addr2),
-				       MAC_ARG(hdr->addr3));
+				if (net_ratelimit())
+					printk(KERN_DEBUG "%s: RX WEP frame "
+					       "with unknown keyidx %d "
+					       "(A1=" MAC_FMT
+					       " A2=" MAC_FMT
+					       " A3=" MAC_FMT ")\n",
+					       rx->dev->name, keyidx,
+					       MAC_ARG(hdr->addr1),
+					       MAC_ARG(hdr->addr2),
+					       MAC_ARG(hdr->addr3));
 				if (!rx->local->apdev)
 					return TXRX_DROP;
 				ieee80211_rx_mgmt(
@@ -530,16 +533,18 @@ ieee80211_rx_h_wep_decrypt(struct ieee80
 		return TXRX_CONTINUE;
 
 	if (!rx->key) {
-		printk(KERN_DEBUG "%s: RX WEP frame, but no key set\n",
-		       rx->dev->name);
+		if (net_ratelimit())
+			printk(KERN_DEBUG "%s: RX WEP frame, but no key set\n",
+			       rx->dev->name);
 		return TXRX_DROP;
 	}
 
 	if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) ||
 	    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);
+			if (net_ratelimit())
+				printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
+				       "failed\n", rx->dev->name);
 			return TXRX_DROP;
 		}
 	} else if (rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) {
@@ -696,12 +701,15 @@ ieee80211_rx_h_defragment(struct ieee802
 		}
 		rpn = rx->key->u.ccmp.rx_pn[rx->u.rx.queue];
 		if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) {
-			printk(KERN_DEBUG "%s: defrag: CCMP PN not sequential"
-			       " A2=" MAC_FMT " PN=%02x%02x%02x%02x%02x%02x "
-			       "(expected %02x%02x%02x%02x%02x%02x)\n",
-			       rx->dev->name, MAC_ARG(hdr->addr2),
-			       rpn[0], rpn[1], rpn[2], rpn[3], rpn[4], rpn[5],
-			       pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]);
+			if (net_ratelimit())
+				printk(KERN_DEBUG "%s: defrag: CCMP PN not "
+				       "sequential A2=" MAC_FMT
+				       " PN=%02x%02x%02x%02x%02x%02x "
+				       "(expected %02x%02x%02x%02x%02x%02x)\n",
+				       rx->dev->name, MAC_ARG(hdr->addr2),
+				       rpn[0], rpn[1], rpn[2], rpn[3], rpn[4],
+				       rpn[5], pn[0], pn[1], pn[2], pn[3],
+				       pn[4], pn[5]);
 			return TXRX_DROP;
 		}
 		memcpy(entry->last_pn, pn, CCMP_PN_LEN);
@@ -879,8 +887,9 @@ ieee80211_rx_h_drop_unencrypted(struct i
 		     (rx->key || rx->sdata->drop_unencrypted) &&
 		     (rx->sdata->eapol == 0 ||
 		      !ieee80211_is_eapol(rx->skb)))) {
-		printk(KERN_DEBUG "%s: RX non-WEP frame, but expected "
-		       "encryption\n", rx->dev->name);
+		if (net_ratelimit())
+			printk(KERN_DEBUG "%s: RX non-WEP frame, but expected "
+			       "encryption\n", rx->dev->name);
 		return TXRX_DROP;
 	}
 	return TXRX_CONTINUE;
@@ -971,17 +980,19 @@ ieee80211_rx_h_data_agg(struct ieee80211
 				* in local net stack and back to the wireless
 				* media */
 				skb2 = skb_copy(frame, GFP_ATOMIC);
-				if (!skb2)
+				if (!skb2 && net_ratelimit())
 					printk(KERN_DEBUG "%s: failed to clone"
 					       " multicast frame\n", dev->name);
 			} else {
 				struct sta_info *dsta;
 
 				dsta = sta_info_get(local, frame->data);
-				if (dsta && !dsta->dev)
-					printk(KERN_DEBUG "Station with null "
-					       "dev structure!\n");
-				else if (dsta && dsta->dev == dev) {
+				if (dsta && !dsta->dev) {
+					if (net_ratelimit())
+						printk(KERN_DEBUG "Station "
+						       "with null dev "
+						       "structure!\n");
+				} else if (dsta && dsta->dev == dev) {
 					/* Destination station is associated
 					* to this AP, so send the frame
 					* directly to it and do not pass
@@ -1061,10 +1072,15 @@ ieee80211_rx_h_data(struct ieee80211_txr
 
 		if (unlikely(sdata->type != IEEE80211_IF_TYPE_AP &&
 			     sdata->type != IEEE80211_IF_TYPE_VLAN)) {
-			printk(KERN_DEBUG "%s: dropped ToDS frame (BSSID="
-			       MAC_FMT " SA=" MAC_FMT " DA=" MAC_FMT ")\n",
-			       dev->name, MAC_ARG(hdr->addr1),
-			       MAC_ARG(hdr->addr2), MAC_ARG(hdr->addr3));
+			if (net_ratelimit())
+				printk(KERN_DEBUG "%s: dropped ToDS frame "
+				       "(BSSID=" MAC_FMT
+				       " SA=" MAC_FMT
+				       " DA=" MAC_FMT ")\n",
+				       dev->name,
+				       MAC_ARG(hdr->addr1),
+				       MAC_ARG(hdr->addr2),
+				       MAC_ARG(hdr->addr3));
 			return TXRX_DROP;
 		}
 		break;
@@ -1074,12 +1090,16 @@ ieee80211_rx_h_data(struct ieee80211_txr
 		memcpy(src, hdr->addr4, ETH_ALEN);
 
 		if (unlikely(sdata->type != IEEE80211_IF_TYPE_WDS)) {
-			printk(KERN_DEBUG "%s: dropped FromDS&ToDS frame (RA="
-			       MAC_FMT " TA=" MAC_FMT " DA=" MAC_FMT " SA="
-			       MAC_FMT ")\n",
-			       rx->dev->name, MAC_ARG(hdr->addr1),
-			       MAC_ARG(hdr->addr2), MAC_ARG(hdr->addr3),
-			       MAC_ARG(hdr->addr4));
+			if (net_ratelimit())
+				printk(KERN_DEBUG "%s: dropped FromDS&ToDS "
+				       "frame (RA=" MAC_FMT
+				       " TA=" MAC_FMT " DA=" MAC_FMT
+				       " SA=" MAC_FMT ")\n",
+				       rx->dev->name,
+				       MAC_ARG(hdr->addr1),
+				       MAC_ARG(hdr->addr2),
+				       MAC_ARG(hdr->addr3),
+				       MAC_ARG(hdr->addr4));
 			return TXRX_DROP;
 		}
 		break;
@@ -1155,15 +1175,16 @@ ieee80211_rx_h_data(struct ieee80211_txr
 			/* send multicast frames both to higher layers in
 			 * local net stack and back to the wireless media */
 			skb2 = skb_copy(skb, GFP_ATOMIC);
-			if (!skb2)
+			if (!skb2 && net_ratelimit())
 				printk(KERN_DEBUG "%s: failed to clone "
 				       "multicast frame\n", dev->name);
 		} else {
 			struct sta_info *dsta;
 			dsta = sta_info_get(local, skb->data);
 			if (dsta && !dsta->dev) {
-				printk(KERN_DEBUG "Station with null dev "
-				       "structure!\n");
+				if (net_ratelimit())
+					printk(KERN_DEBUG "Station with null "
+					       "dev structure!\n");
 			} else if (dsta && dsta->dev == dev) {
 				/* Destination station is associated to this
 				 * AP, so send the frame directly to it and
@@ -1275,24 +1296,28 @@ static void ieee80211_rx_michael_mic_rep
 
 	/* TODO: verify that this is not triggered by fragmented
 	 * frames (hw does not verify MIC for them). */
-	printk(KERN_DEBUG "%s: TKIP hwaccel reported Michael MIC "
-	       "failure from " MAC_FMT " to " MAC_FMT " keyidx=%d\n",
-	       dev->name, MAC_ARG(hdr->addr2), MAC_ARG(hdr->addr1), keyidx);
+	if (net_ratelimit())
+		printk(KERN_DEBUG "%s: TKIP hwaccel reported Michael MIC "
+		       "failure from " MAC_FMT " to " MAC_FMT " keyidx=%d\n",
+		       dev->name, MAC_ARG(hdr->addr2), MAC_ARG(hdr->addr1),
+		       keyidx);
 
 	if (!sta) {
 		/* Some hardware versions seem to generate incorrect
 		 * Michael MIC reports; ignore them to avoid triggering
 		 * countermeasures. */
-		printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
-		       "error for unknown address " MAC_FMT "\n",
-		       dev->name, MAC_ARG(hdr->addr2));
+		if (net_ratelimit())
+			printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
+			       "error for unknown address " MAC_FMT "\n",
+			       dev->name, MAC_ARG(hdr->addr2));
 		goto ignore;
 	}
 
 	if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) {
-		printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
-		       "error for a frame with no ISWEP flag (src "
-		       MAC_FMT ")\n", dev->name, MAC_ARG(hdr->addr2));
+		if (net_ratelimit())
+			printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
+			       "error for a frame with no ISWEP flag (src "
+			       MAC_FMT ")\n", dev->name, MAC_ARG(hdr->addr2));
 		goto ignore;
 	}
 
@@ -1304,9 +1329,11 @@ static void ieee80211_rx_michael_mic_rep
 		 * for group keys and only the AP is sending real multicast
 		 * frames in BSS. */
 		if (keyidx) {
-			printk(KERN_DEBUG "%s: ignored Michael MIC error for "
-			       "a frame with non-zero keyidx (%d) (src " MAC_FMT
-			       ")\n", dev->name, keyidx, MAC_ARG(hdr->addr2));
+			if (net_ratelimit())
+				printk(KERN_DEBUG "%s: ignored Michael MIC "
+				       "error for a frame with non-zero keyidx"
+				       " (%d) (src " MAC_FMT ")\n", dev->name,
+				       keyidx, MAC_ARG(hdr->addr2));
 			goto ignore;
 		}
 	}
@@ -1314,10 +1341,11 @@ static void ieee80211_rx_michael_mic_rep
 	if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
 	    ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT ||
 	     (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH)) {
-		printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
-		       "error for a frame that cannot be encrypted "
-		       "(fc=0x%04x) (src " MAC_FMT ")\n",
-		       dev->name, rx->fc, MAC_ARG(hdr->addr2));
+		if (net_ratelimit())
+			printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
+			       "error for a frame that cannot be encrypted "
+			       "(fc=0x%04x) (src " MAC_FMT ")\n",
+			       dev->name, rx->fc, MAC_ARG(hdr->addr2));
 		goto ignore;
 	}
 

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 15/27] mac80211: remove ieee80211_msg_wep_frame_unknown_key
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (13 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 14/27] mac80211: ratelimit some RX messages Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 16/27] mac80211: remove radar stuff Johannes Berg
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

Neither hostapd nor wpa_supplicant really use it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/ieee80211_common.h |    2 +-
 net/mac80211/rx.c               |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

--- wireless-dev.orig/net/mac80211/rx.c	2007-08-21 14:49:06.855923881 +0200
+++ wireless-dev/net/mac80211/rx.c	2007-08-21 14:51:10.105923881 +0200
@@ -353,12 +353,11 @@ ieee80211_rx_h_load_key(struct ieee80211
 					       MAC_ARG(hdr->addr1),
 					       MAC_ARG(hdr->addr2),
 					       MAC_ARG(hdr->addr3));
-				if (!rx->local->apdev)
-					return TXRX_DROP;
-				ieee80211_rx_mgmt(
-					rx->local, rx->skb, rx->u.rx.status,
-					ieee80211_msg_wep_frame_unknown_key);
-				return TXRX_QUEUED;
+				/*
+				 * TODO: notify userspace about this
+				 * via cfg/nl80211
+				 */
+				return TXRX_DROP;
 			}
 		}
 	}
--- wireless-dev.orig/net/mac80211/ieee80211_common.h	2007-08-21 14:42:05.475923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_common.h	2007-08-21 14:51:10.105923881 +0200
@@ -48,7 +48,7 @@ enum ieee80211_msg_type {
 	ieee80211_msg_tx_callback_ack = 1,
 	ieee80211_msg_tx_callback_fail = 2,
 	/* hole at 3, was ieee80211_msg_passive_scan but unused */
-	ieee80211_msg_wep_frame_unknown_key = 4,
+	/* hole at 4, was ieee80211_msg_wep_frame_unknown_key but now unused */
 	ieee80211_msg_michael_mic_failure = 5,
 	/* hole at 6, was monitor but never sent to userspace */
 	ieee80211_msg_sta_not_assoc = 7,

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 16/27] mac80211: remove radar stuff
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (14 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 15/27] mac80211: remove ieee80211_msg_wep_frame_unknown_key Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 17/27] mac80211: remove scan struct from hostapd_param Johannes Berg
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

Unused in drivers, userspace and mac80211.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 include/net/mac80211.h          |    6 ------
 net/mac80211/ieee80211.c        |   28 ----------------------------
 net/mac80211/ieee80211_common.h |    2 +-
 3 files changed, 1 insertion(+), 35 deletions(-)

--- wireless-dev.orig/include/net/mac80211.h	2007-08-21 14:40:14.185923881 +0200
+++ wireless-dev/include/net/mac80211.h	2007-08-21 14:40:16.095923881 +0200
@@ -1033,12 +1033,6 @@ ieee80211_get_mc_list_item(struct ieee80
 /* called by driver to notify scan status completed */
 void ieee80211_scan_completed(struct ieee80211_hw *hw);
 
-/* Function to indicate Radar Detection. The low level driver must call this
- * function to indicate the presence of radar in the current channel.
- * Additionally the radar type also could be sent */
-int  ieee80211_radar_status(struct ieee80211_hw *hw, int channel,
-			    int radar, int radar_type);
-
 /* return a pointer to the source address (SA) */
 static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
 {
--- wireless-dev.orig/net/mac80211/ieee80211.c	2007-08-21 14:39:42.675923881 +0200
+++ wireless-dev/net/mac80211/ieee80211.c	2007-08-21 14:40:16.095923881 +0200
@@ -201,34 +201,6 @@ ieee80211_rx_mgmt(struct ieee80211_local
 	netif_rx(skb);
 }
 
-int ieee80211_radar_status(struct ieee80211_hw *hw, int channel,
-			   int radar, int radar_type)
-{
-	struct sk_buff *skb;
-	struct ieee80211_radar_info *msg;
-	struct ieee80211_local *local = hw_to_local(hw);
-
-	if (!local->apdev)
-		return 0;
-
-	skb = dev_alloc_skb(sizeof(struct ieee80211_frame_info) +
-			    sizeof(struct ieee80211_radar_info));
-
-	if (!skb)
-		return -ENOMEM;
-	skb_reserve(skb, sizeof(struct ieee80211_frame_info));
-
-	msg = (struct ieee80211_radar_info *)
-		skb_put(skb, sizeof(struct ieee80211_radar_info));
-	msg->channel = channel;
-	msg->radar = radar;
-	msg->radar_type = radar_type;
-
-	ieee80211_rx_mgmt(local, skb, NULL, ieee80211_msg_radar);
-	return 0;
-}
-EXPORT_SYMBOL(ieee80211_radar_status);
-
 void ieee80211_key_threshold_notify(struct net_device *dev,
 				    struct ieee80211_key *key,
 				    struct sta_info *sta)
--- wireless-dev.orig/net/mac80211/ieee80211_common.h	2007-08-21 14:40:15.485923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_common.h	2007-08-21 14:40:16.105923881 +0200
@@ -54,7 +54,7 @@ enum ieee80211_msg_type {
 	ieee80211_msg_sta_not_assoc = 7,
 	/* 8 was ieee80211_msg_set_aid_for_sta */
 	ieee80211_msg_key_threshold_notification = 9,
-	ieee80211_msg_radar = 11,
+	/* 11 was ieee80211_msg_radar */
 };
 
 struct ieee80211_msg_key_notification {

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 17/27] mac80211: remove scan struct from hostapd_param
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (15 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 16/27] mac80211: remove radar stuff Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 18/27] mac80211: fix software decryption Johannes Berg
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

This hasn't been used for quite a while.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/hostapd_ioctl.h |    8 --------
 1 file changed, 8 deletions(-)

--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 14:40:14.195923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 14:40:16.755923881 +0200
@@ -156,14 +156,6 @@ struct prism2_hostapd_param {
 			u8 data[0] ALIGNED; /* num_modes * feature data */
 		} hw_features;
 		struct {
-			u8  now;
-			s8  our_mode_only;
-			s16 last_rx;
-			u16 channel;
-			s16 interval; /* seconds */
-			s32 listen;   /* microseconds */
-		} scan;
-		struct {
 			u16 mode; /* MODE_* */
 			u16 num_supported_rates;
 			u16 num_basic_rates;

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 18/27] mac80211: fix software decryption
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (16 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 17/27] mac80211: remove scan struct from hostapd_param Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 19/27] cfg80211: extend radiotap parser by all remaining fields Johannes Berg
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

When doing key selection for software decryption, mac80211 gets
a few things wrong: it always uses pairwise keys if configured,
even if the frame is addressed to a multicast address. Also, it
doesn't allow using a key index of zero if a pairwise key has
also been found.

This patch changes the key selection code to be (more) in line
with the 802.11 specification. I have confirmed that with this,
multicast frames are correctly decrypted and I've tested with
WEP as well.

While at it, I've cleaned up the semantics of the hardware flags
IEEE80211_HW_WEP_INCLUDE_IV and IEEE80211_HW_DEVICE_HIDES_WEP
and clarified them in the mac80211.h header; it is also now
allowed to set the IEEE80211_HW_DEVICE_HIDES_WEP option even if
it only applies to frames that have been decrypted by the hw,
unencrypted frames must be dropped but encrypted frames that
the hardware couldn't handle can be passed up unmodified.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 include/net/mac80211.h |   37 +++++++++++---
 net/mac80211/rx.c      |  125 ++++++++++++++++++++++++++++++-------------------
 net/mac80211/wpa.c     |    7 +-
 3 files changed, 112 insertions(+), 57 deletions(-)

--- wireless-dev.orig/net/mac80211/rx.c	2007-08-21 15:23:31.625923881 +0200
+++ wireless-dev/net/mac80211/rx.c	2007-08-21 15:29:55.865923881 +0200
@@ -317,52 +317,83 @@ static ieee80211_txrx_result
 ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
-	int always_sta_key;
+	int keyidx;
+	int hdrlen;
+	int trying_wep = 0;
+
+	/*
+	 * Key selection 101
+	 *
+	 * There are three types of keys:
+	 *  - GTK (group keys)
+	 *  - PTK (pairwise keys)
+	 *  - STK (station-to-station pairwise keys)
+	 *
+	 * When selecting a key, we have to distinguish between multicast
+	 * (including broadcast) and unicast frames, the latter can only
+	 * use PTKs and STKs while the former always use GTKs. Unless, of
+	 * course, actual WEP keys ("pre-RSNA") are used, then unicast
+	 * frames can also use key indizes like GTKs. Hence, if we don't
+	 * have a PTK/STK we check the key index for a WEP key.
+	 *
+	 * There is also a slight problem in IBSS mode: GTKs are negotiated
+	 * with each station, that is something we don't currently handle.
+	 */
 
-	if (rx->sdata->type == IEEE80211_IF_TYPE_STA)
-		always_sta_key = 0;
-	else
-		always_sta_key = 1;
+	if (!(rx->fc & IEEE80211_FCTL_PROTECTED))
+		return TXRX_CONTINUE;
 
-	if (rx->sta && rx->sta->key && always_sta_key) {
-		rx->key = rx->sta->key;
+	/*
+	 * No point in finding a key if the frame is neither
+	 * addressed to us nor a multicast frame.
+	 */
+	if (!rx->u.rx.ra_match)
+		return TXRX_DROP;
+
+	if (is_multicast_ether_addr(hdr->addr1) || !rx->sta) {
+ find_by_index:
+		/*
+		 * The device doesn't give us the IV so won't be
+		 * able to look up the key. That's ok though, we
+		 * don't need to decrypt the frame, we just won't
+		 * be able to keep statistics accurate.
+		 * Except for key threshold notifications, should
+		 * we somehow allow the driver to tell us which key
+		 * the hardware used if this flag is set?
+		 */
+		if (!(rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV))
+			return TXRX_CONTINUE;
+
+		hdrlen = ieee80211_get_hdrlen(rx->fc);
+
+		if (rx->skb->len < 8 + hdrlen)
+			/* COUNT THIS? */
+			return TXRX_DROP;
+		/*
+		 * no need to call ieee80211_wep_get_keyidx,
+		 * it verifies a bunch of things we've done already
+		 */
+		keyidx = rx->skb->data[hdrlen + 3] >> 6;
+
+		/*
+		 * TODO: handle IBSS! We can have per-STA group keys there!
+		 */
+		rx->key = rx->sdata->keys[keyidx];
+
+		/*
+		 * If we got here for WEP, make sure we got WEP
+		 */
+		if (trying_wep && rx->key && rx->key->alg != ALG_WEP)
+			rx->key = NULL;
 	} else {
-		if (rx->sta && rx->sta->key)
-			rx->key = rx->sta->key;
-		else
-			rx->key = rx->sdata->default_key;
-
-		if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) &&
-		    rx->fc & IEEE80211_FCTL_PROTECTED) {
-			int keyidx = ieee80211_wep_get_keyidx(rx->skb);
-
-			if (keyidx >= 0 && keyidx < NUM_DEFAULT_KEYS &&
-			    (!rx->sta || !rx->sta->key || keyidx > 0))
-				rx->key = rx->sdata->keys[keyidx];
-
-			if (!rx->key) {
-				if (!rx->u.rx.ra_match)
-					return TXRX_DROP;
-				if (net_ratelimit())
-					printk(KERN_DEBUG "%s: RX WEP frame "
-					       "with unknown keyidx %d "
-					       "(A1=" MAC_FMT
-					       " A2=" MAC_FMT
-					       " A3=" MAC_FMT ")\n",
-					       rx->dev->name, keyidx,
-					       MAC_ARG(hdr->addr1),
-					       MAC_ARG(hdr->addr2),
-					       MAC_ARG(hdr->addr3));
-				/*
-				 * TODO: notify userspace about this
-				 * via cfg/nl80211
-				 */
-				return TXRX_DROP;
-			}
+		rx->key = rx->sta->key;
+		if (!rx->key) {
+			trying_wep = 1;
+			goto find_by_index;
 		}
 	}
 
-	if (rx->fc & IEEE80211_FCTL_PROTECTED && rx->key && rx->u.rx.ra_match) {
+	if (rx->key && rx->u.rx.ra_match) {
 		rx->key->tx_rx_count++;
 		if (unlikely(rx->local->key_tx_rx_threshold &&
 			     rx->key->tx_rx_count >
@@ -520,10 +551,6 @@ ieee80211_rx_h_wep_weak_iv_detection(str
 static ieee80211_txrx_result
 ieee80211_rx_h_wep_decrypt(struct ieee80211_txrx_data *rx)
 {
-	/* If the device handles decryption totally, skip this test */
-	if (rx->local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP)
-		return TXRX_CONTINUE;
-
 	if ((rx->key && rx->key->alg != ALG_WEP) ||
 	    !(rx->fc & IEEE80211_FCTL_PROTECTED) ||
 	    ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
@@ -875,8 +902,14 @@ ieee80211_rx_h_802_1x_pae(struct ieee802
 static ieee80211_txrx_result
 ieee80211_rx_h_drop_unencrypted(struct ieee80211_txrx_data *rx)
 {
-	/*  If the device handles decryption totally, skip this test */
-	if (rx->local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP)
+	/*
+	 * Pass through unencrypted frames if the hardware might have
+	 * decrypted them already without telling us, but that can only
+	 * be true if we either didn't find a key or the found key is
+	 * uploaded to the hardware.
+	 */
+	if ((rx->local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP) &&
+	    (!rx->key || !rx->key->force_sw_encrypt))
 		return TXRX_CONTINUE;
 
 	/* Drop unencrypted frames if key is set. */
--- wireless-dev.orig/include/net/mac80211.h	2007-08-21 15:24:26.015923881 +0200
+++ wireless-dev/include/net/mac80211.h	2007-08-21 15:28:19.455923881 +0200
@@ -1,7 +1,9 @@
 /*
- * Low-level hardware driver -- IEEE 802.11 driver (80211.o) interface
+ * mac80211 <-> driver interface
+ *
  * Copyright 2002-2005, Devicescape Software, Inc.
  * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
+ * Copyright 2007	Johannes Berg <johannes@sipsolutions.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -471,10 +473,16 @@ struct ieee80211_hw {
 	 */
 #define IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE (1<<1)
 
-	/* Some devices handle decryption internally and do not
+	/*
+	 * Some devices handle decryption internally and do not
 	 * indicate whether the frame was encrypted (unencrypted frames
 	 * will be dropped by the hardware, unless specifically allowed
-	 * through) */
+	 * through.)
+	 * It is permissible to not handle all encrypted frames and fall
+	 * back to software encryption; however, if this flag is set
+	 * unencrypted frames must be dropped unless the driver is told
+	 * otherwise via the set_ieee8021x() callback.
+	 */
 #define IEEE80211_HW_DEVICE_HIDES_WEP (1<<2)
 
 	/* Whether RX frames passed to ieee80211_rx() include FCS in the end */
@@ -488,6 +496,18 @@ struct ieee80211_hw {
 	 * can fetch them with ieee80211_get_buffered_bc(). */
 #define IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING (1<<4)
 
+	/*
+	 * This flag is only relevant if hardware encryption is used.
+	 * If set, it has two meanings:
+	 *  1) the IV and ICV are present in received frames that have
+	 *     been decrypted (unless IEEE80211_HW_DEVICE_HIDES_WEP is
+	 *     also set)
+	 *  2) on transmission, the IV should be generated in software.
+	 *
+	 * Please let us know if you *don't* use this flag, the stack would
+	 * really like to be able to get the IV to keep key statistics
+	 * accurate.
+	 */
 #define IEEE80211_HW_WEP_INCLUDE_IV (1<<5)
 
 /* hole at 6 */
@@ -495,11 +515,12 @@ struct ieee80211_hw {
 	/* Force software encryption for TKIP packets if WMM is enabled. */
 #define IEEE80211_HW_NO_TKIP_WMM_HWACCEL (1<<7)
 
-	/* Some devices handle Michael MIC internally and do not include MIC in
-	 * the received packets passed up. device_strips_mic must be set
-	 * for such devices. The 'encryption' frame control bit is expected to
-	 * be still set in the IEEE 802.11 header with this option unlike with
-	 * the device_hides_wep configuration option.
+	/*
+	 * Some devices handle Michael MIC internally and do not include MIC in
+	 * the received packets passed up. This flag must be set for such
+	 * devices. The 'encryption' frame control bit is expected to be still
+	 * set in the IEEE 802.11 header with this option unlike with the
+	 * IEEE80211_HW_DEVICE_HIDES_WEP flag.
 	 */
 #define IEEE80211_HW_DEVICE_STRIPS_MIC (1<<8)
 
--- wireless-dev.orig/net/mac80211/wpa.c	2007-08-21 14:58:42.015923881 +0200
+++ wireless-dev/net/mac80211/wpa.c	2007-08-21 15:28:19.455923881 +0200
@@ -169,9 +169,10 @@ ieee80211_rx_h_michael_mic_verify(struct
 
 	fc = rx->fc;
 
-	/* If device handles decryption totally, skip this check */
-	if ((rx->local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP) ||
-	    (rx->local->hw.flags & IEEE80211_HW_DEVICE_STRIPS_MIC))
+	/*
+	 * No way to verify the MIC if the hardware stripped it
+	 */
+	if (rx->local->hw.flags & IEEE80211_HW_DEVICE_STRIPS_MIC)
 		return TXRX_CONTINUE;
 
 	if (!rx->key || rx->key->alg != ALG_TKIP ||

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 19/27] cfg80211: extend radiotap parser by all remaining  fields
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (17 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 18/27] mac80211: fix software decryption Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 20/27] mac80211: remove unused ioctls (1) Johannes Berg
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

These fields are defined so the parser might as well understand them.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/wireless/radiotap.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- wireless-dev.orig/net/wireless/radiotap.c	2007-08-21 14:42:05.635923881 +0200
+++ wireless-dev/net/wireless/radiotap.c	2007-08-21 14:52:58.095923881 +0200
@@ -161,7 +161,11 @@ int ieee80211_radiotap_iterator_next(
 		[IEEE80211_RADIOTAP_DBM_TX_POWER] = 0x11,
 		[IEEE80211_RADIOTAP_ANTENNA] = 0x11,
 		[IEEE80211_RADIOTAP_DB_ANTSIGNAL] = 0x11,
-		[IEEE80211_RADIOTAP_DB_ANTNOISE] = 0x11
+		[IEEE80211_RADIOTAP_DB_ANTNOISE] = 0x11,
+		[IEEE80211_RADIOTAP_RX_FLAGS] = 0x22,
+		[IEEE80211_RADIOTAP_TX_FLAGS] = 0x22,
+		[IEEE80211_RADIOTAP_RTS_RETRIES] = 0x11,
+		[IEEE80211_RADIOTAP_DATA_RETRIES] = 0x11,
 		/*
 		 * add more here as they are defined in
 		 * include/net/ieee80211_radiotap.h

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 20/27] mac80211: remove unused ioctls (1)
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (18 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 19/27] cfg80211: extend radiotap parser by all remaining fields Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 21/27] mac80211: remove unused ioctls (2) Johannes Berg
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

The ioctls

 * PRISM2_PARAM_HOST_ENCRYPT
 * PRISM2_PARAM_HOST_DECRYPT
 * PRISM2_PARAM_ANTENNA_MODE
 * PRISM2_PARAM_STAT_TIME

are not used by hostapd or wpa_supplicant.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 include/net/mac80211.h         |    3 --
 net/mac80211/hostapd_ioctl.h   |    4 ---
 net/mac80211/ieee80211.c       |   42 -----------------------------------------
 net/mac80211/ieee80211_i.h     |    2 -
 net/mac80211/ieee80211_ioctl.c |   28 ---------------------------
 5 files changed, 79 deletions(-)

--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 15:42:23.335923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 15:42:24.645923881 +0200
@@ -28,8 +28,6 @@ enum {
 	PRISM2_PARAM_BEACON_INT = 3,
 	PRISM2_PARAM_AP_BRIDGE_PACKETS = 10,
 	PRISM2_PARAM_DTIM_PERIOD = 11,
-	PRISM2_PARAM_HOST_ENCRYPT = 17,
-	PRISM2_PARAM_HOST_DECRYPT = 18,
 	PRISM2_PARAM_IEEE_802_1X = 23,
 
 	/* Instant802 additions */
@@ -37,10 +35,8 @@ enum {
 	PRISM2_PARAM_PREAMBLE = 1003,
 	PRISM2_PARAM_SHORT_SLOT_TIME = 1006,
 	PRISM2_PARAM_NEXT_MODE = 1008,
-	PRISM2_PARAM_ANTENNA_MODE = 1013,
 	PRISM2_PARAM_PRIVACY_INVOKED = 1014,
 	PRISM2_PARAM_BROADCAST_SSID = 1015,
-	PRISM2_PARAM_STAT_TIME = 1016,
 	PRISM2_PARAM_STA_ANTENNA_SEL = 1017,
 	PRISM2_PARAM_TX_POWER_REDUCTION = 1022,
 	PRISM2_PARAM_EAPOL = 1023,
--- wireless-dev.orig/net/mac80211/ieee80211_i.h	2007-08-21 15:42:23.375923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h	2007-08-21 15:42:24.645923881 +0200
@@ -590,8 +590,6 @@ struct ieee80211_local {
 
 	u32 channel_use;
 	u32 channel_use_raw;
-	u32 stat_time;
-	struct timer_list stat_timer;
 
 #ifdef CONFIG_MAC80211_DEBUGFS
 	struct work_struct sta_debugfs_add;
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:42:23.465923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:42:24.655923881 +0200
@@ -2113,12 +2113,6 @@ static int ieee80211_ioctl_prism2_param(
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
 	switch (param) {
-	case PRISM2_PARAM_HOST_ENCRYPT:
-	case PRISM2_PARAM_HOST_DECRYPT:
-		/* TODO: implement these; return success now to prevent
-		 * hostapd from aborting */
-		break;
-
 	case PRISM2_PARAM_BEACON_INT:
 		local->hw.conf.beacon_int = value;
 		if (ieee80211_hw_config(local))
@@ -2167,15 +2161,6 @@ static int ieee80211_ioctl_prism2_param(
 		}
 		break;
 
-	case PRISM2_PARAM_STAT_TIME:
-		if (!local->stat_time && value) {
-			local->stat_timer.expires = jiffies + HZ * value / 100;
-			add_timer(&local->stat_timer);
-		} else if (local->stat_time && !value) {
-			del_timer_sync(&local->stat_timer);
-		}
-		local->stat_time = value;
-		break;
 	case PRISM2_PARAM_SHORT_SLOT_TIME:
 		if (value)
 			local->hw.conf.flags |= IEEE80211_CONF_SHORT_SLOT_TIME;
@@ -2195,12 +2180,6 @@ static int ieee80211_ioctl_prism2_param(
 		local->next_mode = value;
 		break;
 
-	case PRISM2_PARAM_ANTENNA_MODE:
-		local->hw.conf.antenna_mode = value;
-		if (ieee80211_hw_config(local))
-			ret = -EINVAL;
-		break;
-
 	case PRISM2_PARAM_BROADCAST_SSID:
 		if ((value < 0) || (value > 1))
 			ret = -EINVAL;
@@ -2353,9 +2332,6 @@ static int ieee80211_ioctl_get_prism2_pa
 		*param = sdata->short_preamble;
 		break;
 
-	case PRISM2_PARAM_STAT_TIME:
-		*param = local->stat_time;
-		break;
 	case PRISM2_PARAM_SHORT_SLOT_TIME:
 		*param = !!(local->hw.conf.flags & IEEE80211_CONF_SHORT_SLOT_TIME);
 		break;
@@ -2364,10 +2340,6 @@ static int ieee80211_ioctl_get_prism2_pa
 		*param = local->next_mode;
 		break;
 
-	case PRISM2_PARAM_ANTENNA_MODE:
-		*param = local->hw.conf.antenna_mode;
-		break;
-
 	case PRISM2_PARAM_BROADCAST_SSID:
 		*param = !!(local->hw.conf.flags & IEEE80211_CONF_SSID_HIDDEN);
 		break;
--- wireless-dev.orig/include/net/mac80211.h	2007-08-21 15:42:23.615923881 +0200
+++ wireless-dev/include/net/mac80211.h	2007-08-21 15:42:24.655923881 +0200
@@ -302,9 +302,6 @@ struct ieee80211_conf {
 	u8 antenna_sel_tx;
 	u8 antenna_sel_rx;
 
-	int antenna_def;
-	int antenna_mode;
-
 	/* Following five fields are used for IEEE 802.11H */
 	unsigned int radar_detect;
 	unsigned int spect_mgmt;
--- wireless-dev.orig/net/mac80211/ieee80211.c	2007-08-21 15:42:23.505923881 +0200
+++ wireless-dev/net/mac80211/ieee80211.c	2007-08-21 15:42:24.665923881 +0200
@@ -788,42 +788,6 @@ struct dev_mc_list *ieee80211_get_mc_lis
 }
 EXPORT_SYMBOL(ieee80211_get_mc_list_item);
 
-static void ieee80211_stat_refresh(unsigned long data)
-{
-	struct ieee80211_local *local = (struct ieee80211_local *) data;
-	struct sta_info *sta;
-	struct ieee80211_sub_if_data *sdata;
-
-	if (!local->stat_time)
-		return;
-
-	/* go through all stations */
-	read_lock_bh(&local->sta_lock);
-	list_for_each_entry(sta, &local->sta_list, list) {
-		sta->channel_use = (sta->channel_use_raw / local->stat_time) /
-			CHAN_UTIL_PER_10MS;
-		sta->channel_use_raw = 0;
-	}
-	read_unlock_bh(&local->sta_lock);
-
-	/* go through all subinterfaces */
-	read_lock(&local->sub_if_lock);
-	list_for_each_entry(sdata, &local->sub_if_list, list) {
-		sdata->channel_use = (sdata->channel_use_raw /
-				      local->stat_time) / CHAN_UTIL_PER_10MS;
-		sdata->channel_use_raw = 0;
-	}
-	read_unlock(&local->sub_if_lock);
-
-	/* hardware interface */
-	local->channel_use = (local->channel_use_raw /
-			      local->stat_time) / CHAN_UTIL_PER_10MS;
-	local->channel_use_raw = 0;
-
-	local->stat_timer.expires = jiffies + HZ * local->stat_time / 100;
-	add_timer(&local->stat_timer);
-}
-
 void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
 				 struct sk_buff *skb,
 				 struct ieee80211_tx_status *status)
@@ -1262,9 +1226,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(
 	INIT_LIST_HEAD(&local->sub_if_list);
 
 	INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work);
-	init_timer(&local->stat_timer);
-	local->stat_timer.function = ieee80211_stat_refresh;
-	local->stat_timer.data = (unsigned long) local;
 	ieee80211_rx_bss_list_init(mdev);
 
 	sta_info_init(local);
@@ -1463,9 +1424,6 @@ void ieee80211_unregister_hw(struct ieee
 
 	rtnl_unlock();
 
-	if (local->stat_time)
-		del_timer_sync(&local->stat_timer);
-
 	ieee80211_rx_bss_list_deinit(local->mdev);
 	ieee80211_clear_tx_pending(local);
 	sta_info_stop(local);

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 21/27] mac80211: remove unused ioctls (2)
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (19 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 20/27] mac80211: remove unused ioctls (1) Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 22/27] mac80211: remove unused ioctls (3) Johannes Berg
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

The ioctls

 * PRISM2_PARAM_STA_ANTENNA_SEL
 * PRISM2_PARAM_TX_POWER_REDUCTION
 * PRISM2_PARAM_KEY_INDEX
 * PRISM2_PARAM_DEFAULT_WEP_ONLY
 * PRISM2_PARAM_ALLOW_BROADCAST_ALWAYS

are not used by hostapd or wpa_supplicant.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 drivers/net/wireless/iwl-4965-rs.c |    2 -
 include/net/mac80211.h             |    1 
 net/mac80211/debugfs.c             |    5 ---
 net/mac80211/hostapd_ioctl.h       |    5 ---
 net/mac80211/ieee80211_i.h         |   11 ------
 net/mac80211/ieee80211_ioctl.c     |   59 -------------------------------------
 net/mac80211/rc80211_simple.c      |    8 -----
 net/mac80211/sta_info.h            |    4 --
 net/mac80211/tx.c                  |    3 -
 9 files changed, 98 deletions(-)

--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 15:42:24.645923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 15:48:54.905923881 +0200
@@ -37,14 +37,9 @@ enum {
 	PRISM2_PARAM_NEXT_MODE = 1008,
 	PRISM2_PARAM_PRIVACY_INVOKED = 1014,
 	PRISM2_PARAM_BROADCAST_SSID = 1015,
-	PRISM2_PARAM_STA_ANTENNA_SEL = 1017,
-	PRISM2_PARAM_TX_POWER_REDUCTION = 1022,
 	PRISM2_PARAM_EAPOL = 1023,
 	PRISM2_PARAM_KEY_TX_RX_THRESHOLD = 1024,
-	PRISM2_PARAM_KEY_INDEX = 1025,
-	PRISM2_PARAM_DEFAULT_WEP_ONLY = 1026,
 	PRISM2_PARAM_WIFI_WME_NOACK_TEST = 1033,
-	PRISM2_PARAM_ALLOW_BROADCAST_ALWAYS = 1034,
 	PRISM2_PARAM_SCAN_FLAGS = 1035,
 	PRISM2_PARAM_HW_MODES = 1036,
 	PRISM2_PARAM_CREATE_IBSS = 1037,
--- wireless-dev.orig/net/mac80211/ieee80211_i.h	2007-08-21 15:42:24.645923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h	2007-08-21 15:48:54.915923881 +0200
@@ -595,12 +595,6 @@ struct ieee80211_local {
 	struct work_struct sta_debugfs_add;
 #endif
 
-	enum {
-		STA_ANTENNA_SEL_AUTO = 0,
-		STA_ANTENNA_SEL_SW_CTRL = 1,
-		STA_ANTENNA_SEL_SW_CTRL_DEBUG = 2
-	} sta_antenna_sel;
-
 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
 	/* TX/RX handler statistics */
 	unsigned int tx_handlers_drop;
@@ -636,10 +630,6 @@ struct ieee80211_local {
 	int total_ps_buffered; /* total number of all buffered unicast and
 				* multicast packets for power saving stations
 				*/
-	int allow_broadcast_always; /* whether to allow TX of broadcast frames
-				     * even when there are no associated STAs
-				     */
-
 	int wifi_wme_noack_test;
 	unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
 
@@ -667,7 +657,6 @@ struct ieee80211_local {
 		struct dentry *mode;
 		struct dentry *wep_iv;
 		struct dentry *rate_ctrl_alg;
-		struct dentry *tx_power_reduction;
 		struct dentry *modes;
 		struct dentry *statistics;
 		struct local_debugfsdentries_statsdentries {
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:42:24.655923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:48:54.915923881 +0200
@@ -2189,17 +2189,6 @@ static int ieee80211_ioctl_prism2_param(
 			local->hw.conf.flags &= ~IEEE80211_CONF_SSID_HIDDEN;
 		break;
 
-	case PRISM2_PARAM_STA_ANTENNA_SEL:
-		local->sta_antenna_sel = value;
-		break;
-
-	case PRISM2_PARAM_TX_POWER_REDUCTION:
-		if (value < 0)
-			ret = -EINVAL;
-		else
-			local->hw.conf.tx_power_reduction = value;
-		break;
-
 	case PRISM2_PARAM_EAPOL:
 		sdata->eapol = value;
 		break;
@@ -2208,27 +2197,10 @@ static int ieee80211_ioctl_prism2_param(
 		local->key_tx_rx_threshold = value;
 		break;
 
-	case PRISM2_PARAM_KEY_INDEX:
-		if (value < 0 || value >= NUM_DEFAULT_KEYS)
-			ret = -EINVAL;
-		else if (!sdata->keys[value])
-			ret = -ENOENT;
-		else
-			sdata->default_key = sdata->keys[value];
-		break;
-
-	case PRISM2_PARAM_DEFAULT_WEP_ONLY:
-		ret = ieee80211_ioctl_default_wep_only(local, value);
-		break;
-
 	case PRISM2_PARAM_WIFI_WME_NOACK_TEST:
 		local->wifi_wme_noack_test = value;
 		break;
 
-	case PRISM2_PARAM_ALLOW_BROADCAST_ALWAYS:
-		local->allow_broadcast_always = value;
-		break;
-
 	case PRISM2_PARAM_SCAN_FLAGS:
 		local->scan_flags = value;
 		break;
@@ -2344,14 +2316,6 @@ static int ieee80211_ioctl_get_prism2_pa
 		*param = !!(local->hw.conf.flags & IEEE80211_CONF_SSID_HIDDEN);
 		break;
 
-	case PRISM2_PARAM_STA_ANTENNA_SEL:
-		*param = local->sta_antenna_sel;
-		break;
-
-	case PRISM2_PARAM_TX_POWER_REDUCTION:
-		*param = local->hw.conf.tx_power_reduction;
-		break;
-
 	case PRISM2_PARAM_EAPOL:
 		*param = sdata->eapol;
 		break;
@@ -2360,33 +2324,10 @@ static int ieee80211_ioctl_get_prism2_pa
 		*param = local->key_tx_rx_threshold;
 		break;
 
-	case PRISM2_PARAM_KEY_INDEX:
-		if (!sdata->default_key)
-			ret = -ENOENT;
-		else if (sdata->default_key == sdata->keys[0])
-			*param = 0;
-		else if (sdata->default_key == sdata->keys[1])
-			*param = 1;
-		else if (sdata->default_key == sdata->keys[2])
-			*param = 2;
-		else if (sdata->default_key == sdata->keys[3])
-			*param = 3;
-		else
-			ret = -ENOENT;
-		break;
-
-	case PRISM2_PARAM_DEFAULT_WEP_ONLY:
-		*param = local->default_wep_only;
-		break;
-
 	case PRISM2_PARAM_WIFI_WME_NOACK_TEST:
 		*param = local->wifi_wme_noack_test;
 		break;
 
-	case PRISM2_PARAM_ALLOW_BROADCAST_ALWAYS:
-		*param = local->allow_broadcast_always;
-		break;
-
 	case PRISM2_PARAM_SCAN_FLAGS:
 		*param = local->scan_flags;
 		break;
--- wireless-dev.orig/net/mac80211/rc80211_simple.c	2007-08-21 15:34:48.205923881 +0200
+++ wireless-dev/net/mac80211/rc80211_simple.c	2007-08-21 15:48:54.925923881 +0200
@@ -147,14 +147,6 @@ static void rate_control_simple_tx_statu
 	srctrl = sta->rate_ctrl_priv;
 	srctrl->tx_num_xmit++;
 	if (status->excessive_retries) {
-		sta->antenna_sel_tx = sta->antenna_sel_tx == 1 ? 2 : 1;
-		sta->antenna_sel_rx = sta->antenna_sel_rx == 1 ? 2 : 1;
-		if (local->sta_antenna_sel == STA_ANTENNA_SEL_SW_CTRL_DEBUG) {
-			printk(KERN_DEBUG "%s: " MAC_FMT " TX antenna --> %d "
-			       "RX antenna --> %d (@%lu)\n",
-			       dev->name, MAC_ARG(hdr->addr1),
-			       sta->antenna_sel_tx, sta->antenna_sel_rx, jiffies);
-		}
 		srctrl->tx_num_failures++;
 		sta->tx_retry_failed++;
 		sta->tx_num_consecutive_failures++;
--- wireless-dev.orig/net/mac80211/tx.c	2007-08-21 15:34:48.225923881 +0200
+++ wireless-dev/net/mac80211/tx.c	2007-08-21 15:48:54.925923881 +0200
@@ -243,7 +243,6 @@ ieee80211_tx_h_check_assoc(struct ieee80
 	} else {
 		if (unlikely((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA &&
 			     tx->local->num_sta == 0 &&
-			     !tx->local->allow_broadcast_always &&
 			     tx->sdata->type != IEEE80211_IF_TYPE_IBSS)) {
 			/*
 			 * No associated STAs - no need to send multicast
@@ -959,8 +958,6 @@ __ieee80211_tx_prepare(struct ieee80211_
 	 */
 	control->power_level = local->hw.conf.power_level;
 	control->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
-	if (local->sta_antenna_sel != STA_ANTENNA_SEL_AUTO && tx->sta)
-		control->antenna_sel_tx = tx->sta->antenna_sel_tx;
 
 	/* process and remove the injection radiotap header */
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
--- wireless-dev.orig/net/mac80211/sta_info.h	2007-08-21 15:34:48.265923881 +0200
+++ wireless-dev/net/mac80211/sta_info.h	2007-08-21 15:48:54.925923881 +0200
@@ -91,10 +91,6 @@ struct sta_info {
 	int channel_use;
 	int channel_use_raw;
 
-	u8 antenna_sel_tx;
-	u8 antenna_sel_rx;
-
-
 	int key_idx_compression; /* key table index for compression and TX
 				  * filtering; used only if sta->key is not
 				  * set */
--- wireless-dev.orig/include/net/mac80211.h	2007-08-21 15:42:24.655923881 +0200
+++ wireless-dev/include/net/mac80211.h	2007-08-21 15:48:54.945923881 +0200
@@ -296,7 +296,6 @@ struct ieee80211_conf {
 	u8 power_level;			/* transmit power limit for current
 					 * regulatory domain; in dBm */
 	u8 antenna_max;			/* maximum antenna gain */
-	short tx_power_reduction; /* in 0.1 dBm */
 
 	/* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */
 	u8 antenna_sel_tx;
--- wireless-dev.orig/net/mac80211/debugfs.c	2007-08-21 15:34:48.295923881 +0200
+++ wireless-dev/net/mac80211/debugfs.c	2007-08-21 15:48:54.955923881 +0200
@@ -124,9 +124,6 @@ DEBUGFS_READONLY_FILE(mode, 20, "%s",
 		      ieee80211_mode_str(local->hw.conf.phymode));
 DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x",
 		      local->wep_iv & 0xffffff);
-DEBUGFS_READONLY_FILE(tx_power_reduction, 20, "%d.%d dBm",
-		      local->hw.conf.tx_power_reduction / 10,
-		      local->hw.conf.tx_power_reduction % 10);
 DEBUGFS_READ(rate_ctrl_alg, 100, "%s",
 	     local->rate_ctrl ? local->rate_ctrl->ops->name : "<unset>");
 
@@ -347,7 +344,6 @@ void debugfs_hw_add(struct ieee80211_loc
 	DEBUGFS_ADD(total_ps_buffered);
 	DEBUGFS_ADD(mode);
 	DEBUGFS_ADD(wep_iv);
-	DEBUGFS_ADD(tx_power_reduction);
 	DEBUGFS_ADD_MODE(rate_ctrl_alg, 0644);
 	DEBUGFS_ADD(modes);
 
@@ -413,7 +409,6 @@ void debugfs_hw_del(struct ieee80211_loc
 	DEBUGFS_DEL(total_ps_buffered);
 	DEBUGFS_DEL(mode);
 	DEBUGFS_DEL(wep_iv);
-	DEBUGFS_DEL(tx_power_reduction);
 	DEBUGFS_DEL(rate_ctrl_alg);
 	DEBUGFS_DEL(modes);
 
--- wireless-dev.orig/drivers/net/wireless/iwl-4965-rs.c	2007-08-21 15:34:48.405923881 +0200
+++ wireless-dev/drivers/net/wireless/iwl-4965-rs.c	2007-08-21 15:48:54.955923881 +0200
@@ -1661,8 +1661,6 @@ out:
 	    (lq_data->phymode == (u8) MODE_ATHEROS_TURBO))
 		sta->txrate = i - IWL_FIRST_OFDM_RATE;
 
-	sta->antenna_sel_tx = tbl->lq_type;
-
 	return;
 }
 

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 22/27] mac80211: remove unused ioctls (3)
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (20 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 21/27] mac80211: remove unused ioctls (2) Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 23/27] mac80211: remove unused ioctls (4) Johannes Berg
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

The ioctls
 * PRISM2_PARAM_RADAR_DETECT
 * PRISM2_PARAM_SPECTRUM_MGMT
 * PRISM2_HOSTAPD_MLME
 * PRISM2_HOSTAPD_SET_RADAR_PARAMS
 * PRISM2_HOSTAPD_SET_QUIET_PARAMS

are not used by hostapd or wpa_supplicant,

 * PRISM2_HOSTAPD_WPA_TRIGGER

was not in use any more since the wpa trigger moved into
debugfs.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 include/net/mac80211.h         |   13 --------
 net/mac80211/debugfs.c         |    4 --
 net/mac80211/hostapd_ioctl.h   |   24 --------------
 net/mac80211/ieee80211_i.h     |    1 
 net/mac80211/ieee80211_ioctl.c |   66 -----------------------------------------
 5 files changed, 108 deletions(-)

--- wireless-dev.orig/net/mac80211/debugfs.c	2007-08-21 15:48:54.955923881 +0200
+++ wireless-dev/net/mac80211/debugfs.c	2007-08-21 15:53:42.255923881 +0200
@@ -100,8 +100,6 @@ DEBUGFS_READONLY_FILE(channel, 20, "%d",
 		      local->hw.conf.channel);
 DEBUGFS_READONLY_FILE(frequency, 20, "%d",
 		      local->hw.conf.freq);
-DEBUGFS_READONLY_FILE(radar_detect, 20, "%d",
-		      local->hw.conf.radar_detect);
 DEBUGFS_READONLY_FILE(antenna_sel_tx, 20, "%d",
 		      local->hw.conf.antenna_sel_tx);
 DEBUGFS_READONLY_FILE(antenna_sel_rx, 20, "%d",
@@ -332,7 +330,6 @@ void debugfs_hw_add(struct ieee80211_loc
 
 	DEBUGFS_ADD(channel);
 	DEBUGFS_ADD(frequency);
-	DEBUGFS_ADD(radar_detect);
 	DEBUGFS_ADD(antenna_sel_tx);
 	DEBUGFS_ADD(antenna_sel_rx);
 	DEBUGFS_ADD(bridge_packets);
@@ -397,7 +394,6 @@ void debugfs_hw_del(struct ieee80211_loc
 {
 	DEBUGFS_DEL(channel);
 	DEBUGFS_DEL(frequency);
-	DEBUGFS_DEL(radar_detect);
 	DEBUGFS_DEL(antenna_sel_tx);
 	DEBUGFS_DEL(antenna_sel_rx);
 	DEBUGFS_DEL(bridge_packets);
--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 15:48:54.905923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 15:53:42.255923881 +0200
@@ -46,8 +46,6 @@ enum {
 	PRISM2_PARAM_WMM_ENABLED = 1038,
 	PRISM2_PARAM_MIXED_CELL = 1039,
 	PRISM2_PARAM_KEY_MGMT = 1040,
-	PRISM2_PARAM_RADAR_DETECT = 1043,
-	PRISM2_PARAM_SPECTRUM_MGMT = 1044,
 	PRISM2_PARAM_USER_SPACE_MLME = 1045,
 	PRISM2_PARAM_MGMT_IF = 1046,
 };
@@ -63,12 +61,10 @@ enum {
 	PRISM2_SET_ENCRYPTION = 6,
 	PRISM2_GET_ENCRYPTION = 7,
 	PRISM2_HOSTAPD_SET_FLAGS_STA = 8,
-	PRISM2_HOSTAPD_MLME = 13,
 
 	/* Instant802 additions */
 	PRISM2_HOSTAPD_SET_BEACON = 1001,
 	PRISM2_HOSTAPD_GET_HW_FEATURES = 1002,
-	PRISM2_HOSTAPD_WPA_TRIGGER = 1004,
 	PRISM2_HOSTAPD_SET_RATE_SETS = 1005,
 	PRISM2_HOSTAPD_ADD_IF = 1006,
 	PRISM2_HOSTAPD_REMOVE_IF = 1007,
@@ -82,8 +78,6 @@ enum {
 	PRISM2_HOSTAPD_SCAN_REQ = 1019,
 	PRISM2_STA_GET_STATE = 1020,
 	PRISM2_HOSTAPD_FLUSH_IFS = 1021,
-	PRISM2_HOSTAPD_SET_RADAR_PARAMS = 1023,
-	PRISM2_HOSTAPD_SET_QUIET_PARAMS = 1024,
 };
 
 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 2048
@@ -214,24 +208,6 @@ struct prism2_hostapd_param {
 			u32 state;
 		} sta_get_state;
 		struct {
-#define MLME_STA_DEAUTH 0
-#define MLME_STA_DISASSOC 1
-			u16 cmd;
-			u16 reason_code;
-		} mlme;
-		struct {
-			u8 radar_firpwr_threshold;
-			u8 radar_rssi_threshold;
-			u8 pulse_height_threshold;
-			u8 pulse_rssi_threshold;
-			u8 pulse_inband_threshold;
-		} radar;
-		struct {
-			unsigned int period;
-			unsigned int offset;
-			unsigned int duration;
-		} quiet;
-		struct {
 			u8 dummy[80]; /* Make sizeof() this struct large enough
 				       * with some compiler versions. */
 		} dummy;
--- wireless-dev.orig/net/mac80211/ieee80211_i.h	2007-08-21 15:48:54.915923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h	2007-08-21 15:53:42.265923881 +0200
@@ -644,7 +644,6 @@ struct ieee80211_local {
 	struct local_debugfsdentries {
 		struct dentry *channel;
 		struct dentry *frequency;
-		struct dentry *radar_detect;
 		struct dentry *antenna_sel_tx;
 		struct dentry *antenna_sel_rx;
 		struct dentry *bridge_packets;
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:48:54.915923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:53:42.275923881 +0200
@@ -1029,29 +1029,6 @@ static int ieee80211_ioctl_sta_get_state
 }
 
 
-static int ieee80211_ioctl_mlme(struct net_device *dev,
-				struct prism2_hostapd_param *param)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	struct ieee80211_sub_if_data *sdata;
-
-	if (local->user_space_mlme)
-		return -EOPNOTSUPP;
-
-	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-	if (sdata->type != IEEE80211_IF_TYPE_STA &&
-	    sdata->type != IEEE80211_IF_TYPE_IBSS)
-		return -EINVAL;
-	switch (param->u.mlme.cmd) {
-	case MLME_STA_DEAUTH:
-		return ieee80211_sta_deauthenticate(dev, param->u.mlme.reason_code);
-	case MLME_STA_DISASSOC:
-		return ieee80211_sta_disassociate(dev, param->u.mlme.reason_code);
-	}
-	return 0;
-}
-
-
 static int ieee80211_ioctl_get_load_stats(struct net_device *dev,
 					  struct prism2_hostapd_param *param)
 {
@@ -1222,34 +1199,6 @@ found:
 }
 
 
-static int ieee80211_ioctl_set_quiet_params(struct net_device *dev,
-					    struct prism2_hostapd_param *param)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	struct ieee80211_conf *conf = &local->hw.conf;
-
-	conf->quiet_duration = param->u.quiet.duration;
-	conf->quiet_offset = param->u.quiet.offset;
-	conf->quiet_period = param->u.quiet.period;
-	return 0;
-}
-
-
-static int ieee80211_ioctl_set_radar_params(struct net_device *dev,
-					    struct prism2_hostapd_param *param)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	struct ieee80211_conf *conf = &local->hw.conf;
-
-	conf->radar_firpwr_threshold = param->u.radar.radar_firpwr_threshold;
-	conf->radar_rssi_threshold = param->u.radar.radar_rssi_threshold;
-	conf->pulse_height_threshold = param->u.radar.pulse_height_threshold;
-	conf->pulse_rssi_threshold = param->u.radar.pulse_rssi_threshold;
-	conf->pulse_inband_threshold = param->u.radar.pulse_inband_threshold;
-	return 0;
-}
-
-
 static int ieee80211_ioctl_priv_hostapd(struct net_device *dev,
 					struct iw_point *p)
 {
@@ -1338,15 +1287,6 @@ static int ieee80211_ioctl_priv_hostapd(
 	case PRISM2_STA_GET_STATE:
 		ret = ieee80211_ioctl_sta_get_state(dev, param);
 		break;
-	case PRISM2_HOSTAPD_MLME:
-		ret = ieee80211_ioctl_mlme(dev, param);
-		break;
-	case PRISM2_HOSTAPD_SET_RADAR_PARAMS:
-		ret = ieee80211_ioctl_set_radar_params(dev, param);
-		break;
-	case PRISM2_HOSTAPD_SET_QUIET_PARAMS:
-		ret = ieee80211_ioctl_set_quiet_params(dev, param);
-		break;
 	default:
 		ret = -EOPNOTSUPP;
 		break;
@@ -2237,12 +2177,6 @@ static int ieee80211_ioctl_prism2_param(
 		else
 			sdata->u.sta.wmm_enabled = !!value;
 		break;
-	case PRISM2_PARAM_RADAR_DETECT:
-		local->hw.conf.radar_detect = value;
-		break;
-	case PRISM2_PARAM_SPECTRUM_MGMT:
-		local->hw.conf.spect_mgmt = value;
-		break;
 	case PRISM2_PARAM_MGMT_IF:
 		if (value == 1) {
 			if (!local->apdev)
--- wireless-dev.orig/include/net/mac80211.h	2007-08-21 15:48:54.945923881 +0200
+++ wireless-dev/include/net/mac80211.h	2007-08-21 15:53:42.275923881 +0200
@@ -300,19 +300,6 @@ struct ieee80211_conf {
 	/* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */
 	u8 antenna_sel_tx;
 	u8 antenna_sel_rx;
-
-	/* Following five fields are used for IEEE 802.11H */
-	unsigned int radar_detect;
-	unsigned int spect_mgmt;
-	unsigned int quiet_duration; /* duration of quiet period */
-	unsigned int quiet_offset; /* how far into the beacon is the quiet
-				    * period */
-	unsigned int quiet_period;
-	u8 radar_firpwr_threshold;
-	u8 radar_rssi_threshold;
-	u8 pulse_height_threshold;
-	u8 pulse_rssi_threshold;
-	u8 pulse_inband_threshold;
 };
 
 /**

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 23/27] mac80211: remove unused ioctls (4)
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (21 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 22/27] mac80211: remove unused ioctls (3) Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 24/27] mac80211: remove PRISM2_PARAM_KEY_MGMT Johannes Berg
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

The ioctls
 * PRISM2_HOSTAPD_GET_DOT11COUNTERSTABLE
 * PRISM2_HOSTAPD_GET_LOAD_STATS
 * PRISM2_HOSTAPD_GET_TX_STATS
 * PRISM2_HOSTAPD_SCAN_REQ
 * PRISM2_STA_GET_STATE
 * PRISM2_HOSTAPD_FLUSH_IFS

are not used by hostapd or wpa_supplicant.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/hostapd_ioctl.h   |   39 -------------
 net/mac80211/ieee80211_ioctl.c |  120 -----------------------------------------
 2 files changed, 159 deletions(-)

--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 15:53:42.255923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 15:55:05.685923881 +0200
@@ -68,16 +68,10 @@ enum {
 	PRISM2_HOSTAPD_SET_RATE_SETS = 1005,
 	PRISM2_HOSTAPD_ADD_IF = 1006,
 	PRISM2_HOSTAPD_REMOVE_IF = 1007,
-	PRISM2_HOSTAPD_GET_DOT11COUNTERSTABLE = 1008,
-	PRISM2_HOSTAPD_GET_LOAD_STATS = 1009,
 	PRISM2_HOSTAPD_SET_STA_VLAN = 1010,
 	PRISM2_HOSTAPD_SET_CHANNEL_FLAG = 1012,
 	PRISM2_HOSTAPD_SET_REGULATORY_DOMAIN = 1013,
 	PRISM2_HOSTAPD_SET_TX_QUEUE_PARAMS = 1014,
-	PRISM2_HOSTAPD_GET_TX_STATS = 1016,
-	PRISM2_HOSTAPD_SCAN_REQ = 1019,
-	PRISM2_STA_GET_STATE = 1020,
-	PRISM2_HOSTAPD_FLUSH_IFS = 1021,
 };
 
 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 2048
@@ -152,24 +146,6 @@ struct prism2_hostapd_param {
 			u8 name[IFNAMSIZ];
 			u8 data[0] ALIGNED;
 		} if_info;
-		struct dot11_counters {
-			u32 dot11TransmittedFragmentCount;
-			u32 dot11MulticastTransmittedFrameCount;
-			u32 dot11FailedCount;
-			u32 dot11ReceivedFragmentCount;
-			u32 dot11MulticastReceivedFrameCount;
-			u32 dot11FCSErrorCount;
-			u32 dot11TransmittedFrameCount;
-			u32 dot11WEPUndecryptableCount;
-			u32 dot11ACKFailureCount;
-			u32 dot11RTSFailureCount;
-			u32 dot11RTSSuccessCount;
-		} dot11CountersTable;
-		struct {
-#define LOAD_STATS_CLEAR BIT(1)
-			u32 flags;
-			u32 channel_use;
-		} get_load_stats;
 		struct {
 			char vlan_name[IFNAMSIZ];
 			int vlan_id;
@@ -192,21 +168,6 @@ struct prism2_hostapd_param {
 			u32 burst_time; /* maximum burst time in 0.1 ms, i.e.,
 					 * 10 = 1 ms */
 		} tx_queue_params;
-		struct ieee80211_tx_stats {
-			struct {
-				unsigned int len; /* num packets in queue */
-				unsigned int limit; /* queue len (soft) limit
-						     */
-				unsigned int count; /* total num frames sent */
-			} data[4];
-		} get_tx_stats;
-		struct {
-			u8 ssid_len;
-			u8 ssid[0] ALIGNED;
-		} scan_req;
-		struct {
-			u32 state;
-		} sta_get_state;
 		struct {
 			u8 dummy[80]; /* Make sizeof() this struct large enough
 				       * with some compiler versions. */
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:53:42.275923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:55:05.695923881 +0200
@@ -314,38 +314,6 @@ static int ieee80211_ioctl_remove_sta(st
 }
 
 
-static int ieee80211_ioctl_get_dot11counterstable(struct net_device *dev,
-					struct prism2_hostapd_param *param)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	struct ieee80211_low_level_stats stats;
-
-	memset(&stats, 0, sizeof(stats));
-	if (local->ops->get_stats)
-		local->ops->get_stats(local_to_hw(local), &stats);
-	param->u.dot11CountersTable.dot11TransmittedFragmentCount =
-		local->dot11TransmittedFragmentCount;
-	param->u.dot11CountersTable.dot11MulticastTransmittedFrameCount =
-		local->dot11MulticastTransmittedFrameCount;
-	param->u.dot11CountersTable.dot11ReceivedFragmentCount =
-		local->dot11ReceivedFragmentCount;
-	param->u.dot11CountersTable.dot11MulticastReceivedFrameCount =
-		local->dot11MulticastReceivedFrameCount;
-	param->u.dot11CountersTable.dot11TransmittedFrameCount =
-		local->dot11TransmittedFrameCount;
-	param->u.dot11CountersTable.dot11FCSErrorCount =
-		stats.dot11FCSErrorCount;
-	param->u.dot11CountersTable.dot11ACKFailureCount =
-		stats.dot11ACKFailureCount;
-	param->u.dot11CountersTable.dot11RTSFailureCount =
-		stats.dot11RTSFailureCount;
-	param->u.dot11CountersTable.dot11RTSSuccessCount =
-		stats.dot11RTSSuccessCount;
-
-	return 0;
-}
-
-
 static int ieee80211_ioctl_get_info_sta(struct net_device *dev,
 					struct prism2_hostapd_param *param)
 {
@@ -993,54 +961,6 @@ static int ieee80211_ioctl_remove_if(str
 	return ieee80211_if_remove(dev, param->u.if_info.name, type);
 }
 
-static int ieee80211_ioctl_scan_req(struct net_device *dev,
-				    struct prism2_hostapd_param *param,
-				    int param_len)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	u8 *pos = param->u.scan_req.ssid;
-	int left = param_len - ((u8 *) pos - (u8 *) param);
-	int len = param->u.scan_req.ssid_len;
-
-	if (local->user_space_mlme)
-		return -EOPNOTSUPP;
-
-	if (!netif_running(dev))
-		return -ENETDOWN;
-
-	if (left < len || len > IEEE80211_MAX_SSID_LEN)
-		return -EINVAL;
-
-	return ieee80211_sta_req_scan(dev, pos, len);
-}
-
-
-static int ieee80211_ioctl_sta_get_state(struct net_device *dev,
-					 struct prism2_hostapd_param *param)
-{
-	struct ieee80211_sub_if_data *sdata;
-
-	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-	if (sdata->type != IEEE80211_IF_TYPE_STA &&
-	    sdata->type != IEEE80211_IF_TYPE_IBSS)
-		return -EINVAL;
-	param->u.sta_get_state.state = sdata->u.sta.state;
-	return 0;
-}
-
-
-static int ieee80211_ioctl_get_load_stats(struct net_device *dev,
-					  struct prism2_hostapd_param *param)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-
-	param->u.get_load_stats.channel_use = local->channel_use;
-/*	if (param->u.get_load_stats.flags & LOAD_STATS_CLEAR)
-		local->channel_use = 0; */ /* now it's not raw counter */
-
-	return 0;
-}
-
 
 static int ieee80211_ioctl_set_sta_vlan(struct net_device *dev,
 					struct prism2_hostapd_param *param)
@@ -1141,31 +1061,6 @@ ieee80211_ioctl_set_tx_queue_params(stru
 }
 
 
-static int ieee80211_ioctl_get_tx_stats(struct net_device *dev,
-					struct prism2_hostapd_param *param)
-{
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-	struct ieee80211_tx_queue_stats stats;
-	int ret, i;
-
-	if (!local->ops->get_tx_stats)
-		return -EOPNOTSUPP;
-
-	memset(&stats, 0, sizeof(stats));
-	ret = local->ops->get_tx_stats(local_to_hw(local), &stats);
-	if (ret)
-		return ret;
-
-	for (i = 0; i < 4; i++) {
-		param->u.get_tx_stats.data[i].len = stats.data[i].len;
-		param->u.get_tx_stats.data[i].limit = stats.data[i].limit;
-		param->u.get_tx_stats.data[i].count = stats.data[i].count;
-	}
-
-	return 0;
-}
-
-
 static int ieee80211_ioctl_set_channel_flag(struct net_device *dev,
 					    struct prism2_hostapd_param *param)
 {
@@ -1260,12 +1155,6 @@ static int ieee80211_ioctl_priv_hostapd(
 	case PRISM2_HOSTAPD_REMOVE_IF:
 		ret = ieee80211_ioctl_remove_if(dev, param);
 		break;
-	case PRISM2_HOSTAPD_GET_DOT11COUNTERSTABLE:
-		ret = ieee80211_ioctl_get_dot11counterstable(dev, param);
-		break;
-	case PRISM2_HOSTAPD_GET_LOAD_STATS:
-		ret = ieee80211_ioctl_get_load_stats(dev, param);
-		break;
 	case PRISM2_HOSTAPD_SET_STA_VLAN:
 		ret = ieee80211_ioctl_set_sta_vlan(dev, param);
 		break;
@@ -1278,15 +1167,6 @@ static int ieee80211_ioctl_priv_hostapd(
 	case PRISM2_HOSTAPD_SET_TX_QUEUE_PARAMS:
 		ret = ieee80211_ioctl_set_tx_queue_params(dev, param);
 		break;
-	case PRISM2_HOSTAPD_GET_TX_STATS:
-		ret = ieee80211_ioctl_get_tx_stats(dev, param);
-		break;
-	case PRISM2_HOSTAPD_SCAN_REQ:
-		ret = ieee80211_ioctl_scan_req(dev, param, p->length);
-		break;
-	case PRISM2_STA_GET_STATE:
-		ret = ieee80211_ioctl_sta_get_state(dev, param);
-		break;
 	default:
 		ret = -EOPNOTSUPP;
 		break;

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 24/27] mac80211: remove PRISM2_PARAM_KEY_MGMT
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (22 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 23/27] mac80211: remove unused ioctls (4) Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 25/27] mac80211: kill key_mgmt, use key_management_enabled Johannes Berg
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

This ioctl isn't used and wext has a replacement.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/mac80211/hostapd_ioctl.h   |    1 -
 net/mac80211/ieee80211_ioctl.c |   13 -------------
 2 files changed, 14 deletions(-)

--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 15:58:25.445923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 15:58:28.215923881 +0200
@@ -45,7 +45,6 @@ enum {
 	PRISM2_PARAM_CREATE_IBSS = 1037,
 	PRISM2_PARAM_WMM_ENABLED = 1038,
 	PRISM2_PARAM_MIXED_CELL = 1039,
-	PRISM2_PARAM_KEY_MGMT = 1040,
 	PRISM2_PARAM_USER_SPACE_MLME = 1045,
 	PRISM2_PARAM_MGMT_IF = 1046,
 };
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:58:17.925923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:58:22.955923881 +0200
@@ -2033,13 +2033,6 @@ static int ieee80211_ioctl_prism2_param(
 			sdata->u.sta.mixed_cell = !!value;
 		break;
 
-	case PRISM2_PARAM_KEY_MGMT:
-		if (sdata->type != IEEE80211_IF_TYPE_STA)
-			ret = -EINVAL;
-		else
-			sdata->u.sta.key_mgmt = value;
-		break;
-
 	case PRISM2_PARAM_HW_MODES:
 		local->enabled_modes = value;
 		break;
@@ -2165,12 +2158,6 @@ static int ieee80211_ioctl_get_prism2_pa
 			*param = !!sdata->u.sta.mixed_cell;
 		break;
 
-	case PRISM2_PARAM_KEY_MGMT:
-		if (sdata->type != IEEE80211_IF_TYPE_STA)
-			ret = -EINVAL;
-		else
-			*param = sdata->u.sta.key_mgmt;
-		break;
 	case PRISM2_PARAM_WMM_ENABLED:
 		if (sdata->type != IEEE80211_IF_TYPE_STA &&
 		    sdata->type != IEEE80211_IF_TYPE_IBSS)

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 25/27] mac80211: kill key_mgmt, use key_management_enabled
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (23 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 24/27] mac80211: remove PRISM2_PARAM_KEY_MGMT Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-21 14:59 ` [PATCH 26/27] mac80211: refactor event sending Johannes Berg
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

The key_mgmt variable for STA interfaces doesn't seem well-defined
nor do we actually use the values other than "NONE", so change it to
be named better.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/hostapd_ioctl.h   |    8 --------
 net/mac80211/ieee80211_i.h     |    2 +-
 net/mac80211/ieee80211_ioctl.c |   20 +++++---------------
 net/mac80211/ieee80211_sta.c   |    3 +--
 4 files changed, 7 insertions(+), 26 deletions(-)

--- wireless-dev.orig/net/mac80211/ieee80211_i.h	2007-08-21 15:58:33.805923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h	2007-08-21 15:59:22.705923881 +0200
@@ -279,7 +279,7 @@ struct ieee80211_if_sta {
 	unsigned long request;
 	struct sk_buff_head skb_queue;
 
-	int key_mgmt;
+	int key_management_enabled;
 	unsigned long last_probe;
 
 #define IEEE80211_AUTH_ALG_OPEN BIT(0)
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:58:33.845923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-21 15:59:22.725923881 +0200
@@ -2323,22 +2323,12 @@ static int ieee80211_ioctl_siwauth(struc
 			ret = -EINVAL;
 		else {
 			/*
-			 * TODO: sdata->u.sta.key_mgmt does not match with WE18
-			 * value completely; could consider modifying this to
-			 * be closer to WE18. For now, this value is not really
-			 * used for anything else than Privacy matching, so the
-			 * current code here should be more or less OK.
+			 * Key management was set by wpa_supplicant,
+			 * we only need this to associate to a network
+			 * that has privacy enabled regardless of not
+			 * having a key.
 			 */
-			if (data->value & IW_AUTH_KEY_MGMT_802_1X) {
-				sdata->u.sta.key_mgmt =
-					IEEE80211_KEY_MGMT_WPA_EAP;
-			} else if (data->value & IW_AUTH_KEY_MGMT_PSK) {
-				sdata->u.sta.key_mgmt =
-					IEEE80211_KEY_MGMT_WPA_PSK;
-			} else {
-				sdata->u.sta.key_mgmt =
-					IEEE80211_KEY_MGMT_NONE;
-			}
+			sdata->u.sta.key_management_enabled = !!data->value;
 		}
 		break;
 	case IW_AUTH_80211_AUTH_ALG:
--- wireless-dev.orig/net/mac80211/ieee80211_sta.c	2007-08-21 15:58:34.025923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_sta.c	2007-08-21 15:59:22.735923881 +0200
@@ -1168,8 +1168,7 @@ static int ieee80211_privacy_mismatch(st
 	struct ieee80211_sta_bss *bss;
 	int res = 0;
 
-	if (!ifsta || ifsta->mixed_cell ||
-	    ifsta->key_mgmt != IEEE80211_KEY_MGMT_NONE)
+	if (!ifsta || ifsta->mixed_cell || ifsta->key_management_enabled)
 		return 0;
 
 	bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
--- wireless-dev.orig/net/mac80211/hostapd_ioctl.h	2007-08-21 15:58:34.065923881 +0200
+++ wireless-dev/net/mac80211/hostapd_ioctl.h	2007-08-21 15:59:22.735923881 +0200
@@ -184,14 +184,6 @@ struct prism2_hostapd_param {
 #define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6
 #define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7
 
-enum {
-	IEEE80211_KEY_MGMT_NONE = 0,
-	IEEE80211_KEY_MGMT_IEEE8021X = 1,
-	IEEE80211_KEY_MGMT_WPA_PSK = 2,
-	IEEE80211_KEY_MGMT_WPA_EAP = 3,
-};
-
-
 /* Data structures used for get_hw_features ioctl */
 struct hostapd_ioctl_hw_modes_hdr {
 	int mode;

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 26/27] mac80211: refactor event sending
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (24 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 25/27] mac80211: kill key_mgmt, use key_management_enabled Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-23 22:16   ` Michael Wu
  2007-08-21 14:59 ` [PATCH 27/27] mac80211: use switch statement in tx code Johannes Berg
                   ` (2 subsequent siblings)
  28 siblings, 1 reply; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

Create a new file event.c that will contain code to send mac/mlme
events to userspace. For now put the Michael MIC failure condition
into it and remove sending of that condition via the management
interface, hostapd interestingly doesn't do anything when it gets
such a packet besides printing a message, it reacts only on the
private iwevent.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/mac80211/Makefile      |    1 +
 net/mac80211/event.c       |   36 ++++++++++++++++++++++++++++++++++++
 net/mac80211/ieee80211_i.h |    2 ++
 net/mac80211/rx.c          |   41 ++++++++---------------------------------
 net/mac80211/wpa.c         |   34 ++++------------------------------
 5 files changed, 51 insertions(+), 63 deletions(-)

--- wireless-dev.orig/net/mac80211/ieee80211_i.h	2007-08-21 15:59:22.705923881 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h	2007-08-21 16:00:34.675923881 +0200
@@ -938,5 +938,7 @@ u8 *ieee80211_get_bssid(struct ieee80211
 int ieee80211_is_eapol(const struct sk_buff *skb);
 int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
 			     int rate, int erp, int short_preamble);
+void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx,
+				     struct ieee80211_hdr *hdr);
 
 #endif /* IEEE80211_I_H */
--- wireless-dev.orig/net/mac80211/wpa.c	2007-08-21 15:28:19.455923881 +0200
+++ wireless-dev/net/mac80211/wpa.c	2007-08-21 16:00:34.675923881 +0200
@@ -11,10 +11,8 @@
 #include <linux/slab.h>
 #include <linux/skbuff.h>
 #include <linux/compiler.h>
-#include <net/iw_handler.h>
-
 #include <net/mac80211.h>
-#include "ieee80211_common.h"
+
 #include "ieee80211_i.h"
 #include "michael.h"
 #include "tkip.h"
@@ -246,33 +244,9 @@ ieee80211_rx_h_michael_mic_verify(struct
 		printk(" (%d)\n", authenticator);
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
-		do {
-			struct ieee80211_hdr *hdr;
-			union iwreq_data wrqu;
-			char *buf = kmalloc(128, GFP_ATOMIC);
-			if (!buf)
-				break;
-
-			/* TODO: needed parameters: count, key type, TSC */
-			hdr = (struct ieee80211_hdr *) skb->data;
-			sprintf(buf, "MLME-MICHAELMICFAILURE.indication("
-				"keyid=%d %scast addr=" MAC_FMT ")",
-				rx->key->keyidx,
-				hdr->addr1[0] & 0x01 ? "broad" : "uni",
-				MAC_ARG(hdr->addr2));
-			memset(&wrqu, 0, sizeof(wrqu));
-			wrqu.data.length = strlen(buf);
-			wireless_send_event(rx->dev, IWEVCUSTOM, &wrqu, buf);
-			kfree(buf);
-		} while (0);
-
-		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;
+		mac80211_ev_michael_mic_failure(rx->dev, rx->key->keyidx,
+						(void *) skb->data);
+		return TXRX_DROP;
 	}
 
  remove_mic:
--- wireless-dev.orig/net/mac80211/rx.c	2007-08-21 15:29:55.865923881 +0200
+++ wireless-dev/net/mac80211/rx.c	2007-08-21 16:02:54.815923881 +0200
@@ -13,7 +13,6 @@
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
-#include <net/iw_handler.h>
 #include <net/mac80211.h>
 #include <net/ieee80211_radiotap.h>
 
@@ -1354,20 +1353,17 @@ static void ieee80211_rx_michael_mic_rep
 	}
 
 	if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) &&
-	    rx->sdata->type == IEEE80211_IF_TYPE_AP) {
-		keyidx = ieee80211_wep_get_keyidx(rx->skb);
+	    rx->sdata->type == IEEE80211_IF_TYPE_AP && keyidx) {
 		/* AP with Pairwise keys support should never receive Michael
 		 * MIC errors for non-zero keyidx because these are reserved
 		 * for group keys and only the AP is sending real multicast
 		 * frames in BSS. */
-		if (keyidx) {
-			if (net_ratelimit())
-				printk(KERN_DEBUG "%s: ignored Michael MIC "
-				       "error for a frame with non-zero keyidx"
-				       " (%d) (src " MAC_FMT ")\n", dev->name,
-				       keyidx, MAC_ARG(hdr->addr2));
-			goto ignore;
-		}
+		if (net_ratelimit())
+			printk(KERN_DEBUG "%s: ignored Michael MIC error for "
+			       "a frame with non-zero keyidx (%d)"
+			       " (src " MAC_FMT ")\n", dev->name, keyidx,
+			       MAC_ARG(hdr->addr2));
+		goto ignore;
 	}
 
 	if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
@@ -1381,32 +1377,11 @@ static void ieee80211_rx_michael_mic_rep
 		goto ignore;
 	}
 
-	do {
-		union iwreq_data wrqu;
-		char *buf = kmalloc(128, GFP_ATOMIC);
-		if (!buf)
-			break;
-
-		/* TODO: needed parameters: count, key type, TSC */
-		sprintf(buf, "MLME-MICHAELMICFAILURE.indication("
-			"keyid=%d %scast addr=" MAC_FMT ")",
-			keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni",
-			MAC_ARG(hdr->addr2));
-		memset(&wrqu, 0, sizeof(wrqu));
-		wrqu.data.length = strlen(buf);
-		wireless_send_event(rx->dev, IWEVCUSTOM, &wrqu, buf);
-		kfree(buf);
-	} while (0);
-
 	/* TODO: consider verifying the MIC error report with software
 	 * implementation if we get too many spurious reports from the
 	 * hardware. */
-	if (!rx->local->apdev)
-		goto ignore;
-	ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
-			  ieee80211_msg_michael_mic_failure);
-	return;
 
+	mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr);
  ignore:
 	dev_kfree_skb(rx->skb);
 	rx->skb = NULL;
--- wireless-dev.orig/net/mac80211/Makefile	2007-08-21 14:58:38.245923881 +0200
+++ wireless-dev/net/mac80211/Makefile	2007-08-21 16:00:34.715923881 +0200
@@ -22,4 +22,5 @@ mac80211-objs := \
 	tx.o \
 	key.o \
 	util.o \
+	event.o \
 	$(mac80211-objs-y)
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ wireless-dev/net/mac80211/event.c	2007-08-21 16:00:34.715923881 +0200
@@ -0,0 +1,36 @@
+/*
+ * mac80211 - events
+ */
+
+#include <linux/netdevice.h>
+#include <net/iw_handler.h>
+#include "ieee80211_i.h"
+
+/*
+ * indicate a failed Michael MIC to userspace; the passed packet
+ * (in the variable hdr) must be long enough to extract the TKIP
+ * fields like TSC
+ */
+void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx,
+				     struct ieee80211_hdr *hdr)
+{
+	union iwreq_data wrqu;
+	char *buf = kmalloc(128, GFP_ATOMIC);
+
+	if (buf) {
+		/* TODO: needed parameters: count, key type, TSC */
+		sprintf(buf, "MLME-MICHAELMICFAILURE.indication("
+			"keyid=%d %scast addr=" MAC_FMT ")",
+			keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni",
+			MAC_ARG(hdr->addr2));
+		memset(&wrqu, 0, sizeof(wrqu));
+		wrqu.data.length = strlen(buf);
+		wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
+		kfree(buf);
+	}
+
+	/*
+	 * TODO: re-add support for sending MIC failure indication
+	 * with all info via nl80211
+	 */
+}

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 27/27] mac80211: use switch statement in tx code
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (25 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 26/27] mac80211: refactor event sending Johannes Berg
@ 2007-08-21 14:59 ` Johannes Berg
  2007-08-22  4:21 ` [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Michael Wu
  2007-08-23 20:54 ` John W. Linville
  28 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-21 14:59 UTC (permalink / raw)
  To: John Linville; +Cc: Jiri Benc, Michael Wu, linux-wireless

The transmit code needs to set the addresses depending on the
interface type, a likely() for AP/VLAN is quite wrong since
most people will be using STA; convert to a switch statement
to make it look nicer.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/mac80211/tx.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

--- wireless-dev.orig/net/mac80211/tx.c	2007-08-21 15:48:54.925923881 +0200
+++ wireless-dev/net/mac80211/tx.c	2007-08-21 16:04:00.675923881 +0200
@@ -1363,15 +1363,17 @@ int ieee80211_subif_start_xmit(struct sk
 	/* TODO: handling for 802.1x authorized/unauthorized port */
 	fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
 
-	if (likely(sdata->type == IEEE80211_IF_TYPE_AP ||
-		   sdata->type == IEEE80211_IF_TYPE_VLAN)) {
+	switch (sdata->type) {
+	case IEEE80211_IF_TYPE_AP:
+	case IEEE80211_IF_TYPE_VLAN:
 		fc |= IEEE80211_FCTL_FROMDS;
 		/* DA BSSID SA */
 		memcpy(hdr.addr1, skb->data, ETH_ALEN);
 		memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN);
 		memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN);
 		hdrlen = 24;
-	} else if (sdata->type == IEEE80211_IF_TYPE_WDS) {
+		break;
+	case IEEE80211_IF_TYPE_WDS:
 		fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS;
 		/* RA TA DA SA */
 		memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN);
@@ -1379,7 +1381,8 @@ int ieee80211_subif_start_xmit(struct sk
 		memcpy(hdr.addr3, skb->data, ETH_ALEN);
 		memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN);
 		hdrlen = 30;
-	} else if (sdata->type == IEEE80211_IF_TYPE_STA) {
+		break;
+	case IEEE80211_IF_TYPE_STA:
 		if (dls_link_status(local, skb->data) == DLS_STATUS_OK) {
 			/* DA SA BSSID */
 			memcpy(hdr.addr1, skb->data, ETH_ALEN);
@@ -1393,13 +1396,15 @@ int ieee80211_subif_start_xmit(struct sk
 			memcpy(hdr.addr3, skb->data, ETH_ALEN);
 		}
 		hdrlen = 24;
-	} else if (sdata->type == IEEE80211_IF_TYPE_IBSS) {
+		break;
+	case IEEE80211_IF_TYPE_IBSS:
 		/* DA SA BSSID */
 		memcpy(hdr.addr1, skb->data, ETH_ALEN);
 		memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
 		memcpy(hdr.addr3, sdata->u.sta.bssid, ETH_ALEN);
 		hdrlen = 24;
-	} else {
+		break;
+	default:
 		ret = 0;
 		goto fail;
 	}

-- 


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/27] various cleanups and fixes for mac80211 and drivers
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (26 preceding siblings ...)
  2007-08-21 14:59 ` [PATCH 27/27] mac80211: use switch statement in tx code Johannes Berg
@ 2007-08-22  4:21 ` Michael Wu
  2007-08-23 20:54 ` John W. Linville
  28 siblings, 0 replies; 32+ messages in thread
From: Michael Wu @ 2007-08-22  4:21 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, Jiri Benc, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

On Tuesday 21 August 2007 10:59, Johannes Berg wrote:
> This series contains:
>  * rtl8187: remove IEEE80211_HW_DATA_NULLFUNC_ACK
>  * p54: remove IEEE80211_HW_DATA_NULLFUNC_ACK
>  * mac80211: remove IEEE80211_HW_DATA_NULLFUNC_ACK

Acked-by: Michael Wu <flamingice@sourmilk.net>

Thanks,
-Michael Wu

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 00/27] various cleanups and fixes for mac80211 and  drivers
  2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
                   ` (27 preceding siblings ...)
  2007-08-22  4:21 ` [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Michael Wu
@ 2007-08-23 20:54 ` John W. Linville
  28 siblings, 0 replies; 32+ messages in thread
From: John W. Linville @ 2007-08-23 20:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Jiri Benc, Michael Wu, linux-wireless

On Tue, Aug 21, 2007 at 04:59:05PM +0200, Johannes Berg wrote:
> I've stripped my patch series down to those things that
> nobody objected to. The ioctl removal is a bit slimmer
> keeping the things Jouni wanted to keep.
> 
> This series contains:
> 
>  * mac80211: fix showing transmitted frames on multiple monitor interfaces
>  * mac80211: fix preamble setting
>  * mac80211: avoid copying packets to interfaces that are down
>  * mac80211: fix key debugfs
>  * mac80211, drivers: remove reset callback
>  * ralink drivers: remove IEEE80211_HW_HOST_GEN_BEACON flag
>  * mac80211: remove IEEE80211_HW_HOST_GEN_BEACON flag
>  * mac80211: remove PRISM2_PARAM_RADIO_ENABLED
>  * mac80211: remove PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM
>  * ralink drivers: remove IEEE80211_HW_DATA_NULLFUNC_ACK
>  * rtl8187: remove IEEE80211_HW_DATA_NULLFUNC_ACK
>  * p54: remove IEEE80211_HW_DATA_NULLFUNC_ACK
>  * mac80211: remove IEEE80211_HW_DATA_NULLFUNC_ACK
>  * mac80211: ratelimit some RX messages
>  * mac80211: remove ieee80211_msg_wep_frame_unknown_key
>  * mac80211: remove radar stuff
>  * mac80211: remove scan struct from hostapd_param
>  * mac80211: fix software decryption
>  * cfg80211: extend radiotap parser by all remaining fields
>  * mac80211: remove unused ioctls (1)
>  * mac80211: remove unused ioctls (2)
>  * mac80211: remove unused ioctls (3)
>  * mac80211: remove unused ioctls (4)
>  * mac80211: remove PRISM2_PARAM_KEY_MGMT
>  * mac80211: kill key_mgmt, use key_management_enabled
>  * mac80211: refactor event sending
>  * mac80211: use switch statement in tx code

I've merged the lot to the 'mac80211' branch (and driver patches to
their respective branches) of wireless-dev, and it is available on
'everything' as well.

Johannes, I appreciate your continued dedication to the cause! :-)

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 26/27] mac80211: refactor event sending
  2007-08-21 14:59 ` [PATCH 26/27] mac80211: refactor event sending Johannes Berg
@ 2007-08-23 22:16   ` Michael Wu
  2007-08-24 10:10     ` Johannes Berg
  0 siblings, 1 reply; 32+ messages in thread
From: Michael Wu @ 2007-08-23 22:16 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, Jiri Benc, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

On Tuesday 21 August 2007 10:59, Johannes Berg wrote:
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ wireless-dev/net/mac80211/event.c	2007-08-21 16:00:34.715923881 +0200
> @@ -0,0 +1,36 @@
> +/*
> + * mac80211 - events
> + */
> +
Should probably make this look a bit more like other files in the directory 
and add the usual copyright/license boilerplate.

-Michael Wu

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 26/27] mac80211: refactor event sending
  2007-08-23 22:16   ` Michael Wu
@ 2007-08-24 10:10     ` Johannes Berg
  0 siblings, 0 replies; 32+ messages in thread
From: Johannes Berg @ 2007-08-24 10:10 UTC (permalink / raw)
  To: Michael Wu; +Cc: John Linville, Jiri Benc, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

On Thu, 2007-08-23 at 18:16 -0400, Michael Wu wrote:
> On Tuesday 21 August 2007 10:59, Johannes Berg wrote:
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ wireless-dev/net/mac80211/event.c	2007-08-21 16:00:34.715923881 +0200
> > @@ -0,0 +1,36 @@
> > +/*
> > + * mac80211 - events
> > + */
> > +
> Should probably make this look a bit more like other files in the directory 
> and add the usual copyright/license boilerplate.

Can do that, will post a patch.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2007-08-24 10:15 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-21 14:59 [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Johannes Berg
2007-08-21 14:59 ` [PATCH 01/27] mac80211: fix showing transmitted frames on multiple monitor interfaces Johannes Berg
2007-08-21 14:59 ` [PATCH 02/27] mac80211: fix preamble setting Johannes Berg
2007-08-21 14:59 ` [PATCH 03/27] mac80211: avoid copying packets to interfaces that are down Johannes Berg
2007-08-21 14:59 ` [PATCH 04/27] mac80211: fix key debugfs Johannes Berg
2007-08-21 14:59 ` [PATCH 05/27] mac80211, drivers: remove reset callback Johannes Berg
2007-08-21 14:59 ` [PATCH 06/27] ralink drivers: remove IEEE80211_HW_HOST_GEN_BEACON flag Johannes Berg
2007-08-21 14:59 ` [PATCH 07/27] mac80211: " Johannes Berg
2007-08-21 14:59 ` [PATCH 08/27] mac80211: remove PRISM2_PARAM_RADIO_ENABLED Johannes Berg
2007-08-21 14:59 ` [PATCH 09/27] mac80211: remove PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM Johannes Berg
2007-08-21 14:59 ` [PATCH 10/27] ralink drivers: remove IEEE80211_HW_DATA_NULLFUNC_ACK Johannes Berg
2007-08-21 14:59 ` [PATCH 11/27] rtl8187: " Johannes Berg
2007-08-21 14:59 ` [PATCH 12/27] p54: " Johannes Berg
2007-08-21 14:59 ` [PATCH 13/27] mac80211: " Johannes Berg
2007-08-21 14:59 ` [PATCH 14/27] mac80211: ratelimit some RX messages Johannes Berg
2007-08-21 14:59 ` [PATCH 15/27] mac80211: remove ieee80211_msg_wep_frame_unknown_key Johannes Berg
2007-08-21 14:59 ` [PATCH 16/27] mac80211: remove radar stuff Johannes Berg
2007-08-21 14:59 ` [PATCH 17/27] mac80211: remove scan struct from hostapd_param Johannes Berg
2007-08-21 14:59 ` [PATCH 18/27] mac80211: fix software decryption Johannes Berg
2007-08-21 14:59 ` [PATCH 19/27] cfg80211: extend radiotap parser by all remaining fields Johannes Berg
2007-08-21 14:59 ` [PATCH 20/27] mac80211: remove unused ioctls (1) Johannes Berg
2007-08-21 14:59 ` [PATCH 21/27] mac80211: remove unused ioctls (2) Johannes Berg
2007-08-21 14:59 ` [PATCH 22/27] mac80211: remove unused ioctls (3) Johannes Berg
2007-08-21 14:59 ` [PATCH 23/27] mac80211: remove unused ioctls (4) Johannes Berg
2007-08-21 14:59 ` [PATCH 24/27] mac80211: remove PRISM2_PARAM_KEY_MGMT Johannes Berg
2007-08-21 14:59 ` [PATCH 25/27] mac80211: kill key_mgmt, use key_management_enabled Johannes Berg
2007-08-21 14:59 ` [PATCH 26/27] mac80211: refactor event sending Johannes Berg
2007-08-23 22:16   ` Michael Wu
2007-08-24 10:10     ` Johannes Berg
2007-08-21 14:59 ` [PATCH 27/27] mac80211: use switch statement in tx code Johannes Berg
2007-08-22  4:21 ` [PATCH 00/27] various cleanups and fixes for mac80211 and drivers Michael Wu
2007-08-23 20:54 ` John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).