Skip to contentSkip to conversation

d80211: pull request

PATCH In review Jiri Benc 4 participants 9 messages Aug 1, 2006 – Aug 4, 2006

Subsystems (3)
lore
Share & tools
lore

Jiri Benc

author
#0 lore raw

cover d80211: pull request

Please pull from
git://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git up to obtain following patches:

Jiri Benc:

      d80211: make sleeping in hw->config possible
      d80211: return correct error codes for scan requests
      d80211: Switch d80211 drivers to IEEE80211_ style definitions

Karol Lewandowski:
d80211: return correct value when loading of rate control module fails

Michael Wu:

      d80211: Switch d80211 to IEEE80211_ style names
 drivers/net/wireless/d80211/adm8211/adm8211.c      |   10 -
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c |   12 -
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c |   15 -
 drivers/net/wireless/d80211/rt2x00/rt2400pci.c     |   12 -
 drivers/net/wireless/d80211/rt2x00/rt2500pci.c     |   12 -
 drivers/net/wireless/d80211/rt2x00/rt2500usb.c     |   12 -
 drivers/net/wireless/d80211/rt2x00/rt61pci.c       |   10 -
 drivers/net/wireless/d80211/rt2x00/rt73usb.c       |   10 -
 include/net/d80211.h                               |  125 ++++---
 net/d80211/ieee80211.c                             |  343 ++++++++++----------
 net/d80211/ieee80211_i.h                           |    6 
 net/d80211/ieee80211_iface.c                       |   10 -
 net/d80211/ieee80211_ioctl.c                       |   22 +
 net/d80211/ieee80211_scan.c                        |    2 
 net/d80211/ieee80211_sta.c                         |  259 ++++++++-------
 net/d80211/ieee80211_sysfs.c                       |    2 
 net/d80211/rate_control.c                          |   10 -
 net/d80211/sta_info.c                              |   16 -
 net/d80211/tkip.c                                  |    8 
 net/d80211/wep.c                                   |    8 
 net/d80211/wme.c                                   |    8 
 net/d80211/wpa.c                                   |   72 ++--
 22 files changed, 508 insertions(+), 476 deletions(-)
Signature · 2 lines
Jiri Benc
SUSE Labs
author
#1 lore raw

PATCH 1/5 d80211: make sleeping in hw->config possible

This patch makes sleeping in the hw->config callback possible by removing the only atomic caller. The atomic caller was a timer and is replaced by a workqueue.

This is based on a patch from Michael Buesch <[email protected]>.

---

 net/d80211/ieee80211.c       |   23 +++++++++++++++--------
 net/d80211/ieee80211_i.h     |    3 ++-
 net/d80211/ieee80211_iface.c |   10 ++++++++--
 net/d80211/ieee80211_sta.c   |   37 +++++++++++++++++--------------------
 4 files changed, 42 insertions(+), 31 deletions(-)

d0d2b7a8ddc378ddea499f1537f6aea83d96d003

net/d80211/ieee80211.c +15 -8
index 4e80767..9f883a4 100644
@@ -4552,14 +4552,6 @@ void ieee80211_unregister_hw(struct net_
         tasklet_disable(&local->tasklet);
         /* TODO: skb_queue should be empty here, no need to do anything? */
 
-	if (local->rate_limit)
-		del_timer_sync(&local->rate_limit_timer);
-	if (local->stat_time)
-		del_timer_sync(&local->stat_timer);
-	if (local->scan_timer.data)
-		del_timer_sync(&local->scan_timer);
-	ieee80211_rx_bss_list_deinit(dev);
-
 	rtnl_lock();
 	local->reg_state = IEEE80211_DEV_UNREGISTERED;
 	if (local->apdev)
@@ -4572,6 +4564,21 @@ void ieee80211_unregister_hw(struct net_
 	}
 	rtnl_unlock();
 
+	if (local->rate_limit)
+		del_timer_sync(&local->rate_limit_timer);
+	if (local->stat_time)
+		del_timer_sync(&local->stat_timer);
+	if (local->scan_work.data) {
+		local->sta_scanning = 0;
+		cancel_delayed_work(&local->scan_work);
+		flush_scheduled_work();
+		/* The scan_work is guaranteed not to be called at this
+		 * point. It is not scheduled and not running now. It can be
+		 * scheduled again only by some sta_timer (all of them are
+		 * stopped by now) or under rtnl lock. */
+	}
+
+	ieee80211_rx_bss_list_deinit(dev);
 	ieee80211_clear_tx_pending(local);
 	sta_info_stop(local);
 	rate_control_remove_attrs(local, local->rate_ctrl_priv,
net/d80211/ieee80211_i.h +2 -1
index 016a2b1..5a2c6e8 100644
@@ -17,6 +17,7 @@ #include <linux/interrupt.h>
 #include <linux/list.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
+#include <linux/workqueue.h>
 #include "ieee80211_key.h"
 #include "sta_info.h"
 
@@ -425,7 +426,7 @@ #define IEEE80211_IRQSAFE_QUEUE_LIMIT 12
 	int scan_channel_idx;
 	enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
 	unsigned long last_scan_completed;
-	struct timer_list scan_timer;
+	struct work_struct scan_work;
 	int scan_oper_channel;
 	int scan_oper_channel_val;
 	int scan_oper_power_level;
net/d80211/ieee80211_iface.c +8 -2
index fa3d9e2..12b9d4f 100644
@@ -287,8 +287,14 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 	case IEEE80211_IF_TYPE_STA:
 	case IEEE80211_IF_TYPE_IBSS:
 		del_timer_sync(&sdata->u.sta.timer);
-		if (local->scan_timer.data == (unsigned long) sdata->dev)
-			del_timer_sync(&local->scan_timer);
+		if (local->scan_work.data == sdata->dev) {
+			local->sta_scanning = 0;
+			cancel_delayed_work(&local->scan_work);
+			flush_scheduled_work();
+			/* see comment in ieee80211_unregister_hw to
+			 * understand why this works */
+			local->scan_work.data = NULL;
+		}
 		kfree(sdata->u.sta.extra_ie);
 		sdata->u.sta.extra_ie = NULL;
 		kfree(sdata->u.sta.assocreq_ies);
net/d80211/ieee80211_sta.c +17 -20
index b0cfff1..22f9599 100644
@@ -2417,15 +2417,16 @@ static int ieee80211_active_scan(struct 
 }
 
 
-static void ieee80211_sta_scan_timer(unsigned long ptr)
+static void ieee80211_sta_scan_work(void *ptr)
 {
-	struct net_device *dev = (struct net_device *) ptr;
+	struct net_device *dev = ptr;
 	struct ieee80211_local *local = dev->ieee80211_ptr;
         struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	struct ieee80211_hw_modes *mode;
 	struct ieee80211_channel *chan;
 	int skip;
 	union iwreq_data wrqu;
+	unsigned long next_delay = 0;
 
 	if (!local->sta_scanning)
 		return;
@@ -2493,31 +2494,30 @@ #endif
 			local->scan_channel_idx = 0;
 		}
 
-		if (skip) {
-			local->scan_timer.expires = jiffies;
+		if (skip)
 			break;
-		}
 
-		local->scan_timer.expires =
-			jiffies + IEEE80211_PROBE_DELAY +
-			usecs_to_jiffies(local->hw->channel_change_time);
+		next_delay = IEEE80211_PROBE_DELAY +
+			     usecs_to_jiffies(local->hw->channel_change_time);
 		local->scan_state = SCAN_SEND_PROBE;
 		break;
 	case SCAN_SEND_PROBE:
 		if (ieee80211_active_scan(local)) {
 			ieee80211_send_probe_req(dev, NULL, local->scan_ssid,
 						 local->scan_ssid_len);
-			local->scan_timer.expires =
-				jiffies + IEEE80211_CHANNEL_TIME;
-		} else {
-			local->scan_timer.expires =
-				jiffies + IEEE80211_PASSIVE_CHANNEL_TIME;
-		}
+			next_delay = IEEE80211_CHANNEL_TIME;
+		} else
+			next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
 		local->scan_state = SCAN_SET_CHANNEL;
 		break;
 	}
 
-	add_timer(&local->scan_timer);
+	if (local->sta_scanning) {
+		if (next_delay)
+			schedule_delayed_work(&local->scan_work, next_delay);
+		else
+			schedule_work(&local->scan_work);
+	}
 }
 
 
@@ -2566,11 +2566,8 @@ int ieee80211_sta_req_scan(struct net_de
 	local->scan_state = SCAN_SET_CHANNEL;
 	local->scan_hw_mode_idx = 0;
 	local->scan_channel_idx = 0;
-	init_timer(&local->scan_timer);
-	local->scan_timer.data = (unsigned long) dev;
-	local->scan_timer.function = ieee80211_sta_scan_timer;
-	local->scan_timer.expires = jiffies + 1;
-	add_timer(&local->scan_timer);
+	INIT_WORK(&local->scan_work, ieee80211_sta_scan_work, dev);
+	schedule_work(&local->scan_work);
 
 	return 0;
 }
Signature · 1 line
1.3.0
author
#2 lore raw

PATCH 2/5 d80211: return correct error codes for scan requests

In reply to Jiri Benc

Do not allow scanning when the network interface is down. Return 0 instead of -EBUSY when scanning is in progress on the same network interface.

---

 net/d80211/ieee80211_ioctl.c |    6 ++++++
 net/d80211/ieee80211_sta.c   |    5 ++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

2cf10f1a78222a375297d01a919d55d1a3c2a5a6

net/d80211/ieee80211_ioctl.c +6 -0
index d73693e..e43e3b0 100644
@@ -1091,6 +1091,9 @@ static int ieee80211_ioctl_scan_req(stru
 	if (local->user_space_mlme)
 		return -EOPNOTSUPP;
 
+	if (!netif_running(dev))
+		return -ENETDOWN;
+
 	if (left < len || len > IEEE80211_MAX_SSID_LEN)
 		return -EINVAL;
 
@@ -1914,6 +1917,9 @@ static int ieee80211_ioctl_siwscan(struc
 	u8 *ssid = NULL;
 	size_t ssid_len = 0;
 
+	if (!netif_running(dev))
+		return -ENETDOWN;
+
 	if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
 		if (sdata->type == IEEE80211_IF_TYPE_STA ||
 		    sdata->type == IEEE80211_IF_TYPE_IBSS) {
net/d80211/ieee80211_sta.c +4 -1
index 22f9599..13dcdae 100644
@@ -2548,8 +2548,11 @@ int ieee80211_sta_req_scan(struct net_de
 	/* TODO: if assoc, move to power save mode for the duration of the
 	 * scan */
 
-	if (local->sta_scanning)
+	if (local->sta_scanning) {
+		if (local->scan_work.data == dev)
+			return 0;
 		return -EBUSY;
+	}
 
 	printk(KERN_DEBUG "%s: starting scan\n", dev->name);
 
Signature · 1 line
1.3.0
author
#3 lore raw

PATCH 3/5 d80211: return correct value when loading of rate control module fails

In reply to Jiri Benc

From: Karol Lewandowski <[email protected]>

When loading of rate_control module fails, ieee80211_register_hw returns value from previous check. This patch fixes that.

---

 net/d80211/ieee80211.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

2a053059b358f64991ac003c48f3de1da86c33ab

net/d80211/ieee80211.c +2 -1
index 9f883a4..41c292b 100644
@@ -4462,7 +4462,8 @@ int ieee80211_register_hw(struct net_dev
 	if (result < 0)
 		goto fail_if_sysfs;
 
-	if (rate_control_initialize(local) < 0) {
+	result = rate_control_initialize(local);
+	if (result < 0) {
 		printk(KERN_DEBUG "%s: Failed to initialize rate control "
 		       "algorithm\n", dev->name);
 		goto fail_rate;
Signature · 1 line
1.3.0
author
#4 lore raw

PATCH 4/5 d80211: Switch d80211 to IEEE80211_ style names

In reply to Jiri Benc

From: Michael Wu <[email protected]>

This patch switches the WLAN_ definitions in d80211.h to IEEE80211_ style definitions found in ieee80211.h. It also switches to MAC_ARG and MAC_FMT.

---

 include/net/d80211.h         |  125 +++++++++--------
 net/d80211/ieee80211.c       |  317 +++++++++++++++++++++---------------------
 net/d80211/ieee80211_i.h     |    3 
 net/d80211/ieee80211_ioctl.c |   16 +-
 net/d80211/ieee80211_scan.c  |    2 
 net/d80211/ieee80211_sta.c   |  217 ++++++++++++++---------------
 net/d80211/ieee80211_sysfs.c |    2 
 net/d80211/rate_control.c    |   10 +
 net/d80211/sta_info.c        |   16 +-
 net/d80211/tkip.c            |    8 +
 net/d80211/wep.c             |    8 +
 net/d80211/wme.c             |    8 +
 net/d80211/wpa.c             |   72 +++++-----
 13 files changed, 408 insertions(+), 396 deletions(-)

6884184d15ad8a0c5f4255e1219c170655a9610d

include/net/d80211.h +66 -59
index 3a8f6d5..ba5cb4c 100644
@@ -898,67 +898,73 @@ void ieee80211_rx_led(int state, struct 
 
 #define FCS_LEN 4
 
-#define WLAN_FC_PVER		0x0003
-#define WLAN_FC_TODS		0x0100
-#define WLAN_FC_FROMDS		0x0200
-#define WLAN_FC_MOREFRAG	0x0400
-#define WLAN_FC_RETRY		0x0800
-#define WLAN_FC_PWRMGT		0x1000
-#define WLAN_FC_MOREDATA	0x2000
-#define WLAN_FC_ISWEP		0x4000
-#define WLAN_FC_ORDER		0x8000
-
-#define WLAN_FC_GET_TYPE(fc)	(((fc) & 0x000c) >> 2)
-#define WLAN_FC_GET_STYPE(fc)	(((fc) & 0x00f0) >> 4)
-
-#define WLAN_GET_SEQ_FRAG(seq)	((seq) & 0x000f)
-#define WLAN_GET_SEQ_SEQ(seq)	((seq) >> 4)
-
-#define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
-
-#define WLAN_FC_TYPE_MGMT	0
-#define WLAN_FC_TYPE_CTRL	1
-#define WLAN_FC_TYPE_DATA	2
+#define IEEE80211_DATA_LEN              2304
+/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
+   6.2.1.1.2.
+
+   The figure in section 7.1.2 suggests a body size of up to 2312
+   bytes is allowed, which is a bit confusing, I suspect this
+   represents the 2304 bytes of real data, plus a possible 8 bytes of
+   WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
+
+#define IEEE80211_FCTL_VERS		0x0003
+#define IEEE80211_FCTL_FTYPE		0x000c
+#define IEEE80211_FCTL_STYPE		0x00f0
+#define IEEE80211_FCTL_TODS		0x0100
+#define IEEE80211_FCTL_FROMDS		0x0200
+#define IEEE80211_FCTL_MOREFRAGS	0x0400
+#define IEEE80211_FCTL_RETRY		0x0800
+#define IEEE80211_FCTL_PM		0x1000
+#define IEEE80211_FCTL_MOREDATA		0x2000
+#define IEEE80211_FCTL_PROTECTED	0x4000
+#define IEEE80211_FCTL_ORDER		0x8000
+
+#define IEEE80211_SCTL_FRAG		0x000F
+#define IEEE80211_SCTL_SEQ		0xFFF0
+
+#define IEEE80211_FTYPE_MGMT		0x0000
+#define IEEE80211_FTYPE_CTL		0x0004
+#define IEEE80211_FTYPE_DATA		0x0008
 
 /* management */
-#define WLAN_FC_STYPE_ASSOC_REQ		0
-#define WLAN_FC_STYPE_ASSOC_RESP	1
-#define WLAN_FC_STYPE_REASSOC_REQ	2
-#define WLAN_FC_STYPE_REASSOC_RESP	3
-#define WLAN_FC_STYPE_PROBE_REQ		4
-#define WLAN_FC_STYPE_PROBE_RESP	5
-#define WLAN_FC_STYPE_BEACON		8
-#define WLAN_FC_STYPE_ATIM		9
-#define WLAN_FC_STYPE_DISASSOC		10
-#define WLAN_FC_STYPE_AUTH		11
-#define WLAN_FC_STYPE_DEAUTH		12
-#define WLAN_FC_STYPE_ACTION		13
+#define IEEE80211_STYPE_ASSOC_REQ	0x0000
+#define IEEE80211_STYPE_ASSOC_RESP	0x0010
+#define IEEE80211_STYPE_REASSOC_REQ	0x0020
+#define IEEE80211_STYPE_REASSOC_RESP	0x0030
+#define IEEE80211_STYPE_PROBE_REQ	0x0040
+#define IEEE80211_STYPE_PROBE_RESP	0x0050
+#define IEEE80211_STYPE_BEACON		0x0080
+#define IEEE80211_STYPE_ATIM		0x0090
+#define IEEE80211_STYPE_DISASSOC	0x00A0
+#define IEEE80211_STYPE_AUTH		0x00B0
+#define IEEE80211_STYPE_DEAUTH		0x00C0
+#define IEEE80211_STYPE_ACTION		0x00D0
 
 /* control */
-#define WLAN_FC_STYPE_PSPOLL		10
-#define WLAN_FC_STYPE_RTS		11
-#define WLAN_FC_STYPE_CTS		12
-#define WLAN_FC_STYPE_ACK		13
-#define WLAN_FC_STYPE_CFEND		14
-#define WLAN_FC_STYPE_CFENDACK		15
+#define IEEE80211_STYPE_PSPOLL		0x00A0
+#define IEEE80211_STYPE_RTS		0x00B0
+#define IEEE80211_STYPE_CTS		0x00C0
+#define IEEE80211_STYPE_ACK		0x00D0
+#define IEEE80211_STYPE_CFEND		0x00E0
+#define IEEE80211_STYPE_CFENDACK	0x00F0
 
 /* data */
-#define WLAN_FC_STYPE_DATA		0
-#define WLAN_FC_STYPE_DATA_CFACK	1
-#define WLAN_FC_STYPE_DATA_CFPOLL	2
-#define WLAN_FC_STYPE_DATA_CFACKPOLL	3
-#define WLAN_FC_STYPE_NULLFUNC		4
-#define WLAN_FC_STYPE_CFACK		5
-#define WLAN_FC_STYPE_CFPOLL		6
-#define WLAN_FC_STYPE_CFACKPOLL		7
-#define WLAN_FC_STYPE_QOS_DATA		8
-#define WLAN_FC_STYPE_QOS_DATA_CFACK	9
-#define WLAN_FC_STYPE_QOS_DATA_CFPOLL	10
-#define WLAN_FC_STYPE_QOS_DATA_CFACKPOLL 11
-#define WLAN_FC_STYPE_QOS_NULLFUNC	12
-#define WLAN_FC_STYPE_QOS_CFACK		13
-#define WLAN_FC_STYPE_QOS_CFPOLL	14
-#define WLAN_FC_STYPE_QOS_CFACKPOLL	15
+#define IEEE80211_STYPE_DATA			0x0000
+#define IEEE80211_STYPE_DATA_CFACK		0x0010
+#define IEEE80211_STYPE_DATA_CFPOLL		0x0020
+#define IEEE80211_STYPE_DATA_CFACKPOLL		0x0030
+#define IEEE80211_STYPE_NULLFUNC		0x0040
+#define IEEE80211_STYPE_CFACK			0x0050
+#define IEEE80211_STYPE_CFPOLL			0x0060
+#define IEEE80211_STYPE_CFACKPOLL		0x0070
+#define IEEE80211_STYPE_QOS_DATA		0x0080
+#define IEEE80211_STYPE_QOS_DATA_CFACK		0x0090
+#define IEEE80211_STYPE_QOS_DATA_CFPOLL		0x00A0
+#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL	0x00B0
+#define IEEE80211_STYPE_QOS_NULLFUNC		0x00C0
+#define IEEE80211_STYPE_QOS_CFACK		0x00D0
+#define IEEE80211_STYPE_QOS_CFPOLL		0x00E0
+#define IEEE80211_STYPE_QOS_CFACKPOLL		0x00F0
 
 
 #define IEEE80211_MAX_FRAG_THRESHOLD 2346
@@ -1002,11 +1008,12 @@ static inline u8 *ieee80211_get_DA(struc
 
 static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
 {
-	return (le16_to_cpu(hdr->frame_control) & WLAN_FC_MOREFRAG) != 0;
+	return (le16_to_cpu(hdr->frame_control) &
+		IEEE80211_FCTL_MOREFRAGS) != 0;
 }
 
-#define MAC2STR(a) ((a)[0] & 0xff), ((a)[1] & 0xff), ((a)[2] & 0xff), \
-		   ((a)[3] & 0xff), ((a)[4] & 0xff), ((a)[5] & 0xff)
-#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
+#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
+#define MAC_ARG(x) ((u8*)(x))[0], ((u8*)(x))[1], ((u8*)(x))[2], \
+		   ((u8*)(x))[3], ((u8*)(x))[4], ((u8*)(x))[5]
 
 #endif /* D80211_H */
net/d80211/ieee80211.c +160 -157

792 lines not on this page · raw message

net/d80211/ieee80211_i.h +2 -1
index 5a2c6e8..7e021ec 100644
@@ -30,13 +30,14 @@ #endif /* ETH_P_PAE */
 
 #define IEEE80211_MAX_SSID_LEN 32
 
+#define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
+
 struct ieee80211_local;
 
 #define BIT(x) (1 << (x))
 
 #define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3)
 
-
 /* Maximum number of broadcast/multicast frames to buffer when some of the
  * associated stations are using power saving. */
 #define AP_MAX_BC_BUFFER 128
net/d80211/ieee80211_ioctl.c +8 -8
index e43e3b0..dd52555 100644
@@ -413,14 +413,14 @@ static int ieee80211_ioctl_set_flags_sta
 		    (param->u.set_flags_sta.flags_or & WLAN_STA_AUTHORIZED) &&
 		    local->hw->set_port_auth(local->mdev, sta->addr, 1))
 			printk(KERN_DEBUG "%s: failed to set low-level driver "
-			       "PAE state (authorized) for " MACSTR "\n",
-			       dev->name, MAC2STR(sta->addr));
+			       "PAE state (authorized) for " MAC_FMT "\n",
+			       dev->name, MAC_ARG(sta->addr));
 		if (local->hw->set_port_auth &&
 		    !(param->u.set_flags_sta.flags_and & WLAN_STA_AUTHORIZED)
 		    && local->hw->set_port_auth(local->mdev, sta->addr, 0))
 			printk(KERN_DEBUG "%s: failed to set low-level driver "
-			       "PAE state (unauthorized) for " MACSTR "\n",
-			       dev->name, MAC2STR(sta->addr));
+			       "PAE state (unauthorized) for " MAC_FMT "\n",
+			       dev->name, MAC_ARG(sta->addr));
 		sta_info_put(sta);
 	}
 
@@ -518,8 +518,8 @@ static int ieee80211_set_encryption(stru
 				*err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR;
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
 			printk(KERN_DEBUG "%s: set_encrypt - unknown addr "
-			       MACSTR "\n",
-			       dev->name, MAC2STR(sta_addr));
+			       MAC_FMT "\n",
+			       dev->name, MAC_ARG(sta_addr));
 #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 
 			return -ENOENT;
@@ -1164,8 +1164,8 @@ static int ieee80211_ioctl_set_sta_vlan(
 			dev_get_by_name(param->u.set_sta_vlan.vlan_name);
                 if (new_vlan_dev) {
 #if 0
-                        printk("%s: Station " MACSTR " moved to vlan: %s\n",
-                               dev->name, MAC2STR(param->sta_addr),
+			printk("%s: Station " MAC_FMT " moved to vlan: %s\n",
+			       dev->name, MAC_ARG(param->sta_addr),
                                new_vlan_dev->name);
 #endif
                         sta->dev = new_vlan_dev;
net/d80211/ieee80211_scan.c +1 -1
index 4184abf..445509e 100644
@@ -319,7 +319,7 @@ void ieee80211_init_scan(struct net_devi
 		return;
 	}
 
-	fc = (WLAN_FC_TYPE_CTRL << 2) | (WLAN_FC_STYPE_CTS << 4);
+	fc = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS;
 	hdr.frame_control = cpu_to_le16(fc);
 	hdr.duration_id =
 		cpu_to_le16(2 * local->hw->channel_change_time +
net/d80211/ieee80211_sta.c +109 -108

518 lines not on this page · raw message

net/d80211/ieee80211_sysfs.c +1 -1
index fb1c6b5..9974668 100644
@@ -420,7 +420,7 @@ #define IEEE80211_IF_FMT_MAC(name, field
 static ssize_t ieee80211_if_fmt_##name(const struct			\
 			ieee80211_sub_if_data *sdata, char *buf)	\
 {									\
-	return sprintf(buf, MACSTR "\n", MAC2STR(sdata->field));	\
+	return sprintf(buf, MAC_FMT "\n", MAC_ARG(sdata->field));	\
 }
 
 #define __IEEE80211_IF_SHOW(name)					\
net/d80211/rate_control.c +5 -5
index bf797ec..1d40e88 100644
@@ -141,9 +141,9 @@ static void rate_control_simple_tx_statu
 	if (status->excessive_retries) {
 		sta->antenna_sel = sta->antenna_sel == 1 ? 2 : 1;
 		if (local->sta_antenna_sel == STA_ANTENNA_SEL_SW_CTRL_DEBUG) {
-			printk(KERN_DEBUG "%s: " MACSTR " TX antenna --> %d "
+			printk(KERN_DEBUG "%s: " MAC_FMT " TX antenna --> %d "
 			       "(@%lu)\n",
-			       dev->name, MAC2STR(hdr->addr1),
+			       dev->name, MAC_ARG(hdr->addr1),
 			       sta->antenna_sel, jiffies);
 		}
 		srctrl->tx_num_failures++;
@@ -196,9 +196,9 @@ #endif
 		srctrl->avg_rate_update = jiffies;
 		if (srctrl->tx_avg_rate_num > 0) {
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
-			printk(KERN_DEBUG "%s: STA " MACSTR " Average rate: "
+			printk(KERN_DEBUG "%s: STA " MAC_FMT " Average rate: "
 			       "%d (%d/%d)\n",
-                               dev->name, MAC2STR(sta->addr),
+			       dev->name, MAC_ARG(sta->addr),
 			       srctrl->tx_avg_rate_sum /
 			       srctrl->tx_avg_rate_num,
 			       srctrl->tx_avg_rate_sum,
@@ -227,7 +227,7 @@ rate_control_simple_get_rate(struct net_
 	memset(extra, 0, sizeof(*extra));
 
 	fc = le16_to_cpu(hdr->frame_control);
-	if (WLAN_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA ||
+	if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
 	    (hdr->addr1[0] & 0x01)) {
 		/* Send management frames and broadcast/multicast data using
 		 * lowest rate. */
net/d80211/sta_info.c +8 -8
index d3b4b42..7f5febe 100644
@@ -51,8 +51,8 @@ static void sta_info_hash_del(struct iee
 	if (s->hnext != NULL)
 		s->hnext = s->hnext->hnext;
 	else
-		printk(KERN_ERR "%s: could not remove STA " MACSTR " from "
-		       "hash table\n", local->mdev->name, MAC2STR(sta->addr));
+		printk(KERN_ERR "%s: could not remove STA " MAC_FMT " from "
+		       "hash table\n", local->mdev->name, MAC_ARG(sta->addr));
 }
 
 static inline struct sta_info *__sta_info_get(struct sta_info *sta)
@@ -139,7 +139,7 @@ struct sta_info * sta_info_add(struct ie
 
 	memset(sta, 0, sizeof(*sta));
 
-	if (kobject_set_name(&sta->kobj, MACSTR, MAC2STR(addr))) {
+	if (kobject_set_name(&sta->kobj, MAC_FMT, MAC_ARG(addr))) {
 		kfree(sta);
 		return NULL;
 	}
@@ -170,8 +170,8 @@ struct sta_info * sta_info_add(struct ie
 	sta->key_idx_compression = HW_KEY_IDX_INVALID;
 
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
-	printk(KERN_DEBUG "%s: Added STA " MACSTR "\n",
-	       local->mdev->name, MAC2STR(addr));
+	printk(KERN_DEBUG "%s: Added STA " MAC_FMT "\n",
+	       local->mdev->name, MAC_ARG(addr));
 #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 
 	if (!in_interrupt()) {
@@ -193,8 +193,8 @@ static void finish_sta_info_free(struct 
 				 struct sta_info *sta)
 {
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
-	printk(KERN_DEBUG "%s: Removed STA " MACSTR "\n",
-	       local->mdev->name, MAC2STR(sta->addr));
+	printk(KERN_DEBUG "%s: Removed STA " MAC_FMT "\n",
+	       local->mdev->name, MAC_ARG(sta->addr));
 #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 
 	rate_control_remove_sta_attrs(local, sta->rate_ctrl_priv, &sta->kobj);
@@ -301,7 +301,7 @@ static void sta_info_cleanup_expire_buff
 		if (skb) {
 			local->total_ps_buffered--;
 			printk(KERN_DEBUG "Buffered frame expired (STA "
-			       MACSTR ")\n", MAC2STR(sta->addr));
+			       MAC_FMT ")\n", MAC_ARG(sta->addr));
 			dev_kfree_skb(skb);
 		} else
 			break;
net/d80211/tkip.c +4 -4
index 337e31a..3f0cf57 100644
@@ -276,8 +276,8 @@ #endif /* CONFIG_TKIP_DEBUG */
 	      iv16 <= key->u.tkip.iv16_rx[queue]))) {
 #ifdef CONFIG_TKIP_DEBUG
 		printk(KERN_DEBUG "TKIP replay detected for RX frame from "
-		       MACSTR " (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
-		       MAC2STR(ta),
+		       MAC_FMT " (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
+		       MAC_ARG(ta),
 		       iv32, iv16, key->u.tkip.iv32_rx[queue],
 		       key->u.tkip.iv16_rx[queue]);
 #endif /* CONFIG_TKIP_DEBUG */
@@ -298,8 +298,8 @@ #endif /* CONFIG_TKIP_DEBUG */
 #ifdef CONFIG_TKIP_DEBUG
 		{
 			int i;
-			printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=" MACSTR
-			       " TK=", MAC2STR(ta));
+			printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=" MAC_FMT
+			       " TK=", MAC_ARG(ta));
 			for (i = 0; i < 16; i++)
 				printk("%02x ",
 				       key->key[ALG_TKIP_TEMP_ENCR_KEY + i]);
net/d80211/wep.c +4 -4
index f60e449..0473f3c 100644
@@ -81,7 +81,7 @@ u8 * ieee80211_wep_add_iv(struct ieee802
 	u8 *newhdr;
 
 	fc = le16_to_cpu(hdr->frame_control);
-	fc |= WLAN_FC_ISWEP;
+	fc |= IEEE80211_FCTL_PROTECTED;
 	hdr->frame_control = cpu_to_le16(fc);
 
 	if ((skb_headroom(skb) < WEP_IV_LEN ||
@@ -227,7 +227,7 @@ int ieee80211_wep_decrypt(struct ieee802
 	int ret = 0;
 
 	fc = le16_to_cpu(hdr->frame_control);
-	if (!(fc & WLAN_FC_ISWEP))
+	if (!(fc & IEEE80211_FCTL_PROTECTED))
 		return -1;
 
 	hdrlen = ieee80211_get_hdrlen(fc);
@@ -281,7 +281,7 @@ int ieee80211_wep_get_keyidx(struct sk_b
 	int hdrlen;
 
 	fc = le16_to_cpu(hdr->frame_control);
-	if (!(fc & WLAN_FC_ISWEP))
+	if (!(fc & IEEE80211_FCTL_PROTECTED))
 		return -1;
 
 	hdrlen = ieee80211_get_hdrlen(fc);
@@ -302,7 +302,7 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_
 	u32 iv;
 
 	fc = le16_to_cpu(hdr->frame_control);
-	if (!(fc & WLAN_FC_ISWEP))
+	if (!(fc & IEEE80211_FCTL_PROTECTED))
 		return NULL;
 
 	hdrlen = ieee80211_get_hdrlen(fc);
net/d80211/wme.c +4 -4
index 76de062..c3c961d 100644
@@ -38,7 +38,7 @@ ieee80211_rx_h_parse_qos(struct ieee8021
 		/* frame has qos control */
 		tid = qc[0] & QOS_CONTROL_TID_MASK;
 	} else {
-		if (unlikely(WLAN_FC_GET_TYPE(rx->fc) == WLAN_FC_TYPE_MGMT)) {
+		if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
 			/* Separate TID for management frames */
 			tid = NUM_RX_DATA_QUEUES - 1;
 		} else {
@@ -76,7 +76,7 @@ ieee80211_rx_h_remove_qos_control(struct
 	memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2);
 	hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2);
 	/* change frame type to non QOS */
-	rx->fc = fc &= ~(WLAN_FC_STYPE_QOS_DATA << 4);
+	rx->fc = fc &= ~(IEEE80211_STYPE_QOS_DATA << 4);
 	hdr->frame_control = cpu_to_le16(fc);
 
 	return TXRX_CONTINUE;
@@ -184,7 +184,7 @@ static inline int classify80211(struct s
 	const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 };
 
 	/* see if frame is data or non data frame */
-	if (unlikely(WLAN_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA)) {
+	if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)) {
 		/* management frames go on AC_VO queue, but are sent
 		* without QoS control fields */
 		return IEEE80211_TX_QUEUE_DATA0;
@@ -199,7 +199,7 @@ static inline int classify80211(struct s
 	}
 
 	/* is this a QoS frame? */
-	qos = fc & (WLAN_FC_STYPE_QOS_DATA << 4);
+	qos = fc & (IEEE80211_STYPE_QOS_DATA << 4);
 
 	if (!qos) {
 		skb->priority = 0; /* required for correct WPA/11i MIC */
net/d80211/wpa.c +36 -36

188 lines not on this page · raw message

Signature · 1 line
1.3.0
author
#7 lore raw

PATCH 5/5 d80211: Switch d80211 drivers to IEEE80211_ style definitions

In reply to Jiri Benc

This patch makes the d80211 drivers work with the switch to IEEE80211_ style names in d80211.h. Based on the patch by Michael Wu <[email protected]>.

---

 drivers/net/wireless/d80211/adm8211/adm8211.c      |   10 +++++-----
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c |   12 ++++++------
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c |   15 +++++++--------
 drivers/net/wireless/d80211/rt2x00/rt2400pci.c     |   12 ++++++------
 drivers/net/wireless/d80211/rt2x00/rt2500pci.c     |   12 ++++++------
 drivers/net/wireless/d80211/rt2x00/rt2500usb.c     |   12 ++++++------
 drivers/net/wireless/d80211/rt2x00/rt61pci.c       |   10 +++++-----
 drivers/net/wireless/d80211/rt2x00/rt73usb.c       |   10 +++++-----
 8 files changed, 46 insertions(+), 47 deletions(-)

d2273a999331dce2e2bf6719e9fbc70ed252ea25

drivers/net/wireless/d80211/adm8211/adm8211.c +5 -5
index 0a762d7..748eb26 100644
@@ -1825,7 +1825,7 @@ static int adm8211_tx(struct net_device 
 
 	memcpy(&hdr, skb->data, sizeof(hdr));
 
-	fc = le16_to_cpu(hdr.frame_control) & ~WLAN_FC_ISWEP;
+	fc = le16_to_cpu(hdr.frame_control) & ~IEEE80211_FCTL_PROTECTED;
 	hdrlen = ieee80211_get_hdrlen(fc);
 	skb_pull(skb, hdrlen);
 	payload_len = skb->len;
@@ -1847,7 +1847,7 @@ static int adm8211_tx(struct net_device 
 	txhdr->frame_control = hdr.frame_control;
 
 	len = hdrlen + payload_len + FCS_LEN;
-	if (fc & WLAN_FC_ISWEP)
+	if (fc & IEEE80211_FCTL_PROTECTED)
 		len += 8;
 
 	txhdr->frag = cpu_to_le16(0x0FFF);
@@ -1866,7 +1866,7 @@ static int adm8211_tx(struct net_device 
 	if (control->use_rts_cts)
 		txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_RTS);
 
-	if (fc & WLAN_FC_ISWEP)
+	if (fc & IEEE80211_FCTL_PROTECTED)
 		txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_WEP_ENGINE);
 
 	txhdr->retry_limit = control->retry_limit;
@@ -2082,8 +2082,8 @@ #endif
 		goto err_free_desc;
 	}
 
-	printk("%s: hwaddr " MACSTR ", Rev 0x%02x\n",
-	       dev->name, MAC2STR(dev->dev_addr), priv->revid);
+	printk("%s: hwaddr " MAC_FMT ", Rev 0x%02x\n",
+	       dev->name, MAC_ARG(dev->dev_addr), priv->revid);
 
 	return 0;
 
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +6 -6
index 337544e..59d137b 100644
@@ -1682,8 +1682,8 @@ static u8 * bcm43xx_generate_probe_resp(
 	*dest_size = dest_pos;
 
 	/* Set the frame control. */
-	dest_data[0] = ((WLAN_FC_TYPE_MGMT << 2) |
-			(WLAN_FC_STYPE_PROBE_RESP << 4));
+	dest_data[0] = (IEEE80211_FTYPE_MGMT |
+			IEEE80211_STYPE_PROBE_RESP);
 	dest_data[1] = 0;
 
 	/* Set the duration field.
@@ -4270,9 +4270,9 @@ static int bcm43xx_add_interface(struct 
 
 	dprintk(KERN_INFO PFX "Virtual interface added "
 			      "(type: 0x%08X, ID: %d, MAC: "
-			      MACSTR ")\n",
+			      MAC_FMT ")\n",
 		conf->type, conf->if_id,
-		MAC2STR((u8 *)conf->mac_addr));
+		MAC_ARG(conf->mac_addr));
 
 out_unlock:
 	spin_unlock_irqrestore(&bcm->irq_lock, flags);
@@ -4301,9 +4301,9 @@ static void bcm43xx_remove_interface(str
 
 	dprintk(KERN_INFO PFX "Virtual interface removed "
 			      "(type: 0x%08X, ID: %d, MAC: "
-			      MACSTR ")\n",
+			      MAC_FMT ")\n",
 		conf->type, conf->if_id,
-		MAC2STR((u8 *)conf->mac_addr));
+		MAC_ARG(conf->mac_addr));
 }
 
 static int bcm43xx_config_interface(struct net_device *net_dev,
drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c +7 -8
index 6ebe9fa..3f86079 100644
@@ -180,12 +180,12 @@ __le16 bcm43xx_calc_duration_id(const st
 	const u16 frame_ctl = le16_to_cpu(wireless_header->frame_control);
 	__le16 duration_id = wireless_header->duration_id;
 
-	switch (WLAN_FC_GET_TYPE(frame_ctl)) {
-	case WLAN_FC_TYPE_DATA:
-	case WLAN_FC_TYPE_MGMT:
+	switch (frame_ctl & IEEE80211_FCTL_FTYPE) {
+	case IEEE80211_FTYPE_DATA:
+	case IEEE80211_FTYPE_MGMT:
 		//TODO: Steal the code from ieee80211, once it is completed there.
 		break;
-	case WLAN_FC_TYPE_CTRL:
+	case IEEE80211_FTYPE_CTL:
 		/* Use the original duration/id. */
 		break;
 	default:
@@ -226,8 +226,7 @@ static void bcm43xx_generate_rts(const s
 				  flen, bitrate);
 	bcm43xx_generate_plcp_hdr((struct bcm43xx_plcp_hdr4 *)(&txhdr->rts_cts_fallback_plcp),
 				  flen, fallback_bitrate);
-	fctl = WLAN_FC_TYPE_CTRL << 2;
-	fctl |= WLAN_FC_STYPE_RTS << 4;
+	fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS;
 	dur = le16_to_cpu(wlhdr->duration_id);
 /*FIXME: should we test for dur==0 here and let it unmodified in this case?
  *       The following assert checks for this case...
@@ -259,8 +258,8 @@ assert(dur);
 
 	txhdr->rts_cts_frame_control = cpu_to_le16(fctl);
 	txhdr->rts_cts_dur = cpu_to_le16(dur);
-//printk(MACSTR "  " MACSTR "  " MACSTR "\n", MAC2STR(wlhdr->addr1), MAC2STR(wlhdr->addr2), MAC2STR(wlhdr->addr3));
-//printk(MACSTR "  " MACSTR "\n", MAC2STR(sa), MAC2STR(da));
+//printk(MAC_FMT "  " MAC_FMT "  " MAC_FMT "\n", MAC_ARG(wlhdr->addr1), MAC_ARG(wlhdr->addr2), MAC_ARG(wlhdr->addr3));
+//printk(MAC_FMT "  " MAC_FMT "\n", MAC_ARG(sa), MAC_ARG(da));
 	memcpy(txhdr->rts_cts_mac1, wlhdr->addr1, ETH_ALEN);//FIXME!
 	memcpy(txhdr->rts_cts_mac2, sa, ETH_ALEN);
 
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +6 -6
index 4a74d2a..709cdbf 100644
@@ -1532,7 +1532,7 @@ static struct sk_buff* rt2400pci_create_
 	memcpy(skb_put(skb, IEEE80211_HEADER), hdr, IEEE80211_HEADER);
 	ieee80211hdr = (struct ieee80211_hdr*)skb->data;
 
-	frame_control = (WLAN_FC_TYPE_CTRL  << 2) | (WLAN_FC_STYPE_RTS << 4);
+	frame_control = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS;
 	ieee80211hdr->frame_control = cpu_to_le16(frame_control);
 
 	ieee80211hdr->duration_id += cpu_to_le16(duration);
@@ -1564,7 +1564,7 @@ static void rt2400pci_write_tx_desc(stru
 	 * Check which rate should be used for this frame.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS &&
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS &&
 	    control->rts_cts_rate)
 		tx_rate = control->rts_cts_rate;
 	else
@@ -1577,7 +1577,7 @@ static void rt2400pci_write_tx_desc(stru
 	 * Set IFS to IFS_SIFS when the this is not the first fragment,
 	 * or this fragment came after RTS/CTS.
 	 */
-	if ((WLAN_GET_SEQ_FRAG(le16_to_cpu(ieee80211hdr->seq_ctrl)) > 0) ||
+	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
 	    control->use_rts_cts)
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
@@ -1598,7 +1598,7 @@ static void rt2400pci_write_tx_desc(stru
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_MORE_FRAG, 0);
 
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS)
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)
 		rt2x00_set_field32(&txd->word0, TXD_W0_RTS, 1);
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_RTS, 0);
@@ -1922,7 +1922,7 @@ static int rt2400pci_tx(struct net_devic
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
 	if (control->use_rts_cts &&
-	    WLAN_FC_GET_STYPE(frame_control) != WLAN_FC_STYPE_RTS) {
+	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt2400pci_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
 		if (!skb_rts) {
@@ -1957,7 +1957,7 @@ static int rt2400pci_tx(struct net_devic
 	memcpy(rt2x00pci_data_addr(entry), skb->data, skb->len);
 	rt2400pci_write_tx_desc(rt2x00dev, txd, skb, control);
 	memcpy(&entry->tx_status.control, control, sizeof(*control));
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS)
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)
 		SET_FLAG(entry, ENTRY_RTS_FRAME);
 	entry->skb = skb;
 
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +6 -6
index a2e41a3..8a22968 100644
@@ -1652,7 +1652,7 @@ static struct sk_buff* rt2500pci_create_
 	memcpy(skb_put(skb, IEEE80211_HEADER), hdr, IEEE80211_HEADER);
 	ieee80211hdr = (struct ieee80211_hdr*)skb->data;
 
-	frame_control = (WLAN_FC_TYPE_CTRL  << 2) | (WLAN_FC_STYPE_RTS << 4);
+	frame_control = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS;
 	ieee80211hdr->frame_control = cpu_to_le16(frame_control);
 
 	ieee80211hdr->duration_id += cpu_to_le16(duration);
@@ -1685,7 +1685,7 @@ static void rt2500pci_write_tx_desc(stru
 	 * Check which rate should be used for this frame.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS &&
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS &&
 	    control->rts_cts_rate)
 		tx_rate = control->rts_cts_rate;
 	else
@@ -1707,7 +1707,7 @@ static void rt2500pci_write_tx_desc(stru
 	 * Set IFS to IFS_SIFS when the this is not the first fragment,
 	 * or this fragment came after RTS/CTS.
 	 */
-	if ((WLAN_GET_SEQ_FRAG(le16_to_cpu(ieee80211hdr->seq_ctrl)) > 0) ||
+	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
 	    control->use_rts_cts)
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
@@ -1723,7 +1723,7 @@ static void rt2500pci_write_tx_desc(stru
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_MORE_FRAG, 0);
 
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS)
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)
 		rt2x00_set_field32(&txd->word10, TXD_W10_RTS, 1);
 	else
 		rt2x00_set_field32(&txd->word10, TXD_W10_RTS, 0);
@@ -2069,7 +2069,7 @@ static int rt2500pci_tx(struct net_devic
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
 	if (control->use_rts_cts &&
-	    WLAN_FC_GET_STYPE(frame_control) != WLAN_FC_STYPE_RTS) {
+	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt2500pci_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
 		if (!skb_rts) {
@@ -2104,7 +2104,7 @@ static int rt2500pci_tx(struct net_devic
 	memcpy(rt2x00pci_data_addr(entry), skb->data, skb->len);
 	rt2500pci_write_tx_desc(rt2x00dev, txd, skb, control);
 	memcpy(&entry->tx_status.control, control, sizeof(*control));
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS)
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)
 		SET_FLAG(entry, ENTRY_RTS_FRAME);
 	entry->skb = skb;
 
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +6 -6
index ff84d0e..d15a33e 100644
@@ -1414,7 +1414,7 @@ static struct sk_buff* rt2500usb_create_
 	memcpy(skb_put(skb, IEEE80211_HEADER), hdr, IEEE80211_HEADER);
 	ieee80211hdr = (struct ieee80211_hdr*)skb->data;
 
-	frame_control = (WLAN_FC_TYPE_CTRL  << 2) | (WLAN_FC_STYPE_RTS << 4);
+	frame_control = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS;
 	ieee80211hdr->frame_control = cpu_to_le16(frame_control);
 
 	ieee80211hdr->duration_id += cpu_to_le16(duration);
@@ -1447,7 +1447,7 @@ static void rt2500usb_write_tx_desc(stru
 	 * Check which rate should be used for this frame.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS &&
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS &&
 	    control->rts_cts_rate)
 		tx_rate = control->rts_cts_rate;
 	else
@@ -1468,7 +1468,7 @@ static void rt2500usb_write_tx_desc(stru
 	 * Set IFS to IFS_SIFS when the this is not the first fragment,
 	 * or this fragment came after RTS/CTS.
 	 */
-	if ((WLAN_GET_SEQ_FRAG(le16_to_cpu(ieee80211hdr->seq_ctrl)) > 0) ||
+	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
 	    control->use_rts_cts)
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
@@ -1482,7 +1482,7 @@ static void rt2500usb_write_tx_desc(stru
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_MORE_FRAG, 0);
 
-	if (WLAN_GET_SEQ_FRAG(ieee80211hdr->seq_ctrl) == 0)
+	if ((ieee80211hdr->seq_ctrl & IEEE80211_SCTL_FRAG) == 0)
 		rt2x00_set_field32(&txd->word0, TXD_W0_NEW_SEQ, 1);
 	else
 		rt2x00_set_field32(&txd->word0, TXD_W0_NEW_SEQ, 0);
@@ -1788,7 +1788,7 @@ static int rt2500usb_tx(struct net_devic
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
 	if (control->use_rts_cts &&
-	    WLAN_FC_GET_STYPE(frame_control) != WLAN_FC_STYPE_RTS) {
+	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt2500usb_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
 		if (!skb_rts) {
@@ -1817,7 +1817,7 @@ static int rt2500usb_tx(struct net_devic
 	memcpy(rt2x00usb_txdata_addr(entry), skb->data, skb->len);
 	rt2500usb_write_tx_desc(rt2x00dev, txd, skb, control);
 	memcpy(&entry->tx_status.control, control, sizeof(*control));
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS)
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)
 		SET_FLAG(entry, ENTRY_RTS_FRAME);
 	entry->skb = skb;
 
drivers/net/wireless/d80211/rt2x00/rt61pci.c +5 -5
index 3233658..8bb9de9 100644
@@ -2085,7 +2085,7 @@ static struct sk_buff* rt61pci_create_rt
 	memcpy(skb_put(skb, IEEE80211_HEADER), hdr, IEEE80211_HEADER);
 	ieee80211hdr = (struct ieee80211_hdr*)skb->data;
 
-	frame_control = (WLAN_FC_TYPE_CTRL  << 2) | (WLAN_FC_STYPE_RTS << 4);
+	frame_control = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS;
 	ieee80211hdr->frame_control = cpu_to_le16(frame_control);
 
 	ieee80211hdr->duration_id += cpu_to_le16(duration);
@@ -2118,7 +2118,7 @@ static void rt61pci_write_tx_desc(struct
 	 * Check which rate should be used for this frame.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS &&
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS &&
 	    control->rts_cts_rate)
 		tx_rate = control->rts_cts_rate;
 	else
@@ -2140,7 +2140,7 @@ static void rt61pci_write_tx_desc(struct
 	 * Set IFS to IFS_SIFS when the this is not the first fragment,
 	 * or this fragment came after RTS/CTS.
 	 */
-	if ((WLAN_GET_SEQ_FRAG(le16_to_cpu(ieee80211hdr->seq_ctrl)) > 0) ||
+	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
 	    control->use_rts_cts)
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
@@ -2548,7 +2548,7 @@ static int rt61pci_tx(struct net_device 
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
 	if (control->use_rts_cts &&
-	    WLAN_FC_GET_STYPE(frame_control) != WLAN_FC_STYPE_RTS) {
+	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt61pci_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
 		if (!skb_rts) {
@@ -2578,7 +2578,7 @@ static int rt61pci_tx(struct net_device 
 	memcpy(rt2x00pci_data_addr(entry), skb->data, skb->len);
 	rt61pci_write_tx_desc(rt2x00dev, txd, skb, control);
 	memcpy(&entry->tx_status.control, control, sizeof(*control));
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS)
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)
 		SET_FLAG(entry, ENTRY_RTS_FRAME);
 	entry->skb = skb;
 
drivers/net/wireless/d80211/rt2x00/rt73usb.c +5 -5
index 1106a20..acc5357 100644
@@ -1681,7 +1681,7 @@ static struct sk_buff* rt73usb_create_rt
 	memcpy(skb_put(skb, IEEE80211_HEADER), hdr, IEEE80211_HEADER);
 	ieee80211hdr = (struct ieee80211_hdr*)skb->data;
 
-	frame_control = (WLAN_FC_TYPE_CTRL  << 2) | (WLAN_FC_STYPE_RTS << 4);
+	frame_control = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS;
 	ieee80211hdr->frame_control = cpu_to_le16(frame_control);
 
 	ieee80211hdr->duration_id += cpu_to_le16(duration);
@@ -1714,7 +1714,7 @@ static void rt73usb_write_tx_desc(struct
 	 * Check which rate should be used for this frame.
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS &&
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS &&
 	    control->rts_cts_rate)
 		tx_rate = control->rts_cts_rate;
 	else
@@ -1736,7 +1736,7 @@ static void rt73usb_write_tx_desc(struct
 	 * Set IFS to IFS_SIFS when the this is not the first fragment,
 	 * or this fragment came after RTS/CTS.
 	 */
-	if ((WLAN_GET_SEQ_FRAG(le16_to_cpu(ieee80211hdr->seq_ctrl)) > 0) ||
+	if (((le16_to_cpu(ieee80211hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) > 0) ||
 	    control->use_rts_cts)
 		rt2x00_set_field32(&txd->word0, TXD_W0_IFS, IFS_SIFS);
 	else
@@ -2072,7 +2072,7 @@ static int rt73usb_tx(struct net_device 
 	 */
 	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
 	if (control->use_rts_cts &&
-	    WLAN_FC_GET_STYPE(frame_control) != WLAN_FC_STYPE_RTS) {
+	    (frame_control & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_RTS) {
 		skb_rts = rt73usb_create_rts(rt2x00dev,
 				ieee80211hdr, control->rts_cts_duration);
 		if (!skb_rts) {
@@ -2101,7 +2101,7 @@ static int rt73usb_tx(struct net_device 
 	memcpy(rt2x00usb_txdata_addr(entry), skb->data, skb->len);
 	rt73usb_write_tx_desc(rt2x00dev, txd, skb, control);
 	memcpy(&entry->tx_status.control, control, sizeof(*control));
-	if (WLAN_FC_GET_STYPE(frame_control) == WLAN_FC_STYPE_RTS)
+	if ((frame_control & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)
 		SET_FLAG(entry, ENTRY_RTS_FRAME);
 	entry->skb = skb;
 
Signature · 1 line
1.3.0
#8 lore raw
In reply to Jiri Benc
Quoted 9 lines · Jiri Benc

Please pull from
git://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git up to obtain following patches:

Jiri Benc:

      d80211: make sleeping in hw->config possible
      d80211: return correct error codes for scan requests
      d80211: Switch d80211 drivers to IEEE80211_ style definitions
Quoted 5 lines

Karol Lewandowski:
d80211: return correct value when loading of rate control module fails

Michael Wu:

      d80211: Switch d80211 to IEEE80211_ style names

Pulled and available in wireless-dev. No fancy announcment, since all I did was pull Jiri's stuff.

John

Signature · 2 lines
John W. Linville
[email protected]
#5 lore raw

Re: [PATCH 4/5] d80211: Switch d80211 to IEEE80211_ style names

In reply to Jiri Benc
Quoted 3 lines · Jiri Benc

From: Michael Wu <[email protected]>
This patch switches the WLAN_ definitions in d80211.h to IEEE80211_ style definitions found in ieee80211.h. It also switches to MAC_ARG and MAC_FMT.

This kind of change is more than just search-and-replace since frame type and subtype macros were using different style (not shifted left in WLAN_FC_{TYPE,STYPE}_* and shifted left in IEEE80211_{FTYPE,STYPE}_*. Some of these seemed to be caught in the patch, but not all. At least the following changes look incorrect. I'm not sure whether this is a complete list of issues, though, so going through all IEEE80211_STYPE_* and IEEE80211_FTYPE_* cases again could be a worthwhile exercise.

ieee80211.c:
- if (WLAN_FC_GET_STYPE(fc) & 0x08)
+ if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_QOS_DATA)
(this is supposed to catch all QoS frames, not just QoS data subtype)

ieee80211.c:
- fc |= WLAN_FC_STYPE_QOS_DATA << 4;
+ fc |= IEEE80211_STYPE_QOS_DATA << 4;

ieee80211.c:
- fc &= ~(WLAN_FC_STYPE_QOS_DATA << 4);
+ fc &= ~(IEEE80211_STYPE_QOS_DATA << 4);

wme.c:
- qos = fc & (WLAN_FC_STYPE_QOS_DATA << 4);
+ qos = fc & (IEEE80211_STYPE_QOS_DATA << 4);

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#6 lore raw

Re: [PATCH 4/5] d80211: Switch d80211 to IEEE80211_ style names

Quoted 9 lines · Jouni Malinen

On Tue, Aug 01, 2006 at 09:16:59PM +0200, Jiri Benc wrote:
This kind of change is more than just search-and-replace since frame type and subtype macros were using different style (not shifted left in WLAN_FC_{TYPE,STYPE}_* and shifted left in IEEE80211_{FTYPE,STYPE}_*. Some of these seemed to be caught in the patch, but not all. At least the following changes look incorrect. I'm not sure whether this is a complete list of issues, though, so going through all IEEE80211_STYPE_* and IEEE80211_FTYPE_* cases again could be a worthwhile exercise.

Thanks for the heads up. I tried to make sure everything using IEEE80211_[FS]TYPE_* was correct, but I'm not very familiar with the QoS stuff, so those got through. I'll patch up the QoS problems tonight and look through any other problem areas.

-Michael Wu