netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/21] d80211: pull request
@ 2006-08-23 19:24 Jiri Benc
  2006-08-23 19:24 ` [PATCH 1/21] d80211: relax sysfs permissions Jiri Benc
                   ` (21 more replies)
  0 siblings, 22 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

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

David Kimdon:
      d80211: allow for large scan results
      d80211: fix multiple device support
      d80211: fix interface removal

Jiri Benc:
      d80211: remove useless and wrong check for interface type

Johannes Berg:
      d80211: relax sysfs permissions
      d80211: master link
      d80211: pointers as extended booleans
      d80211: use kzalloc()
      d80211: get rid of WME bitfield
      d80211: get rid of sta_aid in favour of keeping track of TIM
      d80211: clean up exports
      d80211: clean up includes
      d80211: fix some sparse warnings
      d80211: make lowlevel TX framedump option visible
      d80211: surface IBSS debug
      d80211: get rid of MICHAEL_MIC_HWACCEL define
      d80211: surface powersave debug switch
      d80211: fix some documentation

Michael Buesch:
      d80211: add ieee80211_stop_queues()

Michael Wu:
      d80211: switch status codes, reason codes, and EIDs to enums
      d80211: Group EIDs by standard, add remaining 802.11d EIDs

 include/net/d80211.h         |  144 ++++++++++++----------
 include/net/d80211_mgmt.h    |  158 ++++++++++++++----------
 net/d80211/Kconfig           |   26 ++++
 net/d80211/aes_ccm.c         |    3 
 net/d80211/aes_ccm.h         |    2 
 net/d80211/fifo_qdisc.c      |    5 -
 net/d80211/ieee80211.c       |  276 +++++++++++++++++++++---------------------
 net/d80211/ieee80211_i.h     |   68 ++++++----
 net/d80211/ieee80211_iface.c |    8 +
 net/d80211/ieee80211_ioctl.c |   79 ++++++------
 net/d80211/ieee80211_key.h   |    7 +
 net/d80211/ieee80211_scan.c  |   12 +-
 net/d80211/ieee80211_sta.c   |  113 ++++++++---------
 net/d80211/ieee80211_sysfs.c |    6 -
 net/d80211/rate_control.c    |   18 +--
 net/d80211/rate_control.h    |    2 
 net/d80211/sta_info.c        |   31 ++---
 net/d80211/sta_info.h        |   14 +-
 net/d80211/tkip.c            |   15 --
 net/d80211/tkip.h            |    1 
 net/d80211/wep.c             |   14 +-
 net/d80211/wme.c             |   24 ++--
 net/d80211/wme.h             |   25 ----
 net/d80211/wpa.c             |   17 ---
 24 files changed, 537 insertions(+), 531 deletions(-)


-- 
Jiri Benc
SUSE Labs

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

* [PATCH 1/21] d80211: relax sysfs permissions
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 2/21] d80211: master link Jiri Benc
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

The sysfs attributes add_iface and remove_iface both check for
CAP_NET_ADMIN whenever something is written. Hence, permissions for the
files should be relaxed so that someone who is not root but happens to
have CAP_NET_ADMIN can do things.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

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

b8fa453a5bff1710a6e170e9d50fa337bee5ebdf
diff --git a/net/d80211/ieee80211_sysfs.c b/net/d80211/ieee80211_sysfs.c
index 9974668..6725ff7 100644
--- a/net/d80211/ieee80211_sysfs.c
+++ b/net/d80211/ieee80211_sysfs.c
@@ -195,8 +195,8 @@ static ssize_t ieee80211_local_fmt_rate_
 __IEEE80211_LOCAL_SHOW(rate_ctrl_alg);
 
 static struct class_device_attribute ieee80211_class_dev_attrs[] = {
-	__ATTR(add_iface, S_IWUSR, NULL, store_add_iface),
-	__ATTR(remove_iface, S_IWUSR, NULL, store_remove_iface),
+	__ATTR(add_iface, S_IWUGO, NULL, store_add_iface),
+	__ATTR(remove_iface, S_IWUGO, NULL, store_remove_iface),
 	__ATTR(channel, S_IRUGO, ieee80211_local_show_channel, NULL),
 	__ATTR(frequency, S_IRUGO, ieee80211_local_show_frequency, NULL),
 	__ATTR(radar_detect, S_IRUGO, ieee80211_local_show_radar_detect, NULL),
-- 
1.3.0


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

* [PATCH 2/21] d80211: master link
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
  2006-08-23 19:24 ` [PATCH 1/21] d80211: relax sysfs permissions Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 3/21] d80211: pointers as extended booleans Jiri Benc
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch adds a link from the wiphy to the master device in sysfs.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

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

a648a95b7eb82496b6a2148105228cbc1724e2f1
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 11804d5..0b3c886 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4462,6 +4462,11 @@ int ieee80211_register_hw(struct net_dev
 		rtnl_unlock();
 		goto fail_dev;
 	}
+	result = sysfs_create_link(&local->class_dev.kobj,
+				   &dev->class_dev.kobj,
+				   "master");
+	if (result < 0)
+		goto fail_masterlink;
 	result = ieee80211_sysfs_add_netdevice(dev);
 	rtnl_unlock();
 	if (result < 0)
@@ -4507,6 +4512,8 @@ fail_rate_attrs:
 fail_rate:
 	ieee80211_sysfs_remove_netdevice(dev);
 fail_if_sysfs:
+	sysfs_remove_link(&local->class_dev.kobj, "master");
+fail_masterlink:
 	unregister_netdev(dev);
 fail_dev:
 	sta_info_stop(local);
@@ -4563,6 +4570,8 @@ void ieee80211_unregister_hw(struct net_
 	if (local->apdev)
 		ieee80211_if_del_mgmt(local->apdev);
 
+	sysfs_remove_link(&local->class_dev.kobj, "master");
+
 	list_for_each_safe(ptr, n, &local->sub_if_list) {
 		struct ieee80211_sub_if_data *sdata =
 			list_entry(ptr, struct ieee80211_sub_if_data, list);
-- 
1.3.0


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

* [PATCH 3/21] d80211: pointers as extended booleans
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
  2006-08-23 19:24 ` [PATCH 1/21] d80211: relax sysfs permissions Jiri Benc
  2006-08-23 19:24 ` [PATCH 2/21] d80211: master link Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 4/21] d80211: use kzalloc() Jiri Benc
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This huge patch changes d80211 to treat pointers as "extended booleans",
using "if (!ptr)" and "if (ptr)" instead of comparisons with NULL.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/aes_ccm.c         |    2 +
 net/d80211/ieee80211.c       |   60 ++++++++++++++++-------------------
 net/d80211/ieee80211_iface.c |    6 ++--
 net/d80211/ieee80211_ioctl.c |   48 ++++++++++++++--------------
 net/d80211/ieee80211_scan.c  |   10 +++---
 net/d80211/ieee80211_sta.c   |   72 ++++++++++++++++++++----------------------
 net/d80211/rate_control.c    |    8 ++---
 net/d80211/rate_control.h    |    2 +
 net/d80211/sta_info.c        |   13 ++++----
 net/d80211/wep.c             |   12 ++++---
 net/d80211/wme.c             |    4 +-
 net/d80211/wpa.c             |    2 +
 12 files changed, 116 insertions(+), 123 deletions(-)

3ee6077477530a8082c8eb62de350c30f703e2a2
diff --git a/net/d80211/aes_ccm.c b/net/d80211/aes_ccm.c
index 742ca99..8d1045c 100644
--- a/net/d80211/aes_ccm.c
+++ b/net/d80211/aes_ccm.c
@@ -149,7 +149,7 @@ struct crypto_tfm * ieee80211_aes_key_se
 	struct crypto_tfm *tfm;
 
 	tfm = crypto_alloc_tfm("aes", 0);
-	if (tfm == NULL)
+	if (!tfm)
 		return NULL;
 
 	crypto_cipher_setkey(tfm, key, ALG_CCMP_KEY_LEN);
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 0b3c886..ac0b706 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -68,7 +68,7 @@ ieee80211_key_data2conf(struct ieee80211
 	struct ieee80211_key_conf *conf;
 
 	conf = kmalloc(sizeof(*conf) + data->keylen, GFP_ATOMIC);
-	if (conf == NULL)
+	if (!conf)
 		return NULL;
 
 	conf->hw_key_idx = data->hw_key_idx;
@@ -125,7 +125,7 @@ static int rate_list_match(int *rate_lis
 {
 	int i;
 
-	if (rate_list == NULL)
+	if (!rate_list)
 		return 0;
 
 	for (i = 0; rate_list[i] >= 0; i++)
@@ -222,7 +222,7 @@ static void ieee80211_key_threshold_noti
 
 	skb = dev_alloc_skb(sizeof(struct ieee80211_frame_info) +
 			    sizeof(struct ieee80211_msg_key_notification));
-	if (skb == NULL)
+	if (!skb)
 		return;
 
 	skb_reserve(skb, sizeof(struct ieee80211_frame_info));
@@ -456,7 +456,7 @@ ieee80211_tx_h_fragment(struct ieee80211
 
 	frags = (struct sk_buff **)
 		kmalloc(num_fragm * sizeof(struct sk_buff *), GFP_ATOMIC);
-	if (frags == NULL)
+	if (!frags)
 		goto fail;
 	memset(frags, 0, num_fragm * sizeof(struct sk_buff *));
 
@@ -1105,8 +1105,8 @@ __ieee80211_tx_prepare(struct ieee80211_
 	tx->fragmented = local->fragmentation_threshold <
 		IEEE80211_MAX_FRAG_THRESHOLD && tx->u.tx.unicast &&
 		skb->len + 4 /* FCS */ > local->fragmentation_threshold &&
-		(local->hw->set_frag_threshold == NULL);
-	if (tx->sta == NULL)
+		(!local->hw->set_frag_threshold);
+	if (!tx->sta)
 		control->clear_dst_mask = 1;
 	else if (tx->sta->clear_dst_mask) {
 		control->clear_dst_mask = 1;
@@ -1776,8 +1776,8 @@ struct sk_buff * ieee80211_beacon_get(st
 		dev_put(bdev);
 	}
 
-	if (ap == NULL || sdata->type != IEEE80211_IF_TYPE_AP ||
-	    ap->beacon_head == NULL) {
+	if (!ap || sdata->type != IEEE80211_IF_TYPE_AP ||
+	    !ap->beacon_head) {
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
 		if (net_ratelimit())
 			printk(KERN_DEBUG "no beacon data avail for idx=%d "
@@ -1809,7 +1809,7 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 		extra.endidx = local->num_curr_rates;
 
 		rate = rate_control_get_rate(dev, skb, &extra);
-		if (rate == NULL) {
+		if (!rate) {
 			if (net_ratelimit()) {
 				printk(KERN_DEBUG "%s: ieee80211_beacon_get: no rate "
 				       "found\n", dev->name);
@@ -1854,15 +1854,14 @@ ieee80211_get_buffered_bc(struct net_dev
 		bss = &sdata->u.ap;
 		dev_put(bdev);
 	}
-	if (bss == NULL || sdata->type != IEEE80211_IF_TYPE_AP ||
-	    bss->beacon_head == NULL)
+	if (!bss || sdata->type != IEEE80211_IF_TYPE_AP || !bss->beacon_head)
 		return NULL;
 
 	if (bss->dtim_count != 0)
 		return NULL; /* send buffered bc/mc only after DTIM beacon */
 	skb = skb_dequeue(&bss->ps_bc_buf);
 	memset(control, 0, sizeof(*control));
-	if (skb == NULL)
+	if (!skb)
 		return NULL;
 	local->total_ps_buffered--;
 
@@ -2474,13 +2473,13 @@ ieee80211_rx_h_data(struct ieee80211_txr
 			/* send multicast frames both to higher layers in
 			 * local net stack and back to the wireless media */
 			skb2 = skb_copy(skb, GFP_ATOMIC);
-			if (skb2 == NULL)
+			if (!skb2)
 				printk(KERN_DEBUG "%s: failed to clone "
 				       "multicast frame\n", dev->name);
 		} else {
 			struct sta_info *dsta;
                         dsta = sta_info_get(local, skb->data);
-                        if (dsta && dsta->dev == NULL) {
+			if (dsta && !dsta->dev) {
                                 printk(KERN_DEBUG "Station with null dev "
 				       "structure!\n");
                         } else if (dsta && dsta->dev == dev) {
@@ -2648,7 +2647,7 @@ int ieee80211_radar_status(struct net_de
 	skb = dev_alloc_skb(sizeof(struct ieee80211_frame_info) +
 			    sizeof(struct ieee80211_radar_info));
 
-	if (skb == NULL)
+	if (!skb)
 		return -ENOMEM;
 	skb_reserve(skb, sizeof(struct ieee80211_frame_info));
 
@@ -2672,7 +2671,7 @@ int ieee80211_set_aid_for_sta(struct net
 	skb = dev_alloc_skb(sizeof(struct ieee80211_frame_info) +
 			    sizeof(struct ieee80211_msg_set_aid_for_sta));
 
-        if (skb == NULL)
+	if (!skb)
 		return -ENOMEM;
 	skb_reserve(skb, sizeof(struct ieee80211_frame_info));
 
@@ -2758,7 +2757,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_
 		return TXRX_CONTINUE;
 
 	skb = skb_dequeue(&rx->sta->tx_filtered);
-	if (skb == NULL) {
+	if (!skb) {
 		skb = skb_dequeue(&rx->sta->ps_tx_buf);
 		if (skb)
 			rx->local->total_ps_buffered--;
@@ -2947,7 +2946,7 @@ ieee80211_rx_h_defragment(struct ieee802
 	if (entry->ccmp) {
 		int i;
 		u8 pn[CCMP_PN_LEN], *rpn;
-		if (rx->key == NULL || rx->key->alg != ALG_CCMP)
+		if (!rx->key || rx->key->alg != ALG_CCMP)
 			return TXRX_DROP;
 		memcpy(pn, entry->last_pn, CCMP_PN_LEN);
 		for (i = CCMP_PN_LEN - 1; i >= 0; i--) {
@@ -3105,10 +3104,9 @@ ieee80211_rx_h_check(struct ieee80211_tx
 			int keyidx = ieee80211_wep_get_keyidx(rx->skb);
 
 			if (keyidx >= 0 && keyidx < NUM_DEFAULT_KEYS &&
-			    (rx->sta == NULL || rx->sta->key == NULL ||
-			     keyidx > 0)) {
+			    (!rx->sta || !rx->sta->key || keyidx > 0))
 				rx->key = rx->sdata->keys[keyidx];
-			}
+
 			if (!rx->key) {
 				if (!rx->u.rx.ra_match)
 					return TXRX_DROP;
@@ -3439,7 +3437,7 @@ static void ieee80211_rx_michael_mic_rep
 	       "failure from " MAC_FMT " to " MAC_FMT " keyidx=%d\n",
 	       dev->name, MAC_ARG(hdr->addr2), MAC_ARG(hdr->addr1), keyidx);
 
-	if (sta == NULL) {
+	if (!sta) {
 		/* Some hardware versions seem to generate incorrect
 		 * Michael MIC reports; ignore them to avoid triggering
 		 * countermeasures. */
@@ -3484,7 +3482,7 @@ static void ieee80211_rx_michael_mic_rep
 	do {
 		union iwreq_data wrqu;
 		char *buf = kmalloc(128, GFP_ATOMIC);
-		if (buf == NULL)
+		if (!buf)
 			break;
 
 		/* TODO: needed parameters: count, key type, TSC */
@@ -3639,12 +3637,11 @@ void __ieee80211_rx(struct net_device *d
 					if (!sdata->promisc)
 						continue;
 					rx.u.rx.ra_match = 0;
-				} else if (sta == NULL) {
+				} else if (!sta)
 					sta = rx.sta =
 						ieee80211_ibss_add_sta(dev, skb, bssid,
 								       hdr->addr2);
 						/* FIXME: call with sdata->dev */
-				}
 				break;
 			case IEEE80211_IF_TYPE_AP:
 				if (!bssid) {
@@ -3675,12 +3672,11 @@ void __ieee80211_rx(struct net_device *d
 
 			if (prev) {
 				skb_new = skb_copy(skb, GFP_ATOMIC);
-				if (skb_new == NULL) {
-					if (net_ratelimit()) {
+				if (!skb_new) {
+					if (net_ratelimit())
 						printk(KERN_DEBUG "%s: failed to copy "
 						       "multicast frame for %s",
 						       dev->name, prev->dev->name);
-					}
 					continue;
 				}
 				rx.skb = skb_new;
@@ -3979,7 +3975,7 @@ static void ieee80211_remove_tx_extra(st
 
 	hdrlen = ieee80211_get_hdrlen_from_skb(skb);
 
-	if (key == NULL)
+	if (!key)
 		goto no_key;
 
 	switch (key->alg) {
@@ -4335,7 +4331,7 @@ struct net_device *ieee80211_alloc_hw(si
 		      NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST) +
 		    priv_data_len;
 	mdev = alloc_netdev(priv_size, "wmaster%d", ether_setup);
-	if (mdev == NULL) {
+	if (!mdev) {
 		ieee80211_dev_free(local);
 		return NULL;
 	}
@@ -4719,9 +4715,9 @@ int ieee80211_rate_control_register(stru
 	struct rate_control_algs *alg;
 
 	alg = kmalloc(sizeof(*alg), GFP_KERNEL);
-	if (alg == NULL) {
+	if (!alg)
 		return -1;
-	}
+
 	memset(alg, 0, sizeof(*alg));
 	alg->next = ieee80211_rate_ctrl_algs;
 	alg->ops = ops;
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index 12b9d4f..9a9d730 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -49,7 +49,7 @@ int ieee80211_if_add(struct net_device *
 	ASSERT_RTNL();
 	ndev = *new_dev = alloc_netdev(sizeof(struct ieee80211_sub_if_data),
 				       "", ieee80211_if_setup);
-	if (ndev == NULL)
+	if (!ndev)
 		return -ENOMEM;
 
 	ndev->ieee80211_ptr = local;
@@ -58,7 +58,7 @@ int ieee80211_if_add(struct net_device *
 		do {
 			sprintf(ndev->name, "%s.%d", dev->name, i++);
 			tmp_dev = dev_get_by_name(ndev->name);
-			if (tmp_dev == NULL)
+			if (!tmp_dev)
 				break;
 			dev_put(tmp_dev);
 		} while (i < 10000);
@@ -119,7 +119,7 @@ int ieee80211_if_add_mgmt(struct net_dev
 
 	ndev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), "",
 			    ieee80211_if_mgmt_setup);
-	if (ndev == NULL)
+	if (!ndev)
 		return -ENOMEM;
 	ret = dev_alloc_name(ndev, "wmgmt%d");
 	if (ret)
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index b983716..f134f2a 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -172,7 +172,7 @@ static int ieee80211_ioctl_scan(struct n
 {
 	struct ieee80211_local *local = dev->ieee80211_ptr;
 
-	if (local->hw->passive_scan == NULL)
+	if (!local->hw->passive_scan)
 		return -EOPNOTSUPP;
 
 	if ((param->u.scan.now == 1) && (local->scan.in_scan == 1))
@@ -237,7 +237,7 @@ static void ieee80211_send_layer2_update
 	 * bridge devices */
 
 	skb = dev_alloc_skb(sizeof(*msg));
-	if (skb == NULL)
+	if (!skb)
 		return;
 	msg = (struct iapp_layer2_update *) skb_put(skb, sizeof(*msg));
 
@@ -274,9 +274,9 @@ static int ieee80211_ioctl_add_sta(struc
 
 	sta = sta_info_get(local, param->sta_addr);
 
-        if (sta == NULL) {
+	if (!sta) {
 		sta = sta_info_add(local, dev, param->sta_addr);
-		if (sta == NULL)
+		if (!sta)
 			return -ENOMEM;
         }
 
@@ -324,7 +324,7 @@ static int ieee80211_ioctl_add_sta(struc
 	else
 		sta->flags &= ~WLAN_STA_WDS;
 
-	if (add_key_entry && sta->key == NULL && sdata->default_key == NULL &&
+	if (add_key_entry && !sta->key && !sdata->default_key &&
 	    local->hw->set_key) {
 		struct ieee80211_key_conf conf;
 		/* Add key cache entry with NULL key type because this may used
@@ -564,7 +564,7 @@ static int ieee80211_set_encryption(stru
 		}
 
 		sta = sta_info_get(local, sta_addr);
-		if (sta == NULL) {
+		if (!sta) {
 			if (err)
 				*err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR;
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
@@ -672,7 +672,7 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 			 * packet. */
 			key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
 				key->key);
-			if (key->u.ccmp.tfm == NULL) {
+			if (!key->u.ccmp.tfm) {
 				ret = -ENOMEM;
 				goto err_free;
 			}
@@ -703,7 +703,7 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 		}
 	}
 
-	if (set_tx_key || (sta == NULL && sdata->default_key == NULL && key)) {
+	if (set_tx_key || (!sta && !sdata->default_key && key)) {
 		sdata->default_key = key;
 		if (ieee80211_key_sysfs_add_default(sdata))
 			printk(KERN_WARNING "%s: cannot create symlink to "
@@ -819,7 +819,7 @@ static int ieee80211_ioctl_get_encryptio
 			key = &sdata->keys[param->u.crypt.idx];
 	} else {
 		sta = sta_info_get(local, param->sta_addr);
-		if (sta == NULL) {
+		if (!sta) {
 			param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR;
 			return -EINVAL;
 		}
@@ -828,7 +828,7 @@ static int ieee80211_ioctl_get_encryptio
 	}
 
 	memset(param->u.crypt.seq_counter, 0, HOSTAP_SEQ_COUNTER_SIZE);
-	if (*key == NULL) {
+	if (!*key) {
 		memcpy(param->u.crypt.alg, "none", 5);
 		param->u.crypt.key_len = 0;
 		param->u.crypt.idx = 0xff;
@@ -918,7 +918,7 @@ static int ieee80211_ioctl_wpa_trigger(s
 	}
 
 	sta = sta_info_get(local, param->sta_addr);
-	if (sta == NULL) {
+	if (!sta) {
 		printk(KERN_DEBUG "%s: wpa_trigger - unknown addr\n",
 		       dev->name);
 		return -EINVAL;
@@ -1112,7 +1112,7 @@ static int ieee80211_ioctl_update_if(str
 			}
 		}
 
-		if (wds_dev == NULL || sdata->type != IEEE80211_IF_TYPE_WDS)
+		if (!wds_dev || sdata->type != IEEE80211_IF_TYPE_WDS)
 			return -ENODEV;
 
 		return ieee80211_if_update_wds(wds_dev, wds->remote_addr);
@@ -1250,7 +1250,7 @@ static int ieee80211_set_gen_ie(struct n
 	if (sdata->type == IEEE80211_IF_TYPE_AP) {
 		kfree(sdata->u.ap.generic_elem);
 		sdata->u.ap.generic_elem = kmalloc(len, GFP_KERNEL);
-		if (sdata->u.ap.generic_elem == NULL)
+		if (!sdata->u.ap.generic_elem)
 			return -ENOMEM;
 		memcpy(sdata->u.ap.generic_elem, ie, len);
 		sdata->u.ap.generic_elem_len = len;
@@ -1418,7 +1418,7 @@ static int ieee80211_ioctl_priv_hostapd(
 	}
 
 	param = (struct prism2_hostapd_param *) kmalloc(p->length, GFP_KERNEL);
-	if (param == NULL)
+	if (!param)
 		return -ENOMEM;
 
 	if (copy_from_user(param, p->pointer, p->length)) {
@@ -2285,7 +2285,7 @@ static void ieee80211_key_enable_hwaccel
 	struct ieee80211_key_conf *keyconf;
 	u8 addr[ETH_ALEN];
 
-	if (key == NULL || key->alg != ALG_WEP || !key->force_sw_encrypt ||
+	if (!key || key->alg != ALG_WEP || !key->force_sw_encrypt ||
 	    local->hw->device_hides_wep)
 		return;
 
@@ -2306,7 +2306,7 @@ static void ieee80211_key_disable_hwacce
 	struct ieee80211_key_conf *keyconf;
 	u8 addr[ETH_ALEN];
 
-	if (key == NULL || key->alg != ALG_WEP || key->force_sw_encrypt ||
+	if (!key || key->alg != ALG_WEP || key->force_sw_encrypt ||
 	    local->hw->device_hides_wep)
 		return;
 
@@ -2532,7 +2532,7 @@ static int ieee80211_ioctl_prism2_param(
 	case PRISM2_PARAM_KEY_INDEX:
 		if (value < 0 || value >= NUM_DEFAULT_KEYS)
 			ret = -EINVAL;
-		else if (sdata->keys[value] == NULL)
+		else if (!sdata->keys[value])
 			ret = -ENOENT;
 		else
 			sdata->default_key = sdata->keys[value];
@@ -2594,7 +2594,7 @@ static int ieee80211_ioctl_prism2_param(
 		break;
 	case PRISM2_PARAM_MGMT_IF:
 		if (value == 1) {
-			if (local->apdev == NULL)
+			if (!local->apdev)
 				ret = ieee80211_if_add_mgmt(local->mdev);
 		} else if (value == 0) {
 			if (local->apdev)
@@ -2725,7 +2725,7 @@ static int ieee80211_ioctl_get_prism2_pa
 		break;
 
 	case PRISM2_PARAM_KEY_INDEX:
-		if (sdata->default_key == NULL)
+		if (!sdata->default_key)
 			ret = -ENOENT;
 		else if (sdata->default_key == sdata->keys[0])
 			*param = 0;
@@ -2863,7 +2863,7 @@ static int ieee80211_ioctl_siwencode(str
 	idx = erq->flags & IW_ENCODE_INDEX;
 	if (idx < 1 || idx > 4) {
 		idx = -1;
-		if (sdata->default_key == NULL)
+		if (!sdata->default_key)
 			idx = 0;
 		else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
 			if (sdata->default_key == sdata->keys[i])
@@ -2885,7 +2885,7 @@ static int ieee80211_ioctl_siwencode(str
 	return ieee80211_set_encryption(
 		dev, bcaddr,
 		idx, erq->length == 0 ? ALG_NONE : ALG_WEP,
-		sdata->default_key == NULL,
+		!sdata->default_key,
 		NULL, keybuf, erq->length);
 
 	return 0;
@@ -2904,7 +2904,7 @@ static int ieee80211_ioctl_giwencode(str
 	idx = erq->flags & IW_ENCODE_INDEX;
 	if (idx < 1 || idx > 4) {
 		idx = -1;
-		if (sdata->default_key == NULL)
+		if (!sdata->default_key)
 			idx = 0;
 		else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
 			if (sdata->default_key == sdata->keys[i])
@@ -2918,7 +2918,7 @@ static int ieee80211_ioctl_giwencode(str
 
 	erq->flags = idx + 1;
 
-	if (sdata->keys[idx] == NULL) {
+	if (!sdata->keys[idx]) {
 		erq->length = 0;
 		erq->flags |= IW_ENCODE_DISABLED;
 		return 0;
@@ -3050,7 +3050,7 @@ static int ieee80211_ioctl_siwencodeext(
 	idx = erq->flags & IW_ENCODE_INDEX;
 	if (idx < 1 || idx > 4) {
 		idx = -1;
-		if (sdata->default_key == NULL)
+		if (!sdata->default_key)
 			idx = 0;
 		else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
 			if (sdata->default_key == sdata->keys[i])
diff --git a/net/d80211/ieee80211_scan.c b/net/d80211/ieee80211_scan.c
index 445509e..539b8a2 100644
--- a/net/d80211/ieee80211_scan.c
+++ b/net/d80211/ieee80211_scan.c
@@ -117,7 +117,7 @@ static void ieee80211_scan_start(struct 
 	struct ieee80211_channel *chan = NULL;
 	int ret;
 
-	if (local->hw->passive_scan == 0) {
+	if (!local->hw->passive_scan) {
 		printk(KERN_DEBUG "%s: Scan handler called, yet the hardware "
 		       "does not support passive scanning. Disabled.\n",
 		       dev->name);
@@ -136,7 +136,7 @@ static void ieee80211_scan_start(struct 
 		return;
 	}
 
-	if (local->scan.skb == NULL) {
+	if (!local->scan.skb) {
 		printk(KERN_DEBUG "%s: Scan start called even though scan.skb "
 		       "is not set\n", dev->name);
 	}
@@ -214,7 +214,7 @@ static void ieee80211_scan_stop(struct n
 	struct ieee80211_channel *chan;
 	int wait;
 
-	if (local->hw->passive_scan == NULL)
+	if (!local->hw->passive_scan)
 		return;
 
 	if (local->scan.mode_idx >= local->hw->num_modes) {
@@ -313,7 +313,7 @@ void ieee80211_init_scan(struct net_devi
 	/* Create a CTS from for broadcasting before
 	 * the low level changes channels */
 	local->scan.skb = alloc_skb(len, GFP_KERNEL);
-	if (local->scan.skb == NULL) {
+	if (!local->scan.skb) {
 		printk(KERN_WARNING "%s: Failed to allocate CTS packet for "
 		       "passive scan\n", dev->name);
 		return;
@@ -344,7 +344,7 @@ void ieee80211_stop_scan(struct net_devi
 {
 	struct ieee80211_local *local = dev->ieee80211_ptr;
 
-	if (local->hw->passive_scan != 0) {
+	if (local->hw->passive_scan) {
 		del_timer_sync(&local->scan.timer);
 		dev_kfree_skb(local->scan.skb);
 		local->scan.skb = NULL;
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 8caf352..645529f 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -252,7 +252,7 @@ static void ieee80211_sta_wmm_params(str
 
 	memset(&params, 0, sizeof(params));
 
-	if (local->hw->conf_tx == NULL)
+	if (!local->hw->conf_tx)
 		return;
 
 	local->wmm_acm = 0;
@@ -316,12 +316,12 @@ static void ieee80211_sta_send_associnfo
 	int i;
 	union iwreq_data wrqu;
 
-	if (ifsta->assocreq_ies == NULL && ifsta->assocresp_ies == NULL)
+	if (!ifsta->assocreq_ies && !ifsta->assocresp_ies)
 		return;
 
 	buf = kmalloc(50 + 2 * (ifsta->assocreq_ies_len +
 				ifsta->assocresp_ies_len), GFP_ATOMIC);
-	if (buf == NULL)
+	if (!buf)
 		return;
 
 	len = sprintf(buf, "ASSOCINFO(");
@@ -418,7 +418,7 @@ static void ieee80211_send_auth(struct n
 	struct ieee80211_mgmt *mgmt;
 
 	skb = dev_alloc_skb(sizeof(*mgmt) + 6 + extra_len);
-	if (skb == NULL) {
+	if (!skb) {
 		printk(KERN_DEBUG "%s: failed to allocate buffer for auth "
 		       "frame\n", dev->name);
 		return;
@@ -479,7 +479,7 @@ static void ieee80211_send_assoc(struct 
 
 	skb = dev_alloc_skb(sizeof(*mgmt) + 200 + ifsta->extra_ie_len +
 			    ifsta->ssid_len);
-	if (skb == NULL) {
+	if (!skb) {
 		printk(KERN_DEBUG "%s: failed to allocate buffer for assoc "
 		       "frame\n", dev->name);
 		return;
@@ -588,7 +588,7 @@ static void ieee80211_send_deauth(struct
 	struct ieee80211_mgmt *mgmt;
 
 	skb = dev_alloc_skb(sizeof(*mgmt));
-	if (skb == NULL) {
+	if (!skb) {
 		printk(KERN_DEBUG "%s: failed to allocate buffer for deauth "
 		       "frame\n", dev->name);
 		return;
@@ -615,7 +615,7 @@ static void ieee80211_send_disassoc(stru
 	struct ieee80211_mgmt *mgmt;
 
 	skb = dev_alloc_skb(sizeof(*mgmt));
-	if (skb == NULL) {
+	if (!skb) {
 		printk(KERN_DEBUG "%s: failed to allocate buffer for disassoc "
 		       "frame\n", dev->name);
 		return;
@@ -641,12 +641,12 @@ static int ieee80211_privacy_mismatch(st
 	struct ieee80211_sta_bss *bss;
 	int res = 0;
 
-	if (ifsta == NULL || ifsta->mixed_cell ||
+	if (!ifsta || ifsta->mixed_cell ||
 	    ifsta->key_mgmt != IEEE80211_KEY_MGMT_NONE)
 		return 0;
 
 	bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
-	if (bss == NULL)
+	if (!bss)
 		return 0;
 
 	if (ieee80211_sta_wep_configured(dev) !=
@@ -700,7 +700,7 @@ static void ieee80211_associated(struct 
 	ifsta->state = IEEE80211_ASSOCIATED;
 
 	sta = sta_info_get(local, ifsta->bssid);
-	if (sta == NULL) {
+	if (!sta) {
 		printk(KERN_DEBUG "%s: No STA entry for own AP " MAC_FMT "\n",
 		       dev->name, MAC_ARG(ifsta->bssid));
 		disassoc = 1;
@@ -756,7 +756,7 @@ static void ieee80211_send_probe_req(str
 	int i;
 
 	skb = dev_alloc_skb(sizeof(*mgmt) + 200);
-	if (skb == NULL) {
+	if (!skb) {
 		printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
 		       "request\n", dev->name);
 		return;
@@ -811,7 +811,7 @@ static void ieee80211_send_probe_req(str
 static int ieee80211_sta_wep_configured(struct net_device *dev)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-	if (sdata == NULL || sdata->default_key == NULL ||
+	if (!sdata || !sdata->default_key ||
 	    sdata->default_key->alg != ALG_WEP)
 		return 0;
 	return 1;
@@ -844,7 +844,7 @@ static void ieee80211_auth_challenge(str
 		       dev->name);
 		return;
 	}
-	if (elems.challenge == NULL) {
+	if (!elems.challenge) {
 		printk(KERN_DEBUG "%s: no challenge IE in shared key auth "
 		       "frame\n", dev->name);
 		return;
@@ -1139,7 +1139,7 @@ static void ieee80211_rx_mgmt_assoc_resp
 		return;
 	}
 
-	if (elems.supp_rates == NULL) {
+	if (!elems.supp_rates) {
 		printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n",
 		       dev->name);
 		return;
@@ -1159,9 +1159,9 @@ static void ieee80211_rx_mgmt_assoc_resp
 
 	/* Add STA entry for the AP */
 	sta = sta_info_get(local, ifsta->bssid);
-	if (sta == NULL) {
+	if (!sta) {
 		sta = sta_info_add(local, dev, ifsta->bssid);
-		if (sta == NULL) {
+		if (!sta) {
 			printk(KERN_DEBUG "%s: failed to add STA entry for the"
 			       " AP\n", dev->name);
 			return;
@@ -1225,12 +1225,11 @@ static void __ieee80211_rx_bss_hash_del(
 	b = local->sta_bss_hash[STA_HASH(bss->bssid)];
 	while (b) {
 		if (b == bss) {
-			if (prev == NULL) {
+			if (!prev)
 				local->sta_bss_hash[STA_HASH(bss->bssid)] =
 					bss->hnext;
-			} else {
+			else
 				prev->hnext = bss->hnext;
-			}
 			break;
 		}
 		prev = b;
@@ -1246,7 +1245,7 @@ ieee80211_rx_bss_add(struct net_device *
 	struct ieee80211_sta_bss *bss;
 
 	bss = kmalloc(sizeof(*bss), GFP_ATOMIC);
-	if (bss == NULL)
+	if (!bss)
 		return NULL;
 	memset(bss, 0, sizeof(*bss));
 	atomic_inc(&bss->users);
@@ -1441,7 +1440,7 @@ #endif /* IEEE80211_IBSS_DEBUG */
 		sta_info_put(sta);
 	}
 
-	if (elems.ssid == NULL)
+	if (!elems.ssid)
 		return;
 
 	if (elems.ds_params && elems.ds_params_len == 1)
@@ -1450,9 +1449,9 @@ #endif /* IEEE80211_IBSS_DEBUG */
 		channel = rx_status->channel;
 
 	bss = ieee80211_rx_bss_get(dev, mgmt->bssid);
-	if (bss == NULL) {
+	if (!bss) {
 		bss = ieee80211_rx_bss_add(dev, mgmt->bssid);
-		if (bss == NULL)
+		if (!bss)
 			return;
 	} else {
 #if 0
@@ -1495,7 +1494,7 @@ #endif
 	}
 
 	if (elems.wpa &&
-	    (bss->wpa_ie == NULL || bss->wpa_ie_len != elems.wpa_len ||
+	    (!bss->wpa_ie || bss->wpa_ie_len != elems.wpa_len ||
 	     memcmp(bss->wpa_ie, elems.wpa, elems.wpa_len))) {
 		kfree(bss->wpa_ie);
 		bss->wpa_ie = kmalloc(elems.wpa_len + 2, GFP_ATOMIC);
@@ -1511,7 +1510,7 @@ #endif
 	}
 
 	if (elems.rsn &&
-	    (bss->rsn_ie == NULL || bss->rsn_ie_len != elems.rsn_len ||
+	    (!bss->rsn_ie || bss->rsn_ie_len != elems.rsn_len ||
 	     memcmp(bss->rsn_ie, elems.rsn, elems.rsn_len))) {
 		kfree(bss->rsn_ie);
 		bss->rsn_ie = kmalloc(elems.rsn_len + 2, GFP_ATOMIC);
@@ -1527,7 +1526,7 @@ #endif
 	}
 
 	if (elems.wmm_param &&
-	    (bss->wmm_ie == NULL || bss->wmm_ie_len != elems.wmm_param_len ||
+	    (!bss->wmm_ie || bss->wmm_ie_len != elems.wmm_param_len ||
 	     memcmp(bss->wmm_ie, elems.wmm_param, elems.wmm_param_len))) {
 		kfree(bss->wmm_ie);
 		bss->wmm_ie = kmalloc(elems.wmm_param_len + 2, GFP_ATOMIC);
@@ -1649,7 +1648,7 @@ static void ieee80211_rx_mgmt_probe_req(
 
 	if (sdata->type != IEEE80211_IF_TYPE_IBSS ||
 	    ifsta->state != IEEE80211_IBSS_JOINED ||
-	    len < 24 + 2 || ifsta->probe_resp == NULL)
+	    len < 24 + 2 || !ifsta->probe_resp)
 		return;
 
 	if (local->hw->tx_last_beacon)
@@ -1691,7 +1690,7 @@ #endif /* IEEE80211_IBSS_DEBUG */
 
 	/* Reply with ProbeResp */
 	skb = skb_copy(ifsta->probe_resp, GFP_ATOMIC);
-	if (skb == NULL)
+	if (!skb)
 		return;
 
 	resp = (struct ieee80211_mgmt *) skb->data;
@@ -2012,7 +2011,7 @@ static int ieee80211_sta_join_ibss(struc
 	/* Set beacon template based on scan results */
 	skb = dev_alloc_skb(400);
 	do {
-		if (skb == NULL)
+		if (!skb)
 			break;
 
 		mgmt = (struct ieee80211_mgmt *)
@@ -2065,7 +2064,7 @@ static int ieee80211_sta_join_ibss(struc
 		memset(&extra, 0, sizeof(extra));
 		extra.endidx = local->num_curr_rates;
 		rate = rate_control_get_rate(dev, skb, &extra);
-		if (rate == NULL) {
+		if (!rate) {
 			printk(KERN_DEBUG "%s: Failed to determine TX rate "
 			       "for IBSS beacon\n", dev->name);
 			break;
@@ -2152,7 +2151,7 @@ #endif
 	       dev->name, MAC_ARG(bssid));
 
 	bss = ieee80211_rx_bss_add(dev, bssid);
-	if (bss == NULL)
+	if (!bss)
 		return -ENOMEM;
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -2593,7 +2592,7 @@ ieee80211_sta_scan_result(struct net_dev
 		return current_ev;
 
 	if (local->scan_flags & IEEE80211_SCAN_WPA_ONLY &&
-	    bss->wpa_ie == NULL && bss->rsn_ie == NULL)
+	    !bss->wpa_ie && !bss->rsn_ie)
 		return current_ev;
 
 	if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID &&
@@ -2700,7 +2699,7 @@ ieee80211_sta_scan_result(struct net_dev
 			break;
 
 		buf = kmalloc(100, GFP_ATOMIC);
-		if (buf == NULL)
+		if (!buf)
 			break;
 
 		memset(&iwe, 0, sizeof(iwe));
@@ -2772,7 +2771,7 @@ int ieee80211_sta_set_extra_ie(struct ne
 		return 0;
 	}
 	ifsta->extra_ie = kmalloc(len, GFP_KERNEL);
-	if (ifsta->extra_ie == NULL) {
+	if (!ifsta->extra_ie) {
 		ifsta->extra_ie_len = 0;
 		return -ENOMEM;
 	}
@@ -2816,16 +2815,15 @@ struct sta_info * ieee80211_ibss_add_sta
 	}
 	spin_unlock_bh(&local->sub_if_lock);
 
-	if (sta_dev == NULL)
+	if (!sta_dev)
 		return NULL;
 
 	printk(KERN_DEBUG "%s: Adding new IBSS station " MAC_FMT " (dev=%s)\n",
 	       dev->name, MAC_ARG(addr), sta_dev->name);
 
 	sta = sta_info_add(local, dev, addr);
-	if (sta == NULL) {
+	if (!sta)
 		return NULL;
-	}
 
 	sta->dev = sta_dev;
 	sta->supp_rates = sdata->u.sta.supp_rates_bits;
diff --git a/net/d80211/rate_control.c b/net/d80211/rate_control.c
index 1d40e88..4f1ffbd 100644
--- a/net/d80211/rate_control.c
+++ b/net/d80211/rate_control.c
@@ -288,9 +288,9 @@ static void * rate_control_simple_alloc(
 	struct global_rate_control *rctrl;
 
 	rctrl = kmalloc(sizeof(*rctrl), GFP_ATOMIC);
-	if (rctrl == NULL) {
+	if (!rctrl)
 		return NULL;
-	}
+
 	memset(rctrl, 0, sizeof(*rctrl));
 	return rctrl;
 }
@@ -313,9 +313,9 @@ static void * rate_control_simple_alloc_
 	struct sta_rate_control *rctrl;
 
 	rctrl = kmalloc(sizeof(*rctrl), GFP_ATOMIC);
-	if (rctrl == NULL) {
+	if (!rctrl)
 		return NULL;
-	}
+
 	memset(rctrl, 0, sizeof(*rctrl));
 	return rctrl;
 }
diff --git a/net/d80211/rate_control.h b/net/d80211/rate_control.h
index d8bdfed..08a8add 100644
--- a/net/d80211/rate_control.h
+++ b/net/d80211/rate_control.h
@@ -101,7 +101,7 @@ static inline void * rate_control_alloc(
 
 static inline void rate_control_free(struct ieee80211_local *local)
 {
-	if (local->rate_ctrl == NULL || local->rate_ctrl_priv == NULL)
+	if (!local->rate_ctrl || !local->rate_ctrl_priv)
 		return;
 	local->rate_ctrl->free(local->rate_ctrl_priv);
 	local->rate_ctrl_priv = NULL;
diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c
index 7f5febe..d8f044e 100644
--- a/net/d80211/sta_info.c
+++ b/net/d80211/sta_info.c
@@ -38,17 +38,16 @@ static void sta_info_hash_del(struct iee
 	struct sta_info *s;
 
 	s = local->sta_hash[STA_HASH(sta->addr)];
-	if (s == NULL)
+	if (!s)
 		return;
 	if (memcmp(s->addr, sta->addr, ETH_ALEN) == 0) {
 		local->sta_hash[STA_HASH(sta->addr)] = s->hnext;
 		return;
 	}
 
-	while (s->hnext != NULL &&
-	       memcmp(s->hnext->addr, sta->addr, ETH_ALEN) != 0)
+	while (s->hnext && memcmp(s->hnext->addr, sta->addr, ETH_ALEN) != 0)
 		s = s->hnext;
-	if (s->hnext != NULL)
+	if (s->hnext)
 		s->hnext = s->hnext->hnext;
 	else
 		printk(KERN_ERR "%s: could not remove STA " MAC_FMT " from "
@@ -147,7 +146,7 @@ struct sta_info * sta_info_add(struct ie
 	kobject_init(&sta->kobj);
 
 	sta->rate_ctrl_priv = rate_control_alloc_sta(local);
-	if (sta->rate_ctrl_priv == NULL) {
+	if (!sta->rate_ctrl_priv) {
 		kobject_put(&sta->kobj);
 		kfree(sta);
 		return NULL;
@@ -429,7 +428,7 @@ void sta_info_remove_aid_ptr(struct sta_
 	sdata->bss->sta_aid[sta->aid - 1] = NULL;
 	if (sta->aid == sdata->bss->max_aid) {
 		while (sdata->bss->max_aid > 0 &&
-		       sdata->bss->sta_aid[sdata->bss->max_aid - 1] == NULL)
+		       !sdata->bss->sta_aid[sdata->bss->max_aid - 1])
 			sdata->bss->max_aid--;
 	}
 }
@@ -448,7 +447,7 @@ void sta_info_flush(struct ieee80211_loc
 
 	list_for_each_safe(ptr, n, &local->sta_list) {
 		struct sta_info *sta = list_entry(ptr, struct sta_info, list);
-		if (dev == NULL || dev == sta->dev)
+		if (!dev || dev == sta->dev)
 			sta_info_free(sta, 1);
 	}
 	spin_unlock_bh(&local->sta_lock);
diff --git a/net/d80211/wep.c b/net/d80211/wep.c
index 0473f3c..097a7e9 100644
--- a/net/d80211/wep.c
+++ b/net/d80211/wep.c
@@ -61,7 +61,7 @@ void ieee80211_wep_get_iv(struct ieee802
 	if (ieee80211_wep_weak_iv(local->wep_iv, key->keylen))
 		local->wep_iv += 0x0100;
 
-	if (iv == NULL)
+	if (!iv)
 		return;
 
 	*iv++ = (local->wep_iv >> 16) & 0xff;
@@ -149,16 +149,16 @@ int ieee80211_wep_encrypt(struct ieee802
 	u8 *rc4key, *iv;
 	size_t len;
 
-	if (key == NULL || key->alg != ALG_WEP)
+	if (!key || key->alg != ALG_WEP)
 		return -1;
 
 	klen = 3 + key->keylen;
 	rc4key = kmalloc(klen, GFP_ATOMIC);
-	if (rc4key == NULL)
+	if (!rc4key)
 		return -1;
 
 	iv = ieee80211_wep_add_iv(local, skb, key);
-	if (iv == NULL) {
+	if (!iv) {
 		kfree(rc4key);
 		return -1;
 	}
@@ -239,13 +239,13 @@ int ieee80211_wep_decrypt(struct ieee802
 
 	keyidx = skb->data[hdrlen + 3] >> 6;
 
-	if (key == NULL || keyidx != key->keyidx || key->alg != ALG_WEP)
+	if (!key || keyidx != key->keyidx || key->alg != ALG_WEP)
 		return -1;
 
 	klen = 3 + key->keylen;
 
 	rc4key = kmalloc(klen, GFP_ATOMIC);
-	if (rc4key == NULL)
+	if (!rc4key)
 		return -1;
 
 	/* Prepend 24-bit IV to RC4 key */
diff --git a/net/d80211/wme.c b/net/d80211/wme.c
index fc2a113..8f1862c 100644
--- a/net/d80211/wme.c
+++ b/net/d80211/wme.c
@@ -470,7 +470,7 @@ static int wme_classop_graft(struct Qdis
 	if (queue >= hw->queues)
 		return -EINVAL;
 
-	if (new == NULL)
+	if (!new)
 		new = &noop_qdisc;
 
 	sch_tree_lock(qd);
@@ -660,7 +660,7 @@ void ieee80211_install_qdisc(struct net_
 	struct Qdisc *qdisc;
 
 	qdisc = qdisc_create_dflt(dev, &wme_qdisc_ops);
-	if (qdisc == NULL) {
+	if (!qdisc) {
 		printk(KERN_ERR "%s: qdisc installation failed\n", dev->name);
 		return;
 	}
diff --git a/net/d80211/wpa.c b/net/d80211/wpa.c
index fe5861f..5270b8c 100644
--- a/net/d80211/wpa.c
+++ b/net/d80211/wpa.c
@@ -260,7 +260,7 @@ #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 			struct ieee80211_hdr *hdr;
 			union iwreq_data wrqu;
 			char *buf = kmalloc(128, GFP_ATOMIC);
-			if (buf == NULL)
+			if (!buf)
 				break;
 
 			/* TODO: needed parameters: count, key type, TSC */
-- 
1.3.0


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

* [PATCH 4/21] d80211: use kzalloc()
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (2 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 3/21] d80211: pointers as extended booleans Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 5/21] d80211: get rid of WME bitfield Jiri Benc
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This changes d80211 to use kzalloc() where applicable.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/ieee80211.c    |    7 ++-----
 net/d80211/rate_control.c |   10 ++--------
 2 files changed, 4 insertions(+), 13 deletions(-)

ce05baacb2a48dfc5f917c63fcb52537991bbb1a
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index ac0b706..04c791d 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -454,11 +454,9 @@ ieee80211_tx_h_fragment(struct ieee80211
 	per_fragm = frag_threshold - hdrlen - 4 /* FCS */;
 	num_fragm = (payload_len + per_fragm - 1) / per_fragm;
 
-	frags = (struct sk_buff **)
-		kmalloc(num_fragm * sizeof(struct sk_buff *), GFP_ATOMIC);
+	frags = kzalloc(num_fragm * sizeof(struct sk_buff *), GFP_ATOMIC);
 	if (!frags)
 		goto fail;
-	memset(frags, 0, num_fragm * sizeof(struct sk_buff *));
 
 	hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREFRAGS);
 	pos = first->data + hdrlen + per_fragm;
@@ -4714,11 +4712,10 @@ int ieee80211_rate_control_register(stru
 {
 	struct rate_control_algs *alg;
 
-	alg = kmalloc(sizeof(*alg), GFP_KERNEL);
+	alg = kzalloc(sizeof(*alg), GFP_KERNEL);
 	if (!alg)
 		return -1;
 
-	memset(alg, 0, sizeof(*alg));
 	alg->next = ieee80211_rate_ctrl_algs;
 	alg->ops = ops;
 	ieee80211_rate_ctrl_algs = alg;
diff --git a/net/d80211/rate_control.c b/net/d80211/rate_control.c
index 4f1ffbd..ff383ab 100644
--- a/net/d80211/rate_control.c
+++ b/net/d80211/rate_control.c
@@ -287,11 +287,8 @@ static void * rate_control_simple_alloc(
 {
 	struct global_rate_control *rctrl;
 
-	rctrl = kmalloc(sizeof(*rctrl), GFP_ATOMIC);
-	if (!rctrl)
-		return NULL;
+	rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC);
 
-	memset(rctrl, 0, sizeof(*rctrl));
 	return rctrl;
 }
 
@@ -312,11 +309,8 @@ static void * rate_control_simple_alloc_
 {
 	struct sta_rate_control *rctrl;
 
-	rctrl = kmalloc(sizeof(*rctrl), GFP_ATOMIC);
-	if (!rctrl)
-		return NULL;
+	rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC);
 
-	memset(rctrl, 0, sizeof(*rctrl));
 	return rctrl;
 }
 
-- 
1.3.0


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

* [PATCH 5/21] d80211: get rid of WME bitfield
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (3 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 4/21] d80211: use kzalloc() Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 6/21] d80211: get rid of sta_aid in favour of keeping track of TIM Jiri Benc
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch gets rid of the endian-ness dependent bitfield
used for WME. It cleans up wme includes and adds some necessary
includes in other files that got them implicitly through wme.h

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/fifo_qdisc.c |    1 +
 net/d80211/ieee80211.c  |    1 +
 net/d80211/wme.c        |   18 ++++++++++--------
 net/d80211/wme.h        |   25 ++-----------------------
 4 files changed, 14 insertions(+), 31 deletions(-)

94df2a4b3e67e47058b8f58b4705edb9ed7b447a
diff --git a/net/d80211/fifo_qdisc.c b/net/d80211/fifo_qdisc.c
index 0748a2e..a89a839 100644
--- a/net/d80211/fifo_qdisc.c
+++ b/net/d80211/fifo_qdisc.c
@@ -13,6 +13,7 @@
 #include <linux/config.h>
 #include <linux/version.h>
 #include <linux/netdevice.h>
+#include <net/pkt_sched.h>
 #include <net/d80211.h>
 #include "ieee80211_i.h"
 #include "wme.h"
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 04c791d..05a88f1 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -18,6 +18,7 @@ #include <linux/skbuff.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 #include <linux/wireless.h>
+#include <linux/rtnetlink.h>
 #include <net/iw_handler.h>
 #include <linux/compiler.h>
 
diff --git a/net/d80211/wme.c b/net/d80211/wme.c
index 8f1862c..b1ff066 100644
--- a/net/d80211/wme.c
+++ b/net/d80211/wme.c
@@ -12,7 +12,9 @@ #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/module.h>
 #include <linux/if_arp.h>
+#include <linux/types.h>
 #include <net/ip.h>
+#include <net/pkt_sched.h>
 
 #include <net/d80211.h>
 #include "ieee80211_i.h"
@@ -246,15 +248,15 @@ static int wme_qdiscop_enqueue(struct sk
 	/* now we know the 1d priority, fill in the QoS header if there is one
 	 */
 	if (WLAN_FC_IS_QOS_DATA(fc)) {
-		struct qos_control *qc = (struct qos_control *)
-			(skb->data + ieee80211_get_hdrlen(fc) - 2);
-		u8 *p = (u8 *) qc;
-		*p++ = 0; /* do this due to gcc's lack of optimization on
-			   * bitfield ops */
-		*p = 0;
-		qc->tag1d = skb->priority;
+		u8 *p = skb->data + ieee80211_get_hdrlen(fc) - 2;
+		u8 qos_hdr = skb->priority & QOS_CONTROL_TAG1D_MASK;
 		if (local->wifi_wme_noack_test)
-			qc->ack_policy = 1;
+			qos_hdr |= QOS_CONTROL_ACK_POLICY_NOACK <<
+					QOS_CONTROL_ACK_POLICY_SHIFT;
+		/* qos header is 2 bytes, second reserved */
+		*p = qos_hdr;
+		p++;
+		*p = 0;
 	}
 
 	if (unlikely(queue >= local->hw->queues)) {
diff --git a/net/d80211/wme.h b/net/d80211/wme.h
index 44a2c33..90add6e 100644
--- a/net/d80211/wme.h
+++ b/net/d80211/wme.h
@@ -11,10 +11,8 @@
 #ifndef _WME_H
 #define _WME_H
 
-#include <asm/byteorder.h>
 #include <linux/netdevice.h>
-#include <linux/types.h>
-#include <net/pkt_sched.h>
+#include "ieee80211_i.h"
 
 #define QOS_CONTROL_LEN 2
 
@@ -24,26 +22,7 @@ #define QOS_CONTROL_ACK_POLICY_NOACK 1
 #define QOS_CONTROL_TID_MASK 0x0f
 #define QOS_CONTROL_ACK_POLICY_SHIFT 5
 
-/* This bit field structure should not be used; it can cause compiler to
- * generate unaligned accesses and inefficient code. */
-struct qos_control {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-	u8	tag1d:3, /* bits 0-2 */
-  		reserved1:1,
-		eosp:1,
-		ack_policy:2,
-  		reserved2:1;
-#elif defined (__BIG_ENDIAN_BITFIELD)
-	u8	reserved2:1,
-		ack_policy:2,
-		eosp:1,
-		reserved1:1,
-		tag1d:3; /* bits 0-2 */
-#else
-#error	"Please fix <asm/byteorder.h>"
-#endif
-	u8 reserved;
-} __attribute__ ((packed));
+#define QOS_CONTROL_TAG1D_MASK 0x07
 
 ieee80211_txrx_result
 ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx);
-- 
1.3.0


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

* [PATCH 6/21] d80211: get rid of sta_aid in favour of keeping track of TIM
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (4 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 5/21] d80211: get rid of WME bitfield Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 7/21] d80211: clean up exports Jiri Benc
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch gets rid of the HUGE sta_aid array that was there in the
access point structure and instead keeps track of the TIM. Also
reduces stack usage of the ieee80211_beacon_add_tim() function
considerably, and fixes a bug where removing a station that had
frames buffered wouldn't update the hardware TIM (if necessary).

It also removes the MAX_AID_TABLE_SIZE pseudo-configuration option
(it was a define with a comment indicating it could be changed)
since now having all AIDs available is no longer expensive.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 include/net/d80211.h         |    3 ++
 net/d80211/ieee80211.c       |   68 ++++++++++++++++++++++--------------------
 net/d80211/ieee80211_i.h     |   28 +++++++++++++----
 net/d80211/ieee80211_ioctl.c |    6 +---
 net/d80211/ieee80211_sysfs.c |    2 -
 net/d80211/sta_info.c        |   15 ++++-----
 net/d80211/sta_info.h        |    4 --
 7 files changed, 68 insertions(+), 58 deletions(-)

358fd4b6115683d3a8f88308268cfd6062c31f47
diff --git a/include/net/d80211.h b/include/net/d80211.h
index ba5cb4c..da1892f 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -967,8 +967,11 @@ #define IEEE80211_STYPE_QOS_CFPOLL		0x00
 #define IEEE80211_STYPE_QOS_CFACKPOLL		0x00F0
 
 
+/* miscellaneous IEEE 802.11 constants */
 #define IEEE80211_MAX_FRAG_THRESHOLD 2346
 #define IEEE80211_MAX_RTS_THRESHOLD 2347
+#define IEEE80211_MAX_AID 2007
+#define IEEE80211_MAX_TIM_LEN 251
 
 struct ieee80211_hdr {
 	__le16 frame_control;
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 05a88f1..1846d3e 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -21,6 +21,7 @@ #include <linux/wireless.h>
 #include <linux/rtnetlink.h>
 #include <net/iw_handler.h>
 #include <linux/compiler.h>
+#include <linux/bitmap.h>
 
 #include <net/d80211.h>
 #include <net/d80211_common.h>
@@ -1047,8 +1048,12 @@ #endif /* IEEE80211_VERBOSE_DEBUG_PS */
 		} else
 			tx->local->total_ps_buffered++;
 		/* Queue frame to be sent after STA sends an PS Poll frame */
-		if (skb_queue_empty(&sta->ps_tx_buf) && tx->local->hw->set_tim)
-			tx->local->hw->set_tim(tx->dev, sta->aid, 1);
+		if (skb_queue_empty(&sta->ps_tx_buf)) {
+			if (tx->local->hw->set_tim)
+				tx->local->hw->set_tim(tx->dev, sta->aid, 1);
+			if (tx->sdata->bss)
+				bss_tim_set(tx->local, tx->sdata->bss, sta->aid);
+		}
 		pkt_data = (struct ieee80211_tx_packet_data *)tx->skb->cb;
 		pkt_data->jiffies = jiffies;
                 skb_queue_tail(&sta->ps_tx_buf, tx->skb);
@@ -1687,25 +1692,16 @@ static void ieee80211_beacon_add_tim(str
 {
 	u8 *pos, *tim;
 	int aid0 = 0;
-	int i, num_bits = 0, n1, n2;
-	u8 bitmap[251];
+	int i, have_bits = 0, n1, n2;
 
 	/* Generate bitmap for TIM only if there are any STAs in power save
 	 * mode. */
-	if (atomic_read(&bss->num_sta_ps) > 0 && bss->max_aid > 0) {
-		memset(bitmap, 0, sizeof(bitmap));
-		spin_lock_bh(&local->sta_lock);
-		for (i = 0; i < bss->max_aid; i++) {
-			if (bss->sta_aid[i] &&
-			    (!skb_queue_empty(&bss->sta_aid[i]->ps_tx_buf) ||
-			     !skb_queue_empty(&bss->sta_aid[i]->tx_filtered)))
-			{
-				bitmap[(i + 1) / 8] |= 1 << (i + 1) % 8;
-				num_bits++;
-			}
-		}
-		spin_unlock_bh(&local->sta_lock);
-	}
+	spin_lock_bh(&local->sta_lock);
+	if (atomic_read(&bss->num_sta_ps) > 0)
+		/* in the hope that this is faster than
+		 * checking byte-for-byte */
+		have_bits = !bitmap_empty((unsigned long*)bss->tim,
+					  IEEE80211_MAX_AID+1);
 
 	if (bss->dtim_count == 0)
 		bss->dtim_count = bss->dtim_period - 1;
@@ -1718,40 +1714,40 @@ static void ieee80211_beacon_add_tim(str
 	*pos++ = bss->dtim_count;
 	*pos++ = bss->dtim_period;
 
-	if (bss->dtim_count == 0 && !skb_queue_empty(&bss->ps_bc_buf)) {
+	if (bss->dtim_count == 0 && !skb_queue_empty(&bss->ps_bc_buf))
 		aid0 = 1;
-	}
 
-	if (num_bits) {
+	if (have_bits) {
 		/* Find largest even number N1 so that bits numbered 1 through
 		 * (N1 x 8) - 1 in the bitmap are 0 and number N2 so that bits
 		 * (N2 + 1) x 8 through 2007 are 0. */
 		n1 = 0;
-		for (i = 0; i < sizeof(bitmap); i++) {
-			if (bitmap[i]) {
+		for (i = 0; i < IEEE80211_MAX_TIM_LEN; i++) {
+			if (bss->tim[i]) {
 				n1 = i & 0xfe;
 				break;
 			}
 		}
 		n2 = n1;
-		for (i = sizeof(bitmap) - 1; i >= n1; i--) {
-			if (bitmap[i]) {
+		for (i = IEEE80211_MAX_TIM_LEN - 1; i >= n1; i--) {
+			if (bss->tim[i]) {
 				n2 = i;
 				break;
 			}
 		}
 
 		/* Bitmap control */
-		*pos++ = n1 | (aid0 ? 1 : 0);
+		*pos++ = n1 | aid0;
 		/* Part Virt Bitmap */
-		memcpy(pos, bitmap + n1, n2 - n1 + 1);
+		memcpy(pos, bss->tim + n1, n2 - n1 + 1);
 
 		tim[1] = n2 - n1 + 4;
 		skb_put(skb, n2 - n1);
 	} else {
-		*pos++ = aid0 ? 1 : 0; /* Bitmap control */
+		*pos++ = aid0; /* Bitmap control */
 		*pos++ = 0; /* Part Virt Bitmap */
 	}
+	spin_unlock_bh(&local->sta_lock);
 }
 
 
@@ -2713,8 +2709,12 @@ static int ap_sta_ps_end(struct net_devi
 		atomic_dec(&sdata->bss->num_sta_ps);
 	sta->flags &= ~(WLAN_STA_PS | WLAN_STA_TIM);
 	sta->pspoll = 0;
-	if (!skb_queue_empty(&sta->ps_tx_buf) && local->hw->set_tim)
-		local->hw->set_tim(dev, sta->aid, 0);
+	if (!skb_queue_empty(&sta->ps_tx_buf)) {
+		if (local->hw->set_tim)
+			local->hw->set_tim(dev, sta->aid, 0);
+		if (sdata->bss)
+			bss_tim_clear(local, sdata->bss, sta->aid);
+	}
 #ifdef IEEE80211_VERBOSE_DEBUG_PS
 	printk(KERN_DEBUG "%s: STA " MAC_FMT " aid %d exits power "
 	       "save mode\n", dev->name, MAC_ARG(sta->addr), sta->aid);
@@ -2789,8 +2789,12 @@ #endif /* IEEE80211_VERBOSE_DEBUG_PS */
 
 		dev_queue_xmit(skb);
 
-		if (no_pending_pkts && rx->local->hw->set_tim)
-			rx->local->hw->set_tim(rx->dev, rx->sta->aid, 0);
+		if (no_pending_pkts) {
+			if (rx->local->hw->set_tim)
+				rx->local->hw->set_tim(rx->dev, rx->sta->aid, 0);
+			if (rx->sdata->bss)
+				bss_tim_clear(rx->local, rx->sdata->bss, rx->sta->aid);
+		}
 #ifdef IEEE80211_VERBOSE_DEBUG_PS
 	} else if (!rx->u.rx.sent_ps_buffered) {
 		printk(KERN_DEBUG "%s: STA " MAC_FMT " sent PS Poll even "
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index bdaaf5e..f38eea0 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -18,6 +18,8 @@ #include <linux/list.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/workqueue.h>
+#include <linux/types.h>
+#include <linux/spinlock.h>
 #include "ieee80211_key.h"
 #include "sta_info.h"
 
@@ -211,13 +213,10 @@ struct ieee80211_if_ap {
 	u8 *generic_elem;
 	size_t generic_elem_len;
 
-	/* TODO: sta_aid could be replaced by 2008-bit large bitfield of
-	 * that could be used in TIM element generation. This would also
-	 * make TIM element generation a bit faster. */
-	/* AID mapping to station data. NULL, if AID is free. AID is in the
-	 * range 1..2007 and sta_aid[i] corresponds to AID i+1. */
-	struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
-	int max_aid; /* largest aid currently in use */
+	/* yes, this looks ugly, but guarantees that we can later use
+	 * bitmap_empty :)
+	 * NB: don't ever use set_bit, use bss_tim_set/bss_tim_clear! */
+	u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
 	atomic_t num_sta_ps; /* number of stations in PS mode */
 	struct sk_buff_head ps_bc_buf;
 	int dtim_period, dtim_count;
@@ -545,6 +544,21 @@ struct sta_attribute {
 	ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
 };
 
+static inline void bss_tim_set(struct ieee80211_local *local,
+			       struct ieee80211_if_ap *bss, int aid)
+{
+	spin_lock(&local->sta_lock);
+	bss->tim[(aid)/8] |= 1<<((aid) % 8);
+	spin_unlock(&local->sta_lock);
+}
+
+static inline void bss_tim_clear(struct ieee80211_local *local,
+				 struct ieee80211_if_ap *bss, int aid)
+{
+	spin_lock(&local->sta_lock);
+	bss->tim[(aid)/8] &= !(1<<((aid) % 8));
+	spin_unlock(&local->sta_lock);
+}
 
 /* ieee80211.c */
 void ieee80211_release_hw(struct ieee80211_local *local);
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index f134f2a..db8e8ba 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -296,12 +296,8 @@ static int ieee80211_ioctl_add_sta(struc
 
 	sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC;
 	sta->aid = param->u.add_sta.aid;
-	if (sta->aid > MAX_AID_TABLE_SIZE)
+	if (sta->aid > IEEE80211_MAX_AID)
 		sta->aid = 0;
-	if (sta->aid > 0 && sdata->bss)
-		sdata->bss->sta_aid[sta->aid - 1] = sta;
-	if (sdata->bss && sta->aid > sdata->bss->max_aid)
-		sdata->bss->max_aid = sta->aid;
 
 	rates = 0;
 	for (i = 0; i < sizeof(param->u.add_sta.supp_rates); i++) {
diff --git a/net/d80211/ieee80211_sysfs.c b/net/d80211/ieee80211_sysfs.c
index 6725ff7..bb93723 100644
--- a/net/d80211/ieee80211_sysfs.c
+++ b/net/d80211/ieee80211_sysfs.c
@@ -471,7 +471,6 @@ static ssize_t ieee80211_if_fmt_flags(co
 __IEEE80211_IF_SHOW(flags);
 
 /* AP attributes */
-IEEE80211_IF_SHOW(max_aid, u.ap.max_aid, DEC);
 IEEE80211_IF_SHOW(num_sta_ps, u.ap.num_sta_ps, ATOMIC);
 IEEE80211_IF_SHOW(dtim_period, u.ap.dtim_period, DEC);
 IEEE80211_IF_SHOW(dtim_count, u.ap.dtim_count, DEC);
@@ -549,7 +548,6 @@ static struct attribute *ieee80211_ap_at
 	&class_device_attr_drop_unencrypted.attr,
 	&class_device_attr_eapol.attr,
 	&class_device_attr_ieee8021_x.attr,
-	&class_device_attr_max_aid.attr,
 	&class_device_attr_num_sta_ps.attr,
 	&class_device_attr_dtim_period.attr,
 	&class_device_attr_dtim_count.attr,
diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c
index d8f044e..dd5bc97 100644
--- a/net/d80211/sta_info.c
+++ b/net/d80211/sta_info.c
@@ -421,16 +421,15 @@ void sta_info_remove_aid_ptr(struct sta_
 {
 	struct ieee80211_sub_if_data *sdata;
 
-	sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
-	if (sta->aid <= 0 || !sdata->bss)
+	if (sta->aid <= 0)
 		return;
 
-	sdata->bss->sta_aid[sta->aid - 1] = NULL;
-	if (sta->aid == sdata->bss->max_aid) {
-		while (sdata->bss->max_aid > 0 &&
-		       !sdata->bss->sta_aid[sdata->bss->max_aid - 1])
-			sdata->bss->max_aid--;
-	}
+	sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+
+	if (sdata->local->hw->set_tim)
+		sdata->local->hw->set_tim(sta->dev, sta->aid, 0);
+	if (sdata->bss)
+		bss_tim_clear(sdata->local, sdata->bss, sta->aid);
 }
 
 
diff --git a/net/d80211/sta_info.h b/net/d80211/sta_info.h
index 70334e5..1f0f845 100644
--- a/net/d80211/sta_info.h
+++ b/net/d80211/sta_info.h
@@ -114,10 +114,6 @@ #endif /* CONFIG_D80211_DEBUG_COUNTERS *
 /* Maximum number of concurrently registered stations */
 #define MAX_STA_COUNT 2007
 
-/* Maximum number of AIDs to use for STAs; must be 2007 or lower
- * (IEEE 802.11 beacon format limitation) */
-#define MAX_AID_TABLE_SIZE 2007
-
 #define STA_HASH_SIZE 256
 #define STA_HASH(sta) (sta[5])
 
-- 
1.3.0


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

* [PATCH 7/21] d80211: clean up exports
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (5 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 6/21] d80211: get rid of sta_aid in favour of keeping track of TIM Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 8/21] d80211: clean up includes Jiri Benc
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This puts all EXPORT_SYMBOL() macros along with the function being exported.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/ieee80211.c |   69 +++++++++++++++++-------------------------------
 net/d80211/sta_info.c  |    2 +
 2 files changed, 27 insertions(+), 44 deletions(-)

d7d4b1971ecdd40b8a0b210ddd06d9d8ac972255
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 1846d3e..9416538 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -270,7 +270,7 @@ int ieee80211_get_hdrlen(u16 fc)
 
 	return hdrlen;
 }
-
+EXPORT_SYMBOL(ieee80211_get_hdrlen);
 
 int ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
 {
@@ -284,7 +284,7 @@ int ieee80211_get_hdrlen_from_skb(struct
 		return 0;
 	return hdrlen;
 }
-
+EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
 
 #ifdef IEEE80211_VERBOSE_DEBUG_FRAME_DUMP
 static void ieee80211_dump_frame(const char *ifname, const char *title,
@@ -1827,7 +1827,7 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 	ap->num_beacons++;
 	return skb;
 }
-
+EXPORT_SYMBOL(ieee80211_beacon_get);
 
 struct sk_buff *
 ieee80211_get_buffered_bc(struct net_device *dev, int if_id,
@@ -1893,6 +1893,7 @@ ieee80211_get_buffered_bc(struct net_dev
 
 	return skb;
 }
+EXPORT_SYMBOL(ieee80211_get_buffered_bc);
 
 static int __ieee80211_if_config(struct net_device *dev,
 				 struct sk_buff *beacon)
@@ -1977,7 +1978,7 @@ struct ieee80211_conf *ieee80211_get_hw_
 	struct ieee80211_local *local = dev->ieee80211_ptr;
         return &local->conf;
 }
-
+EXPORT_SYMBOL(ieee80211_get_hw_conf);
 
 static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
 {
@@ -2108,6 +2109,7 @@ struct dev_mc_list *ieee80211_get_mc_lis
 	*ptr = sdata;
 	return mc;
 }
+EXPORT_SYMBOL(ieee80211_get_mc_list_item);
 
 static struct net_device_stats *ieee80211_get_stats(struct net_device *dev)
 {
@@ -2655,7 +2657,7 @@ int ieee80211_radar_status(struct net_de
 	ieee80211_rx_mgmt(dev, skb, 0, ieee80211_msg_radar);
 	return 0;
 }
-
+EXPORT_SYMBOL(ieee80211_radar_status);
 
 int ieee80211_set_aid_for_sta(struct net_device *dev, u8 *peer_address,
 			      u16 aid)
@@ -2678,7 +2680,7 @@ int ieee80211_set_aid_for_sta(struct net
         ieee80211_rx_mgmt(dev, skb, 0, ieee80211_msg_set_aid_for_sta);
         return 0;
 }
-
+EXPORT_SYMBOL(ieee80211_set_aid_for_sta);
 
 static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta)
 {
@@ -3705,7 +3707,7 @@ void __ieee80211_rx(struct net_device *d
 	if (sta)
 		sta_info_put(sta);
 }
-
+EXPORT_SYMBOL(__ieee80211_rx);
 
 static ieee80211_txrx_result
 ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx)
@@ -3878,7 +3880,7 @@ void ieee80211_rx_irqsafe(struct net_dev
         skb_queue_tail(&local->skb_queue, skb);
         tasklet_schedule(&local->tasklet);
 }
-
+EXPORT_SYMBOL(ieee80211_rx_irqsafe);
 
 void ieee80211_tx_status_irqsafe(struct net_device *dev, struct sk_buff *skb,
 				 struct ieee80211_tx_status *status)
@@ -3907,7 +3909,7 @@ void ieee80211_tx_status_irqsafe(struct 
 	}
         tasklet_schedule(&local->tasklet);
 }
-
+EXPORT_SYMBOL(ieee80211_tx_status_irqsafe);
 
 static void ieee80211_tasklet_handler(unsigned long data)
 {
@@ -4161,7 +4163,7 @@ #endif /* IEEE80211_LEDS */
         /* Send frame to hostapd */
         ieee80211_rx_mgmt(dev, skb, NULL, msg_type);
 }
-
+EXPORT_SYMBOL(ieee80211_tx_status);
 
 /* TODO: implement register/unregister functions for adding TX/RX handlers
  * into ordered list */
@@ -4413,7 +4415,7 @@ struct net_device *ieee80211_alloc_hw(si
 
 	return mdev;
 }
-
+EXPORT_SYMBOL(ieee80211_alloc_hw);
 
 int ieee80211_register_hw(struct net_device *dev, struct ieee80211_hw *hw)
 {
@@ -4522,6 +4524,7 @@ fail_sysfs:
 	ieee80211_dev_free_index(local);
 	return result;
 }
+EXPORT_SYMBOL(ieee80211_register_hw);
 
 int ieee80211_update_hw(struct net_device *dev, struct ieee80211_hw *hw)
 {
@@ -4553,7 +4556,7 @@ int ieee80211_update_hw(struct net_devic
 
 	return 0;
 }
-
+EXPORT_SYMBOL(ieee80211_update_hw);
 
 void ieee80211_unregister_hw(struct net_device *dev)
 {
@@ -4612,6 +4615,7 @@ void ieee80211_unregister_hw(struct net_
 
 	ieee80211_dev_free_index(local);
 }
+EXPORT_SYMBOL(ieee80211_unregister_hw);
 
 void ieee80211_free_hw(struct net_device *dev)
 {
@@ -4621,6 +4625,7 @@ void ieee80211_free_hw(struct net_device
 	ieee80211_wep_free(local);
 	ieee80211_dev_free(local);
 }
+EXPORT_SYMBOL(ieee80211_free_hw);
 
 void ieee80211_release_hw(struct ieee80211_local *local)
 {
@@ -4667,6 +4672,7 @@ #endif
 
         return 0;
 }
+EXPORT_SYMBOL(ieee80211_netif_oper);
 
 void ieee80211_wake_queue(struct net_device *dev, int queue)
 {
@@ -4681,6 +4687,7 @@ void ieee80211_wake_queue(struct net_dev
 			__netif_schedule(dev);
 	}
 }
+EXPORT_SYMBOL(ieee80211_wake_queue);
 
 void ieee80211_stop_queue(struct net_device *dev, int queue)
 {
@@ -4688,6 +4695,7 @@ void ieee80211_stop_queue(struct net_dev
 
 	set_bit(IEEE80211_LINK_STATE_XOFF, &local->state[queue]);
 }
+EXPORT_SYMBOL(ieee80211_stop_queue);
 
 void ieee80211_start_queues(struct net_device *dev)
 {
@@ -4697,13 +4705,14 @@ void ieee80211_start_queues(struct net_d
 	for (i = 0; i < local->hw->queues; i++)
 		clear_bit(IEEE80211_LINK_STATE_XOFF, &local->state[i]);
 }
+EXPORT_SYMBOL(ieee80211_start_queues);
 
 void * ieee80211_dev_hw_data(struct net_device *dev)
 {
 	struct ieee80211_local *local = dev->ieee80211_ptr;
 	return local->hw_priv;
 }
-
+EXPORT_SYMBOL(ieee80211_dev_hw_data);
 
 void * ieee80211_dev_stats(struct net_device *dev)
 {
@@ -4711,7 +4720,7 @@ void * ieee80211_dev_stats(struct net_de
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	return &(sdata->stats);
 }
-
+EXPORT_SYMBOL(ieee80211_dev_stats);
 
 int ieee80211_rate_control_register(struct rate_control_ops *ops)
 {
@@ -4727,7 +4736,7 @@ int ieee80211_rate_control_register(stru
 
 	return 0;
 }
-
+EXPORT_SYMBOL(ieee80211_rate_control_register);
 
 void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
 {
@@ -4748,7 +4757,7 @@ void ieee80211_rate_control_unregister(s
 		alg = alg->next;
 	}
 }
-
+EXPORT_SYMBOL(ieee80211_rate_control_unregister);
 
 static int rate_control_initialize(struct ieee80211_local *local)
 {
@@ -4813,34 +4822,6 @@ static void __exit ieee80211_exit(void)
 }
 
 
-EXPORT_SYMBOL(ieee80211_alloc_hw);
-EXPORT_SYMBOL(ieee80211_register_hw);
-EXPORT_SYMBOL(ieee80211_update_hw);
-EXPORT_SYMBOL(ieee80211_unregister_hw);
-EXPORT_SYMBOL(ieee80211_free_hw);
-EXPORT_SYMBOL(__ieee80211_rx);
-EXPORT_SYMBOL(ieee80211_tx_status);
-EXPORT_SYMBOL(ieee80211_beacon_get);
-EXPORT_SYMBOL(ieee80211_get_buffered_bc);
-EXPORT_SYMBOL(ieee80211_netif_oper);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_start_queues);
-EXPORT_SYMBOL(ieee80211_dev_hw_data);
-EXPORT_SYMBOL(ieee80211_dev_stats);
-EXPORT_SYMBOL(ieee80211_get_hw_conf);
-EXPORT_SYMBOL(ieee80211_set_aid_for_sta);
-EXPORT_SYMBOL(ieee80211_rx_irqsafe);
-EXPORT_SYMBOL(ieee80211_tx_status_irqsafe);
-EXPORT_SYMBOL(ieee80211_get_hdrlen);
-EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
-EXPORT_SYMBOL(ieee80211_rate_control_register);
-EXPORT_SYMBOL(ieee80211_rate_control_unregister);
-EXPORT_SYMBOL(sta_info_get);
-EXPORT_SYMBOL(sta_info_put);
-EXPORT_SYMBOL(ieee80211_radar_status);
-EXPORT_SYMBOL(ieee80211_get_mc_list_item);
-
 module_init(ieee80211_init);
 module_exit(ieee80211_exit);
 
diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c
index dd5bc97..5d4b001 100644
--- a/net/d80211/sta_info.c
+++ b/net/d80211/sta_info.c
@@ -76,6 +76,7 @@ struct sta_info * sta_info_get(struct ie
 
 	return sta;
 }
+EXPORT_SYMBOL(sta_info_get);
 
 int sta_info_min_txrate_get(struct ieee80211_local *local)
 {
@@ -104,6 +105,7 @@ void sta_info_put(struct sta_info *sta)
 {
 	kobject_put(&sta->kobj);
 }
+EXPORT_SYMBOL(sta_info_put);
 
 void sta_info_release(struct kobject *kobj)
 {
-- 
1.3.0


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

* [PATCH 8/21] d80211: clean up includes
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (6 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 7/21] d80211: clean up exports Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 9/21] d80211: fix some sparse warnings Jiri Benc
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch cleans up includes all over d80211. It might
not be complete, but this was the best I could do without
analysing it completely.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/aes_ccm.c         |    1 -
 net/d80211/aes_ccm.h         |    2 +-
 net/d80211/fifo_qdisc.c      |    4 +---
 net/d80211/ieee80211.c       |    2 --
 net/d80211/ieee80211_ioctl.c |    2 --
 net/d80211/ieee80211_key.h   |    1 +
 net/d80211/ieee80211_scan.c  |    2 --
 net/d80211/ieee80211_sta.c   |    2 --
 net/d80211/rate_control.c    |    2 --
 net/d80211/sta_info.c        |    3 +--
 net/d80211/sta_info.h        |    4 ++--
 net/d80211/tkip.c            |   15 ---------------
 net/d80211/tkip.h            |    1 +
 net/d80211/wep.c             |    2 --
 net/d80211/wme.c             |    2 --
 net/d80211/wpa.c             |    4 ----
 16 files changed, 7 insertions(+), 42 deletions(-)

681294dce73ff7ea535636dd0a5aeb288744db2d
diff --git a/net/d80211/aes_ccm.c b/net/d80211/aes_ccm.c
index 8d1045c..693b822 100644
--- a/net/d80211/aes_ccm.c
+++ b/net/d80211/aes_ccm.c
@@ -8,7 +8,6 @@
  */
 
 #include <linux/types.h>
-#include <linux/netdevice.h>
 #include <linux/crypto.h>
 #include <asm/scatterlist.h>
 
diff --git a/net/d80211/aes_ccm.h b/net/d80211/aes_ccm.h
index 1544f5a..e900b36 100644
--- a/net/d80211/aes_ccm.h
+++ b/net/d80211/aes_ccm.h
@@ -10,7 +10,7 @@
 #ifndef AES_CCM_H
 #define AES_CCM_H
 
-#include <linux/types.h>
+#include <linux/crypto.h>
 
 #define AES_BLOCK_LEN 16
 
diff --git a/net/d80211/fifo_qdisc.c b/net/d80211/fifo_qdisc.c
index a89a839..12aaed5 100644
--- a/net/d80211/fifo_qdisc.c
+++ b/net/d80211/fifo_qdisc.c
@@ -10,9 +10,7 @@
  * This is a simple replacement for sch_fifo.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
-#include <linux/netdevice.h>
+#include <linux/skbuff.h>
 #include <net/pkt_sched.h>
 #include <net/d80211.h>
 #include "ieee80211_i.h"
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 9416538..c136859 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -7,8 +7,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/netdevice.h>
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index db8e8ba..35e4711 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -7,8 +7,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/netdevice.h>
diff --git a/net/d80211/ieee80211_key.h b/net/d80211/ieee80211_key.h
index 64f2363..1613594 100644
--- a/net/d80211/ieee80211_key.h
+++ b/net/d80211/ieee80211_key.h
@@ -11,6 +11,7 @@ #ifndef IEEE80211_KEY_H
 #define IEEE80211_KEY_H
 
 #include <linux/types.h>
+#include <linux/kobject.h>
 #include <net/d80211.h>
 
 /* ALG_TKIP
diff --git a/net/d80211/ieee80211_scan.c b/net/d80211/ieee80211_scan.c
index 539b8a2..8ed1e39 100644
--- a/net/d80211/ieee80211_scan.c
+++ b/net/d80211/ieee80211_scan.c
@@ -6,8 +6,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/types.h>
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 645529f..0c5bf88 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -15,8 +15,6 @@
  * scan result table filtering (by capability (privacy, IBSS/BSS, WPA/RSN IE,
  *    SSID)
  */
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/if_ether.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
diff --git a/net/d80211/rate_control.c b/net/d80211/rate_control.c
index ff383ab..5f03629 100644
--- a/net/d80211/rate_control.c
+++ b/net/d80211/rate_control.c
@@ -7,8 +7,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/netdevice.h>
diff --git a/net/d80211/sta_info.c b/net/d80211/sta_info.c
index 5d4b001..622b234 100644
--- a/net/d80211/sta_info.c
+++ b/net/d80211/sta_info.c
@@ -6,8 +6,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kobject.h>
@@ -20,6 +18,7 @@ #include <linux/if_arp.h>
 #include <net/d80211.h>
 #include "ieee80211_i.h"
 #include "rate_control.h"
+#include "sta_info.h"
 
 
 /* Caller must hold local->sta_lock */
diff --git a/net/d80211/sta_info.h b/net/d80211/sta_info.h
index 1f0f845..f7a56c0 100644
--- a/net/d80211/sta_info.h
+++ b/net/d80211/sta_info.h
@@ -9,9 +9,9 @@
 #ifndef STA_INFO_H
 #define STA_INFO_H
 
-#include <linux/if_ether.h>
+#include <linux/list.h>
 #include <linux/types.h>
-#include "ieee80211_i.h"
+#include <linux/if_ether.h>
 #include "ieee80211_key.h"
 
 /* Stations flags (struct sta_info::flags) */
diff --git a/net/d80211/tkip.c b/net/d80211/tkip.c
index c27a7fe..7e3665a 100644
--- a/net/d80211/tkip.c
+++ b/net/d80211/tkip.c
@@ -7,28 +7,13 @@
  * published by the Free Software Foundation.
  */
 
-#ifdef CONFIG_TKIP_DEBUG
-#include <linux/config.h>
-#include <linux/version.h>
-#include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/skbuff.h>
-#endif /* CONFIG_TKIP_DEBUG */
-
 #include <linux/types.h>
 #include <linux/netdevice.h>
 
 #include <net/d80211.h>
 #include "ieee80211_key.h"
-#ifdef CONFIG_TKIP_DEBUG
-#include "ieee80211_i.h"
-#endif /* CONFIG_TKIP_DEBUG */
 #include "tkip.h"
-
-/* Dummy prototypes for structures used in wep.h, but not really needed for
- * TKIP. */
-struct ieee80211_local;
-struct sk_buff;
 #include "wep.h"
 
 
diff --git a/net/d80211/tkip.h b/net/d80211/tkip.h
index dc66421..e36b85c 100644
--- a/net/d80211/tkip.h
+++ b/net/d80211/tkip.h
@@ -10,6 +10,7 @@ #ifndef TKIP_H
 #define TKIP_H
 
 #include <linux/types.h>
+#include <linux/crypto.h>
 #include "ieee80211_key.h"
 
 u8 * ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
diff --git a/net/d80211/wep.c b/net/d80211/wep.c
index 097a7e9..c3e4728 100644
--- a/net/d80211/wep.c
+++ b/net/d80211/wep.c
@@ -8,8 +8,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/netdevice.h>
 #include <linux/types.h>
 #include <linux/random.h>
diff --git a/net/d80211/wme.c b/net/d80211/wme.c
index b1ff066..60dd8c2 100644
--- a/net/d80211/wme.c
+++ b/net/d80211/wme.c
@@ -6,8 +6,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/module.h>
diff --git a/net/d80211/wpa.c b/net/d80211/wpa.c
index 5270b8c..412b4a6 100644
--- a/net/d80211/wpa.c
+++ b/net/d80211/wpa.c
@@ -6,15 +6,11 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
-#include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/skbuff.h>
 #include <linux/compiler.h>
-#include <linux/wireless.h>
 #include <net/iw_handler.h>
 
 #include <net/d80211.h>
-- 
1.3.0


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

* [PATCH 9/21] d80211: fix some sparse warnings
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (7 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 8/21] d80211: clean up includes Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 10/21] d80211: make lowlevel TX framedump option visible Jiri Benc
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch fixes some warnings from sparse in d80211. Also
fixes indentation in places near where the changes were.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 include/net/d80211.h       |   38 +++++++++++++++++++-------------------
 net/d80211/ieee80211.c     |   16 ++++++++--------
 net/d80211/ieee80211_i.h   |   40 ++++++++++++++++++++--------------------
 net/d80211/ieee80211_key.h |    6 +++---
 net/d80211/rate_control.c  |    2 +-
 net/d80211/sta_info.h      |    6 +++---
 6 files changed, 54 insertions(+), 54 deletions(-)

5b188f3e93922150f3bee76e4980340db099a272
diff --git a/include/net/d80211.h b/include/net/d80211.h
index da1892f..17238bd 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -246,10 +246,10 @@ struct ieee80211_conf {
 
 	/* Bitfields, grouped together */
 
-	int sw_encrypt:1;
-	int sw_decrypt:1;
-	int short_slot_time:1;		/* use IEEE 802.11g Short Slot Time */
-        int ssid_hidden:1;		/* do not broadcast the ssid */
+	unsigned int sw_encrypt:1;
+	unsigned int sw_decrypt:1;
+	unsigned int short_slot_time:1;	/* use IEEE 802.11g Short Slot Time */
+	unsigned int ssid_hidden:1;	/* do not broadcast the ssid */
 
         u8 power_level;			/* transmit power limit for current
 					 * regulatory domain; in dBm */
@@ -376,13 +376,13 @@ struct ieee80211_key_conf {
 	ieee80211_key_alg alg;
 	int keylen;
 
-        int force_sw_encrypt:1;		/* to be cleared by low-level driver */
+	unsigned int force_sw_encrypt:1;/* to be cleared by low-level driver */
 	int keyidx:8;			/* WEP key index */
-	int default_tx_key:1;		/* This key is the new default TX key
+	unsigned int default_tx_key:1;	/* This key is the new default TX key
 			       		 * (used only for broadcast keys). */
-	int default_wep_only:1; /* static WEP is the only configured security
-				 * policy; this allows some low-level drivers
-				 * to determine when hwaccel can be used */
+	unsigned int default_wep_only:1;/* static WEP is the only configured security
+					 * policy; this allows some low-level drivers
+					 * to determine when hwaccel can be used */
         u8 key[0];
 };
 
@@ -441,20 +441,20 @@ struct ieee80211_hw {
 	 * configure upper layer IEEE 802.11 module to generate beacons. The
 	 * low-level driver can use ieee80211_beacon_get() to fetch next
 	 * beacon frame. */
-	int host_gen_beacon:1;
+	unsigned int host_gen_beacon:1;
 
 	/* The device needs to be supplied with a beacon template only. */
-	int host_gen_beacon_template:1;
+	unsigned int host_gen_beacon_template:1;
 
 	/* Some devices handle decryption internally and do not
 	 * indicate whether the frame was encrypted (unencrypted frames
 	 * will be dropped by the hardware, unless specifically allowed
 	 * through) */
-        int device_hides_wep:1;
+	unsigned int device_hides_wep:1;
 
 	/* Whether RX frames passed to ieee80211_rx() include FCS in the end
 	 */
-	int rx_includes_fcs:1;
+	unsigned int rx_includes_fcs:1;
 
 	/* Some wireless LAN chipsets buffer broadcast/multicast frames for
 	 * power saving stations in the hardware/firmware and others rely on
@@ -462,19 +462,19 @@ struct ieee80211_hw {
 	 * configure upper layer IEEE 802.11 to buffer broadcast/multicast
 	 * frames when there are power saving stations so that low-level driver
 	 * can fetch them with ieee80211_get_buffered_bc(). */
-	int host_broadcast_ps_buffering:1;
+	unsigned int host_broadcast_ps_buffering:1;
 
-	int wep_include_iv:1;
-	int data_nullfunc_ack:1; /* will data nullfunc frames get proper
-                                  * TX status callback */
+	unsigned int wep_include_iv:1;
+	unsigned int data_nullfunc_ack:1; /* will data nullfunc frames get proper
+					   * TX status callback */
 
 	/* Force sw version of encryption for TKIP packets if WMM is enabled.
 	 */
-	int no_tkip_wmm_hwaccel:1;
+	unsigned int no_tkip_wmm_hwaccel:1;
 
         /* 1 if the payload needs to be padded at even boundaries after the
 	 * header */
-        unsigned int extra_hdr_room:1;
+	unsigned int extra_hdr_room:1;
 
 	/* Some devices handle Michael MIC internally and do not include MIC in
 	 * the received packets given to 80211.o. device_strips_mic must be set
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index c136859..b9bea6a 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -237,7 +237,7 @@ static void ieee80211_key_threshold_noti
 
 	key->tx_rx_count = 0;
 
-	ieee80211_rx_mgmt(dev, skb, 0,
+	ieee80211_rx_mgmt(dev, skb, NULL,
 			  ieee80211_msg_key_threshold_notification);
 }
 
@@ -2652,7 +2652,7 @@ int ieee80211_radar_status(struct net_de
 	msg->radar = radar;
 	msg->radar_type = radar_type;
 
-	ieee80211_rx_mgmt(dev, skb, 0, ieee80211_msg_radar);
+	ieee80211_rx_mgmt(dev, skb, NULL, ieee80211_msg_radar);
 	return 0;
 }
 EXPORT_SYMBOL(ieee80211_radar_status);
@@ -2660,8 +2660,8 @@ EXPORT_SYMBOL(ieee80211_radar_status);
 int ieee80211_set_aid_for_sta(struct net_device *dev, u8 *peer_address,
 			      u16 aid)
 {
-        struct sk_buff *skb;
-        struct ieee80211_msg_set_aid_for_sta *msg;
+	struct sk_buff *skb;
+	struct ieee80211_msg_set_aid_for_sta *msg;
 
 	skb = dev_alloc_skb(sizeof(struct ieee80211_frame_info) +
 			    sizeof(struct ieee80211_msg_set_aid_for_sta));
@@ -2670,13 +2670,13 @@ int ieee80211_set_aid_for_sta(struct net
 		return -ENOMEM;
 	skb_reserve(skb, sizeof(struct ieee80211_frame_info));
 
-        msg = (struct ieee80211_msg_set_aid_for_sta *)
+	msg = (struct ieee80211_msg_set_aid_for_sta *)
 		skb_put(skb, sizeof(struct ieee80211_msg_set_aid_for_sta));
 	memcpy(msg->sta_address, peer_address, ETH_ALEN);
-        msg->aid = aid;
+	msg->aid = aid;
 
-        ieee80211_rx_mgmt(dev, skb, 0, ieee80211_msg_set_aid_for_sta);
-        return 0;
+	ieee80211_rx_mgmt(dev, skb, NULL, ieee80211_msg_set_aid_for_sta);
+	return 0;
 }
 EXPORT_SYMBOL(ieee80211_set_aid_for_sta);
 
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index f38eea0..0d2d79d 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -115,10 +115,10 @@ struct ieee80211_txrx_data {
 	union {
 		struct {
 			struct ieee80211_tx_control *control;
-			int unicast:1;
-			int ps_buffered:1;
-			int short_preamble:1;
-			int probe_last_frag:1;
+			unsigned int unicast:1;
+			unsigned int ps_buffered:1;
+			unsigned int short_preamble:1;
+			unsigned int probe_last_frag:1;
 			struct ieee80211_rate *rate;
 			/* use this rate (if set) for last fragment; rate can
 			 * be set to lower rate for the first fragments, e.g.,
@@ -138,10 +138,10 @@ struct ieee80211_txrx_data {
 			int sent_ps_buffered;
 			int queue;
 			int load;
-			int in_scan:1;
-			int ra_match:1; /* frame is destined to interface
-					 * currently processed (including
-					 * multicast frames) */
+			unsigned int in_scan:1;
+			/* frame is destined to interface currently processed
+			 * (including multicast frames) */
+			unsigned int ra_match:1;
 		} rx;
 	} u;
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
@@ -255,16 +255,16 @@ struct ieee80211_if_sta {
 
 	int auth_tries, assoc_tries;
 
-	int ssid_set:1;
-	int bssid_set:1;
-	int prev_bssid_set:1;
-	int authenticated:1;
-	int associated:1;
-	int probereq_poll:1;
-	int use_protection:1;
-	int create_ibss:1;
-	int mixed_cell:1;
-	int wmm_enabled:1;
+	unsigned int ssid_set:1;
+	unsigned int bssid_set:1;
+	unsigned int prev_bssid_set:1;
+	unsigned int authenticated:1;
+	unsigned int associated:1;
+	unsigned int probereq_poll:1;
+	unsigned int use_protection:1;
+	unsigned int create_ibss:1;
+	unsigned int mixed_cell:1;
+	unsigned int wmm_enabled:1;
 
 	int key_mgmt;
 	unsigned long last_probe;
@@ -293,8 +293,8 @@ struct ieee80211_sub_if_data {
         struct ieee80211_local *local;
 
 	int mc_count;
-	unsigned allmulti:1;
-	unsigned promisc:1;
+	unsigned int allmulti:1;
+	unsigned int promisc:1;
 
         struct net_device_stats stats;
 	int drop_unencrypted;
diff --git a/net/d80211/ieee80211_key.h b/net/d80211/ieee80211_key.h
index 1613594..be1a3ce 100644
--- a/net/d80211/ieee80211_key.h
+++ b/net/d80211/ieee80211_key.h
@@ -77,10 +77,10 @@ #endif
 
 	/* if the low level driver can provide hardware acceleration it should
 	 * clear this flag */
-	int force_sw_encrypt:1;
+	unsigned int force_sw_encrypt:1;
 	int keyidx:8; /* WEP key index */
-	int default_tx_key:1; /* This key is the new default TX key
-			       * (used only for broadcast keys). */
+	unsigned int default_tx_key:1; /* This key is the new default TX key
+					* (used only for broadcast keys). */
 
 	u8 key[0];
 };
diff --git a/net/d80211/rate_control.c b/net/d80211/rate_control.c
index 5f03629..30c31ee 100644
--- a/net/d80211/rate_control.c
+++ b/net/d80211/rate_control.c
@@ -375,7 +375,7 @@ static struct rate_control_ops rate_cont
 };
 
 
-int __init rate_control_simple_init(void)
+static int __init rate_control_simple_init(void)
 {
 	return ieee80211_rate_control_register(&rate_control_simple);
 }
diff --git a/net/d80211/sta_info.h b/net/d80211/sta_info.h
index f7a56c0..8d23047 100644
--- a/net/d80211/sta_info.h
+++ b/net/d80211/sta_info.h
@@ -94,9 +94,9 @@ struct sta_info {
 				  * filtering; used only if sta->key is not
 				  * set */
 
-	int sysfs_registered:1;
-	int assoc_ap:1; /* whether this is an AP that we are associated with
-			 * as a client */
+	unsigned int sysfs_registered:1;
+	unsigned int assoc_ap:1; /* whether this is an AP that we are
+				  * associated with as a client */
 
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
 	u32 wpa_trigger;
-- 
1.3.0


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

* [PATCH 10/21] d80211: make lowlevel TX framedump option visible
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (8 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 9/21] d80211: fix some sparse warnings Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 11/21] d80211: surface IBSS debug Jiri Benc
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch surfaces the lowlevel TX framedump option in Kconfig.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/Kconfig     |   13 +++++++++++++
 net/d80211/ieee80211.c |    6 +++---
 2 files changed, 16 insertions(+), 3 deletions(-)

bebc14745291105672e2cc3c46821e1c0731b330
diff --git a/net/d80211/Kconfig b/net/d80211/Kconfig
index 36df52d..ffe2bdf 100644
--- a/net/d80211/Kconfig
+++ b/net/d80211/Kconfig
@@ -21,6 +21,19 @@ config D80211_VERBOSE_DEBUG
 	bool "Verbose debugging output"
 	depends on D80211_DEBUG
 
+config D80211_LOWTX_FRAME_DUMP
+	bool "Debug frame dumping"
+	depends on D80211_DEBUG
+	---help---
+	  Selecting this option will cause the stack to
+	  print a message for each frame that is handed
+	  to the lowlevel driver for transmission. This
+	  message includes all MAC addresses and the
+	  frame control field.
+
+	  If unsure, say N and insert the debugging code
+	  you require into the driver you are debugging.
+
 config TKIP_DEBUG
 	bool "TKIP debugging"
 	depends on D80211_DEBUG
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index b9bea6a..96ef85a 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -284,7 +284,7 @@ int ieee80211_get_hdrlen_from_skb(struct
 }
 EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
 
-#ifdef IEEE80211_VERBOSE_DEBUG_FRAME_DUMP
+#ifdef CONFIG_D80211_LOWTX_FRAME_DUMP
 static void ieee80211_dump_frame(const char *ifname, const char *title,
 				 struct sk_buff *skb)
 {
@@ -315,12 +315,12 @@ static void ieee80211_dump_frame(const c
 		printk(" A4=" MAC_FMT, MAC_ARG(hdr->addr4));
 	printk("\n");
 }
-#else /* IEEE80211_VERBOSE_DEBUG_FRAME_DUMP */
+#else /* CONFIG_D80211_LOWTX_FRAME_DUMP */
 static inline void ieee80211_dump_frame(const char *ifname, const char *title,
 					struct sk_buff *skb)
 {
 }
-#endif /* IEEE80211_VERBOSE_DEBUG_FRAME_DUMP */
+#endif /* CONFIG_D80211_LOWTX_FRAME_DUMP */
 
 
 static int ieee80211_is_eapol(struct sk_buff *skb)
-- 
1.3.0


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

* [PATCH 11/21] d80211: surface IBSS debug
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (9 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 10/21] d80211: make lowlevel TX framedump option visible Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 12/21] d80211: get rid of MICHAEL_MIC_HWACCEL define Jiri Benc
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch surfaces the IBSS debug switch in Kconfig.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/Kconfig         |    6 ++++++
 net/d80211/ieee80211_sta.c |   30 ++++++++++++++----------------
 2 files changed, 20 insertions(+), 16 deletions(-)

9b827dcb576bb80d8dc837d777812fa69b8af438
diff --git a/net/d80211/Kconfig b/net/d80211/Kconfig
index ffe2bdf..ae39e6e 100644
--- a/net/d80211/Kconfig
+++ b/net/d80211/Kconfig
@@ -45,3 +45,9 @@ config D80211_DEBUG_COUNTERS
 config HOSTAPD_WPA_TESTING
 	bool "Support for TKIP countermeasures testing"
 	depends on D80211_DEBUG
+
+config D80211_IBSS_DEBUG
+	bool "Support for IBSS testing"
+	depends on D80211_DEBUG
+	---help---
+	  Say Y here if you intend to debug the IBSS code.
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 0c5bf88..12d6c99 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -31,8 +31,6 @@ #include "ieee80211_i.h"
 #include "rate_control.h"
 #include "hostapd_ioctl.h"
 
-/* #define IEEE80211_IBSS_DEBUG */
-
 #define IEEE80211_AUTH_TIMEOUT (HZ / 5)
 #define IEEE80211_AUTH_MAX_TRIES 3
 #define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
@@ -1359,7 +1357,7 @@ #endif
 
 	if (sdata->type == IEEE80211_IF_TYPE_IBSS && beacon &&
 	    memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) {
-#ifdef IEEE80211_IBSS_DEBUG
+#ifdef CONFIG_D80211_IBSS_DEBUG
 		static unsigned long last_tsf_debug = 0;
 		u64 tsf;
 		if (local->hw->get_tsf)
@@ -1374,7 +1372,7 @@ #ifdef IEEE80211_IBSS_DEBUG
 			       tsf, timestamp, tsf - timestamp, jiffies);
 			last_tsf_debug = jiffies;
 		}
-#endif /* IEEE80211_IBSS_DEBUG */
+#endif /* CONFIG_D80211_IBSS_DEBUG */
 	}
 
 	if (ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen,
@@ -1654,12 +1652,12 @@ static void ieee80211_rx_mgmt_probe_req(
 	else
 		tx_last_beacon = 1;
 
-#ifdef IEEE80211_IBSS_DEBUG
+#ifdef CONFIG_D80211_IBSS_DEBUG
 	printk(KERN_DEBUG "%s: RX ProbeReq SA=" MAC_FMT " DA=" MAC_FMT " BSSID="
 	       MAC_FMT " (tx_last_beacon=%d)\n",
 	       dev->name, MAC_ARG(mgmt->sa), MAC_ARG(mgmt->da),
 	       MAC_ARG(mgmt->bssid), tx_last_beacon);
-#endif /* IEEE80211_IBSS_DEBUG */
+#endif /* CONFIG_D80211_IBSS_DEBUG */
 
 	if (!tx_last_beacon)
 		return;
@@ -1693,10 +1691,10 @@ #endif /* IEEE80211_IBSS_DEBUG */
 
 	resp = (struct ieee80211_mgmt *) skb->data;
 	memcpy(resp->da, mgmt->sa, ETH_ALEN);
-#ifdef IEEE80211_IBSS_DEBUG
+#ifdef CONFIG_D80211_IBSS_DEBUG
 	printk(KERN_DEBUG "%s: Sending ProbeResp to " MAC_FMT "\n",
 	       dev->name, MAC_ARG(resp->da));
-#endif /* IEEE80211_IBSS_DEBUG */
+#endif /* CONFIG_D80211_IBSS_DEBUG */
 	ieee80211_sta_tx(dev, skb, 0, 1);
 }
 
@@ -2193,10 +2191,10 @@ static int ieee80211_sta_find_ibss(struc
 		return -EINVAL;
 
 	active_ibss = ieee80211_sta_active_ibss(dev);
-#ifdef IEEE80211_IBSS_DEBUG
+#ifdef CONFIG_D80211_IBSS_DEBUG
 	printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n",
 	       dev->name, active_ibss);
-#endif /* IEEE80211_IBSS_DEBUG */
+#endif /* CONFIG_D80211_IBSS_DEBUG */
 	spin_lock_bh(&local->sta_bss_lock);
 	list_for_each(ptr, &local->sta_bss_list) {
 		bss = list_entry(ptr, struct ieee80211_sta_bss, list);
@@ -2204,10 +2202,10 @@ #endif /* IEEE80211_IBSS_DEBUG */
 		    memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0
 		    || !(bss->capability & WLAN_CAPABILITY_IBSS))
 			continue;
-#ifdef IEEE80211_IBSS_DEBUG
+#ifdef CONFIG_D80211_IBSS_DEBUG
 		printk(KERN_DEBUG "   bssid=" MAC_FMT " found\n",
 		       MAC_ARG(bss->bssid));
-#endif /* IEEE80211_IBSS_DEBUG */
+#endif /* CONFIG_D80211_IBSS_DEBUG */
 		memcpy(bssid, bss->bssid, ETH_ALEN);
 		found = 1;
 		if (active_ibss || memcmp(bssid, ifsta->bssid, ETH_ALEN) != 0)
@@ -2215,10 +2213,10 @@ #endif /* IEEE80211_IBSS_DEBUG */
 	}
 	spin_unlock_bh(&local->sta_bss_lock);
 
-#ifdef IEEE80211_IBSS_DEBUG
+#ifdef CONFIG_D80211_IBSS_DEBUG
 	printk(KERN_DEBUG "   sta_find_ibss: selected " MAC_FMT " current "
 	       MAC_FMT "\n", MAC_ARG(bssid), MAC_ARG(ifsta->bssid));
-#endif /* IEEE80211_IBSS_DEBUG */
+#endif /* CONFIG_D80211_IBSS_DEBUG */
 	if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 &&
 	    (bss = ieee80211_rx_bss_get(dev, bssid))) {
 		printk(KERN_DEBUG "%s: Selected IBSS BSSID " MAC_FMT
@@ -2226,9 +2224,9 @@ #endif /* IEEE80211_IBSS_DEBUG */
 		       dev->name, MAC_ARG(bssid));
 		return ieee80211_sta_join_ibss(dev, ifsta, bss);
 	}
-#ifdef IEEE80211_IBSS_DEBUG
+#ifdef CONFIG_D80211_IBSS_DEBUG
 	printk(KERN_DEBUG "   did not try to join ibss\n");
-#endif /* IEEE80211_IBSS_DEBUG */
+#endif /* CONFIG_D80211_IBSS_DEBUG */
 
 	/* Selected IBSS not found in current scan results - try to scan */
 	if (ifsta->state == IEEE80211_IBSS_JOINED &&
-- 
1.3.0


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

* [PATCH 12/21] d80211: get rid of MICHAEL_MIC_HWACCEL define
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (10 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 11/21] d80211: surface IBSS debug Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 13/21] d80211: surface powersave debug switch Jiri Benc
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

The symbol MICHAEL_MIC_HWACCEL is always defined and hence
all the ifdefs using it are useless. This patch removes it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/wpa.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)

0c2bf906ecdf3c6fda21aa83afb07f015dd7ec20
diff --git a/net/d80211/wpa.c b/net/d80211/wpa.c
index 412b4a6..31abf9b 100644
--- a/net/d80211/wpa.c
+++ b/net/d80211/wpa.c
@@ -25,9 +25,6 @@ #include "hostapd_ioctl.h"
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 
-#define MICHAEL_MIC_HWACCEL
-
-
 int ieee80211_get_hdr_info(const struct sk_buff *skb, u8 **sa, u8 **da,
 			   u8 *qos_tid, u8 **data, size_t *data_len)
 {
@@ -87,9 +84,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
 	u16 fc;
 	struct sk_buff *skb = tx->skb;
 	int authenticator;
-#if defined(CONFIG_HOSTAPD_WPA_TESTING) || defined(MICHAEL_MIC_HWACCEL)
 	int wpa_test = 0;
-#endif
 
 	fc = tx->fc;
 
@@ -108,14 +103,12 @@ #ifdef CONFIG_HOSTAPD_WPA_TESTING
 	}
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
-#ifdef MICHAEL_MIC_HWACCEL
 	if (!tx->key->force_sw_encrypt && !tx->local->conf.sw_decrypt &&
 	    !tx->fragmented && !wpa_test) {
 		/* hwaccel - with no need for preallocated room for Michael MIC
 		 */
 		return TXRX_CONTINUE;
 	}
-#endif /* MICHAEL_MIC_HWACCEL */
 
 	if (skb_tailroom(skb) < MICHAEL_MIC_LEN) {
 		I802_DEBUG_INC(tx->local->tx_expand_skb_head);
@@ -189,7 +182,6 @@ #ifdef CONFIG_HOSTAPD_WPA_TESTING
 	}
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
-#ifdef MICHAEL_MIC_HWACCEL
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
 	    !rx->key->force_sw_encrypt && !rx->local->conf.sw_decrypt) {
 		if (rx->local->hw->wep_include_iv) {
@@ -202,7 +194,6 @@ #ifdef MICHAEL_MIC_HWACCEL
 		if (!rx->fragmented && !wpa_test)
 			goto remove_mic;
 	}
-#endif /* MICHAEL_MIC_HWACCEL */
 
 	if (ieee80211_get_hdr_info(skb, &sa, &da, &qos_tid, &data, &data_len)
 	    || data_len < MICHAEL_MIC_LEN)
@@ -278,9 +269,7 @@ #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 		return TXRX_QUEUED;
 	}
 
-#ifdef MICHAEL_MIC_HWACCEL
  remove_mic:
-#endif /* MICHAEL_MIC_HWACCEL */
 	/* remove Michael MIC from payload */
 	skb_trim(skb, skb->len - MICHAEL_MIC_LEN);
 
-- 
1.3.0


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

* [PATCH 13/21] d80211: surface powersave debug switch
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (11 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 12/21] d80211: get rid of MICHAEL_MIC_HWACCEL define Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 14/21] d80211: fix some documentation Jiri Benc
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch makes the verbose powersave debugging
visible in Kconfig.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/Kconfig     |    7 +++++++
 net/d80211/ieee80211.c |   28 ++++++++++++++--------------
 2 files changed, 21 insertions(+), 14 deletions(-)

505c84c433dd4185c987844a10baf24fada3620d
diff --git a/net/d80211/Kconfig b/net/d80211/Kconfig
index ae39e6e..2f3c0a3 100644
--- a/net/d80211/Kconfig
+++ b/net/d80211/Kconfig
@@ -51,3 +51,10 @@ config D80211_IBSS_DEBUG
 	depends on D80211_DEBUG
 	---help---
 	  Say Y here if you intend to debug the IBSS code.
+
+config D80211_VERBOSE_PS_DEBUG
+	bool "Verbose powersave mode debugging"
+	depends on D80211_DEBUG
+	---help---
+	  Say Y here to print out verbose powersave
+	  mode debug messages.
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 96ef85a..ad37015 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1026,12 +1026,12 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
 
 	if (unlikely((sta->flags & WLAN_STA_PS) && !sta->pspoll)) {
 		struct ieee80211_tx_packet_data *pkt_data;
-#ifdef IEEE80211_VERBOSE_DEBUG_PS
+#ifdef CONFIG_D80211_VERBOSE_PS_DEBUG
 		printk(KERN_DEBUG "STA " MAC_FMT " aid %d: PS buffer (entries "
 		       "before %d)\n",
 		       MAC_ARG(sta->addr), sta->aid,
 		       skb_queue_len(&sta->ps_tx_buf));
-#endif /* IEEE80211_VERBOSE_DEBUG_PS */
+#endif /* CONFIG_D80211_VERBOSE_PS_DEBUG */
 		sta->flags |= WLAN_STA_TIM;
 		if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
 			purge_old_ps_buffers(tx->local);
@@ -1057,13 +1057,13 @@ #endif /* IEEE80211_VERBOSE_DEBUG_PS */
                 skb_queue_tail(&sta->ps_tx_buf, tx->skb);
 		return TXRX_QUEUED;
 	}
-#ifdef IEEE80211_VERBOSE_DEBUG_PS
+#ifdef CONFIG_D80211_VERBOSE_PS_DEBUG
 	else if (unlikely(sta->flags & WLAN_STA_PS)) {
 		printk(KERN_DEBUG "%s: STA " MAC_FMT " in PS mode, but pspoll "
 		       "set -> send frame\n", tx->dev->name,
 		       MAC_ARG(sta->addr));
 	}
-#endif /* IEEE80211_VERBOSE_DEBUG_PS */
+#endif /* CONFIG_D80211_VERBOSE_PS_DEBUG */
 	sta->pspoll = 0;
 
 	return TXRX_CONTINUE;
@@ -2689,10 +2689,10 @@ static void ap_sta_ps_start(struct net_d
 		atomic_inc(&sdata->bss->num_sta_ps);
 	sta->flags |= WLAN_STA_PS;
 	sta->pspoll = 0;
-#ifdef IEEE80211_VERBOSE_DEBUG_PS
+#ifdef CONFIG_D80211_VERBOSE_PS_DEBUG
 	printk(KERN_DEBUG "%s: STA " MAC_FMT " aid %d enters power "
 	       "save mode\n", dev->name, MAC_ARG(sta->addr), sta->aid);
-#endif /* IEEE80211_VERBOSE_DEBUG_PS */
+#endif /* CONFIG_D80211_VERBOSE_PS_DEBUG */
 }
 
 
@@ -2715,10 +2715,10 @@ static int ap_sta_ps_end(struct net_devi
 		if (sdata->bss)
 			bss_tim_clear(local, sdata->bss, sta->aid);
 	}
-#ifdef IEEE80211_VERBOSE_DEBUG_PS
+#ifdef CONFIG_D80211_VERBOSE_PS_DEBUG
 	printk(KERN_DEBUG "%s: STA " MAC_FMT " aid %d exits power "
 	       "save mode\n", dev->name, MAC_ARG(sta->addr), sta->aid);
-#endif /* IEEE80211_VERBOSE_DEBUG_PS */
+#endif /* CONFIG_D80211_VERBOSE_PS_DEBUG */
 	/* Send all buffered frames to the station */
 	while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) {
 		pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
@@ -2730,11 +2730,11 @@ #endif /* IEEE80211_VERBOSE_DEBUG_PS */
 		pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
 		local->total_ps_buffered--;
 		sent++;
-#ifdef IEEE80211_VERBOSE_DEBUG_PS
+#ifdef CONFIG_D80211_VERBOSE_PS_DEBUG
 		printk(KERN_DEBUG "%s: STA " MAC_FMT " aid %d send PS frame "
 		       "since STA not sleeping anymore\n", dev->name,
 		       MAC_ARG(sta->addr), sta->aid);
-#endif /* IEEE80211_VERBOSE_DEBUG_PS */
+#endif /* CONFIG_D80211_VERBOSE_PS_DEBUG */
 		pkt_data->requeue = 1;
 		dev_queue_xmit(skb);
 	}
@@ -2772,12 +2772,12 @@ ieee80211_rx_h_ps_poll(struct ieee80211_
 		 * still remain is PS mode after this frame exchange */
 		rx->sta->pspoll = 1;
 
-#ifdef IEEE80211_VERBOSE_DEBUG_PS
+#ifdef CONFIG_D80211_VERBOSE_PS_DEBUG
 		printk(KERN_DEBUG "STA " MAC_FMT " aid %d: PS Poll (entries "
 		       "after %d)\n",
 		       MAC_ARG(rx->sta->addr), rx->sta->aid,
 		       skb_queue_len(&rx->sta->ps_tx_buf));
-#endif /* IEEE80211_VERBOSE_DEBUG_PS */
+#endif /* CONFIG_D80211_VERBOSE_PS_DEBUG */
 
 		/* Use MoreData flag to indicate whether there are more
 		 * buffered frames for this STA */
@@ -2795,12 +2795,12 @@ #endif /* IEEE80211_VERBOSE_DEBUG_PS */
 			if (rx->sdata->bss)
 				bss_tim_clear(rx->local, rx->sdata->bss, rx->sta->aid);
 		}
-#ifdef IEEE80211_VERBOSE_DEBUG_PS
+#ifdef CONFIG_D80211_VERBOSE_PS_DEBUG
 	} else if (!rx->u.rx.sent_ps_buffered) {
 		printk(KERN_DEBUG "%s: STA " MAC_FMT " sent PS Poll even "
 		       "though there is no buffered frames for it\n",
 		       rx->dev->name, MAC_ARG(rx->sta->addr));
-#endif /* IEEE80211_VERBOSE_DEBUG_PS */
+#endif /* CONFIG_D80211_VERBOSE_PS_DEBUG */
 
 	}
 
-- 
1.3.0


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

* [PATCH 14/21] d80211: fix some documentation
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (12 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 13/21] d80211: surface powersave debug switch Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 15/21] d80211: switch status codes, reason codes, and EIDs to enums Jiri Benc
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This patch fixes some spelling errors, typos etc. in d80211.h

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 include/net/d80211.h |   94 ++++++++++++++++++++++++++------------------------
 1 files changed, 49 insertions(+), 45 deletions(-)

30aca4fb6d72c86a693016ca8f9eeb46a7ad9dee
diff --git a/include/net/d80211.h b/include/net/d80211.h
index 17238bd..23839b4 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -17,7 +17,7 @@ #include <linux/skbuff.h>
 #include <linux/wireless.h>
 #include "d80211_shared.h"
 
-/* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsave() can be
+/* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be
  * called in hardware interrupt context. The low-level driver must not call any
  * other functions in hardware interrupt context. If there is a need for such
  * call, the low-level driver should first ACK the interrupt and perform the
@@ -131,8 +131,8 @@ struct ieee80211_low_level_stats {
 };
 
 /* Transmit control fields. This data structure is passed to low-level driver
- * with each TX frame. The low-level driver is responsible of configuring
- * hardware to use given values (depending on what is supported). */
+ * with each TX frame. The low-level driver is responsible for configuring
+ * the hardware to use given values (depending on what is supported). */
 #define HW_KEY_IDX_INVALID -1
 
 struct ieee80211_tx_control {
@@ -162,7 +162,7 @@ struct ieee80211_tx_control {
 					 * frame */
 	 /* following three flags are only used with Atheros Super A/G */
 	unsigned int compress:1;
-	unsigned int turbo_prime_notify:1; /* notify HostaAPd after frame
+	unsigned int turbo_prime_notify:1; /* notify HostAPd after frame
 					    * transmission */
 	unsigned int fast_frame:1;
 
@@ -230,7 +230,10 @@ struct ieee80211_tx_status {
 
 
 /**
- * struct ieee80211_conf - configuration of a hardware
+ * struct ieee80211_conf - configuration of the device
+ *
+ * This struct indicates how the driver shall configure the hardware.
+ *
  * @radio_enabled: when zero, driver is required to switch off the radio.
  */
 struct ieee80211_conf {
@@ -290,7 +293,8 @@ struct ieee80211_conf {
 };
 
 /**
- * enum ieee80211_if_types - types of 802.11 network interface
+ * 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.
@@ -312,6 +316,7 @@ enum ieee80211_if_types {
 
 /**
  * struct ieee80211_if_init_conf - initial configuration of an interface
+ *
  * @if_id: internal interface ID. This number has no particular meaning to
  *	drivers and the only allowed usage is to pass it to
  *	ieee80211_beacon_get() and ieee80211_get_buffered_bc() functions.
@@ -334,26 +339,27 @@ struct ieee80211_if_init_conf {
 
 /**
  * struct ieee80211_if_conf - configuration of an interface
+ *
  * @type: type of the interface. This is always the same as was specified in
- *	&struct ieee80211_if_init_conf. The type of interface never change
- *	during the live of the interface; this field is present only for
+ *	&struct ieee80211_if_init_conf. The type of an interface never changes
+ *	during the life of the interface; this field is present only for
  *	convenience.
  * @bssid: BSSID of the network we are associated to/creating.
  * @ssid: used (together with @ssid_len) by drivers for hardware that
- *	generate beacons independently. The pointer is valid only during
- *	config_interface() callback (so copy the value somewhere if you need
- *	it).
+ *	generate beacons independently. The pointer is valid only during the
+ *	config_interface() call, so copy the value somewhere if you need
+ *	it.
  * @ssid_len: length of the @ssid field.
  * @generic_elem: used (together with @generic_elem_len) by drivers for
  *	hardware that generate beacons independently. The pointer is valid
- *	only during config_interface() callback (so copy the value somewhere
- *	if you need it).
+ *	only during the config_interface() call, so copy the value somewhere
+ *	if you need it.
  * @generic_elem_len: length of the generic element.
  * @beacon: beacon template. Valid only if @host_gen_beacon_template in
  *	&struct ieee80211_hw is set. The driver is responsible of freeing
  *	the sk_buff.
  *
- * This structure is passed to config_interface() callback of
+ * This structure is passed to the config_interface() callback of
  * &struct ieee80211_hw.
  */
 struct ieee80211_if_conf {
@@ -425,8 +431,8 @@ typedef enum {
 	ENABLE_COMPRESSION, DISABLE_COMPRESSION
 } set_key_cmd;
 
-/* Configuration block used by the low-level driver to tell 802.11 code about
- * supported hardware features and to pass function pointers for callback
+/* Configuration block used by the low-level driver to tell the 802.11 code
+ * about supported hardware features and to pass function pointers to callback
  * functions. */
 struct ieee80211_hw {
 	int version; /* IEEE80211_VERSION */
@@ -438,9 +444,9 @@ struct ieee80211_hw {
 
 	/* Some wireless LAN chipsets generate beacons in the hardware/firmware
 	 * and others rely on host generated beacons. This option is used to
-	 * configure upper layer IEEE 802.11 module to generate beacons. The
-	 * low-level driver can use ieee80211_beacon_get() to fetch next
-	 * beacon frame. */
+	 * configure the upper layer IEEE 802.11 module to generate beacons.
+	 * The low-level driver can use ieee80211_beacon_get() to fetch the
+	 * next beacon frame. */
 	unsigned int host_gen_beacon:1;
 
 	/* The device needs to be supplied with a beacon template only. */
@@ -452,14 +458,13 @@ struct ieee80211_hw {
 	 * through) */
 	unsigned int device_hides_wep:1;
 
-	/* Whether RX frames passed to ieee80211_rx() include FCS in the end
-	 */
+	/* Whether RX frames passed to ieee80211_rx() include FCS in the end */
 	unsigned int rx_includes_fcs:1;
 
 	/* Some wireless LAN chipsets buffer broadcast/multicast frames for
 	 * power saving stations in the hardware/firmware and others rely on
 	 * the host system for such buffering. This option is used to
-	 * configure upper layer IEEE 802.11 to buffer broadcast/multicast
+	 * configure the IEEE 802.11 upper layer to buffer broadcast/multicast
 	 * frames when there are power saving stations so that low-level driver
 	 * can fetch them with ieee80211_get_buffered_bc(). */
 	unsigned int host_broadcast_ps_buffering:1;
@@ -468,18 +473,18 @@ struct ieee80211_hw {
 	unsigned int data_nullfunc_ack:1; /* will data nullfunc frames get proper
 					   * TX status callback */
 
-	/* Force sw version of encryption for TKIP packets if WMM is enabled.
-	 */
+	/* Force software encryption for TKIP packets if WMM is enabled. */
 	unsigned int no_tkip_wmm_hwaccel:1;
 
-        /* 1 if the payload needs to be padded at even boundaries after the
+	/* set if the payload needs to be padded at even boundaries after the
 	 * header */
 	unsigned int extra_hdr_room:1;
 
 	/* Some devices handle Michael MIC internally and do not include MIC in
-	 * the received packets given to 80211.o. device_strips_mic must be set
-	 * for such devices. ISWEP bit is still expected to be set in the IEEE
-	 * 802.11 header with this option unlike with device_hides_wep option.
+	 * the received packets passed up. device_strips_mic must be set
+	 * for such devices. The 'encryption' frame control bit is expected to
+	 * be still set in the IEEE 802.11 header with this option unlike with
+	 * the device_hides_wep configuration option.
 	 */
 	unsigned int device_strips_mic:1;
 
@@ -487,9 +492,9 @@ struct ieee80211_hw {
 	 * normal operation. */
 	unsigned int monitor_during_oper:1;
 
-	/* 1 = low-level driver supports skb fraglist (NETIF_F_FRAGLIST), i.e.,
-	 * more than one skb per frame */
-	unsigned int fraglist;
+	/* Set if the low-level driver supports skb fraglist (NETIF_F_FRAGLIST),
+	 * i.e. more than one skb per frame */
+	unsigned int fraglist:1;
 
         /* This is the time in us to change channels
          */
@@ -521,17 +526,17 @@ struct ieee80211_hw {
 	/* Handler for asking a driver if a new interface can be added (or,
 	 * more exactly, set UP). If the handler returns zero, the interface
 	 * is added. Driver should perform any initialization it needs prior
-	 * to returning zero. By returning non-zero, adding of the interface
-	 * is not permitted. Unless monitor_during_oper is set, it is
-	 * guaranteed that monitor interfaces and normal interfaces are
-	 * mutually exclusive. The open() handler is called after
-	 * add_interface() if this is the first device added. At least one
-	 * of open() and add_interface() handler has to be non-NULL. If
+	 * to returning zero. By returning non-zero addition of the interface
+	 * is inhibited. Unless monitor_during_oper is set, it is guaranteed
+	 * that monitor interfaces and normal interfaces are mutually
+	 * exclusive. The open() handler is called after add_interface()
+	 * if this is the first device added. At least one of the open()
+	 * open() and add_interface() callbacks has to be assigned. If
 	 * add_interface() is NULL, one STA interface is permitted only. */
 	int (*add_interface)(struct net_device *dev,
 			     struct ieee80211_if_init_conf *conf);
 
-	/* Notify a driver that interface is going down. The stop() handler
+	/* Notify a driver that an interface is going down. The stop() handler
 	 * is called prior to this if this is a last interface. */
 	void (*remove_interface)(struct net_device *dev,
 				 struct ieee80211_if_init_conf *conf);
@@ -545,9 +550,9 @@ struct ieee80211_hw {
 	int (*config_interface)(struct net_device *dev, int if_id,
 				struct ieee80211_if_conf *conf);
 
-	/* ieee80211 drivers should use this and not the function in
-	 * net_device. dev->flags, dev->mc_count and dev->mc_list must not
-	 * be used; use passed parameters and ieee80211_get_mc_list_item()
+	/* ieee80211 drivers must assign this instead of the callback in
+	 * &struct net_device. dev->flags, dev->mc_count and dev->mc_list must
+	 * not be used; use passed parameters and ieee80211_get_mc_list_item()
 	 * instead. */
 	void (*set_multicast_list)(struct net_device *dev,
 				   unsigned short flags, int mc_count);
@@ -571,14 +576,14 @@ struct ieee80211_hw {
 	/* Set TX key index for default/broadcast keys. This is needed in cases
 	 * where wlan card is doing full WEP/TKIP encapsulation (wep_include_iv
 	 * is not set), in other cases, this function pointer can be set to
-	 * NULL since 80211.o takes care of selecting the key index for each
-	 * TX frame. */
+	 * NULL since the IEEE 802. 11 module takes care of selecting the key
+	 * index for each TX frame. */
 	int (*set_key_idx)(struct net_device *dev, int idx);
 
 	/* Enable/disable IEEE 802.1X. This item requests wlan card to pass
 	 * unencrypted EAPOL-Key frames even when encryption is configured.
 	 * If the wlan card does not require such a configuration, this
-	 * function pointer can be set to NULL. 80211.o */
+	 * function pointer can be set to NULL. */
 	int (*set_ieee8021x)(struct net_device *dev, int use_ieee8021x);
 
 	/* Set port authorization state (IEEE 802.1X PAE) to be authorized
@@ -608,7 +613,6 @@ struct ieee80211_hw {
         /* For devices that generate their own beacons and probe response
          * or association responses this updates the state of privacy_invoked
          * returns 0 for success or an error number */
-
         int (*set_privacy_invoked)(struct net_device *dev,
                                    int privacy_invoked);
 
-- 
1.3.0


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

* [PATCH 15/21] d80211: switch status codes, reason codes, and EIDs to enums
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (13 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 14/21] d80211: fix some documentation Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 16/21] d80211: Group EIDs by standard, add remaining 802.11d EIDs Jiri Benc
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Michael Wu <flamingice@sourmilk.net>

This patch converts the status code, reason code, and EID defines in
d80211_mgmt.h to enums. It also adds some status and reason codes, fixes some
typos (DENOED, QUITE), and uses the ieee80211.h version of the name where
reasonable.

Signed-off-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 include/net/d80211_mgmt.h |  149 ++++++++++++++++++++++++++-------------------
 1 files changed, 87 insertions(+), 62 deletions(-)

7bac23cee8567c27c42f460cf7e7d9c340674b31
diff --git a/include/net/d80211_mgmt.h b/include/net/d80211_mgmt.h
index f623db3..6981c6f 100644
--- a/include/net/d80211_mgmt.h
+++ b/include/net/d80211_mgmt.h
@@ -119,76 +119,101 @@ #define WLAN_CAPABILITY_SHORT_SLOT_TIME 
 #define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
 
 /* Status codes */
-#define WLAN_STATUS_SUCCESS 0
-#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
-#define WLAN_STATUS_CAPS_UNSUPPORTED 10
-#define WLAN_STATUS_REASSOC_NO_ASSOC 11
-#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
-#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
-#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
-#define WLAN_STATUS_CHALLENGE_FAIL 15
-#define WLAN_STATUS_AUTH_TIMEOUT 16
-#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
-#define WLAN_STATUS_ASSOC_DENIED_RATES 18
-/* 802.11b */
-#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
-#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
-#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
-/* 802.11h */
-#define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
-#define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
-#define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
-/* 802.11g */
-#define WLAN_STATUS_ASSOC_DENOED_NO_SHORT_SLOT_TIME 25
-#define WLAN_STATUS_ASSOC_DENOED_NO_ER_PBCC 26
-#define WLAN_STATUS_ASSOC_DENOED_NO_DSSS_OFDM 27
+enum ieee80211_statuscode {
+	WLAN_STATUS_SUCCESS = 0,
+	WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
+	WLAN_STATUS_CAPS_UNSUPPORTED = 10,
+	WLAN_STATUS_REASSOC_NO_ASSOC = 11,
+	WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
+	WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
+	WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
+	WLAN_STATUS_CHALLENGE_FAIL = 15,
+	WLAN_STATUS_AUTH_TIMEOUT = 16,
+	WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
+	WLAN_STATUS_ASSOC_DENIED_RATES = 18,
+	/* 802.11b */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
+	WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
+	WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
+	/* 802.11h */
+	WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
+	/* 802.11g */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
+	WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
+	/* 802.11i */
+	WLAN_STATUS_INVALID_IE = 40,
+	WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
+	WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
+	WLAN_STATUS_INVALID_AKMP = 43,
+	WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
+	WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
+	WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
+};
 
 
 /* Reason codes */
-#define WLAN_REASON_UNSPECIFIED 1
-#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
-#define WLAN_REASON_DEAUTH_LEAVING 3
-#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
-#define WLAN_REASON_DISASSOC_AP_BUSY 5
-#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
-#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
-#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
-#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
-/* 802.11h */
-#define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
-#define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
-
-#define WLAN_REASON_MIC_FAILURE 14
+enum ieee80211_reasoncode {
+	WLAN_REASON_UNSPECIFIED = 1,
+	WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
+	WLAN_REASON_DEAUTH_LEAVING = 3,
+	WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
+	WLAN_REASON_DISASSOC_AP_BUSY = 5,
+	WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
+	WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
+	WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
+	WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
+	/* 802.11h */
+	WLAN_REASON_DISASSOC_BAD_POWER = 10,
+	WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
+	/* 802.11i */
+	WLAN_REASON_INVALID_IE = 13,
+	WLAN_REASON_MIC_FAILURE = 14,
+	WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
+	WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
+	WLAN_REASON_IE_DIFFERENT = 17,
+	WLAN_REASON_INVALID_GROUP_CIPHER = 18,
+	WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
+	WLAN_REASON_INVALID_AKMP = 20,
+	WLAN_REASON_UNSUPP_RSN_VERSION = 21,
+	WLAN_REASON_INVALID_RSN_IE_CAP = 22,
+	WLAN_REASON_IEEE8021X_FAILED = 23,
+	WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
+};
 
 
 /* Information Element IDs */
-#define WLAN_EID_SSID 0
-#define WLAN_EID_SUPP_RATES 1
-#define WLAN_EID_FH_PARAMS 2
-#define WLAN_EID_DS_PARAMS 3
-#define WLAN_EID_CF_PARAMS 4
-#define WLAN_EID_TIM 5
-#define WLAN_EID_IBSS_PARAMS 6
-#define WLAN_EID_COUNTRY 7
-#define WLAN_EID_CHALLENGE 16
+enum ieee80211_eid {
+	WLAN_EID_SSID = 0,
+	WLAN_EID_SUPP_RATES = 1,
+	WLAN_EID_FH_PARAMS = 2,
+	WLAN_EID_DS_PARAMS = 3,
+	WLAN_EID_CF_PARAMS = 4,
+	WLAN_EID_TIM = 5,
+	WLAN_EID_IBSS_PARAMS = 6,
+	WLAN_EID_COUNTRY = 7,
+	WLAN_EID_CHALLENGE = 16,
 /* EIDs defined as part fo 11h - starts */
-#define WLAN_EID_PWR_CONSTRAINT	32
-#define WLAN_EID_PWR_CAPABILITY	33
-#define WLAN_EID_TPC_REQUEST	34
-#define WLAN_EID_TPC_REPORT	35
-#define WLAN_EID_SUPPORTED_CHANNELS	36
-#define WLAN_EID_CHANNEL_SWITCH	37
-#define WLAN_EID_MEASURE_REQUEST	38
-#define WLAN_EID_MEASURE_REPORT	39
-#define WLAN_EID_QUITE	40
-#define WLAN_EID_IBSS_DFS	41
+	WLAN_EID_PWR_CONSTRAINT = 32,
+	WLAN_EID_PWR_CAPABILITY = 33,
+	WLAN_EID_TPC_REQUEST = 34,
+	WLAN_EID_TPC_REPORT = 35,
+	WLAN_EID_SUPPORTED_CHANNELS = 36,
+	WLAN_EID_CHANNEL_SWITCH = 37,
+	WLAN_EID_MEASURE_REQUEST = 38,
+	WLAN_EID_MEASURE_REPORT = 39,
+	WLAN_EID_QUIET = 40,
+	WLAN_EID_IBSS_DFS = 41,
 /* EIDs defined as part fo 11h - ends */
-#define WLAN_EID_ERP_INFO 42
-#define WLAN_EID_RSN 48
-#define WLAN_EID_EXT_SUPP_RATES 50
-#define WLAN_EID_WPA 221
-#define WLAN_EID_GENERIC 221
-#define WLAN_EID_VENDOR_SPECIFIC 221
+	WLAN_EID_ERP_INFO = 42,
+	WLAN_EID_RSN = 48,
+	WLAN_EID_EXT_SUPP_RATES = 50,
+	WLAN_EID_WPA = 221,
+	WLAN_EID_GENERIC = 221,
+	WLAN_EID_VENDOR_SPECIFIC = 221,
+	WLAN_EID_QOS_PARAMETER = 222
+};
 
 
 
-- 
1.3.0


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

* [PATCH 16/21] d80211: Group EIDs by standard, add remaining 802.11d EIDs
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (14 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 15/21] d80211: switch status codes, reason codes, and EIDs to enums Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 17/21] d80211: remove useless and wrong check for interface type Jiri Benc
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Michael Wu <flamingice@sourmilk.net>

This patch groups EIDs together by the 802.11 standard they were introduced in
and adds the remaining 802.11d EIDs. The spec where the QoS EID was
introduced still needs to be found. (does not appear to be 802.11e..) This
patch depends on the previous patch that converts the status/reason codes and
EIDs to enums.

Signed-off-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 include/net/d80211_mgmt.h |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

6b31161b5dbf014abc07eadfa473f921d9c313ea
diff --git a/include/net/d80211_mgmt.h b/include/net/d80211_mgmt.h
index 6981c6f..eb032de 100644
--- a/include/net/d80211_mgmt.h
+++ b/include/net/d80211_mgmt.h
@@ -192,9 +192,13 @@ enum ieee80211_eid {
 	WLAN_EID_CF_PARAMS = 4,
 	WLAN_EID_TIM = 5,
 	WLAN_EID_IBSS_PARAMS = 6,
-	WLAN_EID_COUNTRY = 7,
 	WLAN_EID_CHALLENGE = 16,
-/* EIDs defined as part fo 11h - starts */
+	/* 802.11d */
+	WLAN_EID_COUNTRY = 7,
+	WLAN_EID_HP_PARAMS = 8,
+	WLAN_EID_HP_TABLE = 9,
+	WLAN_EID_REQUEST = 10,
+	/* 802.11h */
 	WLAN_EID_PWR_CONSTRAINT = 32,
 	WLAN_EID_PWR_CAPABILITY = 33,
 	WLAN_EID_TPC_REQUEST = 34,
@@ -205,10 +209,11 @@ enum ieee80211_eid {
 	WLAN_EID_MEASURE_REPORT = 39,
 	WLAN_EID_QUIET = 40,
 	WLAN_EID_IBSS_DFS = 41,
-/* EIDs defined as part fo 11h - ends */
+	/* 802.11g */
 	WLAN_EID_ERP_INFO = 42,
-	WLAN_EID_RSN = 48,
 	WLAN_EID_EXT_SUPP_RATES = 50,
+	/* 802.11i */
+	WLAN_EID_RSN = 48,
 	WLAN_EID_WPA = 221,
 	WLAN_EID_GENERIC = 221,
 	WLAN_EID_VENDOR_SPECIFIC = 221,
-- 
1.3.0


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

* [PATCH 17/21] d80211: remove useless and wrong check for interface type
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (15 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 16/21] d80211: Group EIDs by standard, add remaining 802.11d EIDs Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 18/21] d80211: allow for large scan results Jiri Benc
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

The check for interface type in ieee80211_sta_rx_mgmt was wrong (it must
allow IBSS interface as well) and unnecessary, because the check is already
done in ieee80211_rx_h_mgmt.

Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/ieee80211_sta.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

d0c2e2f74781b478f708d58aa83cb83812705af1
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 12d6c99..a3bcc1b 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1711,11 +1711,6 @@ void ieee80211_sta_rx_mgmt(struct net_de
 		goto fail;
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-	if (sdata->type != IEEE80211_IF_TYPE_STA) {
-		printk(KERN_DEBUG "%s: ieee80211_sta_rx_mgmt: non-STA "
-		       "interface (type=%d)\n", dev->name, sdata->type);
-		goto fail;
-	}
 	ifsta = &sdata->u.sta;
 
 	mgmt = (struct ieee80211_mgmt *) skb->data;
-- 
1.3.0


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

* [PATCH 18/21] d80211: allow for large scan results
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (16 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 17/21] d80211: remove useless and wrong check for interface type Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 19/21] d80211: fix multiple device support Jiri Benc
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: David Kimdon <david.kimdon@devicescape.com>

Fix a problem where incomplete scan results could be returned if the
environment includes a large number of devices.  Do not truncate the
scan results and allow a result to contain more than IW_SCAN_MAX_DATA
bytes.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

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

fb6433e836927581362d71532f010b0d5aa7587b
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index 35e4711..53b7841 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -1992,7 +1992,7 @@ static int ieee80211_ioctl_giwscan(struc
 	struct ieee80211_local *local = dev->ieee80211_ptr;
 	if (local->sta_scanning)
 		return -EAGAIN;
-	res = ieee80211_sta_scan_results(dev, extra, IW_SCAN_MAX_DATA);
+	res = ieee80211_sta_scan_results(dev, extra, data->length);
 	if (res >= 0) {
 		data->length = res;
 		return 0;
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index a3bcc1b..a933d92 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -2743,6 +2743,10 @@ int ieee80211_sta_scan_results(struct ne
 	spin_lock_bh(&local->sta_bss_lock);
 	list_for_each(ptr, &local->sta_bss_list) {
 		bss = list_entry(ptr, struct ieee80211_sta_bss, list);
+		if (buf + len - current_ev <= IW_EV_ADDR_LEN) {
+			spin_unlock_bh(&local->sta_bss_lock);
+			return -E2BIG;
+		}
 		current_ev = ieee80211_sta_scan_result(dev, bss, current_ev,
 						       end_buf);
 	}
-- 
1.3.0


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

* [PATCH 19/21] d80211: fix multiple device support
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (17 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 18/21] d80211: allow for large scan results Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 20/21] d80211: fix interface removal Jiri Benc
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: David Kimdon <david.kimdon@devicescape.com>

Fix interpretation of dev_alloc_name() return value.  dev_alloc_name()
returns the number of the unit assigned or a negative errno code.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

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

a13193956bee479d72bad1bc1ccbcb831182b3d3
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index 9a9d730..bdff4cd 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -64,7 +64,7 @@ int ieee80211_if_add(struct net_device *
 		} while (i < 10000);
 	} else if (format) {
 		ret = dev_alloc_name(ndev, name);
-		if (ret)
+		if (ret < 0)
 			goto fail;
 	} else {
 		snprintf(ndev->name, IFNAMSIZ, "%s", name);
-- 
1.3.0


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

* [PATCH 20/21] d80211: fix interface removal
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (18 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 19/21] d80211: fix multiple device support Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:24 ` [PATCH 21/21] d80211: add ieee80211_stop_queues() Jiri Benc
  2006-08-23 19:30 ` [PATCH 0/21] d80211: pull request Jiri Benc
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: David Kimdon <david.kimdon@devicescape.com>

Calls to ieee80211_if_remove() should use the ieee80211 interface types.
Convert interface type from hostapd to ieee80211 format.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 net/d80211/ieee80211_ioctl.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

6014cc141587c2c7e73abb985f7741dc7e24c105
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index 53b7841..89a58e3 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -1070,14 +1070,21 @@ #endif
 static int ieee80211_ioctl_remove_if(struct net_device *dev,
 				     struct prism2_hostapd_param *param)
 {
-	if (param->u.if_info.type != HOSTAP_IF_WDS &&
-	    param->u.if_info.type != HOSTAP_IF_VLAN &&
-	    param->u.if_info.type != HOSTAP_IF_BSS &&
-	    param->u.if_info.type != HOSTAP_IF_STA) {
-                return -EINVAL;
+	unsigned int type;
+
+	if (param->u.if_info.type == HOSTAP_IF_WDS) {
+		type = IEEE80211_IF_TYPE_WDS;
+	} else if (param->u.if_info.type == HOSTAP_IF_VLAN) {
+		type = IEEE80211_IF_TYPE_VLAN;
+	} else if (param->u.if_info.type == HOSTAP_IF_BSS) {
+		type = IEEE80211_IF_TYPE_AP;
+	} else if (param->u.if_info.type == HOSTAP_IF_STA) {
+		type = IEEE80211_IF_TYPE_STA;
+	} else {
+		return -EINVAL;
 	}
-	return ieee80211_if_remove(dev, param->u.if_info.name,
-				   param->u.if_info.type);
+
+	return ieee80211_if_remove(dev, param->u.if_info.name, type);
 }
 
 
-- 
1.3.0


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

* [PATCH 21/21] d80211: add ieee80211_stop_queues()
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (19 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 20/21] d80211: fix interface removal Jiri Benc
@ 2006-08-23 19:24 ` Jiri Benc
  2006-08-23 19:30 ` [PATCH 0/21] d80211: pull request Jiri Benc
  21 siblings, 0 replies; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:24 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Michael Buesch <mb@bu3sch.de>

Add ieee80211_stop_queues() to stop all queues
with a single call.
I will submit a patch for bcm43xx to use this function
as soon as this got merged.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

 include/net/d80211.h   |    9 +++++++++
 net/d80211/ieee80211.c |   10 ++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

414f928269a9d41642e85abc8fe47e5bc90eed6b
diff --git a/include/net/d80211.h b/include/net/d80211.h
index 23839b4..42fdbf7 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -830,6 +830,15 @@ void ieee80211_stop_queue(struct net_dev
 void ieee80211_start_queues(struct net_device *dev);
 
 /**
+ * ieee80211_stop_queues - stop all queues
+ * @dev: pointer to $struct net_device as obtained from
+ *       ieee80211_alloc_hw().
+ *
+ * Drivers should use this function instead of netif_stop_queue.
+ */
+void ieee80211_stop_queues(struct net_device *dev);
+
+/**
  * ieee80211_get_mc_list_item - iteration over items in multicast list
  * @dev: pointer to &struct net_device as obtained from
  *	ieee80211_alloc_hw().
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index ad37015..e72721f 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4705,6 +4705,16 @@ void ieee80211_start_queues(struct net_d
 }
 EXPORT_SYMBOL(ieee80211_start_queues);
 
+void ieee80211_stop_queues(struct net_device *dev)
+{
+	struct ieee80211_local *local = dev->ieee80211_ptr;
+	int i;
+
+	for (i = 0; i < local->hw->queues; i++)
+		ieee80211_stop_queue(dev, i);
+}
+EXPORT_SYMBOL(ieee80211_stop_queues);
+
 void * ieee80211_dev_hw_data(struct net_device *dev)
 {
 	struct ieee80211_local *local = dev->ieee80211_ptr;
-- 
1.3.0


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

* Re: [PATCH 0/21] d80211: pull request
  2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
                   ` (20 preceding siblings ...)
  2006-08-23 19:24 ` [PATCH 21/21] d80211: add ieee80211_stop_queues() Jiri Benc
@ 2006-08-23 19:30 ` Jiri Benc
  2006-08-24  7:58   ` Johannes Berg
  21 siblings, 1 reply; 24+ messages in thread
From: Jiri Benc @ 2006-08-23 19:30 UTC (permalink / raw)
  To: netdev
  Cc: John W. Linville, Johannes Berg, David Kimdon, Larry Finger,
	Mohamed Abbas

I'm also aware of these patches that need more work:

Johannes Berg:
        d80211:  LED triggers
        add nl80211
        make d80211 use nl80211
        d80211:  rework rate control registration
        d80211:  move out rate control registration code
        
David Kimdon:
        d80211: add ioctl to stop data frame tx
        
Larry Finger:
        Add wireless statics to d80211
        (Add wireless statics to bcm43xx-d80211)
        (Add wireless statistics code to d80211 versions of adm8211 and rt2x00)
        
Mohamed Abbas:
        d80211:  add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER
        d80211:  iwlist scan

If a d80211 patch you sent in last three weeks is not listed above or
below (and we didn't agree that we would drop it), please scream.

Thanks,

 Jiri

On Wed, 23 Aug 2006 21:24:08 +0200 (CEST), Jiri Benc wrote:
> Please pull from
> git://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git master
> to obtain following patches:
> 
> David Kimdon:
>       d80211: allow for large scan results
>       d80211: fix multiple device support
>       d80211: fix interface removal
> 
> Jiri Benc:
>       d80211: remove useless and wrong check for interface type
> 
> Johannes Berg:
>       d80211: relax sysfs permissions
>       d80211: master link
>       d80211: pointers as extended booleans
>       d80211: use kzalloc()
>       d80211: get rid of WME bitfield
>       d80211: get rid of sta_aid in favour of keeping track of TIM
>       d80211: clean up exports
>       d80211: clean up includes
>       d80211: fix some sparse warnings
>       d80211: make lowlevel TX framedump option visible
>       d80211: surface IBSS debug
>       d80211: get rid of MICHAEL_MIC_HWACCEL define
>       d80211: surface powersave debug switch
>       d80211: fix some documentation
> 
> Michael Buesch:
>       d80211: add ieee80211_stop_queues()
> 
> Michael Wu:
>       d80211: switch status codes, reason codes, and EIDs to enums
>       d80211: Group EIDs by standard, add remaining 802.11d EIDs


-- 
Jiri Benc
SUSE Labs

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

* Re: [PATCH 0/21] d80211: pull request
  2006-08-23 19:30 ` [PATCH 0/21] d80211: pull request Jiri Benc
@ 2006-08-24  7:58   ` Johannes Berg
  0 siblings, 0 replies; 24+ messages in thread
From: Johannes Berg @ 2006-08-24  7:58 UTC (permalink / raw)
  To: Jiri Benc
  Cc: netdev, John W. Linville, David Kimdon, Larry Finger,
	Mohamed Abbas

On Wed, 2006-08-23 at 21:30 +0200, Jiri Benc wrote:

> Johannes Berg:
>         d80211:  LED triggers

Yep, as noted, the fix for this is to include some more things in
include/linux/leds.h, which is in -mm:
http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.18-rc4/2.6.18-rc4-mm2/broken-out/make-ledsh-include-relevant-headers.patch

>         add nl80211

Yeah, I need to repost a fixed version.

>         make d80211 use nl80211

Ditto, but would appreciate feedback on both of these.

>         d80211:  rework rate control registration
>         d80211:  move out rate control registration code

Thought you wanted to drop them?

johannes

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

end of thread, other threads:[~2006-08-24  7:57 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-23 19:24 [PATCH 0/21] d80211: pull request Jiri Benc
2006-08-23 19:24 ` [PATCH 1/21] d80211: relax sysfs permissions Jiri Benc
2006-08-23 19:24 ` [PATCH 2/21] d80211: master link Jiri Benc
2006-08-23 19:24 ` [PATCH 3/21] d80211: pointers as extended booleans Jiri Benc
2006-08-23 19:24 ` [PATCH 4/21] d80211: use kzalloc() Jiri Benc
2006-08-23 19:24 ` [PATCH 5/21] d80211: get rid of WME bitfield Jiri Benc
2006-08-23 19:24 ` [PATCH 6/21] d80211: get rid of sta_aid in favour of keeping track of TIM Jiri Benc
2006-08-23 19:24 ` [PATCH 7/21] d80211: clean up exports Jiri Benc
2006-08-23 19:24 ` [PATCH 8/21] d80211: clean up includes Jiri Benc
2006-08-23 19:24 ` [PATCH 9/21] d80211: fix some sparse warnings Jiri Benc
2006-08-23 19:24 ` [PATCH 10/21] d80211: make lowlevel TX framedump option visible Jiri Benc
2006-08-23 19:24 ` [PATCH 11/21] d80211: surface IBSS debug Jiri Benc
2006-08-23 19:24 ` [PATCH 12/21] d80211: get rid of MICHAEL_MIC_HWACCEL define Jiri Benc
2006-08-23 19:24 ` [PATCH 13/21] d80211: surface powersave debug switch Jiri Benc
2006-08-23 19:24 ` [PATCH 14/21] d80211: fix some documentation Jiri Benc
2006-08-23 19:24 ` [PATCH 15/21] d80211: switch status codes, reason codes, and EIDs to enums Jiri Benc
2006-08-23 19:24 ` [PATCH 16/21] d80211: Group EIDs by standard, add remaining 802.11d EIDs Jiri Benc
2006-08-23 19:24 ` [PATCH 17/21] d80211: remove useless and wrong check for interface type Jiri Benc
2006-08-23 19:24 ` [PATCH 18/21] d80211: allow for large scan results Jiri Benc
2006-08-23 19:24 ` [PATCH 19/21] d80211: fix multiple device support Jiri Benc
2006-08-23 19:24 ` [PATCH 20/21] d80211: fix interface removal Jiri Benc
2006-08-23 19:24 ` [PATCH 21/21] d80211: add ieee80211_stop_queues() Jiri Benc
2006-08-23 19:30 ` [PATCH 0/21] d80211: pull request Jiri Benc
2006-08-24  7:58   ` Johannes Berg

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