Skip to contentSkip to conversation

management interface removal

PATCH In review Johannes Berg 3 participants 10 messages Aug 13, 2007 – Aug 14, 2007

Subsystems (2)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

cover management interface removal

The first patch in the series is required to get hostapd working with the monitor interface, the second cleans up some event sending code and the third finally removes all the management interface.

Net weight:

 17 files changed, 75 insertions(+), 529 deletions(-)

johannes

author maintainer
#1 lore raw

PATCH 1/3 mac80211: allow tx handlers on injected packets

If we specify the F_WEP flag for injection, then we have indicated that we want encryption. Since that is handled by the tx handlers we need to run the packet through them with the additional benefit that everything else is also done. This is important for hostapd when it sends EAPOL frames, it needs to do that to avoid the qdisc.

I'm not entirely convinced this is the right thing, but it's what I needed to get it all running for now.

---
 net/mac80211/tx.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
net/mac80211/tx.c +7 -3
@@ -835,8 +835,7 @@ __ieee80211_parse_tx_radiotap(
 	control->key_idx = -1; /* no encryption key */
 	control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS |
 			    IEEE80211_TXCTL_USE_CTS_PROTECT);
-	control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT |
-			  IEEE80211_TXCTL_NO_ACK;
+	control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
 	control->antenna_sel_tx = 0; /* default to default antenna */
 
 	/*
@@ -1115,7 +1114,12 @@ static int ieee80211_tx(struct net_devic
 	tx.u.tx.mgmt_interface = mgmt;
 	tx.u.tx.mode = local->hw.conf.mode;
 
-	if (res_prepare == TXRX_QUEUED) { /* if it was an injected packet */
+	/*
+	 * if it was an injected packet and "don't encrypt"
+	 * was specified, then skip everthing. quite hackish
+	 */
+	if (res_prepare == TXRX_QUEUED &&
+	    (control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
 		res = TXRX_CONTINUE;
 	} else {
 		for (handler = local->tx_handlers; *handler != NULL;
author maintainer
#2 lore raw

PATCH 2/3 mac80211: refactor event sending

In reply to Johannes Berg

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.

---
 net/mac80211/Makefile      |    1 +
 net/mac80211/event.c       |   36 ++++++++++++++++++++++++++++++++++++
 net/mac80211/ieee80211_i.h |    2 ++
 net/mac80211/rx.c          |   37 ++++++-------------------------------
 net/mac80211/wpa.c         |   34 ++++------------------------------
 5 files changed, 49 insertions(+), 61 deletions(-)
net/mac80211/ieee80211_i.h +2 -0
@@ -952,5 +952,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 */
net/mac80211/wpa.c +4 -30
@@ -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"
@@ -245,33 +243,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:
net/mac80211/rx.c +6 -31
@@ -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>
 
@@ -1289,18 +1288,15 @@ 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) {
-			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;
-		}
+		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 &&
@@ -1313,32 +1309,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;
net/mac80211/Makefile +1 -0
@@ -22,4 +22,5 @@ mac80211-objs := \
 	tx.o \
 	key.o \
 	util.o \
+	event.o \
 	$(mac80211-objs-y)
net/mac80211/event.c new file +36 -0
@@ -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
+	 */
+}
author maintainer
#3 lore raw

PATCH 3/3 mac80211: remove management interface

In reply to Johannes Berg

Yay! So I got hostapd working without the management interface, that lets me remove it. Less code than I thought though.

It works like this but there are two minor TODO items, injection needs to be able to
* specify QoS parameters
* circumvent PAE/802.1X checks

Oh and somebody needs to fix zd1211rw-mac80211. It abused the MGMT interface constant that was explicitly mentioned to be not for drivers... I've "fixed" it for now but readers of the code may not be happy with it.

---
 drivers/net/wireless/zd1211rw-mac80211/zd_mac.c |   22 +-
 include/net/mac80211.h                          |    6 
 net/mac80211/hostapd_ioctl.h                    |    1 
 net/mac80211/ieee80211.c                        |  186 ------------------------
 net/mac80211/ieee80211_common.h                 |   93 ------------
 net/mac80211/ieee80211_i.h                      |   10 -
 net/mac80211/ieee80211_iface.c                  |   57 -------
 net/mac80211/ieee80211_ioctl.c                  |   16 --
 net/mac80211/ieee80211_rate.c                   |    3 
 net/mac80211/ieee80211_rate.h                   |    2 
 net/mac80211/ieee80211_sta.c                    |    1 
 net/mac80211/rx.c                               |   11 -
 net/mac80211/tx.c                               |   72 ---------
 net/mac80211/wme.c                              |    4 
 14 files changed, 19 insertions(+), 465 deletions(-)
include/net/mac80211.h +1 -5
@@ -174,8 +174,7 @@ struct ieee80211_tx_control {
 			   * specific value for the rate (from
 			   * struct ieee80211_rate) */
 
-#define IEEE80211_TXCTL_REQ_TX_STATUS	(1<<0)/* request TX status callback for
-						* this frame */
+/* bit 0 unused */
 #define IEEE80211_TXCTL_DO_NOT_ENCRYPT	(1<<1) /* send this frame without
 						* encryption; e.g., for EAPOL
 						* frames */
@@ -321,8 +320,6 @@ struct ieee80211_conf {
  * enum ieee80211_if_types - types of 802.11 network interfaces
  *
  * @IEEE80211_IF_TYPE_AP: interface in AP mode.
- * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap
- *	daemon. Drivers should never see this type.
  * @IEEE80211_IF_TYPE_STA: interface in STA (client) mode.
  * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode.
  * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode.
@@ -331,7 +328,6 @@ struct ieee80211_conf {
  */
 enum ieee80211_if_types {
 	IEEE80211_IF_TYPE_AP = 0x00000000,
-	IEEE80211_IF_TYPE_MGMT = 0x00000001,
 	IEEE80211_IF_TYPE_STA = 0x00000002,
 	IEEE80211_IF_TYPE_IBSS = 0x00000003,
 	IEEE80211_IF_TYPE_MNTR = 0x00000004,
net/mac80211/ieee80211.c +1 -185

249 lines not on this page · raw message

net/mac80211/ieee80211_common.h deleted +0 -93

93 lines not on this page · raw message

net/mac80211/ieee80211_i.h +0 -10
@@ -141,7 +141,6 @@ struct ieee80211_txrx_data {
 			 * when using CTS protection with IEEE 802.11g. */
 			struct ieee80211_rate *last_frag_rate;
 			int last_frag_hwrate;
-			int mgmt_interface;
 
 			/* Extra fragments (in addition to the first fragment
 			 * in skb) */
@@ -170,10 +169,8 @@ struct ieee80211_txrx_data {
 struct ieee80211_tx_packet_data {
 	int ifindex;
 	unsigned long jiffies;
-	unsigned int req_tx_status:1;
 	unsigned int do_not_encrypt:1;
 	unsigned int requeue:1;
-	unsigned int mgmt_iface:1;
 	unsigned int queue:4;
 };
 
@@ -468,7 +465,6 @@ struct ieee80211_local {
 	struct list_head modes_list;
 
 	struct net_device *mdev; /* wmaster# - "master" 802.11 device */
-	struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
 	int open_count;
 	int monitors;
 	struct iw_statistics wstats;
@@ -808,14 +804,11 @@ static inline int ieee80211_bssid_match(
 int ieee80211_hw_config(struct ieee80211_local *local);
 int ieee80211_if_config(struct net_device *dev);
 int ieee80211_if_config_beacon(struct net_device *dev);
-void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
-		       struct ieee80211_rx_status *status, u32 msg_type);
 void ieee80211_prepare_rates(struct ieee80211_local *local,
 			     struct ieee80211_hw_mode *mode);
 void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
 int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
 void ieee80211_if_setup(struct net_device *dev);
-void ieee80211_if_mgmt_setup(struct net_device *dev);
 struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
 struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local,
 					  int phymode, int hwrate);
@@ -916,8 +909,6 @@ void __ieee80211_if_del(struct ieee80211
 int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
 void ieee80211_if_free(struct net_device *dev);
 void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
-int ieee80211_if_add_mgmt(struct ieee80211_local *local);
-void ieee80211_if_del_mgmt(struct ieee80211_local *local);
 
 /* regdomain.c */
 void ieee80211_regdomain_init(void);
@@ -934,7 +925,6 @@ void ieee80211_tx_pending(unsigned long 
 int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
-int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev);
 
 /* key handling */
 struct ieee80211_key_conf *
net/mac80211/hostapd_ioctl.h +0 -1
@@ -59,7 +59,6 @@ enum {
 	PRISM2_PARAM_RADAR_DETECT = 1043,
 	PRISM2_PARAM_SPECTRUM_MGMT = 1044,
 	PRISM2_PARAM_USER_SPACE_MLME = 1045,
-	PRISM2_PARAM_MGMT_IF = 1046,
 };
 
 /* PRISM2_IOCTL_HOSTAPD ioctl() cmd:
net/mac80211/ieee80211_ioctl.c +0 -16
@@ -2328,16 +2328,6 @@ static int ieee80211_ioctl_prism2_param(
 	case PRISM2_PARAM_SPECTRUM_MGMT:
 		local->hw.conf.spect_mgmt = value;
 		break;
-	case PRISM2_PARAM_MGMT_IF:
-		if (value == 1) {
-			if (!local->apdev)
-				ret = ieee80211_if_add_mgmt(local);
-		} else if (value == 0) {
-			if (local->apdev)
-				ieee80211_if_del_mgmt(local);
-		} else
-			ret = -EINVAL;
-		break;
 	case PRISM2_PARAM_USER_SPACE_MLME:
 		local->user_space_mlme = value;
 		break;
@@ -2487,12 +2477,6 @@ static int ieee80211_ioctl_get_prism2_pa
 		else
 			*param = !!sdata->u.sta.wmm_enabled;
 		break;
-	case PRISM2_PARAM_MGMT_IF:
-		if (local->apdev)
-			*param = local->apdev->ifindex;
-		else
-			ret = -ENOENT;
-		break;
 	case PRISM2_PARAM_USER_SPACE_MLME:
 		*param = local->user_space_mlme;
 		break;
net/mac80211/ieee80211_iface.c +0 -57

71 lines not on this page · raw message

net/mac80211/ieee80211_rate.c +1 -2
@@ -145,8 +145,7 @@ int ieee80211_init_rate_ctrl_alg(struct 
 	struct rate_control_ref *ref, *old;
 
 	ASSERT_RTNL();
-	if (local->open_count || netif_running(local->mdev) ||
-	    (local->apdev && netif_running(local->apdev)))
+	if (local->open_count || netif_running(local->mdev))
 		return -EBUSY;
 
 	ref = rate_control_alloc(name, local);
net/mac80211/ieee80211_rate.h +0 -2
@@ -30,8 +30,6 @@ struct rate_control_extra {
 
 	/* parameters from the caller to rate_control_get_rate(): */
 	struct ieee80211_hw_mode *mode;
-	int mgmt_data; /* this is data frame that is used for management
-			* (e.g., IEEE 802.1X EAPOL) */
 	u16 ethertype;
 };
 
net/mac80211/ieee80211_sta.c +0 -1
@@ -506,7 +506,6 @@ static void ieee80211_sta_tx(struct net_
 	pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
 	memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
 	pkt_data->ifindex = sdata->dev->ifindex;
-	pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT);
 	pkt_data->do_not_encrypt = !encrypt;
 
 	dev_queue_xmit(skb);
net/mac80211/rx.c +3 -8
@@ -18,7 +18,6 @@
 
 #include "ieee80211_i.h"
 #include "ieee80211_led.h"
-#include "ieee80211_common.h"
 #include "wep.h"
 #include "wpa.h"
 #include "tkip.h"
@@ -1199,14 +1198,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_txr
 	     sdata->type == IEEE80211_IF_TYPE_IBSS) &&
 	    !rx->local->user_space_mlme) {
 		ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status);
-	} else {
-		/* Management frames are sent to hostapd for processing */
-		if (!rx->local->apdev)
-			return TXRX_DROP;
-		ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
-				  ieee80211_msg_normal);
+		return TXRX_QUEUED;
 	}
-	return TXRX_QUEUED;
+
+	return TXRX_DROP;
 }
 
 static inline ieee80211_txrx_result __ieee80211_invoke_rx_handlers(
net/mac80211/tx.c +3 -69

126 lines not on this page · raw message

net/mac80211/wme.c +1 -3
@@ -96,8 +96,6 @@ static inline int classify80211(struct s
 	struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(qd->dev);
 	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
-	struct ieee80211_tx_packet_data *pkt_data =
-		(struct ieee80211_tx_packet_data *) skb->cb;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	unsigned short fc = le16_to_cpu(hdr->frame_control);
 	int qos, tsid, dir;
@@ -110,7 +108,7 @@ static inline int classify80211(struct s
 		return IEEE80211_TX_QUEUE_DATA0;
 	}
 
-	if (unlikely(pkt_data->mgmt_iface)) {
+	if (0 /* TODO, some injection parameter? */) {
 		/* Data frames from hostapd (mainly, EAPOL) use AC_VO
 		* and they will include QoS control fields if
 		* the target STA is using WME. */
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c +9 -13
@@ -28,6 +28,8 @@
 #include "zd_rf.h"
 #include "zd_util.h"
 
+#define ZD1211_NO_DEV_ABUSE -1
+
 /* This table contains the hardware specific values for the modulation rates. */
 static const struct ieee80211_rate zd_rates[] = {
 	{ .rate = 10,
@@ -352,8 +354,6 @@ static int init_tx_skb_control_block(str
  * This information calls ieee80211_tx_status_irqsafe() if required by the
  * control information. It copies the control information into the status
  * information.
- *
- * If no status information has been requested, the skb is freed.
  */
 static void tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
 	              struct ieee80211_tx_status *status)
@@ -362,13 +362,9 @@ static void tx_status(struct ieee80211_h
 		skb->cb;
 
 	ZD_ASSERT(cb->control != NULL);
-	if ((cb->control->flags & IEEE80211_TXCTL_REQ_TX_STATUS)) {
-		memcpy(&status->control, cb->control, sizeof(status->control));
-		clear_tx_skb_control_block(skb);
-		ieee80211_tx_status_irqsafe(hw, skb, status);
-	} else {
-		kfree_tx_skb(skb);
-	}
+	memcpy(&status->control, cb->control, sizeof(status->control));
+	clear_tx_skb_control_block(skb);
+	ieee80211_tx_status_irqsafe(hw, skb, status);
 }
 
 /**
@@ -710,8 +706,8 @@ static int zd_op_add_interface(struct ie
 {
 	struct zd_mac *mac = zd_hw_mac(hw);
 
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (mac->type != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: abusing the type enum to indicate no mode selected */
+	if (mac->type != ZD1211_NO_DEV_ABUSE)
 		return -1;
 
 	switch (conf->type) {
@@ -732,7 +728,7 @@ static void zd_op_remove_interface(struc
 				    struct ieee80211_if_init_conf *conf)
 {
 	struct zd_mac *mac = zd_hw_mac(hw);
-	mac->type = IEEE80211_IF_TYPE_MGMT;
+	mac->type = ZD1211_NO_DEV_ABUSE;
 }
 
 static int zd_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
@@ -862,7 +858,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(str
 	spin_lock_init(&mac->lock);
 	mac->hw = hw;
 
-	mac->type = IEEE80211_IF_TYPE_MGMT;
+	mac->type = ZD1211_NO_DEV_ABUSE;
 	mac->hwaddr = hw->wiphy->perm_addr;
 
 	memcpy(mac->channels, zd_channels, sizeof(zd_channels));
author maintainer
#4 lore raw

Re: [PATCH 3/3] mac80211: remove management interface

Quoted 1 line · Johannes Berg

* circumvent PAE/802.1X checks

OTOH, the RX code unconditionally lets EAPOL frames through so the TX code could do that as well.

johannes

#5 lore raw

Re: [PATCH 3/3] mac80211: remove management interface

In reply to Johannes Berg
Quoted 4 lines · Johannes Berg

Oh and somebody needs to fix zd1211rw-mac80211. It abused the MGMT interface constant that was explicitly mentioned to be not for drivers... I've "fixed" it for now but readers of the code may not be happy with it.

I've done this in all my drivers. It's perfectly fine. If you're going to drop the MGMT enum, please post a patch to s/IEEE80211_IF_TYPE_MGMT/-1/ for all drivers.

-Michael Wu

author maintainer
#6 lore raw

Re: [PATCH 3/3] mac80211: remove management interface

Quoted 9 lines · Michael Wu
Quoted 4 lines · Johannes Berg

Oh and somebody needs to fix zd1211rw-mac80211. It abused the MGMT interface constant that was explicitly mentioned to be not for drivers... I've "fixed" it for now but readers of the code may not be happy with it.

I've done this in all my drivers. It's perfectly fine. If you're going to drop the MGMT enum, please post a patch to s/IEEE80211_IF_TYPE_MGMT/-1/ for all drivers.

Oh, I thought zd1211 was the only one doing that. I could add a IF_TYPE_INVALID if you really require that, but I don't see the point. As soon as the driver wants to work with multiple interfaces this stuff has to go anyway.

johannes

#7 lore raw

Re: [PATCH 3/3] mac80211: remove management interface

Quoted 7 lines · Johannes Berg
Quoted 5 lines · Michael Wu
Quoted 4 lines · Johannes Berg

Oh and somebody needs to fix zd1211rw-mac80211. It abused the MGMT interface constant that was explicitly mentioned to be not for drivers... I've "fixed" it for now but readers of the code may not be happy with it.

Quoted 8 lines
Quoted 3 lines

I've done this in all my drivers. It's perfectly fine. If you're going to drop the MGMT enum, please post a patch to s/IEEE80211_IF_TYPE_MGMT/-1/ for all drivers.

Oh, I thought zd1211 was the only one doing that. I could add a IF_TYPE_INVALID if you really require that, but I don't see the point. As soon as the driver wants to work with multiple interfaces this stuff has to go anyway.

Also rt2x00 was using IEEE80211_IF_TYPE_MGMT as value to indicate no interface has been configured. So if you are going to run s/IEEE80211_IF_TYPE_MGMT/-1/ please include rt2x00.h in that run too.

Thanks :)

Ivo

author maintainer
#8 lore raw

PATCH v2 1/1 mac80211: remove management interface

Yay! So I got hostapd working without the management interface, that lets me remove it. Less code than I thought though.

It works like this but there are two minor TODO items, injection needs to be able to
* specify QoS parameters
* circumvent PAE/802.1X checks

Oh and somebody needs to fix zd1211rw-mac80211. It abused the MGMT interface constant that was explicitly mentioned to be not for drivers... I've "fixed" it for now but readers of the code may not be happy with it.

---
Changes since v1:
* added IF_TYPE_NONE for the benefit drivers authors who are too lazy to do proper multiple interface support and refcounting and insist on abusing the type enum.

 drivers/net/wireless/adm8211.c                  |   12 -
 drivers/net/wireless/p54common.c                |   10 -
 drivers/net/wireless/p54pci.c                   |    4 
 drivers/net/wireless/rt2x00.h                   |    2 
 drivers/net/wireless/rtl8187_dev.c              |    8 -
 drivers/net/wireless/zd1211rw-mac80211/zd_mac.c |    8 -
 include/net/mac80211.h                          |   11 -
 net/mac80211/hostapd_ioctl.h                    |    1 
 net/mac80211/ieee80211.c                        |  186 ------------------------
 net/mac80211/ieee80211_common.h                 |   93 ------------
 net/mac80211/ieee80211_i.h                      |   10 -
 net/mac80211/ieee80211_iface.c                  |   57 -------
 net/mac80211/ieee80211_ioctl.c                  |   16 --
 net/mac80211/ieee80211_rate.c                   |    3 
 net/mac80211/ieee80211_rate.h                   |    2 
 net/mac80211/ieee80211_sta.c                    |    1 
 net/mac80211/rx.c                               |   11 -
 net/mac80211/tx.c                               |   72 ---------
 net/mac80211/wme.c                              |    4 
 19 files changed, 37 insertions(+), 474 deletions(-)
include/net/mac80211.h +6 -5
@@ -174,8 +174,7 @@ struct ieee80211_tx_control {
 			   * specific value for the rate (from
 			   * struct ieee80211_rate) */
 
-#define IEEE80211_TXCTL_REQ_TX_STATUS	(1<<0)/* request TX status callback for
-						* this frame */
+/* bit 0 unused */
 #define IEEE80211_TXCTL_DO_NOT_ENCRYPT	(1<<1) /* send this frame without
 						* encryption; e.g., for EAPOL
 						* frames */
@@ -320,9 +319,11 @@ struct ieee80211_conf {
 /**
  * enum ieee80211_if_types - types of 802.11 network interfaces
  *
+ * @IEEE80211_IF_TYPE_NONE: interface invalid, only here for the
+ *	benefit of drivers that want to support only a single
+ *	interface and insist on using the type to indicate they
+ *	have no interface. Don't use otherwise.
  * @IEEE80211_IF_TYPE_AP: interface in AP mode.
- * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap
- *	daemon. Drivers should never see this type.
  * @IEEE80211_IF_TYPE_STA: interface in STA (client) mode.
  * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode.
  * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode.
@@ -330,8 +331,8 @@ struct ieee80211_conf {
  * @IEEE80211_IF_TYPE_VLAN: not used.
  */
 enum ieee80211_if_types {
+	IEEE80211_IF_TYPE_NONE = -1,
 	IEEE80211_IF_TYPE_AP = 0x00000000,
-	IEEE80211_IF_TYPE_MGMT = 0x00000001,
 	IEEE80211_IF_TYPE_STA = 0x00000002,
 	IEEE80211_IF_TYPE_IBSS = 0x00000003,
 	IEEE80211_IF_TYPE_MNTR = 0x00000004,
net/mac80211/ieee80211.c +1 -185

249 lines not on this page · raw message

net/mac80211/ieee80211_common.h deleted +0 -93

93 lines not on this page · raw message

net/mac80211/ieee80211_i.h +0 -10
@@ -141,7 +141,6 @@ struct ieee80211_txrx_data {
 			 * when using CTS protection with IEEE 802.11g. */
 			struct ieee80211_rate *last_frag_rate;
 			int last_frag_hwrate;
-			int mgmt_interface;
 
 			/* Extra fragments (in addition to the first fragment
 			 * in skb) */
@@ -170,10 +169,8 @@ struct ieee80211_txrx_data {
 struct ieee80211_tx_packet_data {
 	int ifindex;
 	unsigned long jiffies;
-	unsigned int req_tx_status:1;
 	unsigned int do_not_encrypt:1;
 	unsigned int requeue:1;
-	unsigned int mgmt_iface:1;
 	unsigned int queue:4;
 };
 
@@ -468,7 +465,6 @@ struct ieee80211_local {
 	struct list_head modes_list;
 
 	struct net_device *mdev; /* wmaster# - "master" 802.11 device */
-	struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
 	int open_count;
 	int monitors;
 	struct iw_statistics wstats;
@@ -808,14 +804,11 @@ static inline int ieee80211_bssid_match(
 int ieee80211_hw_config(struct ieee80211_local *local);
 int ieee80211_if_config(struct net_device *dev);
 int ieee80211_if_config_beacon(struct net_device *dev);
-void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
-		       struct ieee80211_rx_status *status, u32 msg_type);
 void ieee80211_prepare_rates(struct ieee80211_local *local,
 			     struct ieee80211_hw_mode *mode);
 void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
 int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
 void ieee80211_if_setup(struct net_device *dev);
-void ieee80211_if_mgmt_setup(struct net_device *dev);
 struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
 struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local,
 					  int phymode, int hwrate);
@@ -916,8 +909,6 @@ void __ieee80211_if_del(struct ieee80211
 int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
 void ieee80211_if_free(struct net_device *dev);
 void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
-int ieee80211_if_add_mgmt(struct ieee80211_local *local);
-void ieee80211_if_del_mgmt(struct ieee80211_local *local);
 
 /* regdomain.c */
 void ieee80211_regdomain_init(void);
@@ -934,7 +925,6 @@ void ieee80211_tx_pending(unsigned long 
 int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
-int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev);
 
 /* key handling */
 struct ieee80211_key_conf *
net/mac80211/hostapd_ioctl.h +0 -1
@@ -59,7 +59,6 @@ enum {
 	PRISM2_PARAM_RADAR_DETECT = 1043,
 	PRISM2_PARAM_SPECTRUM_MGMT = 1044,
 	PRISM2_PARAM_USER_SPACE_MLME = 1045,
-	PRISM2_PARAM_MGMT_IF = 1046,
 };
 
 /* PRISM2_IOCTL_HOSTAPD ioctl() cmd:
net/mac80211/ieee80211_ioctl.c +0 -16
@@ -2328,16 +2328,6 @@ static int ieee80211_ioctl_prism2_param(
 	case PRISM2_PARAM_SPECTRUM_MGMT:
 		local->hw.conf.spect_mgmt = value;
 		break;
-	case PRISM2_PARAM_MGMT_IF:
-		if (value == 1) {
-			if (!local->apdev)
-				ret = ieee80211_if_add_mgmt(local);
-		} else if (value == 0) {
-			if (local->apdev)
-				ieee80211_if_del_mgmt(local);
-		} else
-			ret = -EINVAL;
-		break;
 	case PRISM2_PARAM_USER_SPACE_MLME:
 		local->user_space_mlme = value;
 		break;
@@ -2487,12 +2477,6 @@ static int ieee80211_ioctl_get_prism2_pa
 		else
 			*param = !!sdata->u.sta.wmm_enabled;
 		break;
-	case PRISM2_PARAM_MGMT_IF:
-		if (local->apdev)
-			*param = local->apdev->ifindex;
-		else
-			ret = -ENOENT;
-		break;
 	case PRISM2_PARAM_USER_SPACE_MLME:
 		*param = local->user_space_mlme;
 		break;
net/mac80211/ieee80211_iface.c +0 -57

71 lines not on this page · raw message

net/mac80211/ieee80211_rate.c +1 -2
@@ -145,8 +145,7 @@ int ieee80211_init_rate_ctrl_alg(struct 
 	struct rate_control_ref *ref, *old;
 
 	ASSERT_RTNL();
-	if (local->open_count || netif_running(local->mdev) ||
-	    (local->apdev && netif_running(local->apdev)))
+	if (local->open_count || netif_running(local->mdev))
 		return -EBUSY;
 
 	ref = rate_control_alloc(name, local);
net/mac80211/ieee80211_rate.h +0 -2
@@ -30,8 +30,6 @@ struct rate_control_extra {
 
 	/* parameters from the caller to rate_control_get_rate(): */
 	struct ieee80211_hw_mode *mode;
-	int mgmt_data; /* this is data frame that is used for management
-			* (e.g., IEEE 802.1X EAPOL) */
 	u16 ethertype;
 };
 
net/mac80211/ieee80211_sta.c +0 -1
@@ -506,7 +506,6 @@ static void ieee80211_sta_tx(struct net_
 	pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
 	memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
 	pkt_data->ifindex = sdata->dev->ifindex;
-	pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT);
 	pkt_data->do_not_encrypt = !encrypt;
 
 	dev_queue_xmit(skb);
net/mac80211/rx.c +3 -8
@@ -18,7 +18,6 @@
 
 #include "ieee80211_i.h"
 #include "ieee80211_led.h"
-#include "ieee80211_common.h"
 #include "wep.h"
 #include "wpa.h"
 #include "tkip.h"
@@ -1199,14 +1198,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_txr
 	     sdata->type == IEEE80211_IF_TYPE_IBSS) &&
 	    !rx->local->user_space_mlme) {
 		ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status);
-	} else {
-		/* Management frames are sent to hostapd for processing */
-		if (!rx->local->apdev)
-			return TXRX_DROP;
-		ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
-				  ieee80211_msg_normal);
+		return TXRX_QUEUED;
 	}
-	return TXRX_QUEUED;
+
+	return TXRX_DROP;
 }
 
 static inline ieee80211_txrx_result __ieee80211_invoke_rx_handlers(
net/mac80211/tx.c +3 -69

126 lines not on this page · raw message

net/mac80211/wme.c +1 -3
@@ -96,8 +96,6 @@ static inline int classify80211(struct s
 	struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(qd->dev);
 	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
-	struct ieee80211_tx_packet_data *pkt_data =
-		(struct ieee80211_tx_packet_data *) skb->cb;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	unsigned short fc = le16_to_cpu(hdr->frame_control);
 	int qos, tsid, dir;
@@ -110,7 +108,7 @@ static inline int classify80211(struct s
 		return IEEE80211_TX_QUEUE_DATA0;
 	}
 
-	if (unlikely(pkt_data->mgmt_iface)) {
+	if (0 /* TODO, some injection parameter? */) {
 		/* Data frames from hostapd (mainly, EAPOL) use AC_VO
 		* and they will include QoS control fields if
 		* the target STA is using WME. */
drivers/net/wireless/adm8211.c +6 -6
@@ -1479,8 +1479,8 @@ static int adm8211_add_interface(struct 
 				 struct ieee80211_if_init_conf *conf)
 {
 	struct adm8211_priv *priv = dev->priv;
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: using IEEE80211_IF_TYPE_NONE to indicate no mode selected */
+	if (priv->mode != IEEE80211_IF_TYPE_NONE)
 		return -1;
 
 	switch (conf->type) {
@@ -1501,7 +1501,7 @@ static void adm8211_remove_interface(str
 				     struct ieee80211_if_init_conf *conf)
 {
 	struct adm8211_priv *priv = dev->priv;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 }
 
 static int adm8211_init_rings(struct ieee80211_hw *dev)
@@ -2010,7 +2010,7 @@ static int __devinit adm8211_probe(struc
 	priv->tx_power = 0x40;
 	priv->lpf_cutoff = 0xFF;
 	priv->lnags_threshold = 0xFF;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 
 	/* Power-on issue. EEPROM won't read correctly without */
 	if (priv->revid >= ADM8211_REV_BA) {
@@ -2101,7 +2101,7 @@ static int adm8211_suspend(struct pci_de
 	struct ieee80211_hw *dev = pci_get_drvdata(pdev);
 	struct adm8211_priv *priv = dev->priv;
 
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT) {
+	if (priv->mode != IEEE80211_IF_TYPE_NONE) {
 		ieee80211_stop_queues(dev);
 		adm8211_stop(dev);
 	}
@@ -2119,7 +2119,7 @@ static int adm8211_resume(struct pci_dev
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT) {
+	if (priv->mode != IEEE80211_IF_TYPE_NONE) {
 		adm8211_open(dev);
 		ieee80211_start_queues(dev);
 	}
drivers/net/wireless/p54common.c +5 -5
@@ -744,8 +744,8 @@ static int p54_add_interface(struct ieee
 	struct p54_common *priv = dev->priv;
 	int err;
 
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: using IEEE80211_IF_TYPE_NONE to indicate no mode selected */
+	if (priv->mode != IEEE80211_IF_TYPE_NONE)
 		return -1;
 
 	switch (conf->type) {
@@ -760,7 +760,7 @@ static int p54_add_interface(struct ieee
 
 	err = priv->open(dev);
 	if (err) {
-		priv->mode = IEEE80211_IF_TYPE_MGMT;
+		priv->mode = IEEE80211_IF_TYPE_NONE;
 		skb_queue_purge(&priv->tx_queue);
 		return err;
 	}
@@ -791,7 +791,7 @@ static void p54_remove_interface(struct 
 			kfree(range->control);
 		kfree_skb(skb);
 	}
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 	priv->stop(dev);
 }
 
@@ -877,7 +877,7 @@ struct ieee80211_hw *p54_init_common(siz
 		return NULL;
 
 	priv = dev->priv;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 	skb_queue_head_init(&priv->tx_queue);
 	memcpy(priv->channels, p54_channels, sizeof(p54_channels));
 	memcpy(priv->rates, p54_rates, sizeof(p54_rates));
drivers/net/wireless/p54pci.c +2 -2
@@ -637,7 +637,7 @@ static int p54p_suspend(struct pci_dev *
 	struct ieee80211_hw *dev = pci_get_drvdata(pdev);
 	struct p54p_priv *priv = dev->priv;
 
-	if (priv->common.mode != IEEE80211_IF_TYPE_MGMT) {
+	if (priv->common.mode != IEEE80211_IF_TYPE_NONE) {
 		ieee80211_stop_queues(dev);
 		p54p_stop(dev);
 	}
@@ -655,7 +655,7 @@ static int p54p_resume(struct pci_dev *p
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 
-	if (priv->common.mode != IEEE80211_IF_TYPE_MGMT) {
+	if (priv->common.mode != IEEE80211_IF_TYPE_NONE) {
 		p54p_open(dev);
 		ieee80211_start_queues(dev);
 	}
drivers/net/wireless/rt2x00.h +1 -1
@@ -285,7 +285,7 @@ struct interface {
 	 * When set to INVALID_INTERFACE, no interface is configured.
 	 */
 	int type;
-#define INVALID_INTERFACE	IEEE80211_IF_TYPE_MGMT
+#define INVALID_INTERFACE	IEEE80211_IF_TYPE_NONE
 
 	/*
 	 * MAC of the device.
drivers/net/wireless/rtl8187_dev.c +4 -4
@@ -453,8 +453,8 @@ static int rtl8187_add_interface(struct 
 {
 	struct rtl8187_priv *priv = dev->priv;
 
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: using IEEE80211_IF_TYPE_NONE to indicate no mode selected */
+	if (priv->mode != IEEE80211_IF_TYPE_NONE)
 		return -1;
 
 	switch (conf->type) {
@@ -475,7 +475,7 @@ static void rtl8187_remove_interface(str
 				     struct ieee80211_if_init_conf *conf)
 {
 	struct rtl8187_priv *priv = dev->priv;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 }
 
 static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
@@ -603,7 +603,7 @@ static int __devinit rtl8187_probe(struc
 	priv->modes[1].rates = priv->rates;
 	priv->modes[1].num_channels = ARRAY_SIZE(rtl818x_channels);
 	priv->modes[1].channels = priv->channels;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 	dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
 		     IEEE80211_HW_RX_INCLUDES_FCS |
 		     IEEE80211_HW_WEP_INCLUDE_IV |
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c +4 -4
@@ -710,8 +710,8 @@ static int zd_op_add_interface(struct ie
 {
 	struct zd_mac *mac = zd_hw_mac(hw);
 
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (mac->type != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: using IEEE80211_IF_TYPE_NONE to indicate no mode selected */
+	if (mac->type != IEEE80211_IF_TYPE_NONE)
 		return -1;
 
 	switch (conf->type) {
@@ -732,7 +732,7 @@ static void zd_op_remove_interface(struc
 				    struct ieee80211_if_init_conf *conf)
 {
 	struct zd_mac *mac = zd_hw_mac(hw);
-	mac->type = IEEE80211_IF_TYPE_MGMT;
+	mac->type = IEEE80211_IF_TYPE_NONE;
 }
 
 static int zd_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
@@ -862,7 +862,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(str
 	spin_lock_init(&mac->lock);
 	mac->hw = hw;
 
-	mac->type = IEEE80211_IF_TYPE_MGMT;
+	mac->type = IEEE80211_IF_TYPE_NONE;
 	mac->hwaddr = hw->wiphy->perm_addr;
 
 	memcpy(mac->channels, zd_channels, sizeof(zd_channels));
author maintainer
#9 lore raw

Re: [PATCH v2] mac80211: remove management interface

Yay! So I got hostapd working without the management interface, that lets me remove it. Less code than I thought though.

It works like this but there are two minor TODO items, injection needs to be able to
* specify QoS parameters
* circumvent PAE/802.1X checks

Oh and somebody needs to fix zd1211rw-mac80211. It abused the MGMT interface constant that was explicitly mentioned to be not for drivers... I've "fixed" it for now but readers of the code may not be happy with it.

---
Changes since v1:
* added IF_TYPE_NONE for the benefit drivers authors who are too lazy to do proper multiple interface support and refcounting and insist on abusing the type enum.

Changes since v2:
* put back tx status fix in zd1211

 drivers/net/wireless/adm8211.c                  |   12 -
 drivers/net/wireless/p54common.c                |   10 -
 drivers/net/wireless/p54pci.c                   |    4 
 drivers/net/wireless/rt2x00.h                   |    2 
 drivers/net/wireless/rtl8187_dev.c              |    8 -
 drivers/net/wireless/zd1211rw-mac80211/zd_mac.c |   18 --
 include/net/mac80211.h                          |   11 -
 net/mac80211/hostapd_ioctl.h                    |    1 
 net/mac80211/ieee80211.c                        |  186 ------------------------
 net/mac80211/ieee80211_common.h                 |   93 ------------
 net/mac80211/ieee80211_i.h                      |   10 -
 net/mac80211/ieee80211_iface.c                  |   57 -------
 net/mac80211/ieee80211_ioctl.c                  |   16 --
 net/mac80211/ieee80211_rate.c                   |    3 
 net/mac80211/ieee80211_rate.h                   |    2 
 net/mac80211/ieee80211_sta.c                    |    1 
 net/mac80211/rx.c                               |   11 -
 net/mac80211/tx.c                               |   72 ---------
 net/mac80211/wme.c                              |    4 
 19 files changed, 40 insertions(+), 481 deletions(-)
include/net/mac80211.h +6 -5
@@ -174,8 +174,7 @@ struct ieee80211_tx_control {
 			   * specific value for the rate (from
 			   * struct ieee80211_rate) */
 
-#define IEEE80211_TXCTL_REQ_TX_STATUS	(1<<0)/* request TX status callback for
-						* this frame */
+/* bit 0 unused */
 #define IEEE80211_TXCTL_DO_NOT_ENCRYPT	(1<<1) /* send this frame without
 						* encryption; e.g., for EAPOL
 						* frames */
@@ -320,9 +319,11 @@ struct ieee80211_conf {
 /**
  * enum ieee80211_if_types - types of 802.11 network interfaces
  *
+ * @IEEE80211_IF_TYPE_NONE: interface invalid, only here for the
+ *	benefit of drivers that want to support only a single
+ *	interface and insist on using the type to indicate they
+ *	have no interface. Don't use otherwise.
  * @IEEE80211_IF_TYPE_AP: interface in AP mode.
- * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap
- *	daemon. Drivers should never see this type.
  * @IEEE80211_IF_TYPE_STA: interface in STA (client) mode.
  * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode.
  * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode.
@@ -330,8 +331,8 @@ struct ieee80211_conf {
  * @IEEE80211_IF_TYPE_VLAN: not used.
  */
 enum ieee80211_if_types {
+	IEEE80211_IF_TYPE_NONE = -1,
 	IEEE80211_IF_TYPE_AP = 0x00000000,
-	IEEE80211_IF_TYPE_MGMT = 0x00000001,
 	IEEE80211_IF_TYPE_STA = 0x00000002,
 	IEEE80211_IF_TYPE_IBSS = 0x00000003,
 	IEEE80211_IF_TYPE_MNTR = 0x00000004,
net/mac80211/ieee80211.c +1 -185

249 lines not on this page · raw message

net/mac80211/ieee80211_common.h deleted +0 -93

93 lines not on this page · raw message

net/mac80211/ieee80211_i.h +0 -10
@@ -141,7 +141,6 @@ struct ieee80211_txrx_data {
 			 * when using CTS protection with IEEE 802.11g. */
 			struct ieee80211_rate *last_frag_rate;
 			int last_frag_hwrate;
-			int mgmt_interface;
 
 			/* Extra fragments (in addition to the first fragment
 			 * in skb) */
@@ -170,10 +169,8 @@ struct ieee80211_txrx_data {
 struct ieee80211_tx_packet_data {
 	int ifindex;
 	unsigned long jiffies;
-	unsigned int req_tx_status:1;
 	unsigned int do_not_encrypt:1;
 	unsigned int requeue:1;
-	unsigned int mgmt_iface:1;
 	unsigned int queue:4;
 };
 
@@ -468,7 +465,6 @@ struct ieee80211_local {
 	struct list_head modes_list;
 
 	struct net_device *mdev; /* wmaster# - "master" 802.11 device */
-	struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
 	int open_count;
 	int monitors;
 	struct iw_statistics wstats;
@@ -808,14 +804,11 @@ static inline int ieee80211_bssid_match(
 int ieee80211_hw_config(struct ieee80211_local *local);
 int ieee80211_if_config(struct net_device *dev);
 int ieee80211_if_config_beacon(struct net_device *dev);
-void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
-		       struct ieee80211_rx_status *status, u32 msg_type);
 void ieee80211_prepare_rates(struct ieee80211_local *local,
 			     struct ieee80211_hw_mode *mode);
 void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
 int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
 void ieee80211_if_setup(struct net_device *dev);
-void ieee80211_if_mgmt_setup(struct net_device *dev);
 struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
 struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local,
 					  int phymode, int hwrate);
@@ -916,8 +909,6 @@ void __ieee80211_if_del(struct ieee80211
 int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
 void ieee80211_if_free(struct net_device *dev);
 void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
-int ieee80211_if_add_mgmt(struct ieee80211_local *local);
-void ieee80211_if_del_mgmt(struct ieee80211_local *local);
 
 /* regdomain.c */
 void ieee80211_regdomain_init(void);
@@ -934,7 +925,6 @@ void ieee80211_tx_pending(unsigned long 
 int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
-int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev);
 
 /* key handling */
 struct ieee80211_key_conf *
net/mac80211/hostapd_ioctl.h +0 -1
@@ -59,7 +59,6 @@ enum {
 	PRISM2_PARAM_RADAR_DETECT = 1043,
 	PRISM2_PARAM_SPECTRUM_MGMT = 1044,
 	PRISM2_PARAM_USER_SPACE_MLME = 1045,
-	PRISM2_PARAM_MGMT_IF = 1046,
 };
 
 /* PRISM2_IOCTL_HOSTAPD ioctl() cmd:
net/mac80211/ieee80211_ioctl.c +0 -16
@@ -2328,16 +2328,6 @@ static int ieee80211_ioctl_prism2_param(
 	case PRISM2_PARAM_SPECTRUM_MGMT:
 		local->hw.conf.spect_mgmt = value;
 		break;
-	case PRISM2_PARAM_MGMT_IF:
-		if (value == 1) {
-			if (!local->apdev)
-				ret = ieee80211_if_add_mgmt(local);
-		} else if (value == 0) {
-			if (local->apdev)
-				ieee80211_if_del_mgmt(local);
-		} else
-			ret = -EINVAL;
-		break;
 	case PRISM2_PARAM_USER_SPACE_MLME:
 		local->user_space_mlme = value;
 		break;
@@ -2487,12 +2477,6 @@ static int ieee80211_ioctl_get_prism2_pa
 		else
 			*param = !!sdata->u.sta.wmm_enabled;
 		break;
-	case PRISM2_PARAM_MGMT_IF:
-		if (local->apdev)
-			*param = local->apdev->ifindex;
-		else
-			ret = -ENOENT;
-		break;
 	case PRISM2_PARAM_USER_SPACE_MLME:
 		*param = local->user_space_mlme;
 		break;
net/mac80211/ieee80211_iface.c +0 -57

71 lines not on this page · raw message

net/mac80211/ieee80211_rate.c +1 -2
@@ -145,8 +145,7 @@ int ieee80211_init_rate_ctrl_alg(struct 
 	struct rate_control_ref *ref, *old;
 
 	ASSERT_RTNL();
-	if (local->open_count || netif_running(local->mdev) ||
-	    (local->apdev && netif_running(local->apdev)))
+	if (local->open_count || netif_running(local->mdev))
 		return -EBUSY;
 
 	ref = rate_control_alloc(name, local);
net/mac80211/ieee80211_rate.h +0 -2
@@ -30,8 +30,6 @@ struct rate_control_extra {
 
 	/* parameters from the caller to rate_control_get_rate(): */
 	struct ieee80211_hw_mode *mode;
-	int mgmt_data; /* this is data frame that is used for management
-			* (e.g., IEEE 802.1X EAPOL) */
 	u16 ethertype;
 };
 
net/mac80211/ieee80211_sta.c +0 -1
@@ -506,7 +506,6 @@ static void ieee80211_sta_tx(struct net_
 	pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
 	memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
 	pkt_data->ifindex = sdata->dev->ifindex;
-	pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT);
 	pkt_data->do_not_encrypt = !encrypt;
 
 	dev_queue_xmit(skb);
net/mac80211/rx.c +3 -8
@@ -18,7 +18,6 @@
 
 #include "ieee80211_i.h"
 #include "ieee80211_led.h"
-#include "ieee80211_common.h"
 #include "wep.h"
 #include "wpa.h"
 #include "tkip.h"
@@ -1199,14 +1198,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_txr
 	     sdata->type == IEEE80211_IF_TYPE_IBSS) &&
 	    !rx->local->user_space_mlme) {
 		ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status);
-	} else {
-		/* Management frames are sent to hostapd for processing */
-		if (!rx->local->apdev)
-			return TXRX_DROP;
-		ieee80211_rx_mgmt(rx->local, rx->skb, rx->u.rx.status,
-				  ieee80211_msg_normal);
+		return TXRX_QUEUED;
 	}
-	return TXRX_QUEUED;
+
+	return TXRX_DROP;
 }
 
 static inline ieee80211_txrx_result __ieee80211_invoke_rx_handlers(
net/mac80211/tx.c +3 -69

126 lines not on this page · raw message

net/mac80211/wme.c +1 -3
@@ -96,8 +96,6 @@ static inline int classify80211(struct s
 	struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(qd->dev);
 	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
-	struct ieee80211_tx_packet_data *pkt_data =
-		(struct ieee80211_tx_packet_data *) skb->cb;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	unsigned short fc = le16_to_cpu(hdr->frame_control);
 	int qos, tsid, dir;
@@ -110,7 +108,7 @@ static inline int classify80211(struct s
 		return IEEE80211_TX_QUEUE_DATA0;
 	}
 
-	if (unlikely(pkt_data->mgmt_iface)) {
+	if (0 /* TODO, some injection parameter? */) {
 		/* Data frames from hostapd (mainly, EAPOL) use AC_VO
 		* and they will include QoS control fields if
 		* the target STA is using WME. */
drivers/net/wireless/adm8211.c +6 -6
@@ -1479,8 +1479,8 @@ static int adm8211_add_interface(struct 
 				 struct ieee80211_if_init_conf *conf)
 {
 	struct adm8211_priv *priv = dev->priv;
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: using IEEE80211_IF_TYPE_NONE to indicate no mode selected */
+	if (priv->mode != IEEE80211_IF_TYPE_NONE)
 		return -1;
 
 	switch (conf->type) {
@@ -1501,7 +1501,7 @@ static void adm8211_remove_interface(str
 				     struct ieee80211_if_init_conf *conf)
 {
 	struct adm8211_priv *priv = dev->priv;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 }
 
 static int adm8211_init_rings(struct ieee80211_hw *dev)
@@ -2010,7 +2010,7 @@ static int __devinit adm8211_probe(struc
 	priv->tx_power = 0x40;
 	priv->lpf_cutoff = 0xFF;
 	priv->lnags_threshold = 0xFF;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 
 	/* Power-on issue. EEPROM won't read correctly without */
 	if (priv->revid >= ADM8211_REV_BA) {
@@ -2101,7 +2101,7 @@ static int adm8211_suspend(struct pci_de
 	struct ieee80211_hw *dev = pci_get_drvdata(pdev);
 	struct adm8211_priv *priv = dev->priv;
 
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT) {
+	if (priv->mode != IEEE80211_IF_TYPE_NONE) {
 		ieee80211_stop_queues(dev);
 		adm8211_stop(dev);
 	}
@@ -2119,7 +2119,7 @@ static int adm8211_resume(struct pci_dev
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT) {
+	if (priv->mode != IEEE80211_IF_TYPE_NONE) {
 		adm8211_open(dev);
 		ieee80211_start_queues(dev);
 	}
drivers/net/wireless/p54common.c +5 -5
@@ -744,8 +744,8 @@ static int p54_add_interface(struct ieee
 	struct p54_common *priv = dev->priv;
 	int err;
 
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: using IEEE80211_IF_TYPE_NONE to indicate no mode selected */
+	if (priv->mode != IEEE80211_IF_TYPE_NONE)
 		return -1;
 
 	switch (conf->type) {
@@ -760,7 +760,7 @@ static int p54_add_interface(struct ieee
 
 	err = priv->open(dev);
 	if (err) {
-		priv->mode = IEEE80211_IF_TYPE_MGMT;
+		priv->mode = IEEE80211_IF_TYPE_NONE;
 		skb_queue_purge(&priv->tx_queue);
 		return err;
 	}
@@ -791,7 +791,7 @@ static void p54_remove_interface(struct 
 			kfree(range->control);
 		kfree_skb(skb);
 	}
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 	priv->stop(dev);
 }
 
@@ -877,7 +877,7 @@ struct ieee80211_hw *p54_init_common(siz
 		return NULL;
 
 	priv = dev->priv;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 	skb_queue_head_init(&priv->tx_queue);
 	memcpy(priv->channels, p54_channels, sizeof(p54_channels));
 	memcpy(priv->rates, p54_rates, sizeof(p54_rates));
drivers/net/wireless/p54pci.c +2 -2
@@ -637,7 +637,7 @@ static int p54p_suspend(struct pci_dev *
 	struct ieee80211_hw *dev = pci_get_drvdata(pdev);
 	struct p54p_priv *priv = dev->priv;
 
-	if (priv->common.mode != IEEE80211_IF_TYPE_MGMT) {
+	if (priv->common.mode != IEEE80211_IF_TYPE_NONE) {
 		ieee80211_stop_queues(dev);
 		p54p_stop(dev);
 	}
@@ -655,7 +655,7 @@ static int p54p_resume(struct pci_dev *p
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 
-	if (priv->common.mode != IEEE80211_IF_TYPE_MGMT) {
+	if (priv->common.mode != IEEE80211_IF_TYPE_NONE) {
 		p54p_open(dev);
 		ieee80211_start_queues(dev);
 	}
drivers/net/wireless/rt2x00.h +1 -1
@@ -285,7 +285,7 @@ struct interface {
 	 * When set to INVALID_INTERFACE, no interface is configured.
 	 */
 	int type;
-#define INVALID_INTERFACE	IEEE80211_IF_TYPE_MGMT
+#define INVALID_INTERFACE	IEEE80211_IF_TYPE_NONE
 
 	/*
 	 * MAC of the device.
drivers/net/wireless/rtl8187_dev.c +4 -4
@@ -453,8 +453,8 @@ static int rtl8187_add_interface(struct 
 {
 	struct rtl8187_priv *priv = dev->priv;
 
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (priv->mode != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: using IEEE80211_IF_TYPE_NONE to indicate no mode selected */
+	if (priv->mode != IEEE80211_IF_TYPE_NONE)
 		return -1;
 
 	switch (conf->type) {
@@ -475,7 +475,7 @@ static void rtl8187_remove_interface(str
 				     struct ieee80211_if_init_conf *conf)
 {
 	struct rtl8187_priv *priv = dev->priv;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 }
 
 static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
@@ -603,7 +603,7 @@ static int __devinit rtl8187_probe(struc
 	priv->modes[1].rates = priv->rates;
 	priv->modes[1].num_channels = ARRAY_SIZE(rtl818x_channels);
 	priv->modes[1].channels = priv->channels;
-	priv->mode = IEEE80211_IF_TYPE_MGMT;
+	priv->mode = IEEE80211_IF_TYPE_NONE;
 	dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
 		     IEEE80211_HW_RX_INCLUDES_FCS |
 		     IEEE80211_HW_WEP_INCLUDE_IV |
drivers/net/wireless/zd1211rw-mac80211/zd_mac.c +7 -11
@@ -362,13 +362,9 @@ static void tx_status(struct ieee80211_h
 		skb->cb;
 
 	ZD_ASSERT(cb->control != NULL);
-	if ((cb->control->flags & IEEE80211_TXCTL_REQ_TX_STATUS)) {
-		memcpy(&status->control, cb->control, sizeof(status->control));
-		clear_tx_skb_control_block(skb);
-		ieee80211_tx_status_irqsafe(hw, skb, status);
-	} else {
-		kfree_tx_skb(skb);
-	}
+	memcpy(&status->control, cb->control, sizeof(status->control));
+	clear_tx_skb_control_block(skb);
+	ieee80211_tx_status_irqsafe(hw, skb, status);
 }
 
 /**
@@ -710,8 +706,8 @@ static int zd_op_add_interface(struct ie
 {
 	struct zd_mac *mac = zd_hw_mac(hw);
 
-	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-	if (mac->type != IEEE80211_IF_TYPE_MGMT)
+	/* NOTE: using IEEE80211_IF_TYPE_NONE to indicate no mode selected */
+	if (mac->type != IEEE80211_IF_TYPE_NONE)
 		return -1;
 
 	switch (conf->type) {
@@ -732,7 +728,7 @@ static void zd_op_remove_interface(struc
 				    struct ieee80211_if_init_conf *conf)
 {
 	struct zd_mac *mac = zd_hw_mac(hw);
-	mac->type = IEEE80211_IF_TYPE_MGMT;
+	mac->type = IEEE80211_IF_TYPE_NONE;
 }
 
 static int zd_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
@@ -862,7 +858,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(str
 	spin_lock_init(&mac->lock);
 	mac->hw = hw;
 
-	mac->type = IEEE80211_IF_TYPE_MGMT;
+	mac->type = IEEE80211_IF_TYPE_NONE;
 	mac->hwaddr = hw->wiphy->perm_addr;
 
 	memcpy(mac->channels, zd_channels, sizeof(zd_channels));