* [PATCH 00/18] d80211: various cleanups/fixes/changes
@ 2006-08-21 7:41 Johannes Berg
2006-08-21 7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
` (17 more replies)
0 siblings, 18 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc
Here are various things that I worked on over the weekend.
johannes
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 01/18] d80211: LED triggers
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-22 0:30 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
` (3 more replies)
2006-08-21 7:41 ` [PATCH 02/18] d80211: master link Johannes Berg
` (16 subsequent siblings)
17 siblings, 4 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-led.patch --]
[-- Type: text/plain, Size: 10883 bytes --]
This patch makes d80211 export LED triggers for rx/tx and introduces
functions to allow device drivers to query the trigger names for setting
default triggers. It also cleans up the Makefile LED related stuff.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/include/net/d80211.h 2006-08-20 14:56:10.708192788 +0200
+++ wireless-dev/include/net/d80211.h 2006-08-20 16:27:03.988192788 +0200
@@ -695,6 +695,36 @@ struct net_device *ieee80211_alloc_hw(si
* function. */
int ieee80211_register_hw(struct net_device *dev, struct ieee80211_hw *hw);
+/* driver can use this and ieee80211_get_rx_led_name to get the
+ * name of the registered LEDs after ieee80211_register_hw
+ * was called.
+ * This is useful to set the default trigger on the LED class
+ * device that your driver should export for each LED the device
+ * has, that way the default behaviour will be as expected but
+ * the user can still change it/turn off the LED etc.
+ */
+#ifdef CONFIG_D80211_LEDS
+extern char *__ieee80211_get_tx_led_name(struct net_device *dev);
+extern char *__ieee80211_get_rx_led_name(struct net_device *dev);
+#endif
+static inline char *ieee80211_get_tx_led_name(struct net_device *dev)
+{
+#ifdef CONFIG_D80211_LEDS
+ return __ieee80211_get_tx_led_name(dev);
+#else
+ return NULL;
+#endif
+}
+
+static inline char *ieee80211_get_rx_led_name(struct net_device *dev)
+{
+#ifdef CONFIG_D80211_LEDS
+ return __ieee80211_get_rx_led_name(dev);
+#else
+ return NULL;
+#endif
+}
+
/* This function is allowed to update hardware configuration (e.g., list of
* supported operation modes and rates). */
int ieee80211_update_hw(struct net_device *dev, struct ieee80211_hw *hw);
@@ -884,16 +914,6 @@ enum {
IEEE80211_TEST_PARAM_TX_ANT_SEL_RAW = 5,
};
-/* ieee80211_tx_led called with state == 1 when the first frame is queued
- * with state == 0 when the last frame is transmitted and tx queue is empty
- */
-void ieee80211_tx_led(int state, struct net_device *dev);
-/* ieee80211_rx_led is called each time frame is received, state is not used
- * (== 2)
- */
-void ieee80211_rx_led(int state, struct net_device *dev);
-
-
/* IEEE 802.11 defines */
#define FCS_LEN 4
--- wireless-dev.orig/net/d80211/Kconfig 2006-08-20 14:56:10.728192788 +0200
+++ wireless-dev/net/d80211/Kconfig 2006-08-20 16:27:27.578192788 +0200
@@ -7,6 +7,14 @@ config D80211
This option enables the hardware independent IEEE 802.11
networking stack.
+config D80211_LEDS
+ bool "Enable LED triggers"
+ depends on D80211
+ select LEDS_TRIGGERS
+ ---help---
+ This option enables a few LED triggers for different
+ packet receive/transmit events.
+
config D80211_DEBUG
bool "Enable debugging output"
depends on D80211
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:10.768192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 16:27:08.548192788 +0200
@@ -31,7 +31,7 @@
#include "tkip.h"
#include "wme.h"
#include "aes_ccm.h"
-
+#include "ieee80211_led.h"
/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
@@ -1181,11 +1181,7 @@ static int __ieee80211_tx(struct ieee802
ret = local->hw->tx(local->mdev, skb, control);
if (ret)
return IEEE80211_TX_AGAIN;
-#ifdef IEEE80211_LEDS
- if (local->tx_led_counter++ == 0) {
- ieee80211_tx_led(1, local->mdev);
- }
-#endif /* IEEE80211_LEDS */
+ ieee80211_led_tx(local, 1);
}
if (tx->u.tx.extra_frag) {
control->use_rts_cts = 0;
@@ -1210,11 +1206,7 @@ static int __ieee80211_tx(struct ieee802
control);
if (ret)
return IEEE80211_TX_FRAG_AGAIN;
-#ifdef IEEE80211_LEDS
- if (local->tx_led_counter++ == 0) {
- ieee80211_tx_led(1, local->mdev);
- }
-#endif /* IEEE80211_LEDS */
+ ieee80211_led_tx(local, 1);
tx->u.tx.extra_frag[i] = NULL;
}
kfree(tx->u.tx.extra_frag);
@@ -2998,10 +2990,8 @@ ieee80211_rx_h_defragment(struct ieee802
rx->sta->rx_packets++;
if (is_multicast_ether_addr(hdr->addr1))
rx->local->dot11MulticastReceivedFrameCount++;
-#ifdef IEEE80211_LEDS
else
- ieee80211_rx_led(2, rx->dev);
-#endif /* IEEE80211_LEDS */
+ ieee80211_led_rx(rx->local);
return TXRX_CONTINUE;
}
@@ -4104,11 +4094,8 @@ void ieee80211_tx_status(struct net_devi
rate_control_tx_status(dev, skb, status);
}
-#ifdef IEEE80211_LEDS
- if (local->tx_led_counter && (local->tx_led_counter-- == 1)) {
- ieee80211_tx_led(0, dev);
- }
-#endif /* IEEE80211_LEDS */
+ ieee80211_led_tx(local, 0);
+
/* SNMP counters
* Fragments are passed to low-level drivers as separate skbs, so these
* are actually fragments, not frames. Update frame counters only for
@@ -4500,6 +4487,8 @@ int ieee80211_register_hw(struct net_dev
local->reg_state = IEEE80211_DEV_REGISTERED;
rtnl_unlock();
+ ieee80211_led_init(local);
+
return 0;
fail_rate_attrs:
@@ -4603,6 +4592,7 @@ void ieee80211_unregister_hw(struct net_
skb_queue_purge(&local->skb_queue_unreliable);
ieee80211_dev_free_index(local);
+ ieee80211_led_exit(local);
}
void ieee80211_free_hw(struct net_device *dev)
--- wireless-dev.orig/net/d80211/ieee80211_dev.c 2006-08-20 14:56:10.818192788 +0200
+++ wireless-dev/net/d80211/ieee80211_dev.c 2006-08-20 14:56:15.978192788 +0200
@@ -13,6 +13,7 @@
#include <linux/netdevice.h>
#include <net/d80211.h>
#include "ieee80211_i.h"
+#include "ieee80211_led.h"
struct ieee80211_dev_list {
struct list_head list;
--- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-08-20 14:56:10.838192788 +0200
+++ wireless-dev/net/d80211/ieee80211_i.h 2006-08-20 16:27:06.458192788 +0200
@@ -460,7 +460,11 @@ struct ieee80211_local {
u32 dot11TransmittedFrameCount;
u32 dot11WEPUndecryptableCount;
- int tx_led_counter;
+#ifdef CONFIG_D80211_LEDS
+ int tx_led_counter, rx_led_counter;
+ struct led_trigger *tx_led, *rx_led;
+ char tx_led_name[32], rx_led_name[32];
+#endif
u32 channel_use;
u32 channel_use_raw;
--- wireless-dev.orig/net/d80211/ieee80211_led.c 2006-08-20 14:56:10.878192788 +0200
+++ wireless-dev/net/d80211/ieee80211_led.c 2006-08-20 14:56:15.978192788 +0200
@@ -1,32 +1,91 @@
/*
- * Copyright 2002-2004, Instant802 Networks, Inc.
+ * Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/config.h>
-#include <linux/netdevice.h>
-#include <linux/types.h>
-
-#ifdef CONFIG_OAP_LEDS_WLAN
-extern void leds_wlan_set(int unit, int tx, int state);
-#endif
-
-void ieee80211_rx_led(int state, struct net_device *dev) {
-#ifdef CONFIG_OAP_LEDS_WLAN
- static unsigned int count = 0;
+/* just for IFNAMSIZ */
+#include <linux/if.h>
+#include "ieee80211_led.h"
+
+void ieee80211_led_rx(struct ieee80211_local *local)
+{
+ if (unlikely(!local->rx_led))
+ return;
+ if (local->rx_led_counter++ % 2 == 0)
+ led_trigger_event(local->rx_led, LED_OFF);
+ else
+ led_trigger_event(local->rx_led, LED_FULL);
+}
+
+/* q is 1 if a packet was enqueued, 0 if it has been transmitted */
+void ieee80211_led_tx(struct ieee80211_local *local, int q)
+{
+ if (unlikely(!local->tx_led))
+ return;
+ /* not sure how this is supposed to work ... */
+ local->tx_led_counter += 2*q-1;
+ if (local->tx_led_counter % 2 == 0)
+ led_trigger_event(local->tx_led, LED_OFF);
+ else
+ led_trigger_event(local->tx_led, LED_FULL);
+}
+
+void ieee80211_led_init(struct ieee80211_local *local)
+{
+ local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
+ if (!local->rx_led)
+ return;
+ snprintf(local->rx_led_name, sizeof(local->rx_led_name),
+ "wiphy%drx", local->dev_index);
+ local->rx_led->name = local->rx_led_name;
+ if (led_trigger_register(local->rx_led)) {
+ kfree(local->rx_led);
+ local->rx_led = NULL;
+ }
- if (state == 2) {
- leds_wlan_set(0, 0, (++count) & 1);
+ local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
+ if (!local->tx_led)
+ return;
+ snprintf(local->tx_led_name, sizeof(local->tx_led_name),
+ "wiphy%dtx", local->dev_index);
+ local->tx_led->name = local->tx_led_name;
+ if (led_trigger_register(local->tx_led)) {
+ kfree(local->tx_led);
+ local->tx_led = NULL;
}
-#endif
}
-void ieee80211_tx_led(int state, struct net_device *dev) {
-#ifdef CONFIG_OAP_LEDS_WLAN
- leds_wlan_set(0, 1, state);
-#endif
+void ieee80211_led_exit(struct ieee80211_local *local)
+{
+ if (local->tx_led) {
+ led_trigger_unregister(local->tx_led);
+ kfree(local->tx_led);
+ }
+ if (local->rx_led) {
+ led_trigger_unregister(local->rx_led);
+ kfree(local->rx_led);
+ }
}
+char *__ieee80211_get_tx_led_name(struct net_device *dev)
+{
+ struct ieee80211_local *local = dev->ieee80211_ptr;
+
+ if (local->tx_led)
+ return local->tx_led_name;
+ return NULL;
+}
+EXPORT_SYMBOL(__ieee80211_get_tx_led_name);
+
+char *__ieee80211_get_rx_led_name(struct net_device *dev)
+{
+ struct ieee80211_local *local = dev->ieee80211_ptr;
+
+ if (local->rx_led)
+ return local->rx_led_name;
+ return NULL;
+}
+EXPORT_SYMBOL(__ieee80211_get_rx_led_name);
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ wireless-dev/net/d80211/ieee80211_led.h 2006-08-20 14:56:15.978192788 +0200
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/leds.h>
+#include "ieee80211_i.h"
+
+#ifdef CONFIG_D80211_LEDS
+extern void ieee80211_led_rx(struct ieee80211_local *local);
+extern void ieee80211_led_tx(struct ieee80211_local *local, int q);
+extern void ieee80211_led_init(struct ieee80211_local *local);
+extern void ieee80211_led_exit(struct ieee80211_local *local);
+#else
+static inline void ieee80211_led_rx(struct ieee80211_local *local)
+{
+}
+static inline void ieee80211_led_tx(struct ieee80211_local *local, int q)
+{
+}
+static inline void ieee80211_led_init(struct ieee80211_local *local)
+{
+}
+static inline void ieee80211_led_exit(struct ieee80211_local *local)
+{
+}
+#endif
--- wireless-dev.orig/net/d80211/Makefile 2006-08-20 14:56:10.958192788 +0200
+++ wireless-dev/net/d80211/Makefile 2006-08-20 16:27:06.898192788 +0200
@@ -1,5 +1,7 @@
obj-$(CONFIG_D80211) += 80211.o rate_control.o
+80211-objs-$(CONFIG_D80211_LEDS) += ieee80211_led.o
+
80211-objs := \
ieee80211.o \
ieee80211_ioctl.o \
@@ -15,13 +17,9 @@ obj-$(CONFIG_D80211) += 80211.o rate_con
michael.o \
tkip.o \
aes_ccm.o \
- wme.o
+ wme.o \
+ $(80211-objs-y)
ifeq ($(CONFIG_NET_SCHED),)
80211-objs += fifo_qdisc.o
endif
-
-ifeq ($(CONFIG_D80211_LEDS),y)
- 80211-objs += ieee80211_led.o
-endif
-
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 02/18] d80211: master link
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
2006-08-21 7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 8:13 ` Johannes Berg
2006-08-21 19:08 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 03/18] d80211: pointers as extended booleans Johannes Berg
` (15 subsequent siblings)
17 siblings, 2 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-masterlink.patch --]
[-- Type: text/plain, Size: 551 bytes --]
This patch adds a link from the wiphy to the master device in sysfs.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:15.968192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:16.818192788 +0200
@@ -4449,6 +4449,7 @@ int ieee80211_register_hw(struct net_dev
rtnl_unlock();
goto fail_dev;
}
+ sysfs_create_link(&local->class_dev.kobj, &dev->class_dev.kobj, "master");
result = ieee80211_sysfs_add_netdevice(dev);
rtnl_unlock();
if (result < 0)
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 03/18] d80211: pointers as extended booleans
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
2006-08-21 7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
2006-08-21 7:41 ` [PATCH 02/18] d80211: master link Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-22 6:43 ` Bill Fink
2006-08-21 7:41 ` [PATCH 04/18] d80211: use kzalloc() Johannes Berg
` (14 subsequent siblings)
17 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-nullpointers.patch --]
[-- Type: text/plain, Size: 31167 bytes --]
Please review carefully, the task was so boring that I might have made
stupid mistakes.
---
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>
--- wireless-dev.orig/net/d80211/ieee80211_scan.c 2006-08-20 14:56:09.738192788 +0200
+++ wireless-dev/net/d80211/ieee80211_scan.c 2006-08-20 14:56:17.398192788 +0200
@@ -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;
--- wireless-dev.orig/net/d80211/wep.c 2006-08-20 14:56:09.758192788 +0200
+++ wireless-dev/net/d80211/wep.c 2006-08-20 14:56:17.408192788 +0200
@@ -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 */
--- wireless-dev.orig/net/d80211/aes_ccm.c 2006-08-20 14:56:09.798192788 +0200
+++ wireless-dev/net/d80211/aes_ccm.c 2006-08-20 14:56:17.408192788 +0200
@@ -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);
--- wireless-dev.orig/net/d80211/ieee80211_iface.c 2006-08-20 14:56:09.838192788 +0200
+++ wireless-dev/net/d80211/ieee80211_iface.c 2006-08-20 14:56:17.408192788 +0200
@@ -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)
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-08-20 14:56:09.878192788 +0200
+++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-08-20 14:56:17.408192788 +0200
@@ -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 @@ static int ieee80211_set_encryption(stru
* 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 @@ static int ieee80211_set_encryption(stru
}
}
- 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])
--- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-08-20 14:56:09.918192788 +0200
+++ wireless-dev/net/d80211/ieee80211_sta.c 2006-08-20 14:56:17.418192788 +0200
@@ -252,7 +252,7 @@ static void ieee80211_sta_wmm_params(str
memset(¶ms, 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 @@ static void ieee80211_rx_bss_info(struct
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 @@ static void ieee80211_rx_bss_info(struct
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 @@ static void ieee80211_rx_bss_info(struct
}
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 @@ static void ieee80211_rx_bss_info(struct
}
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 @@ static void ieee80211_rx_bss_info(struct
}
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 @@ static void ieee80211_rx_mgmt_probe_req(
/* 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 @@ static int ieee80211_sta_create_ibss(str
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;
--- wireless-dev.orig/net/d80211/rate_control.c 2006-08-20 14:56:09.958192788 +0200
+++ wireless-dev/net/d80211/rate_control.c 2006-08-20 14:56:17.418192788 +0200
@@ -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;
}
--- wireless-dev.orig/net/d80211/rate_control.h 2006-08-20 14:56:09.998192788 +0200
+++ wireless-dev/net/d80211/rate_control.h 2006-08-20 14:56:17.418192788 +0200
@@ -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;
--- wireless-dev.orig/net/d80211/sta_info.c 2006-08-20 14:56:10.048192788 +0200
+++ wireless-dev/net/d80211/sta_info.c 2006-08-20 14:56:17.418192788 +0200
@@ -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);
--- wireless-dev.orig/net/d80211/wme.c 2006-08-20 14:56:10.068192788 +0200
+++ wireless-dev/net/d80211/wme.c 2006-08-20 14:56:17.418192788 +0200
@@ -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;
}
--- wireless-dev.orig/net/d80211/wpa.c 2006-08-20 14:56:10.108192788 +0200
+++ wireless-dev/net/d80211/wpa.c 2006-08-20 14:56:17.418192788 +0200
@@ -260,7 +260,7 @@ ieee80211_rx_h_michael_mic_verify(struct
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 */
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:16.818192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:17.428192788 +0200
@@ -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;
@@ -1768,8 +1768,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 "
@@ -1801,7 +1801,7 @@ struct sk_buff * ieee80211_beacon_get(st
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);
@@ -1846,15 +1846,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--;
@@ -2466,13 +2465,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) {
@@ -2640,7 +2639,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));
@@ -2664,7 +2663,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));
@@ -2750,7 +2749,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--;
@@ -2939,7 +2938,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--) {
@@ -3095,10 +3094,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;
@@ -3429,7 +3427,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. */
@@ -3474,7 +3472,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 */
@@ -3629,12 +3627,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) {
@@ -3665,12 +3662,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;
@@ -3969,7 +3965,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) {
@@ -4322,7 +4318,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;
}
@@ -4701,9 +4697,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;
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 04/18] d80211: use kzalloc()
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (2 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 03/18] d80211: pointers as extended booleans Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 05/18] d80211: get rid of WME bitfield Johannes Berg
` (13 subsequent siblings)
17 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-kzalloc.patch --]
[-- Type: text/plain, Size: 1878 bytes --]
This changes d80211 to use kzalloc() where applicable.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:17.428192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:18.438192788 +0200
@@ -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;
@@ -4696,11 +4694,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;
--- wireless-dev.orig/net/d80211/rate_control.c 2006-08-20 14:56:17.418192788 +0200
+++ wireless-dev/net/d80211/rate_control.c 2006-08-20 14:56:18.438192788 +0200
@@ -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;
}
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 05/18] d80211: get rid of WME bitfield
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (3 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 04/18] d80211: use kzalloc() Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 06/18] d80211: rework rate control registration Johannes Berg
` (12 subsequent siblings)
17 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-wme-bitfield.patch --]
[-- Type: text/plain, Size: 3237 bytes --]
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>
--- wireless-dev.orig/net/d80211/wme.c 2006-08-20 14:56:17.418192788 +0200
+++ wireless-dev/net/d80211/wme.c 2006-08-20 14:56:19.058192788 +0200
@@ -12,7 +12,9 @@
#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)) {
--- wireless-dev.orig/net/d80211/wme.h 2006-08-20 14:56:09.068192788 +0200
+++ wireless-dev/net/d80211/wme.h 2006-08-20 14:56:19.058192788 +0200
@@ -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_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);
--- wireless-dev.orig/net/d80211/fifo_qdisc.c 2006-08-20 14:56:09.098192788 +0200
+++ wireless-dev/net/d80211/fifo_qdisc.c 2006-08-20 14:56:19.058192788 +0200
@@ -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"
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:18.438192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:19.058192788 +0200
@@ -18,6 +18,7 @@
#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>
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 06/18] d80211: rework rate control registration
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (4 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 05/18] d80211: get rid of WME bitfield Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 19:19 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 07/18] d80211: get rid of sta_aid in favour of keeping track of TIM Johannes Berg
` (11 subsequent siblings)
17 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-rate-control-rework.patch --]
[-- Type: text/plain, Size: 30850 bytes --]
Contrary to what Jiri said, proper rate control module refcounting
is much easier than allowing rate control changes on-the-fly...
This patch implements only the former along with cleanups.
Note that the diff between rate_control.c and rate_control_simple.c
is small (modulo fixing indenting etc.), but I wanted to rename the
file to more accurately reflect what it is.
---
This patch reworks rate control module registration, gets rid of the
linked list implementation that was there, and as an added bonus adds
rate control module refcounting.
It moves rate_control.c to rate_control_simple.c and Lindents
(+manual cleanups) it in the process.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/rate_control.c 2006-08-20 14:56:18.438192788 +0200
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,396 +0,0 @@
-/*
- * Copyright 2002-2005, Instant802 Networks, Inc.
- * Copyright 2005, Devicescape Software, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * 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>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/skbuff.h>
-#include <linux/compiler.h>
-
-#include <net/d80211.h>
-#include "ieee80211_i.h"
-#include "rate_control.h"
-
-
-/* This is a minimal implementation of TX rate controlling that can be used
- * as the default when no improved mechanisms are available. */
-
-
-#define RATE_CONTROL_EMERG_DEC 2
-#define RATE_CONTROL_INTERVAL (HZ / 20)
-#define RATE_CONTROL_MIN_TX 10
-
-MODULE_ALIAS("ieee80211_rate_control");
-
-static void rate_control_rate_inc(struct ieee80211_local *local,
- struct sta_info *sta)
-{
- struct ieee80211_sub_if_data *sdata;
- int i = sta->txrate;
- int maxrate;
-
- sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
- if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
- /* forced unicast rate - do not change STA rate */
- return;
- }
-
- maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1;
-
- if (i > local->num_curr_rates)
- i = local->num_curr_rates - 2;
-
- while (i + 1 < local->num_curr_rates) {
- i++;
- if (sta->supp_rates & BIT(i) &&
- local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED &&
- (maxrate < 0 || i <= maxrate)) {
- sta->txrate = i;
- break;
- }
- }
-}
-
-
-static void rate_control_rate_dec(struct ieee80211_local *local,
- struct sta_info *sta)
-{
- struct ieee80211_sub_if_data *sdata;
- int i = sta->txrate;
-
- sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
- if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
- /* forced unicast rate - do not change STA rate */
- return;
- }
-
- if (i > local->num_curr_rates)
- i = local->num_curr_rates;
-
- while (i > 0) {
- i--;
- if (sta->supp_rates & BIT(i) &&
- local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED) {
- sta->txrate = i;
- break;
- }
- }
-}
-
-
-static struct ieee80211_rate *
-rate_control_lowest_rate(struct ieee80211_local *local)
-{
- int i;
-
- for (i = 0; i < local->num_curr_rates; i++) {
- struct ieee80211_rate *rate = &local->curr_rates[i];
-
- if (rate->flags & IEEE80211_RATE_SUPPORTED
- )
- return rate;
- }
-
- printk(KERN_DEBUG "rate_control_lowest_rate - no supported rates "
- "found\n");
- return &local->curr_rates[0];
-}
-
-
-struct global_rate_control {
- int dummy;
-};
-
-struct sta_rate_control {
- unsigned long last_rate_change;
- u32 tx_num_failures;
- u32 tx_num_xmit;
-
- unsigned long avg_rate_update;
- u32 tx_avg_rate_sum;
- u32 tx_avg_rate_num;
-};
-
-
-static void rate_control_simple_tx_status(struct net_device *dev,
- struct sk_buff *skb,
- struct ieee80211_tx_status *status)
-{
- struct ieee80211_local *local = dev->ieee80211_ptr;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- struct sta_info *sta;
- struct sta_rate_control *srctrl;
-
- sta = sta_info_get(local, hdr->addr1);
-
- if (!sta)
- return;
-
- srctrl = sta->rate_ctrl_priv;
- srctrl->tx_num_xmit++;
- if (status->excessive_retries) {
- sta->antenna_sel = sta->antenna_sel == 1 ? 2 : 1;
- if (local->sta_antenna_sel == STA_ANTENNA_SEL_SW_CTRL_DEBUG) {
- printk(KERN_DEBUG "%s: " MAC_FMT " TX antenna --> %d "
- "(@%lu)\n",
- dev->name, MAC_ARG(hdr->addr1),
- sta->antenna_sel, jiffies);
- }
- srctrl->tx_num_failures++;
- sta->tx_retry_failed++;
- sta->tx_num_consecutive_failures++;
- sta->tx_num_mpdu_fail++;
- } else {
- sta->last_ack_rssi[0] = sta->last_ack_rssi[1];
- sta->last_ack_rssi[1] = sta->last_ack_rssi[2];
- sta->last_ack_rssi[2] = status->ack_signal;
- sta->tx_num_consecutive_failures = 0;
- sta->tx_num_mpdu_ok++;
- }
- sta->tx_retry_count += status->retry_count;
- sta->tx_num_mpdu_fail += status->retry_count;
-
- if (time_after(jiffies,
- srctrl->last_rate_change + RATE_CONTROL_INTERVAL) &&
- srctrl->tx_num_xmit > RATE_CONTROL_MIN_TX) {
- u32 per_failed;
- srctrl->last_rate_change = jiffies;
-
- per_failed = (100 * sta->tx_num_mpdu_fail) /
- (sta->tx_num_mpdu_fail + sta->tx_num_mpdu_ok);
- /* TODO: calculate average per_failed to make adjusting
- * parameters easier */
-#if 0
- if (net_ratelimit()) {
- printk(KERN_DEBUG "MPDU fail=%d ok=%d per_failed=%d\n",
- sta->tx_num_mpdu_fail, sta->tx_num_mpdu_ok,
- per_failed);
- }
-#endif
-
- if (per_failed > local->rate_ctrl_num_down) {
- rate_control_rate_dec(local, sta);
- } else if (per_failed < local->rate_ctrl_num_up) {
- rate_control_rate_inc(local, sta);
- }
- srctrl->tx_avg_rate_sum += local->curr_rates[sta->txrate].rate;
- srctrl->tx_avg_rate_num++;
- srctrl->tx_num_failures = 0;
- srctrl->tx_num_xmit = 0;
- } else if (sta->tx_num_consecutive_failures >=
- RATE_CONTROL_EMERG_DEC) {
- rate_control_rate_dec(local, sta);
- }
-
- if (srctrl->avg_rate_update + 60 * HZ < jiffies) {
- srctrl->avg_rate_update = jiffies;
- if (srctrl->tx_avg_rate_num > 0) {
-#ifdef CONFIG_D80211_VERBOSE_DEBUG
- printk(KERN_DEBUG "%s: STA " MAC_FMT " Average rate: "
- "%d (%d/%d)\n",
- dev->name, MAC_ARG(sta->addr),
- srctrl->tx_avg_rate_sum /
- srctrl->tx_avg_rate_num,
- srctrl->tx_avg_rate_sum,
- srctrl->tx_avg_rate_num);
-#endif /* CONFIG_D80211_VERBOSE_DEBUG */
- srctrl->tx_avg_rate_sum = 0;
- srctrl->tx_avg_rate_num = 0;
- }
- }
-
- sta_info_put(sta);
-}
-
-
-static struct ieee80211_rate *
-rate_control_simple_get_rate(struct net_device *dev, struct sk_buff *skb,
- struct rate_control_extra *extra)
-{
- struct ieee80211_local *local = dev->ieee80211_ptr;
- struct ieee80211_sub_if_data *sdata;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- struct sta_info *sta;
- int rateidx, nonerp_idx;
- u16 fc;
-
- memset(extra, 0, sizeof(*extra));
-
- fc = le16_to_cpu(hdr->frame_control);
- if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
- (hdr->addr1[0] & 0x01)) {
- /* Send management frames and broadcast/multicast data using
- * lowest rate. */
- /* TODO: this could probably be improved.. */
- return rate_control_lowest_rate(local);
- }
-
- sta = sta_info_get(local, hdr->addr1);
-
- if (!sta)
- return rate_control_lowest_rate(local);
-
- sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- if (sdata->bss && sdata->bss->force_unicast_rateidx > -1)
- sta->txrate = sdata->bss->force_unicast_rateidx;
-
- rateidx = sta->txrate;
-
- if (rateidx >= local->num_curr_rates)
- rateidx = local->num_curr_rates - 1;
-
- sta->last_txrate = rateidx;
- nonerp_idx = rateidx;
- while (nonerp_idx > 0 &&
- ((local->curr_rates[nonerp_idx].flags & IEEE80211_RATE_ERP) ||
- !(local->curr_rates[nonerp_idx].flags &
- IEEE80211_RATE_SUPPORTED) ||
- !(sta->supp_rates & BIT(nonerp_idx))))
- nonerp_idx--;
- extra->nonerp_idx = nonerp_idx;
- extra->nonerp = &local->curr_rates[extra->nonerp_idx];
-
- sta_info_put(sta);
-
- return &local->curr_rates[rateidx];
-}
-
-
-static void rate_control_simple_rate_init(struct ieee80211_local *local,
- struct sta_info *sta)
-{
- int i;
- sta->txrate = 0;
- /* TODO: what is a good starting rate for STA? About middle? Maybe not
- * the lowest or the highest rate.. Could consider using RSSI from
- * previous packets? Need to have IEEE 802.1X auth succeed immediately
- * after assoc.. */
- for (i = 0; i < local->num_curr_rates; i++) {
- if ((sta->supp_rates & BIT(i)) &&
- (local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED))
- sta->txrate = i;
- }
-}
-
-
-static void * rate_control_simple_alloc(struct ieee80211_local *local)
-{
- struct global_rate_control *rctrl;
-
- rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC);
-
- return rctrl;
-}
-
-
-static void rate_control_simple_free(void *priv)
-{
- struct global_rate_control *rctrl = priv;
- kfree(rctrl);
-}
-
-
-static void rate_control_simple_clear(void *priv)
-{
-}
-
-
-static void * rate_control_simple_alloc_sta(void)
-{
- struct sta_rate_control *rctrl;
-
- rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC);
-
- return rctrl;
-}
-
-
-static void rate_control_simple_free_sta(void *priv)
-{
- struct sta_rate_control *rctrl = priv;
- kfree(rctrl);
-}
-
-static ssize_t show_sta_tx_avg_rate_sum(const struct sta_info *sta, char *buf)
-{
- struct sta_rate_control *srctrl = sta->rate_ctrl_priv;
-
- return sprintf(buf, "%d\n", srctrl->tx_avg_rate_sum);
-}
-
-static ssize_t show_sta_tx_avg_rate_num(const struct sta_info *sta, char *buf)
-{
- struct sta_rate_control *srctrl = sta->rate_ctrl_priv;
-
- return sprintf(buf, "%d\n", srctrl->tx_avg_rate_num);
-}
-
-static struct sta_attribute sta_attr_tx_avg_rate_sum =
- __ATTR(tx_avg_rate_sum, S_IRUSR, show_sta_tx_avg_rate_sum, NULL);
-static struct sta_attribute sta_attr_tx_avg_rate_num =
- __ATTR(tx_avg_rate_num, S_IRUSR, show_sta_tx_avg_rate_num, NULL);
-
-static struct attribute *rate_control_simple_sta_attrs[] = {
- &sta_attr_tx_avg_rate_sum.attr,
- &sta_attr_tx_avg_rate_num.attr,
- NULL,
-};
-
-static struct attribute_group rate_control_simple_sta_group = {
- .name = "rate_control_simple",
- .attrs = rate_control_simple_sta_attrs,
-};
-
-static int rate_control_simple_add_sta_attrs(void *priv, struct kobject *kobj)
-{
- return sysfs_create_group(kobj, &rate_control_simple_sta_group);
-}
-
-static void rate_control_simple_remove_sta_attrs(void *priv,
- struct kobject *kobj)
-{
- sysfs_remove_group(kobj, &rate_control_simple_sta_group);
-}
-
-static struct rate_control_ops rate_control_simple = {
- .name = "simple",
- .tx_status = rate_control_simple_tx_status,
- .get_rate = rate_control_simple_get_rate,
- .rate_init = rate_control_simple_rate_init,
- .clear = rate_control_simple_clear,
- .alloc = rate_control_simple_alloc,
- .free = rate_control_simple_free,
- .alloc_sta = rate_control_simple_alloc_sta,
- .free_sta = rate_control_simple_free_sta,
- .add_sta_attrs = rate_control_simple_add_sta_attrs,
- .remove_sta_attrs = rate_control_simple_remove_sta_attrs,
-};
-
-
-int __init rate_control_simple_init(void)
-{
- return ieee80211_rate_control_register(&rate_control_simple);
-}
-
-
-static void __exit rate_control_simple_exit(void)
-{
- ieee80211_rate_control_unregister(&rate_control_simple);
-}
-
-
-module_init(rate_control_simple_init);
-module_exit(rate_control_simple_exit);
-
-MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211");
-MODULE_LICENSE("GPL");
--- wireless-dev.orig/net/d80211/rate_control.h 2006-08-20 14:56:17.418192788 +0200
+++ wireless-dev/net/d80211/rate_control.h 2006-08-20 14:56:19.758192788 +0200
@@ -10,9 +10,12 @@
#ifndef RATE_CONTROL
#define RATE_CONTROL
+#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/types.h>
+#include <linux/mutex.h>
+#include <linux/list.h>
#include <net/d80211.h>
#include "ieee80211_i.h"
#include "sta_info.h"
@@ -38,6 +41,7 @@ struct rate_control_extra {
struct rate_control_ops {
const char *name;
+ struct module *owner;
void (*tx_status)(struct net_device *dev, struct sk_buff *skb,
struct ieee80211_tx_status *status);
struct ieee80211_rate *
@@ -55,11 +59,14 @@ struct rate_control_ops {
void (*remove_attrs)(void *priv, struct kobject *kobj);
int (*add_sta_attrs)(void *priv, struct kobject *kobj);
void (*remove_sta_attrs)(void *priv, struct kobject *kobj);
+
+ /* private: */
+ struct list_head list;
};
-int ieee80211_rate_control_register(struct rate_control_ops *ops);
-void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
+extern int ieee80211_rate_control_register(struct rate_control_ops *ops);
+extern void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
static inline void rate_control_tx_status(struct net_device *dev,
@@ -93,9 +100,14 @@ static inline void rate_control_clear(st
}
-static inline void * rate_control_alloc(struct ieee80211_local *local)
+static inline void rate_control_alloc(struct ieee80211_local *local,
+ struct rate_control_ops *ops)
{
- return local->rate_ctrl->alloc(local);
+ if (!try_module_get(ops->owner))
+ return;
+ local->rate_ctrl_priv = ops->alloc(local);
+ if (local->rate_ctrl_priv)
+ local->rate_ctrl = ops;
}
@@ -103,6 +115,7 @@ static inline void rate_control_free(str
{
if (!local->rate_ctrl || !local->rate_ctrl_priv)
return;
+ module_put(local->rate_ctrl->owner);
local->rate_ctrl->free(local->rate_ctrl_priv);
local->rate_ctrl_priv = NULL;
}
@@ -151,4 +164,7 @@ static inline void rate_control_remove_s
local->rate_ctrl->remove_sta_attrs(priv, kobj);
}
+extern struct list_head ieee80211_rate_ctrl_algs;
+extern struct mutex ieee80211_rate_ctrl_mtx;
+
#endif /* RATE_CONTROL */
--- wireless-dev.orig/net/d80211/Makefile 2006-08-20 14:56:15.978192788 +0200
+++ wireless-dev/net/d80211/Makefile 2006-08-20 14:56:19.758192788 +0200
@@ -1,4 +1,4 @@
-obj-$(CONFIG_D80211) += 80211.o rate_control.o
+obj-$(CONFIG_D80211) += 80211.o rate_control_simple.o
80211-objs-$(CONFIG_D80211_LEDS) += ieee80211_led.o
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:19.058192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:19.768192788 +0200
@@ -19,6 +19,7 @@
#include <linux/if_arp.h>
#include <linux/wireless.h>
#include <linux/rtnetlink.h>
+#include <linux/mutex.h>
#include <net/iw_handler.h>
#include <linux/compiler.h>
@@ -47,12 +48,8 @@ static unsigned char eapol_header[] =
{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e };
-struct rate_control_algs {
- struct rate_control_algs *next;
- struct rate_control_ops *ops;
-};
-
-static struct rate_control_algs *ieee80211_rate_ctrl_algs;
+LIST_HEAD(ieee80211_rate_ctrl_algs);
+DEFINE_MUTEX(ieee80211_rate_ctrl_mtx);
static int rate_control_initialize(struct ieee80211_local *local);
@@ -4452,8 +4449,8 @@ int ieee80211_register_hw(struct net_dev
result = rate_control_initialize(local);
if (result < 0) {
- printk(KERN_DEBUG "%s: Failed to initialize rate control "
- "algorithm\n", dev->name);
+ printk(KERN_DEBUG "%s: Failed to initialize default rate "
+ "control algorithm\n", dev->name);
goto fail_rate;
}
result = rate_control_add_attrs(local, local->rate_ctrl_priv,
@@ -4693,61 +4690,56 @@ void * ieee80211_dev_stats(struct net_de
int ieee80211_rate_control_register(struct rate_control_ops *ops)
{
- struct rate_control_algs *alg;
-
- alg = kzalloc(sizeof(*alg), GFP_KERNEL);
- if (!alg)
- return -1;
-
- alg->next = ieee80211_rate_ctrl_algs;
- alg->ops = ops;
- ieee80211_rate_ctrl_algs = alg;
+ struct rate_control_ops *i;
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ list_for_each_entry(i, &ieee80211_rate_ctrl_algs, list) {
+ if (strcmp(i->name, ops->name) == 0) {
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+ return -EALREADY;
+ }
+ }
+ list_add(&ops->list, &ieee80211_rate_ctrl_algs);
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
return 0;
}
void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
{
- struct rate_control_algs *alg, *prev;
-
- prev = NULL;
- alg = ieee80211_rate_ctrl_algs;
- while (alg) {
- if (alg->ops == ops) {
- if (prev)
- prev->next = alg->next;
- else
- ieee80211_rate_ctrl_algs = alg->next;
- kfree(alg);
- break;
- }
- prev = alg;
- alg = alg->next;
- }
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ list_del(&ops->list);
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
}
static int rate_control_initialize(struct ieee80211_local *local)
{
- struct rate_control_algs *algs;
+ struct rate_control_ops *rctrl;
+
+ BUG_ON(local->rate_ctrl);
- if (!ieee80211_rate_ctrl_algs)
- request_module("ieee80211_rate_control");
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ if (list_empty(&ieee80211_rate_ctrl_algs)) {
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+ request_module("ieee80211_rate_control_simple");
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ }
- for (algs = ieee80211_rate_ctrl_algs; algs; algs = algs->next) {
- local->rate_ctrl = algs->ops;
- local->rate_ctrl_priv = rate_control_alloc(local);
- if (local->rate_ctrl_priv) {
+ list_for_each_entry(rctrl, &ieee80211_rate_ctrl_algs, list) {
+ rate_control_alloc(local, rctrl);
+ if (local->rate_ctrl) {
printk(KERN_DEBUG "%s: Selected rate control "
"algorithm '%s'\n", local->mdev->name,
local->rate_ctrl->name);
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
return 0;
}
}
printk(KERN_WARNING "%s: Failed to select rate control algorithm\n",
local->mdev->name);
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
return -1;
}
--- wireless-dev.orig/net/d80211/ieee80211_sysfs.c 2006-08-20 14:56:08.768192788 +0200
+++ wireless-dev/net/d80211/ieee80211_sysfs.c 2006-08-20 14:56:19.768192788 +0200
@@ -12,6 +12,8 @@
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
+#include <linux/mutex.h>
+#include <linux/list.h>
#include <net/d80211.h>
#include "ieee80211_i.h"
#include "rate_control.h"
@@ -188,12 +190,53 @@ __IEEE80211_LOCAL_SHOW(modes);
static ssize_t ieee80211_local_fmt_rate_ctrl_alg(struct ieee80211_local *local,
char *buf)
{
- if (local->rate_ctrl && local->rate_ctrl_priv)
- return sprintf(buf, "%s\n", local->rate_ctrl->name);
- return 0;
+ struct rate_control_ops *ops;
+ ssize_t len = 0;
+
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ list_for_each_entry(ops, &ieee80211_rate_ctrl_algs, list)
+ if (local->rate_ctrl == ops)
+ len += sprintf(buf+len, "[%s] ", ops->name);
+ else
+ len += sprintf(buf+len, "%s ", ops->name);
+
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+
+ len += sprintf(buf+len, "\n");
+ return len;
}
__IEEE80211_LOCAL_SHOW(rate_ctrl_alg);
+#ifdef _WRITE_RATE_CTRL_NOT_YET
+static ssize_t ieee80211_local_store_rate_ctrl_alg(struct class_device *dev,
+ const char *buf, size_t len)
+{
+ struct ieee80211_local *local = to_ieee80211_local(dev);
+ struct rate_control_ops *ops;
+ int res = 0;
+
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ list_for_each_entry(ops, &ieee80211_rate_ctrl_algs, list) {
+ if (strncmp(ops->name, buf, len) == 0) {
+ /* ok, this part is hard.
+ * we not only need to replace the running
+ * rate control algorithm and it's priv,
+ * which would be easy by just locking around
+ * every use, but we also need to
+ * replace it in ever sta_info!!
+ */
+ }
+ }
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+
+ return res < 0 ? res : len;
+}
+#endif /* _WRITE_RATE_CTRL_NOT_YET */
+
+
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),
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ wireless-dev/net/d80211/rate_control_simple.c 2006-08-20 14:56:19.768192788 +0200
@@ -0,0 +1,382 @@
+/*
+ * Copyright 2002-2005, Instant802 Networks, Inc.
+ * Copyright 2005, Devicescape Software, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * 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>
+#include <linux/types.h>
+#include <linux/slab.h>
+#include <linux/skbuff.h>
+#include <linux/compiler.h>
+
+#include <net/d80211.h>
+#include "ieee80211_i.h"
+#include "rate_control.h"
+
+/* This is a minimal implementation of TX rate controlling that can be used
+ * as the default when no improved mechanisms are available. */
+
+#define RATE_CONTROL_EMERG_DEC 2
+#define RATE_CONTROL_INTERVAL (HZ / 20)
+#define RATE_CONTROL_MIN_TX 10
+
+MODULE_ALIAS("ieee80211_rate_control_simple");
+
+static void rate_control_rate_inc(struct ieee80211_local *local,
+ struct sta_info *sta)
+{
+ struct ieee80211_sub_if_data *sdata;
+ int i = sta->txrate;
+ int maxrate;
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+ if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
+ /* forced unicast rate - do not change STA rate */
+ return;
+ }
+
+ maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1;
+
+ if (i > local->num_curr_rates)
+ i = local->num_curr_rates - 2;
+
+ while (i + 1 < local->num_curr_rates) {
+ i++;
+ if (sta->supp_rates & BIT(i) &&
+ local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED &&
+ (maxrate < 0 || i <= maxrate)) {
+ sta->txrate = i;
+ break;
+ }
+ }
+}
+
+static void rate_control_rate_dec(struct ieee80211_local *local,
+ struct sta_info *sta)
+{
+ struct ieee80211_sub_if_data *sdata;
+ int i = sta->txrate;
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+ if (sdata->bss && sdata->bss->force_unicast_rateidx > -1) {
+ /* forced unicast rate - do not change STA rate */
+ return;
+ }
+
+ if (i > local->num_curr_rates)
+ i = local->num_curr_rates;
+
+ while (i > 0) {
+ i--;
+ if (sta->supp_rates & BIT(i) &&
+ local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED) {
+ sta->txrate = i;
+ break;
+ }
+ }
+}
+
+static struct ieee80211_rate *rate_control_lowest_rate(struct ieee80211_local
+ *local)
+{
+ int i;
+
+ for (i = 0; i < local->num_curr_rates; i++) {
+ struct ieee80211_rate *rate = &local->curr_rates[i];
+
+ if (rate->flags & IEEE80211_RATE_SUPPORTED)
+ return rate;
+ }
+
+ printk(KERN_DEBUG "rate_control_lowest_rate - no supported rates "
+ "found\n");
+ return &local->curr_rates[0];
+}
+
+struct global_rate_control {
+ int dummy;
+};
+
+struct sta_rate_control {
+ unsigned long last_rate_change;
+ u32 tx_num_failures;
+ u32 tx_num_xmit;
+
+ unsigned long avg_rate_update;
+ u32 tx_avg_rate_sum;
+ u32 tx_avg_rate_num;
+};
+
+static void rate_control_simple_tx_status(struct net_device *dev,
+ struct sk_buff *skb,
+ struct ieee80211_tx_status *status)
+{
+ struct ieee80211_local *local = dev->ieee80211_ptr;
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ struct sta_info *sta;
+ struct sta_rate_control *srctrl;
+
+ sta = sta_info_get(local, hdr->addr1);
+
+ if (!sta)
+ return;
+
+ srctrl = sta->rate_ctrl_priv;
+ srctrl->tx_num_xmit++;
+ if (status->excessive_retries) {
+ sta->antenna_sel = sta->antenna_sel == 1 ? 2 : 1;
+ if (local->sta_antenna_sel == STA_ANTENNA_SEL_SW_CTRL_DEBUG) {
+ printk(KERN_DEBUG "%s: " MAC_FMT " TX antenna --> %d "
+ "(@%lu)\n",
+ dev->name, MAC_ARG(hdr->addr1),
+ sta->antenna_sel, jiffies);
+ }
+ srctrl->tx_num_failures++;
+ sta->tx_retry_failed++;
+ sta->tx_num_consecutive_failures++;
+ sta->tx_num_mpdu_fail++;
+ } else {
+ sta->last_ack_rssi[0] = sta->last_ack_rssi[1];
+ sta->last_ack_rssi[1] = sta->last_ack_rssi[2];
+ sta->last_ack_rssi[2] = status->ack_signal;
+ sta->tx_num_consecutive_failures = 0;
+ sta->tx_num_mpdu_ok++;
+ }
+ sta->tx_retry_count += status->retry_count;
+ sta->tx_num_mpdu_fail += status->retry_count;
+
+ if (time_after(jiffies,
+ srctrl->last_rate_change + RATE_CONTROL_INTERVAL) &&
+ srctrl->tx_num_xmit > RATE_CONTROL_MIN_TX) {
+ u32 per_failed;
+ srctrl->last_rate_change = jiffies;
+
+ per_failed = (100 * sta->tx_num_mpdu_fail) /
+ (sta->tx_num_mpdu_fail + sta->tx_num_mpdu_ok);
+ /* TODO: calculate average per_failed to make adjusting
+ * parameters easier */
+#if 0
+ if (net_ratelimit()) {
+ printk(KERN_DEBUG "MPDU fail=%d ok=%d per_failed=%d\n",
+ sta->tx_num_mpdu_fail, sta->tx_num_mpdu_ok,
+ per_failed);
+ }
+#endif
+
+ if (per_failed > local->rate_ctrl_num_down) {
+ rate_control_rate_dec(local, sta);
+ } else if (per_failed < local->rate_ctrl_num_up) {
+ rate_control_rate_inc(local, sta);
+ }
+ srctrl->tx_avg_rate_sum += local->curr_rates[sta->txrate].rate;
+ srctrl->tx_avg_rate_num++;
+ srctrl->tx_num_failures = 0;
+ srctrl->tx_num_xmit = 0;
+ } else if (sta->tx_num_consecutive_failures >= RATE_CONTROL_EMERG_DEC) {
+ rate_control_rate_dec(local, sta);
+ }
+
+ if (srctrl->avg_rate_update + 60 * HZ < jiffies) {
+ srctrl->avg_rate_update = jiffies;
+ if (srctrl->tx_avg_rate_num > 0) {
+#ifdef CONFIG_D80211_VERBOSE_DEBUG
+ printk(KERN_DEBUG "%s: STA " MAC_FMT " Average rate: "
+ "%d (%d/%d)\n",
+ dev->name, MAC_ARG(sta->addr),
+ srctrl->tx_avg_rate_sum /
+ srctrl->tx_avg_rate_num,
+ srctrl->tx_avg_rate_sum,
+ srctrl->tx_avg_rate_num);
+#endif /* CONFIG_D80211_VERBOSE_DEBUG */
+ srctrl->tx_avg_rate_sum = 0;
+ srctrl->tx_avg_rate_num = 0;
+ }
+ }
+
+ sta_info_put(sta);
+}
+
+static struct ieee80211_rate *rate_control_simple_get_rate(struct net_device
+ *dev,
+ struct sk_buff *skb,
+ struct
+ rate_control_extra
+ *extra)
+{
+ struct ieee80211_local *local = dev->ieee80211_ptr;
+ struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ struct sta_info *sta;
+ int rateidx, nonerp_idx;
+ u16 fc;
+
+ memset(extra, 0, sizeof(*extra));
+
+ fc = le16_to_cpu(hdr->frame_control);
+ if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
+ (hdr->addr1[0] & 0x01)) {
+ /* Send management frames and broadcast/multicast data using
+ * lowest rate. */
+ /* TODO: this could probably be improved.. */
+ return rate_control_lowest_rate(local);
+ }
+
+ sta = sta_info_get(local, hdr->addr1);
+
+ if (!sta)
+ return rate_control_lowest_rate(local);
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ if (sdata->bss && sdata->bss->force_unicast_rateidx > -1)
+ sta->txrate = sdata->bss->force_unicast_rateidx;
+
+ rateidx = sta->txrate;
+
+ if (rateidx >= local->num_curr_rates)
+ rateidx = local->num_curr_rates - 1;
+
+ sta->last_txrate = rateidx;
+ nonerp_idx = rateidx;
+ while (nonerp_idx > 0 &&
+ ((local->curr_rates[nonerp_idx].flags & IEEE80211_RATE_ERP) ||
+ !(local->curr_rates[nonerp_idx].flags &
+ IEEE80211_RATE_SUPPORTED) ||
+ !(sta->supp_rates & BIT(nonerp_idx))))
+ nonerp_idx--;
+ extra->nonerp_idx = nonerp_idx;
+ extra->nonerp = &local->curr_rates[extra->nonerp_idx];
+
+ sta_info_put(sta);
+
+ return &local->curr_rates[rateidx];
+}
+
+static void rate_control_simple_rate_init(struct ieee80211_local *local,
+ struct sta_info *sta)
+{
+ int i;
+ sta->txrate = 0;
+ /* TODO: what is a good starting rate for STA? About middle? Maybe not
+ * the lowest or the highest rate.. Could consider using RSSI from
+ * previous packets? Need to have IEEE 802.1X auth succeed immediately
+ * after assoc.. */
+ for (i = 0; i < local->num_curr_rates; i++) {
+ if ((sta->supp_rates & BIT(i)) &&
+ (local->curr_rates[i].flags & IEEE80211_RATE_SUPPORTED))
+ sta->txrate = i;
+ }
+}
+
+static void *rate_control_simple_alloc(struct ieee80211_local *local)
+{
+ struct global_rate_control *rctrl;
+
+ rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC);
+
+ return rctrl;
+}
+
+static void rate_control_simple_free(void *priv)
+{
+ struct global_rate_control *rctrl = priv;
+ kfree(rctrl);
+}
+
+static void rate_control_simple_clear(void *priv)
+{
+}
+
+static void *rate_control_simple_alloc_sta(void)
+{
+ struct sta_rate_control *rctrl;
+
+ rctrl = kzalloc(sizeof(*rctrl), GFP_ATOMIC);
+
+ return rctrl;
+}
+
+static void rate_control_simple_free_sta(void *priv)
+{
+ struct sta_rate_control *rctrl = priv;
+ kfree(rctrl);
+}
+
+static ssize_t show_sta_tx_avg_rate_sum(const struct sta_info *sta, char *buf)
+{
+ struct sta_rate_control *srctrl = sta->rate_ctrl_priv;
+
+ return sprintf(buf, "%d\n", srctrl->tx_avg_rate_sum);
+}
+
+static ssize_t show_sta_tx_avg_rate_num(const struct sta_info *sta, char *buf)
+{
+ struct sta_rate_control *srctrl = sta->rate_ctrl_priv;
+
+ return sprintf(buf, "%d\n", srctrl->tx_avg_rate_num);
+}
+
+static struct sta_attribute sta_attr_tx_avg_rate_sum =
+ __ATTR(tx_avg_rate_sum, S_IRUSR, show_sta_tx_avg_rate_sum, NULL);
+static struct sta_attribute sta_attr_tx_avg_rate_num =
+ __ATTR(tx_avg_rate_num, S_IRUSR, show_sta_tx_avg_rate_num, NULL);
+
+static struct attribute *rate_control_simple_sta_attrs[] = {
+ &sta_attr_tx_avg_rate_sum.attr,
+ &sta_attr_tx_avg_rate_num.attr,
+ NULL,
+};
+
+static struct attribute_group rate_control_simple_sta_group = {
+ .name = "rate_control_simple",
+ .attrs = rate_control_simple_sta_attrs,
+};
+
+static int rate_control_simple_add_sta_attrs(void *priv, struct kobject *kobj)
+{
+ return sysfs_create_group(kobj, &rate_control_simple_sta_group);
+}
+
+static void rate_control_simple_remove_sta_attrs(void *priv,
+ struct kobject *kobj)
+{
+ sysfs_remove_group(kobj, &rate_control_simple_sta_group);
+}
+
+static struct rate_control_ops rate_control_simple = {
+ .name = "simple",
+ .owner = THIS_MODULE,
+ .tx_status = rate_control_simple_tx_status,
+ .get_rate = rate_control_simple_get_rate,
+ .rate_init = rate_control_simple_rate_init,
+ .clear = rate_control_simple_clear,
+ .alloc = rate_control_simple_alloc,
+ .free = rate_control_simple_free,
+ .alloc_sta = rate_control_simple_alloc_sta,
+ .free_sta = rate_control_simple_free_sta,
+ .add_sta_attrs = rate_control_simple_add_sta_attrs,
+ .remove_sta_attrs = rate_control_simple_remove_sta_attrs,
+};
+
+int __init rate_control_simple_init(void)
+{
+ return ieee80211_rate_control_register(&rate_control_simple);
+}
+
+static void __exit rate_control_simple_exit(void)
+{
+ ieee80211_rate_control_unregister(&rate_control_simple);
+}
+
+module_init(rate_control_simple_init);
+module_exit(rate_control_simple_exit);
+
+MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211");
+MODULE_LICENSE("GPL");
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 07/18] d80211: get rid of sta_aid in favour of keeping track of TIM
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (5 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 06/18] d80211: rework rate control registration Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-22 18:36 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 08/18] d80211: clean up exports Johannes Berg
` (10 subsequent siblings)
17 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-sta-aid.patch --]
[-- Type: text/plain, Size: 8734 bytes --]
I think this is not correct if a STA is removed for which packets
are buffered, but if it is still wrong then that case was never
correct to start with if the hw has a set_tim callback.
---
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.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:19.768192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:20.578192788 +0200
@@ -22,6 +22,7 @@
#include <linux/mutex.h>
#include <net/iw_handler.h>
#include <linux/compiler.h>
+#include <linux/bitmap.h>
#include <net/d80211.h>
#include <net/d80211_common.h>
@@ -1044,8 +1045,12 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
} 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);
@@ -1676,25 +1681,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,
+ MAX_AID_TABLE_SIZE+1);
if (bss->dtim_count == 0)
bss->dtim_count = bss->dtim_period - 1;
@@ -1707,40 +1703,41 @@ 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]) {
+ /* 251 = max size of tim bitmap in beacon */
+ for (i = 0; i < 251; i++) {
+ if (bss->tim[i]) {
n1 = i & 0xfe;
break;
}
}
n2 = n1;
- for (i = sizeof(bitmap) - 1; i >= n1; i--) {
- if (bitmap[i]) {
+ for (i = 251 - 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);
}
@@ -2702,8 +2699,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);
@@ -2778,8 +2779,12 @@ ieee80211_rx_h_ps_poll(struct ieee80211_
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 "
--- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-08-20 14:56:15.978192788 +0200
+++ wireless-dev/net/d80211/ieee80211_i.h 2006-08-20 14:56:20.578192788 +0200
@@ -18,6 +18,8 @@
#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(MAX_AID_TABLE_SIZE+1)];
atomic_t num_sta_ps; /* number of stations in PS mode */
struct sk_buff_head ps_bc_buf;
int dtim_period, dtim_count;
@@ -549,6 +548,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);
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-08-20 14:56:17.408192788 +0200
+++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-08-20 14:56:20.588192788 +0200
@@ -298,10 +298,6 @@ static int ieee80211_ioctl_add_sta(struc
sta->aid = param->u.add_sta.aid;
if (sta->aid > MAX_AID_TABLE_SIZE)
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++) {
--- wireless-dev.orig/net/d80211/ieee80211_sysfs.c 2006-08-20 14:56:19.768192788 +0200
+++ wireless-dev/net/d80211/ieee80211_sysfs.c 2006-08-20 14:56:20.588192788 +0200
@@ -514,7 +514,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);
@@ -592,7 +591,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,
--- wireless-dev.orig/net/d80211/sta_info.c 2006-08-20 14:56:17.418192788 +0200
+++ wireless-dev/net/d80211/sta_info.c 2006-08-20 14:56:20.588192788 +0200
@@ -424,13 +424,6 @@ void sta_info_remove_aid_ptr(struct sta_
sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
if (sta->aid <= 0 || !sdata->bss)
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--;
- }
}
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 08/18] d80211: clean up exports
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (6 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 07/18] d80211: get rid of sta_aid in favour of keeping track of TIM Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-22 16:44 ` Jouni Malinen
2006-08-21 7:41 ` [PATCH 09/18] d80211: move out rate control registration code Johannes Berg
` (9 subsequent siblings)
17 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-export-cleanup.patch --]
[-- Type: text/plain, Size: 7208 bytes --]
This puts all EXPORT_SYMBOL() macros along with the function being exported,
and changes some exports that are only relevant to rate control modules
and to be GPL-only because they rate control modules need to be built against
the internal ieee80211_i.h header.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:20.578192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:21.308192788 +0200
@@ -267,6 +267,7 @@ int ieee80211_get_hdrlen(u16 fc)
return hdrlen;
}
+EXPORT_SYMBOL(ieee80211_get_hdrlen);
int ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
@@ -281,6 +282,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
@@ -1817,6 +1819,7 @@ struct sk_buff * ieee80211_beacon_get(st
ap->num_beacons++;
return skb;
}
+EXPORT_SYMBOL(ieee80211_beacon_get);
struct sk_buff *
@@ -1883,6 +1886,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)
@@ -1967,6 +1971,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)
@@ -2098,6 +2103,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)
{
@@ -2645,6 +2651,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,
@@ -2668,6 +2675,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)
@@ -3693,6 +3701,7 @@ void __ieee80211_rx(struct net_device *d
if (sta)
sta_info_put(sta);
}
+EXPORT_SYMBOL(__ieee80211_rx);
static ieee80211_txrx_result
@@ -3866,6 +3875,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,
@@ -3895,6 +3905,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)
@@ -4146,6 +4157,7 @@ void ieee80211_tx_status(struct net_devi
/* 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
@@ -4398,6 +4410,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)
@@ -4503,6 +4516,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)
{
@@ -4534,6 +4548,7 @@ int ieee80211_update_hw(struct net_devic
return 0;
}
+EXPORT_SYMBOL(ieee80211_update_hw);
void ieee80211_unregister_hw(struct net_device *dev)
@@ -4592,6 +4607,7 @@ void ieee80211_unregister_hw(struct net_
ieee80211_dev_free_index(local);
ieee80211_led_exit(local);
}
+EXPORT_SYMBOL(ieee80211_unregister_hw);
void ieee80211_free_hw(struct net_device *dev)
{
@@ -4601,6 +4617,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)
{
@@ -4647,6 +4664,7 @@ int ieee80211_netif_oper(struct net_devi
return 0;
}
+EXPORT_SYMBOL(ieee80211_netif_oper);
void ieee80211_wake_queue(struct net_device *dev, int queue)
{
@@ -4661,6 +4679,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)
{
@@ -4668,6 +4687,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)
{
@@ -4677,12 +4697,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)
@@ -4716,6 +4738,7 @@ void ieee80211_rate_control_unregister(s
list_del(&ops->list);
mutex_unlock(&ieee80211_rate_ctrl_mtx);
}
+EXPORT_SYMBOL(ieee80211_dev_stats);
static int rate_control_initialize(struct ieee80211_local *local)
@@ -4788,34 +4811,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);
--- wireless-dev.orig/net/d80211/sta_info.c 2006-08-20 14:56:20.588192788 +0200
+++ wireless-dev/net/d80211/sta_info.c 2006-08-20 14:56:21.318192788 +0200
@@ -76,6 +76,7 @@ struct sta_info * sta_info_get(struct ie
return sta;
}
+EXPORT_SYMBOL_GPL(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_GPL(sta_info_put);
void sta_info_release(struct kobject *kobj)
{
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 09/18] d80211: move out rate control registration code
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (7 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 08/18] d80211: clean up exports Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 10/18] d80211: clean up includes Johannes Berg
` (8 subsequent siblings)
17 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-shuffle-out-ratecontrol.patch --]
[-- Type: text/plain, Size: 5378 bytes --]
This patch moves some common rate control code from ieee80211.c into a new
rate_control.c file.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/Makefile 2006-08-20 14:56:19.758192788 +0200
+++ wireless-dev/net/d80211/Makefile 2006-08-20 14:56:21.948192788 +0200
@@ -15,6 +15,7 @@ obj-$(CONFIG_D80211) += 80211.o rate_con
ieee80211_sysfs.o \
ieee80211_sysfs_sta.o \
michael.o \
+ rate_control.o \
tkip.o \
aes_ccm.o \
wme.o \
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ wireless-dev/net/d80211/rate_control.c 2006-08-20 14:56:21.948192788 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2002-2005, Instant802 Networks, Inc.
+ * Copyright 2005-2006, Devicescape Software, Inc.
+ * Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <net/d80211.h>
+#include "ieee80211_i.h"
+#include "rate_control.h"
+
+LIST_HEAD(ieee80211_rate_ctrl_algs);
+DEFINE_MUTEX(ieee80211_rate_ctrl_mtx);
+
+int ieee80211_rate_control_register(struct rate_control_ops *ops)
+{
+ struct rate_control_ops *i;
+
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ list_for_each_entry(i, &ieee80211_rate_ctrl_algs, list) {
+ if (strcmp(i->name, ops->name) == 0) {
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+ return -EALREADY;
+ }
+ }
+ list_add(&ops->list, &ieee80211_rate_ctrl_algs);
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(ieee80211_rate_control_register);
+
+void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
+{
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ list_del(&ops->list);
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+}
+EXPORT_SYMBOL_GPL(ieee80211_rate_control_unregister);
+
+struct rate_control_ops *ieee80211_rate_control_select(char *name)
+{
+ struct rate_control_ops *rctl, *result = NULL;
+
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ if (list_empty(&ieee80211_rate_ctrl_algs)) {
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+ request_module("ieee80211_rate_control_%s", name?name:"simple");
+ mutex_lock(&ieee80211_rate_ctrl_mtx);
+ }
+ list_for_each_entry(rctl, &ieee80211_rate_ctrl_algs, list) {
+ if (!name || strcmp(rctl->name, name) == 0) {
+ result = rctl;
+ break;
+ }
+ }
+ mutex_unlock(&ieee80211_rate_ctrl_mtx);
+ return result;
+}
--- wireless-dev.orig/net/d80211/rate_control.h 2006-08-20 14:56:19.758192788 +0200
+++ wireless-dev/net/d80211/rate_control.h 2006-08-20 14:56:21.948192788 +0200
@@ -67,7 +67,7 @@ struct rate_control_ops {
extern int ieee80211_rate_control_register(struct rate_control_ops *ops);
extern void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
-
+extern struct rate_control_ops *ieee80211_rate_control_select(char *name);
static inline void rate_control_tx_status(struct net_device *dev,
struct sk_buff *skb,
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:21.308192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:22.008192788 +0200
@@ -19,7 +19,6 @@
#include <linux/if_arp.h>
#include <linux/wireless.h>
#include <linux/rtnetlink.h>
-#include <linux/mutex.h>
#include <net/iw_handler.h>
#include <linux/compiler.h>
#include <linux/bitmap.h>
@@ -48,10 +47,6 @@ static unsigned char bridge_tunnel_heade
static unsigned char eapol_header[] =
{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e };
-
-LIST_HEAD(ieee80211_rate_ctrl_algs);
-DEFINE_MUTEX(ieee80211_rate_ctrl_mtx);
-
static int rate_control_initialize(struct ieee80211_local *local);
@@ -4713,31 +4708,6 @@ void * ieee80211_dev_stats(struct net_de
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
return &(sdata->stats);
}
-
-
-int ieee80211_rate_control_register(struct rate_control_ops *ops)
-{
- struct rate_control_ops *i;
-
- mutex_lock(&ieee80211_rate_ctrl_mtx);
- list_for_each_entry(i, &ieee80211_rate_ctrl_algs, list) {
- if (strcmp(i->name, ops->name) == 0) {
- mutex_unlock(&ieee80211_rate_ctrl_mtx);
- return -EALREADY;
- }
- }
- list_add(&ops->list, &ieee80211_rate_ctrl_algs);
- mutex_unlock(&ieee80211_rate_ctrl_mtx);
- return 0;
-}
-
-
-void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
-{
- mutex_lock(&ieee80211_rate_ctrl_mtx);
- list_del(&ops->list);
- mutex_unlock(&ieee80211_rate_ctrl_mtx);
-}
EXPORT_SYMBOL(ieee80211_dev_stats);
@@ -4747,27 +4717,19 @@ static int rate_control_initialize(struc
BUG_ON(local->rate_ctrl);
- mutex_lock(&ieee80211_rate_ctrl_mtx);
- if (list_empty(&ieee80211_rate_ctrl_algs)) {
- mutex_unlock(&ieee80211_rate_ctrl_mtx);
- request_module("ieee80211_rate_control_simple");
- mutex_lock(&ieee80211_rate_ctrl_mtx);
- }
-
- list_for_each_entry(rctrl, &ieee80211_rate_ctrl_algs, list) {
+ rctrl = ieee80211_rate_control_select(NULL);
+ if (rctrl) {
rate_control_alloc(local, rctrl);
if (local->rate_ctrl) {
printk(KERN_DEBUG "%s: Selected rate control "
"algorithm '%s'\n", local->mdev->name,
local->rate_ctrl->name);
- mutex_unlock(&ieee80211_rate_ctrl_mtx);
return 0;
}
}
printk(KERN_WARNING "%s: Failed to select rate control algorithm\n",
local->mdev->name);
- mutex_unlock(&ieee80211_rate_ctrl_mtx);
return -1;
}
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 10/18] d80211: clean up includes
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (8 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 09/18] d80211: move out rate control registration code Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 11/18] d80211: clean up qdisc requeue Johannes Berg
` (7 subsequent siblings)
17 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-includes.patch --]
[-- Type: text/plain, Size: 6724 bytes --]
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>
--- wireless-dev.orig/net/d80211/fifo_qdisc.c 2006-08-20 14:56:19.058192788 +0200
+++ wireless-dev/net/d80211/fifo_qdisc.c 2006-08-20 14:56:22.698192788 +0200
@@ -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"
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:22.008192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:22.708192788 +0200
@@ -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>
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-08-20 14:56:20.588192788 +0200
+++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-08-20 14:56:22.708192788 +0200
@@ -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>
--- wireless-dev.orig/net/d80211/ieee80211_scan.c 2006-08-20 14:56:17.398192788 +0200
+++ wireless-dev/net/d80211/ieee80211_scan.c 2006-08-20 14:56:22.708192788 +0200
@@ -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>
--- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-08-20 14:56:17.418192788 +0200
+++ wireless-dev/net/d80211/ieee80211_sta.c 2006-08-20 14:56:22.718192788 +0200
@@ -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>
--- wireless-dev.orig/net/d80211/rate_control_simple.c 2006-08-20 14:56:19.768192788 +0200
+++ wireless-dev/net/d80211/rate_control_simple.c 2006-08-20 14:56:22.718192788 +0200
@@ -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>
--- wireless-dev.orig/net/d80211/sta_info.c 2006-08-20 14:56:21.318192788 +0200
+++ wireless-dev/net/d80211/sta_info.c 2006-08-20 14:56:22.718192788 +0200
@@ -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 <net/d80211.h>
#include "ieee80211_i.h"
#include "rate_control.h"
+#include "sta_info.h"
/* Caller must hold local->sta_lock */
--- wireless-dev.orig/net/d80211/tkip.c 2006-08-20 14:56:06.998192788 +0200
+++ wireless-dev/net/d80211/tkip.c 2006-08-20 14:56:22.718192788 +0200
@@ -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"
--- wireless-dev.orig/net/d80211/wep.c 2006-08-20 14:56:17.408192788 +0200
+++ wireless-dev/net/d80211/wep.c 2006-08-20 14:56:22.718192788 +0200
@@ -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>
--- wireless-dev.orig/net/d80211/wme.c 2006-08-20 14:56:19.058192788 +0200
+++ wireless-dev/net/d80211/wme.c 2006-08-20 14:56:22.718192788 +0200
@@ -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>
--- wireless-dev.orig/net/d80211/wpa.c 2006-08-20 14:56:17.418192788 +0200
+++ wireless-dev/net/d80211/wpa.c 2006-08-20 14:56:22.718192788 +0200
@@ -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>
--- wireless-dev.orig/net/d80211/aes_ccm.c 2006-08-20 14:56:17.408192788 +0200
+++ wireless-dev/net/d80211/aes_ccm.c 2006-08-20 14:56:22.728192788 +0200
@@ -8,7 +8,6 @@
*/
#include <linux/types.h>
-#include <linux/netdevice.h>
#include <linux/crypto.h>
#include <asm/scatterlist.h>
--- wireless-dev.orig/net/d80211/aes_ccm.h 2006-08-20 14:56:07.198192788 +0200
+++ wireless-dev/net/d80211/aes_ccm.h 2006-08-20 14:56:22.728192788 +0200
@@ -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
--- wireless-dev.orig/net/d80211/ieee80211_key.h 2006-08-20 14:56:07.218192788 +0200
+++ wireless-dev/net/d80211/ieee80211_key.h 2006-08-20 14:56:22.728192788 +0200
@@ -11,6 +11,7 @@
#define IEEE80211_KEY_H
#include <linux/types.h>
+#include <linux/kobject.h>
#include <net/d80211.h>
/* ALG_TKIP
--- wireless-dev.orig/net/d80211/sta_info.h 2006-08-20 14:56:07.258192788 +0200
+++ wireless-dev/net/d80211/sta_info.h 2006-08-20 14:56:22.728192788 +0200
@@ -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) */
--- wireless-dev.orig/net/d80211/tkip.h 2006-08-20 14:56:07.308192788 +0200
+++ wireless-dev/net/d80211/tkip.h 2006-08-20 14:56:22.728192788 +0200
@@ -10,6 +10,7 @@
#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,
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 11/18] d80211: clean up qdisc requeue
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (9 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 10/18] d80211: clean up includes Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 19:31 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 12/18] d80211: fix some sparse warnings Johannes Berg
` (6 subsequent siblings)
17 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-requeue-cleanup.patch --]
[-- Type: text/plain, Size: 4101 bytes --]
There was a comment saying:
/* TODO: clean up the cases where master_hard_start_xmit
* returns non 0 - it shouldn't ever do that. Once done we
* can remove this function */
I noticed that master_hard_start_xmit never returns nonzero
by following the paths it calls. This patch hence removes
the function and changes a few things to make the fact that
it always returns 0 more obvious.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 14:56:22.708192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 14:56:23.818192788 +0200
@@ -1211,8 +1211,8 @@ static int __ieee80211_tx(struct ieee802
return IEEE80211_TX_OK;
}
-static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
- struct ieee80211_tx_control *control, int mgmt)
+static void ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
+ struct ieee80211_tx_control *control, int mgmt)
{
struct ieee80211_local *local = dev->ieee80211_ptr;
struct sta_info *sta;
@@ -1225,7 +1225,7 @@ static int ieee80211_tx(struct net_devic
if (unlikely(skb->len < 10)) {
dev_kfree_skb(skb);
- return 0;
+ return;
}
__ieee80211_tx_prepare(&tx, skb, dev, control);
@@ -1245,12 +1245,18 @@ static int ieee80211_tx(struct net_devic
if (unlikely(res == TXRX_DROP)) {
I802_DEBUG_INC(local->tx_handlers_drop);
- goto drop;
+ if (skb)
+ dev_kfree_skb(skb);
+ for (i = 0; i < tx.u.tx.num_extra_frag; i++)
+ if (tx.u.tx.extra_frag[i])
+ dev_kfree_skb(tx.u.tx.extra_frag[i]);
+ kfree(tx.u.tx.extra_frag);
+ return;
}
if (unlikely(res == TXRX_QUEUED)) {
I802_DEBUG_INC(local->tx_handlers_queued);
- return 0;
+ return;
}
if (tx.u.tx.extra_frag) {
@@ -1306,16 +1312,6 @@ retry:
store->last_frag_rateidx = tx.u.tx.last_frag_rateidx;
store->last_frag_rate_ctrl_probe = tx.u.tx.probe_last_frag;
}
- return 0;
-
- drop:
- if (skb)
- dev_kfree_skb(skb);
- for (i = 0; i < tx.u.tx.num_extra_frag; i++)
- if (tx.u.tx.extra_frag[i])
- dev_kfree_skb(tx.u.tx.extra_frag[i]);
- kfree(tx.u.tx.extra_frag);
- return 0;
}
static void ieee80211_tx_pending(unsigned long data)
@@ -1380,7 +1376,6 @@ static int ieee80211_master_start_xmit(s
struct ieee80211_tx_packet_data *pkt_data;
struct net_device *odev = NULL;
struct ieee80211_sub_if_data *sdata, *osdata;
- int ret;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -1415,11 +1410,11 @@ static int ieee80211_master_start_xmit(s
control.requeue = pkt_data->requeue;
control.queue = pkt_data->queue;
- ret = ieee80211_tx(odev, skb, &control,
- control.type == IEEE80211_IF_TYPE_MGMT);
+ ieee80211_tx(odev, skb, &control,
+ control.type == IEEE80211_IF_TYPE_MGMT);
dev_put(odev);
- return ret;
+ return 0;
}
--- wireless-dev.orig/net/d80211/wme.c 2006-08-20 14:56:22.718192788 +0200
+++ wireless-dev/net/d80211/wme.c 2006-08-20 14:56:23.818192788 +0200
@@ -286,30 +286,6 @@ static int wme_qdiscop_enqueue(struct sk
return err;
}
-
-/* TODO: clean up the cases where master_hard_start_xmit
- * returns non 0 - it shouldn't ever do that. Once done we
- * can remove this function */
-static int wme_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd)
-{
- struct ieee80211_sched_data *q = qdisc_priv(qd);
- struct ieee80211_tx_packet_data *pkt_data =
- (struct ieee80211_tx_packet_data *) skb->cb;
- struct Qdisc *qdisc;
- int err;
-
- /* we recorded which queue to use earlier! */
- qdisc = q->queues[pkt_data->queue];
-
- if ((err = qdisc->ops->requeue(skb, qdisc)) == 0) {
- qd->q.qlen++;
- return 0;
- }
- qd->qstats.drops++;
- return err;
-}
-
-
static struct sk_buff *wme_qdiscop_dequeue(struct Qdisc* qd)
{
struct ieee80211_sched_data *q = qdisc_priv(qd);
@@ -643,7 +619,7 @@ static struct Qdisc_ops wme_qdisc_ops =
.enqueue = wme_qdiscop_enqueue,
.dequeue = wme_qdiscop_dequeue,
- .requeue = wme_qdiscop_requeue,
+ .requeue = NULL, /* not needed since master_start_xmit never fails */
.drop = NULL, /* drop not needed since we are always the root qdisc */
.init = wme_qdiscop_init,
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 12/18] d80211: fix some sparse warnings
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (10 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 11/18] d80211: clean up qdisc requeue Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-22 18:55 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 13/18] d80211: clean up some coding style issues Johannes Berg
` (5 subsequent siblings)
17 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-sparse.patch --]
[-- Type: text/plain, Size: 9192 bytes --]
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>
--- wireless-dev.orig/include/net/d80211.h 2006-08-20 17:21:26.778192788 +0200
+++ wireless-dev/include/net/d80211.h 2006-08-20 17:21:27.318192788 +0200
@@ -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
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 17:21:27.278192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 20:13:29.932819787 +0200
@@ -229,7 +229,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);
}
@@ -2636,7 +2636,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);
@@ -2645,8 +2645,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));
@@ -2655,13 +2655,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);
--- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-08-20 17:21:27.088192788 +0200
+++ wireless-dev/net/d80211/ieee80211_i.h 2006-08-20 20:13:30.362819787 +0200
@@ -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;
--- wireless-dev.orig/net/d80211/ieee80211_key.h 2006-08-20 17:21:27.238192788 +0200
+++ wireless-dev/net/d80211/ieee80211_key.h 2006-08-20 17:21:27.328192788 +0200
@@ -77,10 +77,10 @@ struct ieee80211_key {
/* 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];
};
--- wireless-dev.orig/net/d80211/rate_control_simple.c 2006-08-20 17:21:27.228192788 +0200
+++ wireless-dev/net/d80211/rate_control_simple.c 2006-08-20 20:13:30.172819787 +0200
@@ -363,7 +363,7 @@ static struct rate_control_ops rate_cont
.remove_sta_attrs = rate_control_simple_remove_sta_attrs,
};
-int __init rate_control_simple_init(void)
+static int __init rate_control_simple_init(void)
{
return ieee80211_rate_control_register(&rate_control_simple);
}
--- wireless-dev.orig/net/d80211/sta_info.h 2006-08-20 17:21:27.238192788 +0200
+++ wireless-dev/net/d80211/sta_info.h 2006-08-20 17:36:57.728192788 +0200
@@ -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;
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 13/18] d80211: clean up some coding style issues
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (11 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 12/18] d80211: fix some sparse warnings Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 19:35 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 14/18] d80211: make lowlevel TX framedump option visible Johannes Berg
` (4 subsequent siblings)
17 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-coding-style.patch --]
[-- Type: text/plain, Size: 36538 bytes --]
Try to reduce the coding style nits people will point out once
we post integration patches.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 20:13:29.932819787 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 20:32:55.212819787 +0200
@@ -36,22 +36,15 @@
/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
static unsigned char rfc1042_header[] =
-{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
+ { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
+
/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
static unsigned char bridge_tunnel_header[] =
-{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
-/* No encapsulation header if EtherType < 0x600 (=length) */
+ { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
+/* No encapsulation header if EtherType < 0x600 (=length) */
static unsigned char eapol_header[] =
-{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e };
-
-static int rate_control_initialize(struct ieee80211_local *local);
-
-
-static u8 * ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len);
-
-static int ieee80211_mgmt_start_xmit(struct sk_buff *skb,
- struct net_device *dev);
+ { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e };
struct ieee80211_key_conf *
ieee80211_key_data2conf(struct ieee80211_local *local,
@@ -479,7 +472,8 @@ ieee80211_tx_h_fragment(struct ieee80211
fhdr = (struct ieee80211_hdr *) skb_put(frag, hdrlen);
memcpy(fhdr, first->data, hdrlen);
if (i == num_fragm - 2)
- fhdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS);
+ fhdr->frame_control &=
+ cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS);
fhdr->seq_ctrl = cpu_to_le16(i + 1);
copylen = left > per_fragm ? per_fragm : left;
memcpy(skb_put(frag, copylen), pos, copylen);
@@ -515,8 +509,7 @@ static int wep_encrypt_skb(struct ieee80
} else {
tx->u.tx.control->key_idx = tx->key->hw_key_idx;
if (tx->local->hw->wep_include_iv) {
- if (ieee80211_wep_add_iv(tx->local, skb, tx->key) ==
- NULL)
+ if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
return -1;
}
}
@@ -535,7 +528,8 @@ void ieee80211_tx_set_iswep(struct ieee8
for (i = 0; i < tx->u.tx.num_extra_frag; i++) {
fhdr = (struct ieee80211_hdr *)
tx->u.tx.extra_frag[i]->data;
- fhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
+ fhdr->frame_control |=
+ cpu_to_le16(IEEE80211_FCTL_PROTECTED);
}
}
}
@@ -1173,7 +1167,8 @@ static int __ieee80211_tx(struct ieee802
int ret, i;
if (skb) {
- ieee80211_dump_frame(local->mdev->name, "TX to low-level driver", skb);
+ ieee80211_dump_frame(local->mdev->name,
+ "TX to low-level driver", skb);
ret = local->hw->tx(local->mdev, skb, control);
if (ret)
return IEEE80211_TX_AGAIN;
@@ -1266,9 +1261,9 @@ static void ieee80211_tx(struct net_devi
(struct ieee80211_hdr *)
tx.u.tx.extra_frag[i]->data;
- if (i + 1 < tx.u.tx.num_extra_frag) {
+ if (i + 1 < tx.u.tx.num_extra_frag)
next_len = tx.u.tx.extra_frag[i + 1]->len;
- } else {
+ else {
next_len = 0;
tx.u.tx.rate = tx.u.tx.last_frag_rate;
tx.u.tx.last_frag_hwrate = tx.u.tx.rate->val;
@@ -1731,8 +1726,8 @@ static void ieee80211_beacon_add_tim(str
}
-struct sk_buff * ieee80211_beacon_get(struct net_device *dev, int if_id,
- struct ieee80211_tx_control *control)
+struct sk_buff *ieee80211_beacon_get(struct net_device *dev, int if_id,
+ struct ieee80211_tx_control *control)
{
struct ieee80211_local *local = dev->ieee80211_ptr;
struct sk_buff *skb;
@@ -1775,9 +1770,8 @@ struct sk_buff * ieee80211_beacon_get(st
ieee80211_beacon_add_tim(local, ap, skb);
- if (b_tail) {
+ if (b_tail)
memcpy(skb_put(skb, bt_len), b_tail, bt_len);
- }
if (control) {
memset(&extra, 0, sizeof(extra));
@@ -1786,16 +1780,18 @@ struct sk_buff * ieee80211_beacon_get(st
rate = rate_control_get_rate(dev, skb, &extra);
if (!rate) {
if (net_ratelimit()) {
- printk(KERN_DEBUG "%s: ieee80211_beacon_get: no rate "
- "found\n", dev->name);
+ printk(KERN_DEBUG "%s: ieee80211_beacon_get: "
+ "no rate found\n", dev->name);
}
dev_kfree_skb(skb);
return NULL;
}
- control->tx_rate = (local->short_preamble &&
- (rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
- rate->val2 : rate->val;
+ if (local->short_preamble &&
+ (rate->flags & IEEE80211_RATE_PREAMBLE2))
+ control->tx_rate = rate->val2;
+ else
+ control->tx_rate = rate->val;
control->antenna_sel = local->conf.antenna_sel;
control->power_level = local->conf.power_level;
control->no_ack = 1;
@@ -1940,9 +1936,8 @@ int ieee80211_hw_config(struct net_devic
for (i = 0; i < local->hw->num_modes; i++) {
struct ieee80211_hw_modes *mode = &local->hw->modes[i];
if (mode->mode == local->conf.phymode) {
- if (local->curr_rates != mode->rates) {
+ if (local->curr_rates != mode->rates)
rate_control_clear(local);
- }
local->curr_rates = mode->rates;
local->num_curr_rates = mode->num_rates;
ieee80211_prepare_rates(dev);
@@ -2386,9 +2381,8 @@ ieee80211_rx_h_data(struct ieee80211_txr
memcpy(dst, hdr->addr1, ETH_ALEN);
memcpy(src, hdr->addr3, ETH_ALEN);
- if (sdata->type != IEEE80211_IF_TYPE_STA) {
+ if (sdata->type != IEEE80211_IF_TYPE_STA)
return TXRX_DROP;
- }
break;
case 0:
/* DA SA BSSID */
@@ -2458,10 +2452,10 @@ ieee80211_rx_h_data(struct ieee80211_txr
} else {
struct sta_info *dsta;
dsta = sta_info_get(local, skb->data);
- if (dsta && !dsta->dev) {
- printk(KERN_DEBUG "Station with null dev "
+ if (dsta && !dsta->dev)
+ printk(KERN_DEBUG "Station with null dev "
"structure!\n");
- } else if (dsta && dsta->dev == dev) {
+ else if (dsta && dsta->dev == dev) {
/* Destination station is associated to this
* AP, so send the frame directly to it and
* do not pass the frame to local net stack.
@@ -2768,18 +2762,24 @@ ieee80211_rx_h_ps_poll(struct ieee80211_
/* Use MoreData flag to indicate whether there are more
* buffered frames for this STA */
if (no_pending_pkts) {
- hdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREDATA);
+ hdr->frame_control &=
+ cpu_to_le16(~IEEE80211_FCTL_MOREDATA);
rx->sta->flags &= ~WLAN_STA_TIM;
} else
- hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
+ hdr->frame_control |=
+ cpu_to_le16(IEEE80211_FCTL_MOREDATA);
dev_queue_xmit(skb);
if (no_pending_pkts) {
if (rx->local->hw->set_tim)
- rx->local->hw->set_tim(rx->dev, rx->sta->aid, 0);
+ 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);
+ bss_tim_clear(rx->local,
+ rx->sdata->bss,
+ rx->sta->aid);
}
#ifdef IEEE80211_VERBOSE_DEBUG_PS
} else if (!rx->u.rx.sent_ps_buffered) {
@@ -3078,9 +3078,9 @@ ieee80211_rx_h_check(struct ieee80211_tx
else
always_sta_key = 1;
- if (rx->sta && rx->sta->key && always_sta_key) {
+ if (rx->sta && rx->sta->key && always_sta_key)
rx->key = rx->sta->key;
- } else {
+ else {
if (rx->sta && rx->sta->key)
rx->key = rx->sta->key;
else
@@ -3125,6 +3125,39 @@ ieee80211_rx_h_check(struct ieee80211_tx
return TXRX_CONTINUE;
}
+static u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
+{
+ u16 fc;
+
+ if (len < 24)
+ return NULL;
+
+ fc = le16_to_cpu(hdr->frame_control);
+
+ switch (fc & IEEE80211_FCTL_FTYPE) {
+ case IEEE80211_FTYPE_DATA:
+ switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
+ case IEEE80211_FCTL_TODS:
+ return hdr->addr1;
+ case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
+ return NULL;
+ case IEEE80211_FCTL_FROMDS:
+ return hdr->addr2;
+ case 0:
+ return hdr->addr3;
+ }
+ break;
+ case IEEE80211_FTYPE_MGMT:
+ return hdr->addr3;
+ case IEEE80211_FTYPE_CTL:
+ if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)
+ return hdr->addr1;
+ else
+ return NULL;
+ }
+
+ return NULL;
+}
static ieee80211_txrx_result
ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx)
@@ -3195,13 +3228,10 @@ ieee80211_rx_h_wep_weak_iv_detection(str
return TXRX_CONTINUE;
/* Check for weak IVs, if hwaccel did not remove IV from the frame */
- if (rx->local->hw->wep_include_iv ||
- rx->key->force_sw_encrypt || rx->local->conf.sw_decrypt) {
- u8 *iv = ieee80211_wep_is_weak_iv(rx->skb, rx->key);
- if (iv) {
- rx->sta->wep_weak_iv_count++;
- }
- }
+ if ((rx->local->hw->wep_include_iv ||
+ rx->key->force_sw_encrypt || rx->local->conf.sw_decrypt)
+ && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
+ rx->sta->wep_weak_iv_count++;
return TXRX_CONTINUE;
}
@@ -3370,41 +3400,6 @@ ieee80211_rx_h_passive_scan(struct ieee8
return TXRX_CONTINUE;
}
-
-static u8 * ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
-{
- u16 fc;
-
- if (len < 24)
- return NULL;
-
- fc = le16_to_cpu(hdr->frame_control);
-
- switch (fc & IEEE80211_FCTL_FTYPE) {
- case IEEE80211_FTYPE_DATA:
- switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
- case IEEE80211_FCTL_TODS:
- return hdr->addr1;
- case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
- return NULL;
- case IEEE80211_FCTL_FROMDS:
- return hdr->addr2;
- case 0:
- return hdr->addr3;
- }
- break;
- case IEEE80211_FTYPE_MGMT:
- return hdr->addr3;
- case IEEE80211_FTYPE_CTL:
- if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)
- return hdr->addr1;
- else
- return NULL;
- }
-
- return NULL;
-}
-
static void ieee80211_rx_michael_mic_report(struct net_device *dev,
struct ieee80211_hdr *hdr,
struct sta_info *sta,
@@ -3518,9 +3513,8 @@ static inline ieee80211_txrx_result __ie
}
}
- if (res == TXRX_DROP) {
+ if (res == TXRX_DROP)
dev_kfree_skb(rx->skb);
- }
return res;
}
@@ -3626,7 +3620,8 @@ void __ieee80211_rx(struct net_device *d
rx.u.rx.ra_match = 0;
} else if (!sta)
sta = rx.sta =
- ieee80211_ibss_add_sta(dev, skb, bssid,
+ ieee80211_ibss_add_sta(dev, skb,
+ bssid,
hdr->addr2);
/* FIXME: call with sdata->dev */
break;
@@ -3661,9 +3656,11 @@ void __ieee80211_rx(struct net_device *d
skb_new = skb_copy(skb, GFP_ATOMIC);
if (!skb_new) {
if (net_ratelimit())
- printk(KERN_DEBUG "%s: failed to copy "
- "multicast frame for %s",
- dev->name, prev->dev->name);
+ printk(KERN_DEBUG "%s: failed "
+ "to copy multicast frame "
+ "for %s",
+ dev->name,
+ prev->dev->name);
continue;
}
rx.skb = skb_new;
@@ -4400,6 +4397,27 @@ struct net_device *ieee80211_alloc_hw(si
}
EXPORT_SYMBOL(ieee80211_alloc_hw);
+static int rate_control_initialize(struct ieee80211_local *local)
+{
+ struct rate_control_ops *rctrl;
+
+ BUG_ON(local->rate_ctrl);
+
+ rctrl = ieee80211_rate_control_select(NULL);
+ if (rctrl) {
+ rate_control_alloc(local, rctrl);
+ if (local->rate_ctrl) {
+ printk(KERN_DEBUG "%s: Selected rate control "
+ "algorithm '%s'\n", local->mdev->name,
+ local->rate_ctrl->name);
+ return 0;
+ }
+ }
+
+ printk(KERN_WARNING "%s: Failed to select rate control algorithm\n",
+ local->mdev->name);
+ return -1;
+}
int ieee80211_register_hw(struct net_device *dev, struct ieee80211_hw *hw)
{
@@ -4447,7 +4465,8 @@ int ieee80211_register_hw(struct net_dev
rtnl_unlock();
goto fail_dev;
}
- sysfs_create_link(&local->class_dev.kobj, &dev->class_dev.kobj, "master");
+ sysfs_create_link(&local->class_dev.kobj, &dev->class_dev.kobj,
+ "master");
result = ieee80211_sysfs_add_netdevice(dev);
rtnl_unlock();
if (result < 0)
@@ -4687,7 +4706,7 @@ void ieee80211_start_queues(struct net_d
}
EXPORT_SYMBOL(ieee80211_start_queues);
-void * ieee80211_dev_hw_data(struct net_device *dev)
+void *ieee80211_dev_hw_data(struct net_device *dev)
{
struct ieee80211_local *local = dev->ieee80211_ptr;
return local->hw_priv;
@@ -4695,7 +4714,7 @@ void * ieee80211_dev_hw_data(struct net_
EXPORT_SYMBOL(ieee80211_dev_hw_data);
-void * ieee80211_dev_stats(struct net_device *dev)
+void *ieee80211_dev_stats(struct net_device *dev)
{
struct ieee80211_sub_if_data *sdata;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -4704,29 +4723,6 @@ void * ieee80211_dev_stats(struct net_de
EXPORT_SYMBOL(ieee80211_dev_stats);
-static int rate_control_initialize(struct ieee80211_local *local)
-{
- struct rate_control_ops *rctrl;
-
- BUG_ON(local->rate_ctrl);
-
- rctrl = ieee80211_rate_control_select(NULL);
- if (rctrl) {
- rate_control_alloc(local, rctrl);
- if (local->rate_ctrl) {
- printk(KERN_DEBUG "%s: Selected rate control "
- "algorithm '%s'\n", local->mdev->name,
- local->rate_ctrl->name);
- return 0;
- }
- }
-
- printk(KERN_WARNING "%s: Failed to select rate control algorithm\n",
- local->mdev->name);
- return -1;
-}
-
-
static int __init ieee80211_init(void)
{
struct sk_buff *skb;
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-08-20 20:13:40.372819787 +0200
+++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-08-20 20:13:49.872819787 +0200
@@ -605,9 +605,8 @@ static int ieee80211_set_encryption(stru
else if (sdata->type == IEEE80211_IF_TYPE_STA) {
sta = sta_info_get(local, sdata->u.sta.bssid);
if (sta) {
- if (sta->flags & WLAN_STA_WME) {
+ if (sta->flags & WLAN_STA_WME)
try_hwaccel = 0;
- }
sta_info_put(sta);
sta = NULL;
}
@@ -2018,9 +2017,8 @@ static int ieee80211_ioctl_siwrts(struct
/* If the wlan card performs RTS/CTS in hardware/firmware,
* configure it here */
- if (local->hw->set_rts_threshold) {
+ if (local->hw->set_rts_threshold)
local->hw->set_rts_threshold(dev, local->rts_threshold);
- }
return 0;
}
@@ -2421,9 +2419,9 @@ static int ieee80211_ioctl_prism2_param(
local->rate_limit_bucket = local->rate_limit_burst;
local->rate_limit_timer.expires = jiffies + HZ;
add_timer(&local->rate_limit_timer);
- } else if (local->rate_limit && !value) {
+ } else if (local->rate_limit && !value)
del_timer_sync(&local->rate_limit_timer);
- }
+
local->rate_limit = value;
break;
@@ -2431,9 +2429,9 @@ static int ieee80211_ioctl_prism2_param(
if (!local->stat_time && value) {
local->stat_timer.expires = jiffies + HZ * value / 100;
add_timer(&local->stat_timer);
- } else if (local->stat_time && !value) {
+ } else if (local->stat_time && !value)
del_timer_sync(&local->stat_timer);
- }
+
local->stat_time = value;
break;
case PRISM2_PARAM_SHORT_SLOT_TIME:
--- wireless-dev.orig/net/d80211/ieee80211_scan.c 2006-08-20 20:13:30.022819787 +0200
+++ wireless-dev/net/d80211/ieee80211_scan.c 2006-08-20 20:13:49.882819787 +0200
@@ -38,9 +38,8 @@ static void get_channel_params(struct ie
local->scan.chan_idx = 0;
do {
*chan = &(*mode)->channels[local->scan.chan_idx];
- if ((*chan)->chan == channel) {
+ if ((*chan)->chan == channel)
return;
- }
local->scan.chan_idx++;
} while (local->scan.chan_idx < (*mode)->num_channels);
*chan = NULL;
@@ -222,9 +221,8 @@ static void ieee80211_scan_stop(struct n
mode = &local->hw->modes[local->scan.mode_idx];
- if (local->scan.chan_idx >= mode->num_channels) {
+ if (local->scan.chan_idx >= mode->num_channels)
local->scan.chan_idx = 0;
- }
chan = &mode->channels[local->scan.chan_idx];
--- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-08-20 20:13:30.062819787 +0200
+++ wireless-dev/net/d80211/ieee80211_sta.c 2006-08-20 20:32:53.612819787 +0200
@@ -262,28 +262,24 @@ static void ieee80211_sta_wmm_params(str
switch (aci) {
case 1:
queue = IEEE80211_TX_QUEUE_DATA3;
- if (acm) {
+ if (acm)
local->wmm_acm |= BIT(1) | BIT(2);
- }
break;
case 2:
queue = IEEE80211_TX_QUEUE_DATA1;
- if (acm) {
+ if (acm)
local->wmm_acm |= BIT(4) | BIT(5);
- }
break;
case 3:
queue = IEEE80211_TX_QUEUE_DATA0;
- if (acm) {
+ if (acm)
local->wmm_acm |= BIT(6) | BIT(7);
- }
break;
case 0:
default:
queue = IEEE80211_TX_QUEUE_DATA2;
- if (acm) {
+ if (acm)
local->wmm_acm |= BIT(0) | BIT(3);
- }
break;
}
@@ -492,9 +488,8 @@ static void ieee80211_send_assoc(struct
if (bss) {
if (bss->capability & WLAN_CAPABILITY_PRIVACY)
capab |= WLAN_CAPABILITY_PRIVACY;
- if (bss->wmm_ie) {
+ if (bss->wmm_ie)
wmm = 1;
- }
ieee80211_rx_bss_put(dev, bss);
}
@@ -1011,9 +1006,8 @@ static void ieee80211_rx_mgmt_deauth(str
" (reason=%d)\n",
dev->name, MAC_ARG(mgmt->sa), reason_code);
- if (ifsta->authenticated) {
+ if (ifsta->authenticated)
printk(KERN_DEBUG "%s: deauthenticated\n", dev->name);
- }
if (ifsta->state == IEEE80211_AUTHENTICATE ||
ifsta->state == IEEE80211_ASSOCIATE ||
@@ -2162,9 +2156,9 @@ static int ieee80211_sta_create_ibss(str
bss->freq = local->conf.freq;
bss->last_update = jiffies;
bss->capability = cpu_to_le16(WLAN_CAPABILITY_IBSS);
- if (sdata->default_key) {
+ if (sdata->default_key)
bss->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
- } else
+ else
sdata->drop_unencrypted = 0;
bss->supp_rates_len = local->num_curr_rates;
pos = bss->supp_rates;
@@ -2782,9 +2776,9 @@ int ieee80211_sta_set_extra_ie(struct ne
}
-struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
- struct sk_buff *skb, u8 *bssid,
- u8 *addr)
+struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
+ struct sk_buff *skb, u8 *bssid,
+ u8 *addr)
{
struct ieee80211_local *local = dev->ieee80211_ptr;
struct list_head *ptr;
--- wireless-dev.orig/net/d80211/ieee80211_sysfs.c 2006-08-20 20:13:30.102819787 +0200
+++ wireless-dev/net/d80211/ieee80211_sysfs.c 2006-08-20 20:13:49.902819787 +0200
@@ -18,8 +18,10 @@
#include "ieee80211_i.h"
#include "rate_control.h"
-#define to_ieee80211_local(class) container_of(class, struct ieee80211_local, class_dev)
-#define to_net_dev(class) container_of(class, struct net_device, class_dev)
+#define to_ieee80211_local(class)\
+ container_of(class, struct ieee80211_local, class_dev)
+#define to_net_dev(class)\
+ container_of(class, struct net_device, class_dev)
static inline int rtnl_lock_local(struct ieee80211_local *local)
{
@@ -245,18 +247,56 @@ static struct class_device_attribute iee
__ATTR(radar_detect, S_IRUGO, ieee80211_local_show_radar_detect, NULL),
__ATTR(antenna_sel, S_IRUGO, ieee80211_local_show_antenna_sel, NULL),
__ATTR(calib_int, S_IRUGO, ieee80211_local_show_calib_int, NULL),
- __ATTR(bridge_packets, S_IRUGO, ieee80211_local_show_bridge_packets, NULL),
- __ATTR(key_tx_rx_threshold, S_IRUGO, ieee80211_local_show_key_tx_rx_threshold, NULL),
- __ATTR(rts_threshold, S_IRUGO, ieee80211_local_show_rts_threshold, NULL),
- __ATTR(fragmentation_threshold, S_IRUGO, ieee80211_local_show_fragmentation_threshold, NULL),
- __ATTR(short_retry_limit, S_IRUGO, ieee80211_local_show_short_retry_limit, NULL),
- __ATTR(long_retry_limit, S_IRUGO, ieee80211_local_show_long_retry_limit, NULL),
- __ATTR(total_ps_buffered, S_IRUGO, ieee80211_local_show_total_ps_buffered, NULL),
+ __ATTR(bridge_packets,
+ S_IRUGO,
+ ieee80211_local_show_bridge_packets,
+ NULL),
+
+ __ATTR(key_tx_rx_threshold,
+ S_IRUGO,
+ ieee80211_local_show_key_tx_rx_threshold,
+ NULL),
+
+ __ATTR(rts_threshold,
+ S_IRUGO,
+ ieee80211_local_show_rts_threshold,
+ NULL),
+
+ __ATTR(fragmentation_threshold,
+ S_IRUGO,
+ ieee80211_local_show_fragmentation_threshold,
+ NULL),
+
+ __ATTR(short_retry_limit,
+ S_IRUGO,
+ ieee80211_local_show_short_retry_limit,
+ NULL),
+
+ __ATTR(long_retry_limit,
+ S_IRUGO,
+ ieee80211_local_show_long_retry_limit,
+ NULL),
+
+ __ATTR(total_ps_buffered,
+ S_IRUGO,
+ ieee80211_local_show_total_ps_buffered,
+ NULL),
+
__ATTR(mode, S_IRUGO, ieee80211_local_show_mode, NULL),
+
__ATTR(wep_iv, S_IRUGO, ieee80211_local_show_wep_iv, NULL),
- __ATTR(tx_power_reduction, S_IRUGO, ieee80211_local_show_tx_power_reduction, NULL),
+
+ __ATTR(tx_power_reduction,
+ S_IRUGO,
+ ieee80211_local_show_tx_power_reduction,
+ NULL),
+
__ATTR(modes, S_IRUGO, ieee80211_local_show_modes, NULL),
- __ATTR(rate_ctrl_alg, S_IRUGO, ieee80211_local_show_rate_ctrl_alg, NULL),
+
+ __ATTR(rate_ctrl_alg,
+ S_IRUGO,
+ ieee80211_local_show_rate_ctrl_alg,
+ NULL),
{}
};
@@ -266,14 +306,17 @@ static struct class_device_attribute iee
IEEE80211_LOCAL_SHOW(name, field, format) \
static CLASS_DEVICE_ATTR(name, S_IRUGO, ieee80211_local_show_##name, NULL);
-IEEE80211_LOCAL_ATTR(transmitted_fragment_count, dot11TransmittedFragmentCount, "%u");
-IEEE80211_LOCAL_ATTR(multicast_transmitted_frame_count, dot11MulticastTransmittedFrameCount, "%u");
+IEEE80211_LOCAL_ATTR(transmitted_fragment_count,
+ dot11TransmittedFragmentCount, "%u");
+IEEE80211_LOCAL_ATTR(multicast_transmitted_frame_count,
+ dot11MulticastTransmittedFrameCount, "%u");
IEEE80211_LOCAL_ATTR(failed_count, dot11FailedCount, "%u");
IEEE80211_LOCAL_ATTR(retry_count, dot11RetryCount, "%u");
IEEE80211_LOCAL_ATTR(multiple_retry_count, dot11MultipleRetryCount, "%u");
IEEE80211_LOCAL_ATTR(frame_duplicate_count, dot11FrameDuplicateCount, "%u");
IEEE80211_LOCAL_ATTR(received_fragment_count, dot11ReceivedFragmentCount, "%u");
-IEEE80211_LOCAL_ATTR(multicast_received_frame_count, dot11MulticastReceivedFrameCount, "%u");
+IEEE80211_LOCAL_ATTR(multicast_received_frame_count,
+ dot11MulticastReceivedFrameCount, "%u");
IEEE80211_LOCAL_ATTR(transmitted_frame_count, dot11TransmittedFrameCount, "%u");
IEEE80211_LOCAL_ATTR(wep_undecryptable_count, dot11WEPUndecryptableCount, "%u");
IEEE80211_LOCAL_ATTR(num_scans, scan.num_scans, "%u");
@@ -281,20 +324,28 @@ IEEE80211_LOCAL_ATTR(num_scans, scan.num
#ifdef CONFIG_D80211_DEBUG_COUNTERS
IEEE80211_LOCAL_ATTR(tx_handlers_drop, tx_handlers_drop, "%u");
IEEE80211_LOCAL_ATTR(tx_handlers_queued, tx_handlers_queued, "%u");
-IEEE80211_LOCAL_ATTR(tx_handlers_drop_unencrypted, tx_handlers_drop_unencrypted, "%u");
-IEEE80211_LOCAL_ATTR(tx_handlers_drop_fragment, tx_handlers_drop_fragment, "%u");
+IEEE80211_LOCAL_ATTR(tx_handlers_drop_unencrypted,
+ tx_handlers_drop_unencrypted, "%u");
+IEEE80211_LOCAL_ATTR(tx_handlers_drop_fragment,
+ tx_handlers_drop_fragment, "%u");
IEEE80211_LOCAL_ATTR(tx_handlers_drop_wep, tx_handlers_drop_wep, "%u");
-IEEE80211_LOCAL_ATTR(tx_handlers_drop_rate_limit, tx_handlers_drop_rate_limit, "%u");
-IEEE80211_LOCAL_ATTR(tx_handlers_drop_not_assoc, tx_handlers_drop_not_assoc, "%u");
-IEEE80211_LOCAL_ATTR(tx_handlers_drop_unauth_port, tx_handlers_drop_unauth_port, "%u");
+IEEE80211_LOCAL_ATTR(tx_handlers_drop_rate_limit,
+ tx_handlers_drop_rate_limit, "%u");
+IEEE80211_LOCAL_ATTR(tx_handlers_drop_not_assoc,
+ tx_handlers_drop_not_assoc, "%u");
+IEEE80211_LOCAL_ATTR(tx_handlers_drop_unauth_port,
+ tx_handlers_drop_unauth_port, "%u");
IEEE80211_LOCAL_ATTR(rx_handlers_drop, rx_handlers_drop, "%u");
IEEE80211_LOCAL_ATTR(rx_handlers_queued, rx_handlers_queued, "%u");
-IEEE80211_LOCAL_ATTR(rx_handlers_drop_nullfunc, rx_handlers_drop_nullfunc, "%u");
+IEEE80211_LOCAL_ATTR(rx_handlers_drop_nullfunc,
+ rx_handlers_drop_nullfunc, "%u");
IEEE80211_LOCAL_ATTR(rx_handlers_drop_defrag, rx_handlers_drop_defrag, "%u");
IEEE80211_LOCAL_ATTR(rx_handlers_drop_short, rx_handlers_drop_short, "%u");
-IEEE80211_LOCAL_ATTR(rx_handlers_drop_passive_scan, rx_handlers_drop_passive_scan, "%u");
+IEEE80211_LOCAL_ATTR(rx_handlers_drop_passive_scan,
+ rx_handlers_drop_passive_scan, "%u");
IEEE80211_LOCAL_ATTR(tx_expand_skb_head, tx_expand_skb_head, "%u");
-IEEE80211_LOCAL_ATTR(tx_expand_skb_head_cloned, tx_expand_skb_head_cloned, "%u");
+IEEE80211_LOCAL_ATTR(tx_expand_skb_head_cloned,
+ tx_expand_skb_head_cloned, "%u");
IEEE80211_LOCAL_ATTR(rx_expand_skb_head, rx_expand_skb_head, "%u");
IEEE80211_LOCAL_ATTR(rx_expand_skb_head2, rx_expand_skb_head2, "%u");
IEEE80211_LOCAL_ATTR(rx_handlers_fragments, rx_handlers_fragments, "%u");
@@ -432,10 +483,10 @@ static ssize_t ieee80211_if_show(struct
ssize_t ret = -EINVAL;
read_lock(&dev_base_lock);
- if (dev->reg_state == NETREG_REGISTERED) {
+ if (dev->reg_state == NETREG_REGISTERED)
ret = (*format)(sdata, buf);
- }
read_unlock(&dev_base_lock);
+
return ret;
}
--- wireless-dev.orig/net/d80211/rate_control_simple.c 2006-08-20 20:13:30.172819787 +0200
+++ wireless-dev/net/d80211/rate_control_simple.c 2006-08-20 20:13:49.902819787 +0200
@@ -169,18 +169,17 @@ static void rate_control_simple_tx_statu
}
#endif
- if (per_failed > local->rate_ctrl_num_down) {
+ if (per_failed > local->rate_ctrl_num_down)
rate_control_rate_dec(local, sta);
- } else if (per_failed < local->rate_ctrl_num_up) {
+ else if (per_failed < local->rate_ctrl_num_up)
rate_control_rate_inc(local, sta);
- }
+
srctrl->tx_avg_rate_sum += local->curr_rates[sta->txrate].rate;
srctrl->tx_avg_rate_num++;
srctrl->tx_num_failures = 0;
srctrl->tx_num_xmit = 0;
- } else if (sta->tx_num_consecutive_failures >= RATE_CONTROL_EMERG_DEC) {
+ } else if (sta->tx_num_consecutive_failures >= RATE_CONTROL_EMERG_DEC)
rate_control_rate_dec(local, sta);
- }
if (srctrl->avg_rate_update + 60 * HZ < jiffies) {
srctrl->avg_rate_update = jiffies;
--- wireless-dev.orig/net/d80211/wme.c 2006-08-20 20:13:30.192819787 +0200
+++ wireless-dev/net/d80211/wme.c 2006-08-20 20:13:49.912819787 +0200
@@ -38,19 +38,17 @@ ieee80211_rx_h_parse_qos(struct ieee8021
/* frame has qos control */
tid = qc[0] & QOS_CONTROL_TID_MASK;
} else {
- if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
+ if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT))
/* Separate TID for management frames */
tid = NUM_RX_DATA_QUEUES - 1;
- } else {
+ else
/* no qos control present */
tid = 0; /* 802.1d - Best Effort */
- }
}
#ifdef CONFIG_D80211_DEBUG_COUNTERS
I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
- if (rx->sta) {
+ if (rx->sta)
I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
- }
#endif /* CONFIG_D80211_DEBUG_COUNTERS */
rx->u.rx.queue = tid;
@@ -184,11 +182,10 @@ static inline int classify80211(struct s
const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 };
/* see if frame is data or non data frame */
- if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)) {
+ if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA))
/* management frames go on AC_VO queue, but are sent
* without QoS control fields */
return IEEE80211_TX_QUEUE_DATA0;
- }
if (unlikely(pkt_data->mgmt_iface)) {
/* Data frames from hostapd (mainly, EAPOL) use AC_VO
@@ -213,11 +210,10 @@ static inline int classify80211(struct s
/* incase we are a client verify acm is not set for this ac */
for (; unlikely(local->wmm_acm & BIT(skb->priority)); )
{
- if (wme_downgrade_ac(skb)) {
+ if (wme_downgrade_ac(skb))
/* No AC with lower priority has acm=0,
* drop packet. */
return -1;
- }
}
/* look up which queue to use for frames with this 1d tag */
@@ -402,9 +398,8 @@ static int wme_qdiscop_init(struct Qdisc
return -EINVAL;
/* if options were passed in, set them */
- if (opt) {
+ if (opt)
err = wme_qdiscop_tune(qd, opt);
- }
/* create child queues */
for (i = 0; i < queues; i++) {
@@ -412,7 +407,8 @@ static int wme_qdiscop_init(struct Qdisc
q->queues[i] = qdisc_create_dflt(qd->dev, &CHILD_QDISC_OPS);
if (q->queues[i] == 0) {
q->queues[i] = &noop_qdisc;
- printk(KERN_ERR "%s child qdisc %i creation failed", dev->name, i);
+ printk(KERN_ERR "%s child qdisc %i creation failed",
+ dev->name, i);
}
}
@@ -588,7 +584,8 @@ static struct tcf_proto ** wme_classop_f
}
-/* this qdisc is classful (i.e. has classes, some of which may have leaf qdiscs attached)
+/* this qdisc is classful (i.e. has classes,
+ * some of which may have leaf qdiscs attached)
* - these are the operations on the classes */
static struct Qdisc_class_ops class_ops =
{
--- wireless-dev.orig/net/d80211/wpa.c 2006-08-20 20:13:30.232819787 +0200
+++ wireless-dev/net/d80211/wpa.c 2006-08-20 20:32:51.772819787 +0200
@@ -184,9 +184,8 @@ ieee80211_rx_h_michael_mic_verify(struct
return TXRX_CONTINUE;
#ifdef CONFIG_HOSTAPD_WPA_TESTING
- if (rx->sta && rx->sta->wpa_trigger & WPA_TRIGGER_FAIL_RX_MIC) {
+ if (rx->sta && rx->sta->wpa_trigger & WPA_TRIGGER_FAIL_RX_MIC)
wpa_test = 1;
- }
#endif /* CONFIG_HOSTAPD_WPA_TESTING */
#ifdef MICHAEL_MIC_HWACCEL
@@ -498,7 +497,8 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8
hwaccel = 1;
}
- res = ieee80211_tkip_decrypt_data(rx->local->wep_tfm, key, skb->data + hdrlen,
+ res = ieee80211_tkip_decrypt_data(rx->local->wep_tfm, key,
+ skb->data + hdrlen,
skb->len - hdrlen, rx->sta->addr,
hwaccel, rx->u.rx.queue);
if (res != TKIP_DECRYPT_OK || wpa_test) {
--- wireless-dev.orig/net/d80211/aes_ccm.c 2006-08-20 20:13:30.272819787 +0200
+++ wireless-dev/net/d80211/aes_ccm.c 2006-08-20 20:13:49.922819787 +0200
@@ -143,7 +143,7 @@ int ieee80211_aes_ccm_decrypt(struct cry
}
-struct crypto_tfm * ieee80211_aes_key_setup_encrypt(const u8 key[])
+struct crypto_tfm *ieee80211_aes_key_setup_encrypt(const u8 key[])
{
struct crypto_tfm *tfm;
--- wireless-dev.orig/net/d80211/aes_ccm.h 2006-08-20 20:13:30.342819787 +0200
+++ wireless-dev/net/d80211/aes_ccm.h 2006-08-20 20:13:49.922819787 +0200
@@ -14,7 +14,7 @@
#define AES_BLOCK_LEN 16
-struct crypto_tfm * ieee80211_aes_key_setup_encrypt(const u8 key[]);
+struct crypto_tfm *ieee80211_aes_key_setup_encrypt(const u8 key[]);
void ieee80211_aes_ccm_encrypt(struct crypto_tfm *tfm, u8 *scratch,
u8 *b_0, u8 *aad, u8 *data, size_t data_len,
u8 *cdata, u8 *mic);
--- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-08-20 20:13:30.362819787 +0200
+++ wireless-dev/net/d80211/ieee80211_i.h 2006-08-20 20:13:49.922819787 +0200
@@ -637,9 +637,9 @@ void ieee80211_sta_rx_scan(struct net_de
void ieee80211_rx_bss_list_init(struct net_device *dev);
void ieee80211_rx_bss_list_deinit(struct net_device *dev);
int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
-struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
- struct sk_buff *skb, u8 *bssid,
- u8 *addr);
+struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
+ struct sk_buff *skb, u8 *bssid,
+ u8 *addr);
int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
--- wireless-dev.orig/net/d80211/rate_control.h 2006-08-20 20:13:30.402819787 +0200
+++ wireless-dev/net/d80211/rate_control.h 2006-08-20 20:13:49.922819787 +0200
@@ -121,7 +121,7 @@ static inline void rate_control_free(str
}
-static inline void * rate_control_alloc_sta(struct ieee80211_local *local)
+static inline void *rate_control_alloc_sta(struct ieee80211_local *local)
{
return local->rate_ctrl->alloc_sta();
}
--- wireless-dev.orig/net/d80211/sta_info.c 2006-08-20 20:13:30.442819787 +0200
+++ wireless-dev/net/d80211/sta_info.c 2006-08-20 20:13:49.932819787 +0200
@@ -58,7 +58,7 @@ static inline struct sta_info *__sta_inf
return kobject_get(&sta->kobj) ? sta : NULL;
}
-struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr)
+struct sta_info *sta_info_get(struct ieee80211_local *local, u8 *addr)
{
struct sta_info *sta;
@@ -128,8 +128,8 @@ void sta_info_release(struct kobject *ko
}
-struct sta_info * sta_info_add(struct ieee80211_local *local,
- struct net_device *dev, u8 *addr)
+struct sta_info *sta_info_add(struct ieee80211_local *local,
+ struct net_device *dev, u8 *addr)
{
struct sta_info *sta;
--- wireless-dev.orig/net/d80211/tkip.c 2006-08-20 20:13:30.482819787 +0200
+++ wireless-dev/net/d80211/tkip.c 2006-08-20 20:13:49.932819787 +0200
@@ -176,8 +176,8 @@ static void tkip_mixing_phase2(const u16
/* Add TKIP IV and Ext. IV at @pos. @iv0, @iv1, and @iv2 are the first octets
* of the IV. Returns pointer to the octet following IVs (i.e., beginning of
* the packet payload). */
-u8 * ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
- u8 iv0, u8 iv1, u8 iv2)
+u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
+ u8 iv0, u8 iv1, u8 iv2)
{
*pos++ = iv0;
*pos++ = iv1;
@@ -196,7 +196,8 @@ u8 * ieee80211_tkip_add_iv(u8 *pos, stru
* headroom of eight octets for IV and Ext. IV and taildroom of four octets
* for ICV. @payload_len is the length of payload (_not_ including extra
* headroom and tailroom). @ta is the transmitter addresses. */
-void ieee80211_tkip_encrypt_data(struct crypto_tfm *tfm, struct ieee80211_key *key,
+void ieee80211_tkip_encrypt_data(struct crypto_tfm *tfm,
+ struct ieee80211_key *key,
u8 *pos, size_t payload_len, u8 *ta)
{
u8 rc4key[16];
@@ -221,7 +222,8 @@ void ieee80211_tkip_encrypt_data(struct
* beginning of the buffer containing IEEE 802.11 header payload, i.e.,
* including IV, Ext. IV, real data, Michael MIC, ICV. @payload_len is the
* length of payload, including IV, Ext. IV, MIC, ICV. */
-int ieee80211_tkip_decrypt_data(struct crypto_tfm *tfm, struct ieee80211_key *key,
+int ieee80211_tkip_decrypt_data(struct crypto_tfm *tfm,
+ struct ieee80211_key *key,
u8 *payload, size_t payload_len, u8 *ta,
int only_iv, int queue)
{
--- wireless-dev.orig/net/d80211/tkip.h 2006-08-20 20:13:30.502819787 +0200
+++ wireless-dev/net/d80211/tkip.h 2006-08-20 20:13:49.932819787 +0200
@@ -13,9 +13,10 @@
#include <linux/crypto.h>
#include "ieee80211_key.h"
-u8 * ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
- u8 iv0, u8 iv1, u8 iv2);
-void ieee80211_tkip_encrypt_data(struct crypto_tfm *tfm, struct ieee80211_key *key,
+u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key,
+ u8 iv0, u8 iv1, u8 iv2);
+void ieee80211_tkip_encrypt_data(struct crypto_tfm *tfm,
+ struct ieee80211_key *key,
u8 *pos, size_t payload_len, u8 *ta);
enum {
TKIP_DECRYPT_OK = 0,
@@ -23,7 +24,8 @@ enum {
TKIP_DECRYPT_INVALID_KEYIDX = -2,
TKIP_DECRYPT_REPLAY = -3,
};
-int ieee80211_tkip_decrypt_data(struct crypto_tfm *tfm, struct ieee80211_key *key,
+int ieee80211_tkip_decrypt_data(struct crypto_tfm *tfm,
+ struct ieee80211_key *key,
u8 *payload, size_t payload_len, u8 *ta,
int only_iv, int queue);
--- wireless-dev.orig/net/d80211/wep.c 2006-08-20 20:13:30.572819787 +0200
+++ wireless-dev/net/d80211/wep.c 2006-08-20 20:13:49.932819787 +0200
@@ -172,7 +172,8 @@ int ieee80211_wep_encrypt(struct ieee802
/* Add room for ICV */
skb_put(skb, WEP_ICV_LEN);
- ieee80211_wep_encrypt_data(local->wep_tfm, rc4key, klen, iv + WEP_IV_LEN, len);
+ ieee80211_wep_encrypt_data(local->wep_tfm, rc4key, klen,
+ iv + WEP_IV_LEN, len);
kfree(rc4key);
--- wireless-dev.orig/include/net/d80211.h 2006-08-20 20:32:58.982819787 +0200
+++ wireless-dev/include/net/d80211.h 2006-08-20 20:34:00.682819787 +0200
@@ -366,8 +366,13 @@ struct ieee80211_if_conf {
struct sk_buff *beacon;
};
-typedef enum { ALG_NONE, ALG_WEP, ALG_TKIP, ALG_CCMP, ALG_NULL }
-ieee80211_key_alg;
+typedef enum {
+ ALG_NONE,
+ ALG_WEP,
+ ALG_TKIP,
+ ALG_CCMP,
+ ALG_NULL
+} ieee80211_key_alg;
struct ieee80211_key_conf {
@@ -414,15 +419,17 @@ struct ieee80211_scan_conf {
struct sk_buff *skb; /* skb to transmit before changing channels, maybe
* NULL for none */
struct ieee80211_tx_control *tx_control;
-
};
#define IEEE80211_SEQ_COUNTER_RX 0
#define IEEE80211_SEQ_COUNTER_TX 1
typedef enum {
- SET_KEY, DISABLE_KEY, REMOVE_ALL_KEYS,
- ENABLE_COMPRESSION, DISABLE_COMPRESSION
+ SET_KEY,
+ DISABLE_KEY,
+ REMOVE_ALL_KEYS,
+ ENABLE_COMPRESSION,
+ DISABLE_COMPRESSION
} set_key_cmd;
/* Configuration block used by the low-level driver to tell 802.11 code about
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 14/18] d80211: make lowlevel TX framedump option visible
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (12 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 13/18] d80211: clean up some coding style issues Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 15/18] d80211: surface IBSS debug Johannes Berg
` (3 subsequent siblings)
17 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-make-framedump-selectable.patch --]
[-- Type: text/plain, Size: 1822 bytes --]
This patch surfaces the lowlevel TX framedump option in Kconfig.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/Kconfig 2006-08-20 17:28:47.578192788 +0200
+++ wireless-dev/net/d80211/Kconfig 2006-08-20 19:30:45.722819787 +0200
@@ -29,6 +29,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
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 17:28:09.988192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 19:30:14.732819787 +0200
@@ -271,7 +271,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)
{
@@ -302,12 +302,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)
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 15/18] d80211: surface IBSS debug
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (13 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 14/18] d80211: make lowlevel TX framedump option visible Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define Johannes Berg
` (2 subsequent siblings)
17 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-ibss-debug.patch --]
[-- Type: text/plain, Size: 4574 bytes --]
This patch surfaces the IBSS debug switch in Kconfig.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/Kconfig 2006-08-20 17:38:37.978192788 +0200
+++ wireless-dev/net/d80211/Kconfig 2006-08-20 17:39:14.728192788 +0200
@@ -53,3 +53,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.
--- wireless-dev.orig/net/d80211/ieee80211_sta.c 2006-08-20 17:38:01.488192788 +0200
+++ wireless-dev/net/d80211/ieee80211_sta.c 2006-08-20 17:38:27.758192788 +0200
@@ -31,8 +31,6 @@
#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)
@@ -1353,7 +1351,7 @@ static void ieee80211_rx_bss_info(struct
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)
@@ -1368,7 +1366,7 @@ static void ieee80211_rx_bss_info(struct
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,
@@ -1648,12 +1646,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;
@@ -1687,10 +1685,10 @@ static void ieee80211_rx_mgmt_probe_req(
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);
}
@@ -2187,10 +2185,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);
@@ -2198,10 +2196,10 @@ static int ieee80211_sta_find_ibss(struc
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)
@@ -2209,10 +2207,10 @@ static int ieee80211_sta_find_ibss(struc
}
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
@@ -2220,9 +2218,9 @@ static int ieee80211_sta_find_ibss(struc
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 &&
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (14 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 15/18] d80211: surface IBSS debug Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-22 19:00 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 17/18] d80211: surface powersave debug switch Johannes Berg
2006-08-21 7:41 ` [PATCH 18/18] d80211: fix some documentation Johannes Berg
17 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-michael-mic-define.patch --]
[-- Type: text/plain, Size: 2098 bytes --]
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>
--- wireless-dev.orig/net/d80211/wpa.c 2006-08-20 17:32:40.058192788 +0200
+++ wireless-dev/net/d80211/wpa.c 2006-08-20 17:33:52.968192788 +0200
@@ -25,9 +25,6 @@
#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 @@ ieee80211_tx_h_michael_mic_add(struct ie
}
#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);
@@ -188,7 +181,6 @@ ieee80211_rx_h_michael_mic_verify(struct
wpa_test = 1;
#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) {
@@ -201,7 +193,6 @@ ieee80211_rx_h_michael_mic_verify(struct
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)
@@ -277,9 +268,7 @@ ieee80211_rx_h_michael_mic_verify(struct
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);
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 17/18] d80211: surface powersave debug switch
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (15 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 18/18] d80211: fix some documentation Johannes Berg
17 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-ps-debug.patch --]
[-- Type: text/plain, Size: 4635 bytes --]
This patch makes the verbose powersave debugging
visible in Kconfig.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/Kconfig 2006-08-20 17:41:50.828192788 +0200
+++ wireless-dev/net/d80211/Kconfig 2006-08-20 17:42:43.448192788 +0200
@@ -59,3 +59,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.
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-20 17:41:19.968192788 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-20 17:41:39.448192788 +0200
@@ -1014,12 +1014,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);
@@ -1045,13 +1045,13 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
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;
@@ -2669,10 +2669,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 */
}
@@ -2695,10 +2695,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;
@@ -2710,11 +2710,11 @@ static int ap_sta_ps_end(struct net_devi
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);
}
@@ -2752,12 +2752,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 */
@@ -2781,12 +2781,12 @@ ieee80211_rx_h_ps_poll(struct ieee80211_
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 */
}
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 18/18] d80211: fix some documentation
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
` (16 preceding siblings ...)
2006-08-21 7:41 ` [PATCH 17/18] d80211: surface powersave debug switch Johannes Berg
@ 2006-08-21 7:41 ` Johannes Berg
17 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 7:41 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc, Johannes Berg
[-- Attachment #1: d80211-doc-fixes.patch --]
[-- Type: text/plain, Size: 11402 bytes --]
This patch fixes some spelling errors, typos etc. in d80211.h
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/include/net/d80211.h 2006-08-20 20:34:00.682819787 +0200
+++ wireless-dev/include/net/d80211.h 2006-08-20 20:58:32.412819787 +0200
@@ -17,7 +17,7 @@
#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 {
@@ -432,8 +438,8 @@ typedef enum {
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 */
@@ -445,9 +451,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. */
@@ -459,14 +465,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;
@@ -475,18 +480,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;
@@ -494,9 +499,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
*/
@@ -528,17 +533,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);
@@ -552,9 +557,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);
@@ -578,14 +583,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
@@ -615,7 +620,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);
--
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 02/18] d80211: master link
2006-08-21 7:41 ` [PATCH 02/18] d80211: master link Johannes Berg
@ 2006-08-21 8:13 ` Johannes Berg
2006-08-21 19:08 ` Jiri Benc
1 sibling, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-21 8:13 UTC (permalink / raw)
To: netdev; +Cc: Jouni Malinen, John W. Linville, Jiri Benc
On Mon, 2006-08-21 at 09:41 +0200, Johannes Berg wrote:
> + sysfs_create_link(&local->class_dev.kobj, &dev->class_dev.kobj, "master");
Whoops, with the long line again, and then I fix it in patch 13. I suck
at this ;)
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 02/18] d80211: master link
2006-08-21 7:41 ` [PATCH 02/18] d80211: master link Johannes Berg
2006-08-21 8:13 ` Johannes Berg
@ 2006-08-21 19:08 ` Jiri Benc
2006-08-22 7:49 ` Johannes Berg
1 sibling, 1 reply; 57+ messages in thread
From: Jiri Benc @ 2006-08-21 19:08 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 21 Aug 2006 09:41:09 +0200, Johannes Berg wrote:
> This patch adds a link from the wiphy to the master device in sysfs.
Please add proper error handling and remove the link when the master
device is unregistered.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 06/18] d80211: rework rate control registration
2006-08-21 7:41 ` [PATCH 06/18] d80211: rework rate control registration Johannes Berg
@ 2006-08-21 19:19 ` Jiri Benc
2006-08-22 8:33 ` Johannes Berg
0 siblings, 1 reply; 57+ messages in thread
From: Jiri Benc @ 2006-08-21 19:19 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 21 Aug 2006 09:41:13 +0200, Johannes Berg wrote:
> Contrary to what Jiri said, proper rate control module refcounting
> is much easier than allowing rate control changes on-the-fly...
> This patch implements only the former along with cleanups.
> Note that the diff between rate_control.c and rate_control_simple.c
> is small (modulo fixing indenting etc.), but I wanted to rename the
> file to more accurately reflect what it is.
This is not so easy. The locking around rate control modules is
currently totally wrecked. I started cleaning this up before I left for
vacation and haven't time to finish it yet.
My patches do:
- rename of rate control files (rate_control.h => ieee80211_rate.h)
- introduce a new ieee80211_rate.c file (I'm trying to gradually move
things out of the big ieee80211.c)
- fix locking (Yes, it is broken. Yes, I can prove it.)
- allow different rate control algorithm for each wiphy
- proper and race-free rate control modules loading
Changing of rate control algorithm on the fly is still not supported,
but the infrastructure for it is (hopefully) laid.
Sorry for not cleanly stating this before :-(
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 11/18] d80211: clean up qdisc requeue
2006-08-21 7:41 ` [PATCH 11/18] d80211: clean up qdisc requeue Johannes Berg
@ 2006-08-21 19:31 ` Jiri Benc
2006-08-22 7:48 ` Johannes Berg
0 siblings, 1 reply; 57+ messages in thread
From: Jiri Benc @ 2006-08-21 19:31 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 21 Aug 2006 09:41:18 +0200, Johannes Berg wrote:
> There was a comment saying:
> /* TODO: clean up the cases where master_hard_start_xmit
> * returns non 0 - it shouldn't ever do that. Once done we
> * can remove this function */
>
> I noticed that master_hard_start_xmit never returns nonzero
> by following the paths it calls. This patch hence removes
> the function and changes a few things to make the fact that
> it always returns 0 more obvious.
Please do not do this. The plan is to move most processing from tx path
to 802.11 qdisc dequeue function and then 0 will be a valid return code
from ieee80211_tx.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 13/18] d80211: clean up some coding style issues
2006-08-21 7:41 ` [PATCH 13/18] d80211: clean up some coding style issues Johannes Berg
@ 2006-08-21 19:35 ` Jiri Benc
2006-08-22 8:27 ` Johannes Berg
0 siblings, 1 reply; 57+ messages in thread
From: Jiri Benc @ 2006-08-21 19:35 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 21 Aug 2006 09:41:20 +0200, Johannes Berg wrote:
> Try to reduce the coding style nits people will point out once
> we post integration patches.
Please, wait with such patches for some more time. Yes, the coding style
in some places in d80211 annoys me as well. But there is a bunch of not
yet applied d80211 patches floating around and this will cause
unnecessary conflicts.
Submitting this patch two or three weeks later will help me a lot.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER
2006-08-21 7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
@ 2006-08-22 0:30 ` Mohamed Abbas
2006-08-22 0:36 ` [PATCH 02/3] d80211: iwlist scan Mohamed Abbas
` (3 more replies)
2006-08-22 16:54 ` [PATCH 01/18] d80211: LED triggers Jouni Malinen
` (2 subsequent siblings)
3 siblings, 4 replies; 57+ messages in thread
From: Mohamed Abbas @ 2006-08-22 0:30 UTC (permalink / raw)
To: netdev; +Cc: John W. Linville
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
the attached patch will add support to handle these iw_handle
SIOC[S/G]IWRATE, SIOC[S/G]IWTXPOW and SIOC[S/G]IWPOWER. It also added
some changes in ieee80211_ioctl_giwrange function to report supported
channels and rates. a call to ieee80211_hw_config is needed to infor
the low level driver about these changes, I guess we might need to add
flag to indicate which parameters was changed so the low level driver
does not need to make extra calls.
[-- Attachment #2: d80211-add-more-wireless-tool-cmd.patch --]
[-- Type: text/plain, Size: 10386 bytes --]
diff --git a/include/net/d80211.h b/include/net/d80211.h
index ba5cb4c..0cde91f 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -256,6 +256,7 @@ struct ieee80211_conf {
u8 antenna_max; /* maximum antenna gain */
short tx_power_reduction; /* in 0.1 dBm */
+ u8 power_management_enable; /* flag to enable/disable power management*/
int antenna_sel; /* default antenna conf:
* 0 = default/diversity,
* 1 = Ant0,
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 11804d5..86a5373 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1250,6 +1250,10 @@ static int ieee80211_tx(struct net_devic
break;
}
+ /* only data unicast frame */
+ if ((tx.u.tx.rate) && !mgmt && !control->no_ack)
+ local->last_rate = tx.u.tx.rate->rate * 100000;
+
skb = tx.skb; /* handlers are allowed to change skb */
if (sta)
@@ -4358,6 +4362,8 @@ struct net_device *ieee80211_alloc_hw(si
local->long_retry_limit = 4;
local->conf.calib_int = 60;
local->conf.radio_enabled = 1;
+ local->last_rate = -1;
+ local->conf.power_management_enable = 0;
local->rate_ctrl_num_up = RATE_CONTROL_NUM_UP;
local->rate_ctrl_num_down = RATE_CONTROL_NUM_DOWN;
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index bdaaf5e..29c40c5 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -396,6 +396,9 @@ #define IEEE80211_IRQSAFE_QUEUE_LIMIT 12
int *supp_rates[NUM_IEEE80211_MODES];
int *basic_rates[NUM_IEEE80211_MODES];
+ u32 last_rate; /* last tx data rate value. management and multi cast frame
+ * wont be used. */
+
int rts_threshold;
int cts_protect_erp_frames;
int fragmentation_threshold;
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index b983716..5e01659 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -1537,6 +1537,19 @@ static int ieee80211_ioctl_giwname(struc
char *name, char *extra)
{
struct ieee80211_local *local = dev->ieee80211_ptr;
+ struct ieee80211_sub_if_data *sdata;
+
+ sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ if (!local->conf.radio_enabled) {
+ strcpy(name, "radio off");
+ return 0;
+ } else if (sdata->type == IEEE80211_IF_TYPE_STA) {
+ if (!(sdata->u.sta.associated) ||
+ (sdata->u.sta.probereq_poll)) {
+ strcpy(name, "unassociated");
+ return 0;
+ }
+ }
switch (local->conf.phymode) {
case MODE_IEEE80211A:
@@ -1565,6 +1578,9 @@ static int ieee80211_ioctl_giwrange(stru
struct iw_point *data, char *extra)
{
struct iw_range *range = (struct iw_range *) extra;
+ int i,j,c;
+ int skip_bg = 0;
+ struct ieee80211_local *local = dev->ieee80211_ptr;
data->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range));
@@ -1580,6 +1596,42 @@ static int ieee80211_ioctl_giwrange(stru
range->min_frag = 256;
range->max_frag = 2346;
+ j = 0;
+ for (i = 0; i < local->num_curr_rates ; i++) {
+ struct ieee80211_rate *rate = &local->curr_rates[i];
+
+ if (rate->flags & IEEE80211_RATE_SUPPORTED) {
+ range->bitrate[j] = rate->rate * 100000;
+ j++;
+ }
+ }
+ range->num_bitrates = j;
+
+ c = 0;
+ for (i = 0; i < local->hw->num_modes; i++) {
+ struct ieee80211_hw_modes *mode = &local->hw->modes[i];
+ if (skip_bg &&
+ ((mode->mode == MODE_IEEE80211G) ||
+ (mode->mode == MODE_IEEE80211B)))
+ continue;
+
+ for (j = 0;
+ j < mode->num_channels && c < IW_MAX_FREQUENCIES; j++) {
+ struct ieee80211_channel *chan = &mode->channels[j];
+
+ range->freq[c].i = chan->chan;
+ range->freq[c].m = chan->freq * 100000;
+ range->freq[c].e = 1;
+ c++;
+ }
+ if ((mode->mode == MODE_IEEE80211G) ||
+ (mode->mode == MODE_IEEE80211B))
+ skip_bg = 1;
+
+ }
+ range->num_channels = c;
+ range->num_frequency = c;
+
return 0;
}
@@ -2138,6 +2190,169 @@ static int ieee80211_ioctl_giwretry(stru
}
+static int ieee80211_ioctl_siwrate(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct ieee80211_local *local = dev->ieee80211_ptr;
+ int i, j;
+ u32 target_rate = wrqu->bitrate.value /100000;
+ u32 fixed;
+ int *old_supp = local->supp_rates[local->conf.phymode];
+ int *supp = NULL;
+
+ /* value = -1, fixed = 0 means auto only, so we should use
+ * all rates offered by AP
+ * value = X, fixed = 1 means only rate X
+ * value = X, fixed = 0 means all rates lower equal X */
+ if (target_rate == -1) {
+ fixed = 0;
+ goto apply;
+ }
+
+ fixed = wrqu->bitrate.fixed;
+ supp = (int *) kmalloc((local->num_curr_rates + 1) *
+ sizeof(int), GFP_KERNEL);
+ if (!supp)
+ return 0;
+
+ j = 0;
+ for (i=0; i< local->num_curr_rates; i++) {
+ struct ieee80211_rate *rate = &local->curr_rates[i];
+
+ if (target_rate == rate->rate) {
+ supp[j++] = rate->rate;
+ break;
+ } else if (!fixed)
+ supp[j++] = rate->rate;
+ }
+
+ supp[j] = -1;
+
+ if ((j >= local->num_curr_rates) || (j == 0)) {
+ kfree(supp);
+ supp = NULL;
+ }
+
+ apply:
+ if (!old_supp && !supp)
+ return 0;
+
+ local->supp_rates[local->conf.phymode] = supp;
+ if (old_supp)
+ kfree(old_supp);
+
+
+ ieee80211_prepare_rates(dev);
+ ieee80211_hw_config(dev);
+ return 0;
+}
+
+static int ieee80211_ioctl_giwrate(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct ieee80211_local *local = dev->ieee80211_ptr;
+ u32 max_rate = 0;
+ int i;
+
+ for (i = local->num_curr_rates - 1; i >= 0 ; i--) {
+ struct ieee80211_rate *rate = &local->curr_rates[i];
+
+ if (rate->flags & IEEE80211_RATE_SUPPORTED) {
+ max_rate = rate->rate * 100000;
+ break;
+ }
+ }
+
+ if (max_rate >= local->last_rate)
+ wrqu->bitrate.value = local->last_rate;
+ else
+ wrqu->bitrate.value = max_rate;
+ return 0;
+}
+
+static int ieee80211_ioctl_giwtxpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
+
+ wrqu->txpower.flags = IW_TXPOW_DBM;
+ wrqu->txpower.fixed = 1;
+ wrqu->txpower.disabled = (conf->radio_enabled) ? 0 : 1;
+ wrqu->txpower.value = conf->power_level;
+ return 0;
+}
+
+
+static int ieee80211_ioctl_siwtxpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int rc = 0;
+ struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
+
+ /* we need to add flag in ieee80211_conf to mark the changed fields.
+ */
+ if (wrqu->txpower.flags != IW_TXPOW_DBM)
+ rc = -EINVAL;
+ else
+ conf->power_level = wrqu->txpower.value;
+
+
+ ieee80211_ioctl_set_radio_enabled(dev, !wrqu->txpower.disabled);
+ return rc;
+}
+
+static int ieee80211_ioctl_siwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
+
+ /* We might need to add new callback function instead of
+ calling ieee80211_hw_config
+ */
+ if (wrqu->power.disabled) {
+ conf->power_management_enable = 0;
+ ieee80211_hw_config(dev);
+ return 0;
+ }
+
+ if (wrqu->power.flags & IW_POWER_TYPE)
+ return -EOPNOTSUPP;
+
+ switch (wrqu->power.flags & IW_POWER_MODE) {
+ case IW_POWER_ON: /* If not specified */
+ case IW_POWER_MODE: /* If set all mask */
+ case IW_POWER_ALL_R: /* If explicitely state all */
+ break;
+ default: /* Otherwise we don't support it */
+ return -EOPNOTSUPP;
+ }
+
+ conf->power_management_enable = 1;
+ ieee80211_hw_config(dev);
+
+ return 0;
+}
+
+static int ieee80211_ioctl_giwpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
+
+ if (!conf->power_management_enable)
+ wrqu->power.disabled = 1;
+ else {
+ wrqu->power.disabled = 0;
+ }
+ return 0;
+}
+
+
static void ieee80211_ioctl_unmask_channels(struct ieee80211_local *local)
{
int m, c;
@@ -3141,20 +3356,20 @@ static const iw_handler ieee80211_handle
(iw_handler) NULL, /* SIOCGIWNICKN */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) NULL, /* -- hole -- */
- (iw_handler) NULL, /* SIOCSIWRATE */
- (iw_handler) NULL, /* SIOCGIWRATE */
+ (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */
+ (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */
(iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */
(iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */
(iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */
(iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */
- (iw_handler) NULL, /* SIOCSIWTXPOW */
- (iw_handler) NULL, /* SIOCGIWTXPOW */
+ (iw_handler) ieee80211_ioctl_siwtxpow, /* SIOCSIWTXPOW */
+ (iw_handler) ieee80211_ioctl_giwtxpow, /* SIOCGIWTXPOW */
(iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */
(iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
(iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
(iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
- (iw_handler) NULL, /* SIOCSIWPOWER */
- (iw_handler) NULL, /* SIOCGIWPOWER */
+ (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */
+ (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) NULL, /* -- hole -- */
(iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
^ permalink raw reply related [flat|nested] 57+ messages in thread
* [PATCH 02/3] d80211: iwlist scan
2006-08-22 0:30 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
@ 2006-08-22 0:36 ` Mohamed Abbas
2006-08-23 15:46 ` Jiri Benc
2006-08-22 0:38 ` [PATCH 03/3] d80211: adhoc Mohamed Abbas
` (2 subsequent siblings)
3 siblings, 1 reply; 57+ messages in thread
From: Mohamed Abbas @ 2006-08-22 0:36 UTC (permalink / raw)
To: netdev; +Cc: John W. Linville
[-- Attachment #1: Type: text/plain, Size: 299 bytes --]
This patch enhance iwlist scan to dispaly supported rate with readable
format. It also add a macro to convert channel to freq value. this macro
is needed in ieee80211_rx_bss_info. In 3945 we issues a host scan
command to perform scanning which will cause in setting the freq to the
wrong value.
[-- Attachment #2: d80211-iwlist-fix.patch --]
[-- Type: text/plain, Size: 3203 bytes --]
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index bdaaf5e..29c40c5 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -442,6 +445,7 @@ #define IEEE80211_IRQSAFE_QUEUE_LIMIT 12
#define IEEE80211_SCAN_MATCH_SSID BIT(0)
#define IEEE80211_SCAN_WPA_ONLY BIT(1)
#define IEEE80211_SCAN_EXTRA_INFO BIT(2)
+#define IEEE80211_SCAN_SUPP_RATE_INFO BIT(3)
int scan_flags;
#ifdef CONFIG_HOSTAPD_WPA_TESTING
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 8caf352..1153932 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1329,6 +1329,11 @@ void ieee80211_rx_bss_list_deinit(struct
}
}
+/* macro to convert channel to freq value */
+#define ieee80211chan2mhz(x) \
+ (((x) <= 14) ? \
+ (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
+ ((x) + 1000) * 5)
static void ieee80211_rx_bss_info(struct net_device *dev,
struct ieee80211_mgmt *mgmt,
@@ -1547,18 +1552,7 @@ #endif
bss->hw_mode = local->conf.phymode;
bss->channel = channel;
bss->freq = local->conf.freq;
- if (channel != local->conf.channel &&
- (local->conf.phymode == MODE_IEEE80211G ||
- local->conf.phymode == MODE_IEEE80211B) &&
- channel >= 1 && channel <= 14) {
- static const int freq_list[] = {
- 2412, 2417, 2422, 2427, 2432, 2437, 2442,
- 2447, 2452, 2457, 2462, 2467, 2472, 2484
- };
- /* IEEE 802.11g/b mode can receive packets from neighboring
- * channels, so map the channel into frequency. */
- bss->freq = freq_list[channel - 1];
- }
+ bss->freq = ieee80211chan2mhz(channel);
bss->timestamp = timestamp;
bss->last_update = jiffies;
bss->rssi = rx_status->ssi;
@@ -2724,16 +2719,33 @@ ieee80211_sta_scan_result(struct net_dev
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
buf);
- p = buf;
- p += sprintf(p, "supp_rates=");
- for (i = 0; i < bss->supp_rates_len; i++)
- p+= sprintf(p, "%02x", bss->supp_rates[i]);
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- iwe.u.data.length = strlen(buf);
- current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
- buf);
-
+ /* dispaly all support rates in readable format */
+ if ((local->scan_flags & IEEE80211_SCAN_SUPP_RATE_INFO)) {
+ p = current_ev + IW_EV_LCP_LEN;
+ iwe.cmd = SIOCGIWRATE;
+ /* Those two flags are ignored... */
+ iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+
+ for (i = 0; i < bss->supp_rates_len; i++) {
+ iwe.u.bitrate.value = ((bss->supp_rates[i] &
+ 0x7f) * 500000);
+ p = iwe_stream_add_value(current_ev, p,
+ end_buf, &iwe, IW_EV_PARAM_LEN);
+ }
+ /* Check if we added any rate */
+ if((p - current_ev) > IW_EV_LCP_LEN)
+ current_ev = p;
+ } else {
+ p = buf;
+ p += sprintf(p, "supp_rates=");
+ for (i = 0; i < bss->supp_rates_len; i++)
+ p+= sprintf(p, "%02x", bss->supp_rates[i]);
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVCUSTOM;
+ iwe.u.data.length = strlen(buf);
+ current_ev = iwe_stream_add_point(current_ev, end_buf,
+ &iwe, buf);
+ }
kfree(buf);
break;
} while (0);
^ permalink raw reply related [flat|nested] 57+ messages in thread
* [PATCH 03/3] d80211: adhoc
2006-08-22 0:30 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
2006-08-22 0:36 ` [PATCH 02/3] d80211: iwlist scan Mohamed Abbas
@ 2006-08-22 0:38 ` Mohamed Abbas
2006-08-23 15:51 ` Jiri Benc
2006-08-23 15:19 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Jiri Benc
2006-08-25 18:37 ` Jouni Malinen
3 siblings, 1 reply; 57+ messages in thread
From: Mohamed Abbas @ 2006-08-22 0:38 UTC (permalink / raw)
To: netdev; +Cc: John W. Linville
[-- Attachment #1: Type: text/plain, Size: 82 bytes --]
This a small patch allow IBSS network to recieve management frame.
Thanks
Mohamed
[-- Attachment #2: d80211-adhoc.patch --]
[-- Type: text/plain, Size: 567 bytes --]
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 8caf352..1153932 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1716,7 +1710,8 @@ void ieee80211_sta_rx_mgmt(struct net_de
goto fail;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- if (sdata->type != IEEE80211_IF_TYPE_STA) {
+ if ((sdata->type != IEEE80211_IF_TYPE_STA) &&
+ (sdata->type != IEEE80211_IF_TYPE_IBSS)) {
printk(KERN_DEBUG "%s: ieee80211_sta_rx_mgmt: non-STA "
"interface (type=%d)\n", dev->name, sdata->type);
goto fail;
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [PATCH 03/18] d80211: pointers as extended booleans
2006-08-21 7:41 ` [PATCH 03/18] d80211: pointers as extended booleans Johannes Berg
@ 2006-08-22 6:43 ` Bill Fink
2006-08-22 8:39 ` Johannes Berg
0 siblings, 1 reply; 57+ messages in thread
From: Bill Fink @ 2006-08-22 6:43 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, jkm, linville, jbenc, johannes
On Mon, 21 Aug 2006, Johannes Berg wrote:
> Please review carefully, the task was so boring that I might have made
> stupid mistakes.
> ---
> 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>
>
> --- wireless-dev.orig/net/d80211/ieee80211_scan.c 2006-08-20 14:56:09.738192788 +0200
> +++ wireless-dev/net/d80211/ieee80211_scan.c 2006-08-20 14:56:17.398192788 +0200
[...]
> @@ -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;
[...]
Just a minor nit. I don't believe the "()" on the first new line
are needed.
-Bill
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 11/18] d80211: clean up qdisc requeue
2006-08-21 19:31 ` Jiri Benc
@ 2006-08-22 7:48 ` Johannes Berg
0 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-22 7:48 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 2006-08-21 at 21:31 +0200, Jiri Benc wrote:
> to 802.11 qdisc dequeue function and then 0 will be a valid return code
> from ieee80211_tx.
Surely you mean non-zero here? :)
How will that work in the case where NET_SCHED is enabled?
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 02/18] d80211: master link
2006-08-21 19:08 ` Jiri Benc
@ 2006-08-22 7:49 ` Johannes Berg
0 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-22 7:49 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 2006-08-21 at 21:08 +0200, Jiri Benc wrote:
> Please add proper error handling and remove the link when the master
> device is unregistered.
Whoops, good points.
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 13/18] d80211: clean up some coding style issues
2006-08-21 19:35 ` Jiri Benc
@ 2006-08-22 8:27 ` Johannes Berg
0 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-22 8:27 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 2006-08-21 at 21:35 +0200, Jiri Benc wrote:
> Please, wait with such patches for some more time.
dropped.
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 06/18] d80211: rework rate control registration
2006-08-21 19:19 ` Jiri Benc
@ 2006-08-22 8:33 ` Johannes Berg
0 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-22 8:33 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 2006-08-21 at 21:19 +0200, Jiri Benc wrote:
> This is not so easy. The locking around rate control modules is
> currently totally wrecked. I started cleaning this up before I left for
> vacation and haven't time to finish it yet.
>
> My patches do:
> - rename of rate control files (rate_control.h => ieee80211_rate.h)
> - introduce a new ieee80211_rate.c file (I'm trying to gradually move
> things out of the big ieee80211.c)
> - fix locking (Yes, it is broken. Yes, I can prove it.)
> - allow different rate control algorithm for each wiphy
> - proper and race-free rate control modules loading
I do the same here, actually, except for filenames. And then I simply
rely on module refcounting, which is fine IMHO.
And I'm pretty sure that with locking around all the
registration/unregistration it's fine. And I think that in this case,
having the list_head in the rate control ops structure is fine because
no rate control module can reasonably register it twice anyway.
However, I can drop the patch if you want to. I'm not particularly
attached to it ;)
> Sorry for not cleanly stating this before :-(
Do you have anything else you're working on? :P
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 03/18] d80211: pointers as extended booleans
2006-08-22 6:43 ` Bill Fink
@ 2006-08-22 8:39 ` Johannes Berg
0 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-22 8:39 UTC (permalink / raw)
To: Bill Fink; +Cc: netdev, jkm, linville, jbenc
On Tue, 2006-08-22 at 02:43 -0400, Bill Fink wrote:
> Just a minor nit. I don't believe the "()" on the first new line
> are needed.
Good point. Weren't even needed before when that was still == NULL :)
Thanks,
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 08/18] d80211: clean up exports
2006-08-21 7:41 ` [PATCH 08/18] d80211: clean up exports Johannes Berg
@ 2006-08-22 16:44 ` Jouni Malinen
2006-08-23 7:01 ` Johannes Berg
2006-08-23 10:03 ` [PATCH] " Johannes Berg
0 siblings, 2 replies; 57+ messages in thread
From: Jouni Malinen @ 2006-08-22 16:44 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, John W. Linville, Jiri Benc
On Mon, Aug 21, 2006 at 09:41:15AM +0200, Johannes Berg wrote:
> This puts all EXPORT_SYMBOL() macros along with the function being exported,
> and changes some exports that are only relevant to rate control modules
> and to be GPL-only because they rate control modules need to be built against
> the internal ieee80211_i.h header.
Moving the EXPORT_SYMBOL definitions sounds good, but I would like to
keep changes between EXPORT_SYMBOL and EXPORT_SYMBOL_GPL separate from
this kind of cleanup. In addition, I'm not personally a huge fan of the
EXPORT_SYMBOL_GPL in the first place since I believe the GPL should
cover this without additional changes in the source code. In other
words, I would prefer that the EXPORT_SYMBOL would not be changed to
EXPORT_SYMBOL_GPL here.
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/18] d80211: LED triggers
2006-08-21 7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
2006-08-22 0:30 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
@ 2006-08-22 16:54 ` Jouni Malinen
2006-08-22 18:38 ` Jiri Benc
2006-08-23 7:02 ` Johannes Berg
2006-08-23 18:16 ` Jiri Benc
2006-09-22 11:59 ` Jiri Benc
3 siblings, 2 replies; 57+ messages in thread
From: Jouni Malinen @ 2006-08-22 16:54 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, John W. Linville, Jiri Benc
On Mon, Aug 21, 2006 at 09:41:08AM +0200, Johannes Berg wrote:
> This patch makes d80211 export LED triggers for rx/tx and introduces
> functions to allow device drivers to query the trigger names for setting
> default triggers. It also cleans up the Makefile LED related stuff.
Is someone using these or planning on using them? I have been open to
just removing all code due to lack of active use.
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 07/18] d80211: get rid of sta_aid in favour of keeping track of TIM
2006-08-21 7:41 ` [PATCH 07/18] d80211: get rid of sta_aid in favour of keeping track of TIM Johannes Berg
@ 2006-08-22 18:36 ` Jiri Benc
2006-08-23 7:04 ` Johannes Berg
` (2 more replies)
0 siblings, 3 replies; 57+ messages in thread
From: Jiri Benc @ 2006-08-22 18:36 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 21 Aug 2006 09:41:14 +0200, Johannes Berg wrote:
> I think this is not correct if a STA is removed for which packets
> are buffered, but if it is still wrong then that case was never
> correct to start with if the hw has a set_tim callback.
You're right, good catch.
Just minor things:
> [...]
> - 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]) {
> + /* 251 = max size of tim bitmap in beacon */
> + for (i = 0; i < 251; i++) {
Please, use a constant here.
> [...]
> @@ -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(MAX_AID_TABLE_SIZE+1)];
Hm, adding spaces here would extend the line above 80 characters... But
this way it doesn't look good. What to do here? I'd prefer leaving the
line a little over 80 chars in this case. What do you think?
> [...]
> --- wireless-dev.orig/net/d80211/sta_info.c 2006-08-20 14:56:17.418192788 +0200
> +++ wireless-dev/net/d80211/sta_info.c 2006-08-20 14:56:20.588192788 +0200
> @@ -424,13 +424,6 @@ void sta_info_remove_aid_ptr(struct sta_
> sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
> if (sta->aid <= 0 || !sdata->bss)
> 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--;
> - }
> }
Why are you not calling bss_tim_clear here? Am I missing something?
Also, adding hw->set_tim call here should fix the problem you described
at the beginning of the mail.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/18] d80211: LED triggers
2006-08-22 16:54 ` [PATCH 01/18] d80211: LED triggers Jouni Malinen
@ 2006-08-22 18:38 ` Jiri Benc
2006-08-23 7:02 ` Johannes Berg
1 sibling, 0 replies; 57+ messages in thread
From: Jiri Benc @ 2006-08-22 18:38 UTC (permalink / raw)
To: Jouni Malinen; +Cc: Johannes Berg, netdev, John W. Linville
On Tue, 22 Aug 2006 09:54:02 -0700, Jouni Malinen wrote:
> Is someone using these or planning on using them? I have been open to
> just removing all code due to lack of active use.
I would apply the patch - it is an useful feature and it can be compiled
out.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 12/18] d80211: fix some sparse warnings
2006-08-21 7:41 ` [PATCH 12/18] d80211: fix some sparse warnings Johannes Berg
@ 2006-08-22 18:55 ` Jiri Benc
0 siblings, 0 replies; 57+ messages in thread
From: Jiri Benc @ 2006-08-22 18:55 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 21 Aug 2006 09:41:19 +0200, Johannes Berg wrote:
> This patch fixes some warnings from sparse in d80211. Also
> fixes indentation in places near where the changes were.
I can't say I like those nearby indentation fixes at this time, but
I can live with it :-)
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define
2006-08-21 7:41 ` [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define Johannes Berg
@ 2006-08-22 19:00 ` Jiri Benc
2006-08-23 7:05 ` Johannes Berg
0 siblings, 1 reply; 57+ messages in thread
From: Jiri Benc @ 2006-08-22 19:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 21 Aug 2006 09:41:23 +0200, Johannes Berg wrote:
> The symbol MICHAEL_MIC_HWACCEL is always defined and hence
> all the ifdefs using it are useless. This patch removes it.
>
> [...]
> @@ -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
When you're touching this, could you #ifdef out wpa_test when
CONFIG_HOSTAPD_WPA_TESTING is not defined? This could be a part of this
patch.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 08/18] d80211: clean up exports
2006-08-22 16:44 ` Jouni Malinen
@ 2006-08-23 7:01 ` Johannes Berg
2006-08-23 10:03 ` [PATCH] " Johannes Berg
1 sibling, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-23 7:01 UTC (permalink / raw)
To: Jouni Malinen; +Cc: netdev, John W. Linville, Jiri Benc
On Tue, 2006-08-22 at 09:44 -0700, Jouni Malinen wrote:
> Moving the EXPORT_SYMBOL definitions sounds good, but I would like to
> keep changes between EXPORT_SYMBOL and EXPORT_SYMBOL_GPL separate from
> this kind of cleanup. In addition, I'm not personally a huge fan of the
> EXPORT_SYMBOL_GPL in the first place since I believe the GPL should
> cover this without additional changes in the source code. In other
> words, I would prefer that the EXPORT_SYMBOL would not be changed to
> EXPORT_SYMBOL_GPL here.
I just intended making it _GPL as an additional deterrent since you
practically need the internal ieee80211_i.h header for any kind of rate
control algorithm. I'm fine with dropping them, however.
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/18] d80211: LED triggers
2006-08-22 16:54 ` [PATCH 01/18] d80211: LED triggers Jouni Malinen
2006-08-22 18:38 ` Jiri Benc
@ 2006-08-23 7:02 ` Johannes Berg
1 sibling, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-23 7:02 UTC (permalink / raw)
To: Jouni Malinen; +Cc: netdev, John W. Linville, Jiri Benc
On Tue, 2006-08-22 at 09:54 -0700, Jouni Malinen wrote:
> Is someone using these or planning on using them? I have been open to
> just removing all code due to lack of active use.
Some people on powerbooks want to use the front LED for wireless
activity instead of other things, and a few weeks ago I wrote a LED
class device for it so they could hook it up now :)
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 07/18] d80211: get rid of sta_aid in favour of keeping track of TIM
2006-08-22 18:36 ` Jiri Benc
@ 2006-08-23 7:04 ` Johannes Berg
2006-08-23 10:04 ` [PATCH] " Johannes Berg
2006-08-23 10:16 ` [PATCH ] " Johannes Berg
2 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-23 7:04 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
On Tue, 2006-08-22 at 20:36 +0200, Jiri Benc wrote:
> On Mon, 21 Aug 2006 09:41:14 +0200, Johannes Berg wrote:
> > I think this is not correct if a STA is removed for which packets
> > are buffered, but if it is still wrong then that case was never
> > correct to start with if the hw has a set_tim callback.
>
> You're right, good catch.
:)
> > + /* 251 = max size of tim bitmap in beacon */
> > + for (i = 0; i < 251; i++) {
>
> Please, use a constant here.
Yeah, good point.
> > + u8 tim[sizeof(unsigned long)*BITS_TO_LONGS(MAX_AID_TABLE_SIZE+1)];
>
> Hm, adding spaces here would extend the line above 80 characters... But
> this way it doesn't look good. What to do here? I'd prefer leaving the
> line a little over 80 chars in this case. What do you think?
Heh, didn't even really think about that. I can throw in a few spaces.
> > @@ -424,13 +424,6 @@ void sta_info_remove_aid_ptr(struct sta_
> > sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
> > if (sta->aid <= 0 || !sdata->bss)
> > 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--;
> > - }
> > }
>
> Why are you not calling bss_tim_clear here? Am I missing something?
Dunno. I probably just looked at the code and thought 'oh, all this does
is updated max_aid, let me get rid of it' :)
> Also, adding hw->set_tim call here should fix the problem you described
> at the beginning of the mail.
Yeah, I guess so.
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define
2006-08-22 19:00 ` Jiri Benc
@ 2006-08-23 7:05 ` Johannes Berg
2006-08-23 9:46 ` Jiri Benc
0 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-23 7:05 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
On Tue, 2006-08-22 at 21:00 +0200, Jiri Benc wrote:
> When you're touching this, could you #ifdef out wpa_test when
> CONFIG_HOSTAPD_WPA_TESTING is not defined? This could be a part of this
> patch.
I thought about it but deemed it too ugly. And wouldn't the compiler
optimize it away anyway? Thing is, it's used in tests, and having
#ifdefs within if (...) tests is hugely ugly.
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define
2006-08-23 7:05 ` Johannes Berg
@ 2006-08-23 9:46 ` Jiri Benc
0 siblings, 0 replies; 57+ messages in thread
From: Jiri Benc @ 2006-08-23 9:46 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Wed, 23 Aug 2006 09:05:30 +0200, Johannes Berg wrote:
> On Tue, 2006-08-22 at 21:00 +0200, Jiri Benc wrote:
> > When you're touching this, could you #ifdef out wpa_test when
> > CONFIG_HOSTAPD_WPA_TESTING is not defined? This could be a part of this
> > patch.
>
> I thought about it but deemed it too ugly. And wouldn't the compiler
> optimize it away anyway? Thing is, it's used in tests, and having
> #ifdefs within if (...) tests is hugely ugly.
#ifdefs within if tests are ugly, I agree. I thought about restructuring
these ifs. Okay, we will go with your patch and address this later.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH] d80211: clean up exports
2006-08-22 16:44 ` Jouni Malinen
2006-08-23 7:01 ` Johannes Berg
@ 2006-08-23 10:03 ` Johannes Berg
1 sibling, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-23 10:03 UTC (permalink / raw)
To: Jouni Malinen; +Cc: netdev, John W. Linville, Jiri Benc
This puts all EXPORT_SYMBOL() macros along with the function being exported.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-23 10:35:03.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-23 10:35:03.000000000 +0200
@@ -267,6 +267,7 @@ int ieee80211_get_hdrlen(u16 fc)
return hdrlen;
}
+EXPORT_SYMBOL(ieee80211_get_hdrlen);
int ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
@@ -281,6 +282,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
@@ -1816,6 +1818,7 @@ struct sk_buff * ieee80211_beacon_get(st
ap->num_beacons++;
return skb;
}
+EXPORT_SYMBOL(ieee80211_beacon_get);
struct sk_buff *
@@ -1882,6 +1885,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)
@@ -1966,6 +1970,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)
@@ -2097,6 +2102,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)
{
@@ -2644,6 +2650,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,
@@ -2667,6 +2674,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)
@@ -3692,6 +3700,7 @@ void __ieee80211_rx(struct net_device *d
if (sta)
sta_info_put(sta);
}
+EXPORT_SYMBOL(__ieee80211_rx);
static ieee80211_txrx_result
@@ -3865,6 +3874,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,
@@ -3894,6 +3904,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)
@@ -4145,6 +4156,7 @@ void ieee80211_tx_status(struct net_devi
/* 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
@@ -4397,6 +4409,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)
@@ -4508,6 +4521,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)
{
@@ -4539,6 +4553,7 @@ int ieee80211_update_hw(struct net_devic
return 0;
}
+EXPORT_SYMBOL(ieee80211_update_hw);
void ieee80211_unregister_hw(struct net_device *dev)
@@ -4599,6 +4614,7 @@ void ieee80211_unregister_hw(struct net_
ieee80211_dev_free_index(local);
ieee80211_led_exit(local);
}
+EXPORT_SYMBOL(ieee80211_unregister_hw);
void ieee80211_free_hw(struct net_device *dev)
{
@@ -4608,6 +4624,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)
{
@@ -4654,6 +4671,7 @@ int ieee80211_netif_oper(struct net_devi
return 0;
}
+EXPORT_SYMBOL(ieee80211_netif_oper);
void ieee80211_wake_queue(struct net_device *dev, int queue)
{
@@ -4668,6 +4686,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)
{
@@ -4675,6 +4694,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)
{
@@ -4684,12 +4704,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)
@@ -4723,6 +4745,7 @@ void ieee80211_rate_control_unregister(s
list_del(&ops->list);
mutex_unlock(&ieee80211_rate_ctrl_mtx);
}
+EXPORT_SYMBOL(ieee80211_dev_stats);
static int rate_control_initialize(struct ieee80211_local *local)
@@ -4795,34 +4818,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);
--- wireless-dev.orig/net/d80211/sta_info.c 2006-08-23 10:35:03.000000000 +0200
+++ wireless-dev/net/d80211/sta_info.c 2006-08-23 10:35:03.000000000 +0200
@@ -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)
{
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH] d80211: get rid of sta_aid in favour of keeping track of TIM
2006-08-22 18:36 ` Jiri Benc
2006-08-23 7:04 ` Johannes Berg
@ 2006-08-23 10:04 ` Johannes Berg
2006-08-23 10:05 ` Johannes Berg
2006-08-23 10:16 ` [PATCH ] " Johannes Berg
2 siblings, 1 reply; 57+ messages in thread
From: Johannes Berg @ 2006-08-23 10:04 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
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).
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-23 10:35:02.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-23 10:35:03.000000000 +0200
@@ -22,6 +22,7 @@
#include <linux/mutex.h>
#include <net/iw_handler.h>
#include <linux/compiler.h>
+#include <linux/bitmap.h>
#include <net/d80211.h>
#include <net/d80211_common.h>
@@ -1044,8 +1045,12 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
} 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);
@@ -1676,25 +1681,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,
+ MAX_AID_TABLE_SIZE+1);
if (bss->dtim_count == 0)
bss->dtim_count = bss->dtim_period - 1;
@@ -1707,40 +1703,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);
}
@@ -2702,8 +2698,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);
@@ -2778,8 +2778,12 @@ ieee80211_rx_h_ps_poll(struct ieee80211_
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 "
--- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-08-23 10:35:00.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211_i.h 2006-08-23 10:35:03.000000000 +0200
@@ -18,6 +18,8 @@
#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(MAX_AID_TABLE_SIZE + 1)];
atomic_t num_sta_ps; /* number of stations in PS mode */
struct sk_buff_head ps_bc_buf;
int dtim_period, dtim_count;
@@ -549,6 +548,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);
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-08-23 10:35:01.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-08-23 10:35:03.000000000 +0200
@@ -298,10 +298,6 @@ static int ieee80211_ioctl_add_sta(struc
sta->aid = param->u.add_sta.aid;
if (sta->aid > MAX_AID_TABLE_SIZE)
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++) {
--- wireless-dev.orig/net/d80211/ieee80211_sysfs.c 2006-08-23 10:35:02.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211_sysfs.c 2006-08-23 10:35:03.000000000 +0200
@@ -514,7 +514,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);
@@ -592,7 +591,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,
--- wireless-dev.orig/net/d80211/sta_info.c 2006-08-23 10:35:01.000000000 +0200
+++ wireless-dev/net/d80211/sta_info.c 2006-08-23 10:35:03.000000000 +0200
@@ -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);
}
--- wireless-dev.orig/include/net/d80211.h 2006-08-23 10:35:00.000000000 +0200
+++ wireless-dev/include/net/d80211.h 2006-08-23 10:35:03.000000000 +0200
@@ -987,8 +987,10 @@ enum {
#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_TIM_LEN 251
struct ieee80211_hdr {
__le16 frame_control;
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH] d80211: get rid of sta_aid in favour of keeping track of TIM
2006-08-23 10:04 ` [PATCH] " Johannes Berg
@ 2006-08-23 10:05 ` Johannes Berg
0 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-23 10:05 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
On Wed, 2006-08-23 at 12:04 +0200, Johannes Berg wrote:
> +/* miscellaneous IEEE 802.11 constants */
> #define IEEE80211_MAX_FRAG_THRESHOLD 2346
> #define IEEE80211_MAX_RTS_THRESHOLD 2347
> +#define IEEE80211_MAX_TIM_LEN 251
Nice, but I'm using it wrongly :) I'll send a fixed patch.
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH ] d80211: get rid of sta_aid in favour of keeping track of TIM
2006-08-22 18:36 ` Jiri Benc
2006-08-23 7:04 ` Johannes Berg
2006-08-23 10:04 ` [PATCH] " Johannes Berg
@ 2006-08-23 10:16 ` Johannes Berg
2 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-23 10:16 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, Jouni Malinen, John W. Linville
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>
--- wireless-dev.orig/net/d80211/ieee80211.c 2006-08-23 10:58:26.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211.c 2006-08-23 12:09:53.000000000 +0200
@@ -22,6 +22,7 @@
#include <linux/mutex.h>
#include <net/iw_handler.h>
#include <linux/compiler.h>
+#include <linux/bitmap.h>
#include <net/d80211.h>
#include <net/d80211_common.h>
@@ -1044,8 +1045,12 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
} 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);
@@ -1676,25 +1681,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;
@@ -1707,40 +1703,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);
}
@@ -2702,8 +2698,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);
@@ -2778,8 +2778,12 @@ ieee80211_rx_h_ps_poll(struct ieee80211_
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 "
--- wireless-dev.orig/net/d80211/ieee80211_i.h 2006-08-23 10:58:26.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211_i.h 2006-08-23 12:09:53.000000000 +0200
@@ -18,6 +18,8 @@
#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;
@@ -549,6 +548,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);
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c 2006-08-23 10:58:26.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211_ioctl.c 2006-08-23 12:09:53.000000000 +0200
@@ -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++) {
--- wireless-dev.orig/net/d80211/ieee80211_sysfs.c 2006-08-23 10:58:26.000000000 +0200
+++ wireless-dev/net/d80211/ieee80211_sysfs.c 2006-08-23 12:06:16.000000000 +0200
@@ -514,7 +514,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);
@@ -592,7 +591,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,
--- wireless-dev.orig/net/d80211/sta_info.c 2006-08-23 10:58:26.000000000 +0200
+++ wireless-dev/net/d80211/sta_info.c 2006-08-23 12:06:18.000000000 +0200
@@ -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);
}
--- wireless-dev.orig/include/net/d80211.h 2006-08-23 10:58:26.000000000 +0200
+++ wireless-dev/include/net/d80211.h 2006-08-23 12:09:38.000000000 +0200
@@ -987,8 +987,11 @@ enum {
#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;
--- wireless-dev.orig/net/d80211/sta_info.h 2006-08-23 12:09:04.000000000 +0200
+++ wireless-dev/net/d80211/sta_info.h 2006-08-23 12:09:09.000000000 +0200
@@ -114,10 +114,6 @@ struct sta_info {
/* 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])
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER
2006-08-22 0:30 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
2006-08-22 0:36 ` [PATCH 02/3] d80211: iwlist scan Mohamed Abbas
2006-08-22 0:38 ` [PATCH 03/3] d80211: adhoc Mohamed Abbas
@ 2006-08-23 15:19 ` Jiri Benc
2006-08-25 18:37 ` Jouni Malinen
3 siblings, 0 replies; 57+ messages in thread
From: Jiri Benc @ 2006-08-23 15:19 UTC (permalink / raw)
To: Mohamed Abbas; +Cc: netdev, John W. Linville
On Mon, 21 Aug 2006 17:30:22 -0700, Mohamed Abbas wrote:
> the attached patch will add support to handle these iw_handle
> SIOC[S/G]IWRATE, SIOC[S/G]IWTXPOW and SIOC[S/G]IWPOWER. It also added
> some changes in ieee80211_ioctl_giwrange function to report supported
> channels and rates. a call to ieee80211_hw_config is needed to infor
> the low level driver about these changes, I guess we might need to add
> flag to indicate which parameters was changed so the low level driver
> does not need to make extra calls.
I'd like adding such flags but haven't figured how to do it easily yet.
Most drivers currently solve that by keeping private copy of the last
config and configure necessary things only.
> [...]
> --- a/net/d80211/ieee80211.c
> +++ b/net/d80211/ieee80211.c
> @@ -1250,6 +1250,10 @@ static int ieee80211_tx(struct net_devic
> break;
> }
>
> + /* only data unicast frame */
> + if ((tx.u.tx.rate) && !mgmt && !control->no_ack)
> + local->last_rate = tx.u.tx.rate->rate * 100000;
> +
Are you sure you want to set this even for dropped frames? Also, you
don't filter out management and multicast/broadcast frames with that
condition.
Move this to one of tx handlers (probably ieee80211_tx_h_rate_ctrl or
ieee80211_tx_h_misc) and remove the check for tx.u.tx.rate as it's
useless there.
> [...]
> --- a/net/d80211/ieee80211_ioctl.c
> +++ b/net/d80211/ieee80211_ioctl.c
> @@ -1537,6 +1537,19 @@ static int ieee80211_ioctl_giwname(struc
> char *name, char *extra)
> {
> struct ieee80211_local *local = dev->ieee80211_ptr;
> + struct ieee80211_sub_if_data *sdata;
> +
> + sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> + if (!local->conf.radio_enabled) {
> + strcpy(name, "radio off");
> + return 0;
> + } else if (sdata->type == IEEE80211_IF_TYPE_STA) {
> + if (!(sdata->u.sta.associated) ||
> + (sdata->u.sta.probereq_poll)) {
> + strcpy(name, "unassociated");
> + return 0;
> + }
> + }
I'm sorry, but I must NACK this hunk. Please find a better way to report
radio and association status.
>
> switch (local->conf.phymode) {
> case MODE_IEEE80211A:
> [...]
> @@ -1580,6 +1596,42 @@ static int ieee80211_ioctl_giwrange(stru
> range->min_frag = 256;
> range->max_frag = 2346;
>
> + j = 0;
> + for (i = 0; i < local->num_curr_rates ; i++) {
> + struct ieee80211_rate *rate = &local->curr_rates[i];
> +
> + if (rate->flags & IEEE80211_RATE_SUPPORTED) {
> + range->bitrate[j] = rate->rate * 100000;
> + j++;
Isn't a check for array overflow necessary here?
> + }
> + }
> + range->num_bitrates = j;
> +
> + c = 0;
> + for (i = 0; i < local->hw->num_modes; i++) {
> + struct ieee80211_hw_modes *mode = &local->hw->modes[i];
> + if (skip_bg &&
> + ((mode->mode == MODE_IEEE80211G) ||
> + (mode->mode == MODE_IEEE80211B)))
> + continue;
> +
> + for (j = 0;
> + j < mode->num_channels && c < IW_MAX_FREQUENCIES; j++) {
> + struct ieee80211_channel *chan = &mode->channels[j];
> +
> + range->freq[c].i = chan->chan;
> + range->freq[c].m = chan->freq * 100000;
> + range->freq[c].e = 1;
> + c++;
> + }
> + if ((mode->mode == MODE_IEEE80211G) ||
> + (mode->mode == MODE_IEEE80211B))
> + skip_bg = 1;
This possibly won't report all supported frequencies if b and g ones differ.
> +
> + }
> + range->num_channels = c;
> + range->num_frequency = c;
> +
> return 0;
> }
>
> @@ -2138,6 +2190,169 @@ static int ieee80211_ioctl_giwretry(stru
> }
>
>
> +static int ieee80211_ioctl_siwrate(struct net_device *dev,
> + struct iw_request_info *info,
> + union iwreq_data *wrqu, char *extra)
> +{
> + struct ieee80211_local *local = dev->ieee80211_ptr;
> + int i, j;
> + u32 target_rate = wrqu->bitrate.value /100000;
> + u32 fixed;
> + int *old_supp = local->supp_rates[local->conf.phymode];
> + int *supp = NULL;
> +
> + /* value = -1, fixed = 0 means auto only, so we should use
> + * all rates offered by AP
> + * value = X, fixed = 1 means only rate X
> + * value = X, fixed = 0 means all rates lower equal X */
> + if (target_rate == -1) {
> + fixed = 0;
> + goto apply;
> + }
> +
> + fixed = wrqu->bitrate.fixed;
> + supp = (int *) kmalloc((local->num_curr_rates + 1) *
> + sizeof(int), GFP_KERNEL);
> + if (!supp)
> + return 0;
> +
> + j = 0;
> + for (i=0; i< local->num_curr_rates; i++) {
Use correct spacing, please.
> + struct ieee80211_rate *rate = &local->curr_rates[i];
> +
> + if (target_rate == rate->rate) {
> + supp[j++] = rate->rate;
> + break;
> + } else if (!fixed)
> + supp[j++] = rate->rate;
Please add a note to d80211.h that drivers are required to sort rates
ascending by their rate.
> + }
> +
> + supp[j] = -1;
> +
> + if ((j >= local->num_curr_rates) || (j == 0)) {
> + kfree(supp);
> + supp = NULL;
> + }
If target_rate is the highest possible rate, j will be equal to
local->num_curr_rates and you will end up with
local->supp_rates[phymode] set to NULL.
> +
> + apply:
> + if (!old_supp && !supp)
> + return 0;
> +
> + local->supp_rates[local->conf.phymode] = supp;
> + if (old_supp)
> + kfree(old_supp);
> +
> +
> + ieee80211_prepare_rates(dev);
> + ieee80211_hw_config(dev);
ieee80211_hw_config can return an error.
> + return 0;
> +}
I'm not sure how this will work when intersection between supported
rates of already associated station and new supported rates is empty.
Also, management and multicast/broadcast frames need to be send at
certain rates. I'm not sure what happens when none of those rates is
enabled. But that's a more general problem, nothing to address in your
patch.
> +
> +static int ieee80211_ioctl_giwrate(struct net_device *dev,
> + struct iw_request_info *info,
> + union iwreq_data *wrqu, char *extra)
> +{
> + struct ieee80211_local *local = dev->ieee80211_ptr;
> + u32 max_rate = 0;
> + int i;
> +
> + for (i = local->num_curr_rates - 1; i >= 0 ; i--) {
> + struct ieee80211_rate *rate = &local->curr_rates[i];
> +
> + if (rate->flags & IEEE80211_RATE_SUPPORTED) {
> + max_rate = rate->rate * 100000;
> + break;
> + }
> + }
> +
> + if (max_rate >= local->last_rate)
> + wrqu->bitrate.value = local->last_rate;
> + else
> + wrqu->bitrate.value = max_rate;
> + return 0;
> +}
I'm not sure if this implementation is correct. The concept of last_rate
is totally wrong at least.
> +
> +static int ieee80211_ioctl_giwtxpow(struct net_device *dev,
> + struct iw_request_info *info,
> + union iwreq_data *wrqu, char *extra)
> +{
> + struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
> +
> + wrqu->txpower.flags = IW_TXPOW_DBM;
> + wrqu->txpower.fixed = 1;
> + wrqu->txpower.disabled = (conf->radio_enabled) ? 0 : 1;
> + wrqu->txpower.value = conf->power_level;
> + return 0;
> +}
> +
> +
> +static int ieee80211_ioctl_siwtxpow(struct net_device *dev,
> + struct iw_request_info *info,
> + union iwreq_data *wrqu, char *extra)
> +{
> + int rc = 0;
> + struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
> +
> + /* we need to add flag in ieee80211_conf to mark the changed fields.
> + */
Remove this comment, please.
> + if (wrqu->txpower.flags != IW_TXPOW_DBM)
> + rc = -EINVAL;
> + else
> + conf->power_level = wrqu->txpower.value;
> +
> +
> + ieee80211_ioctl_set_radio_enabled(dev, !wrqu->txpower.disabled);
if (!rc)
rc = ieee80211_ioctl_set_radio_enabled(...)
> + return rc;
> +}
> +
> +static int ieee80211_ioctl_siwpower(struct net_device *dev,
> + struct iw_request_info *info,
> + union iwreq_data *wrqu, char *extra)
> +{
> + struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
> +
> + /* We might need to add new callback function instead of
> + calling ieee80211_hw_config
> + */
> + if (wrqu->power.disabled) {
> + conf->power_management_enable = 0;
> + ieee80211_hw_config(dev);
> + return 0;
> + }
> +
> + if (wrqu->power.flags & IW_POWER_TYPE)
> + return -EOPNOTSUPP;
-EOPNOTSUPP doesn't sound right, the operation is supported, just
parameters are not. Don't know what is the best error, though. -EINVAL?
> +
> + switch (wrqu->power.flags & IW_POWER_MODE) {
> + case IW_POWER_ON: /* If not specified */
> + case IW_POWER_MODE: /* If set all mask */
> + case IW_POWER_ALL_R: /* If explicitely state all */
> + break;
> + default: /* Otherwise we don't support it */
> + return -EOPNOTSUPP;
Again, not -EOPNOTSUPP.
> + }
> +
> + conf->power_management_enable = 1;
> + ieee80211_hw_config(dev);
Error handling.
> +
> + return 0;
> +}
I'd prefer more complete solution for power management, but okay, let's
change it later.
> [...]
Please, correct indentation through the whole patch (spaces to tabs).
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 02/3] d80211: iwlist scan
2006-08-22 0:36 ` [PATCH 02/3] d80211: iwlist scan Mohamed Abbas
@ 2006-08-23 15:46 ` Jiri Benc
2006-08-28 20:37 ` [PATCH 0/7] d80211: support more wireless command mabbas
0 siblings, 1 reply; 57+ messages in thread
From: Jiri Benc @ 2006-08-23 15:46 UTC (permalink / raw)
To: Mohamed Abbas; +Cc: netdev, John W. Linville
On Mon, 21 Aug 2006 17:36:16 -0700, Mohamed Abbas wrote:
> This patch enhance iwlist scan to dispaly supported rate with readable
> format. It also add a macro to convert channel to freq value. this macro
> is needed in ieee80211_rx_bss_info. In 3945 we issues a host scan
> command to perform scanning which will cause in setting the freq to the
> wrong value.
Please (this apply also to your other patches):
- use more descriptive subject
- append Signed-off-by: line
- Cc: me on d80211 patches
- indent with tabs
> [...]
> --- a/net/d80211/ieee80211_sta.c
> +++ b/net/d80211/ieee80211_sta.c
> @@ -1329,6 +1329,11 @@ void ieee80211_rx_bss_list_deinit(struct
> }
> }
>
> +/* macro to convert channel to freq value */
> +#define ieee80211chan2mhz(x) \
#defined identifiers should be in upper case.
> + (((x) <= 14) ? \
> + (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
> + ((x) + 1000) * 5)
>
> static void ieee80211_rx_bss_info(struct net_device *dev,
> struct ieee80211_mgmt *mgmt,
> @@ -1547,18 +1552,7 @@ #endif
> bss->hw_mode = local->conf.phymode;
> bss->channel = channel;
> bss->freq = local->conf.freq;
> - if (channel != local->conf.channel &&
> - (local->conf.phymode == MODE_IEEE80211G ||
> - local->conf.phymode == MODE_IEEE80211B) &&
> - channel >= 1 && channel <= 14) {
> - static const int freq_list[] = {
> - 2412, 2417, 2422, 2427, 2432, 2437, 2442,
> - 2447, 2452, 2457, 2462, 2467, 2472, 2484
> - };
> - /* IEEE 802.11g/b mode can receive packets from neighboring
> - * channels, so map the channel into frequency. */
> - bss->freq = freq_list[channel - 1];
> - }
> + bss->freq = ieee80211chan2mhz(channel);
This must depend on current phymode. No hackish macros trying to guess
phymode depending on channel number, please.
> bss->timestamp = timestamp;
> bss->last_update = jiffies;
> bss->rssi = rx_status->ssi;
> @@ -2724,16 +2719,33 @@ ieee80211_sta_scan_result(struct net_dev
> current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
> buf);
>
> - p = buf;
> - p += sprintf(p, "supp_rates=");
> - for (i = 0; i < bss->supp_rates_len; i++)
> - p+= sprintf(p, "%02x", bss->supp_rates[i]);
> - memset(&iwe, 0, sizeof(iwe));
> - iwe.cmd = IWEVCUSTOM;
> - iwe.u.data.length = strlen(buf);
> - current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
> - buf);
> -
> + /* dispaly all support rates in readable format */
> + if ((local->scan_flags & IEEE80211_SCAN_SUPP_RATE_INFO)) {
No need to have this in scan_flags. Just use this unconditionally and
drop the else part.
> + p = current_ev + IW_EV_LCP_LEN;
> + iwe.cmd = SIOCGIWRATE;
> + /* Those two flags are ignored... */
> + iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
> +
> + for (i = 0; i < bss->supp_rates_len; i++) {
> + iwe.u.bitrate.value = ((bss->supp_rates[i] &
> + 0x7f) * 500000);
> + p = iwe_stream_add_value(current_ev, p,
> + end_buf, &iwe, IW_EV_PARAM_LEN);
> + }
> + /* Check if we added any rate */
> + if((p - current_ev) > IW_EV_LCP_LEN)
> + current_ev = p;
> + } else {
> + p = buf;
> + p += sprintf(p, "supp_rates=");
> + for (i = 0; i < bss->supp_rates_len; i++)
> + p+= sprintf(p, "%02x", bss->supp_rates[i]);
> + memset(&iwe, 0, sizeof(iwe));
> + iwe.cmd = IWEVCUSTOM;
> + iwe.u.data.length = strlen(buf);
> + current_ev = iwe_stream_add_point(current_ev, end_buf,
> + &iwe, buf);
> + }
> kfree(buf);
> break;
> } while (0);
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 03/3] d80211: adhoc
2006-08-22 0:38 ` [PATCH 03/3] d80211: adhoc Mohamed Abbas
@ 2006-08-23 15:51 ` Jiri Benc
0 siblings, 0 replies; 57+ messages in thread
From: Jiri Benc @ 2006-08-23 15:51 UTC (permalink / raw)
To: Mohamed Abbas; +Cc: netdev, John W. Linville
On Mon, 21 Aug 2006 17:38:04 -0700, Mohamed Abbas wrote:
> This a small patch allow IBSS network to recieve management frame.
> Thanks
> Mohamed
>
> diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
> index 8caf352..1153932 100644
> --- a/net/d80211/ieee80211_sta.c
> +++ b/net/d80211/ieee80211_sta.c
> @@ -1716,7 +1710,8 @@ void ieee80211_sta_rx_mgmt(struct net_de
> goto fail;
>
> sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> - if (sdata->type != IEEE80211_IF_TYPE_STA) {
> + if ((sdata->type != IEEE80211_IF_TYPE_STA) &&
> + (sdata->type != IEEE80211_IF_TYPE_IBSS)) {
> printk(KERN_DEBUG "%s: ieee80211_sta_rx_mgmt: non-STA "
> "interface (type=%d)\n", dev->name, sdata->type);
> goto fail;
The check for the interface type can be removed completely here - it is
already checked by ieee80211_rx_h_mgmt. I'll take care of that.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/18] d80211: LED triggers
2006-08-21 7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
2006-08-22 0:30 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
2006-08-22 16:54 ` [PATCH 01/18] d80211: LED triggers Jouni Malinen
@ 2006-08-23 18:16 ` Jiri Benc
2006-08-24 7:03 ` Johannes Berg
2006-09-22 11:59 ` Jiri Benc
3 siblings, 1 reply; 57+ messages in thread
From: Jiri Benc @ 2006-08-23 18:16 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, John W. Linville
On Mon, 21 Aug 2006 09:41:08 +0200, Johannes Berg wrote:
> This patch makes d80211 export LED triggers for rx/tx and introduces
> functions to allow device drivers to query the trigger names for setting
> default triggers. It also cleans up the Makefile LED related stuff.
CC [M] net/d80211/ieee80211_led.o
In file included from net/d80211/ieee80211_led.h:9,
from net/d80211/ieee80211_led.c:11:
include/linux/leds.h:39: error: field 'node' has incomplete type
include/linux/leds.h:44: error: syntax error before 'rwlock_t'
include/linux/leds.h:44: warning: no semicolon at end of struct or union
include/linux/leds.h:50: error: syntax error before '}' token
include/linux/leds.h:72: error: syntax error before 'rwlock_t'
include/linux/leds.h:72: warning: no semicolon at end of struct or union
include/linux/leds.h:77: error: syntax error before '}' token
net/d80211/ieee80211_led.c: In function 'ieee80211_led_init':
net/d80211/ieee80211_led.c:38: error: invalid application of 'sizeof' to incomplete type 'struct
net/d80211/ieee80211_led.c:43: error: dereferencing pointer to incomplete type
net/d80211/ieee80211_led.c:49: error: invalid application of 'sizeof' to incomplete type 'struct
net/d80211/ieee80211_led.c:54: error: dereferencing pointer to incomplete type
make[2]: *** [net/d80211/ieee80211_led.o] Error 1
make[1]: *** [net/d80211] Error 2
make: *** [net] Error 2
Omitting the patch for now.
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/18] d80211: LED triggers
2006-08-23 18:16 ` Jiri Benc
@ 2006-08-24 7:03 ` Johannes Berg
0 siblings, 0 replies; 57+ messages in thread
From: Johannes Berg @ 2006-08-24 7:03 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, John W. Linville
On Wed, 2006-08-23 at 20:16 +0200, Jiri Benc wrote:
> CC [M] net/d80211/ieee80211_led.o
> In file included from net/d80211/ieee80211_led.h:9,
> from net/d80211/ieee80211_led.c:11:
> include/linux/leds.h:39: error: field 'node' has incomplete type
> include/linux/leds.h:44: error: syntax error before 'rwlock_t'
Oh right, forgot about that. Please queue, the fix for this is in -mm,
include/linux/leds.h isn't including all files it requires.
johannes
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER
2006-08-22 0:30 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
` (2 preceding siblings ...)
2006-08-23 15:19 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Jiri Benc
@ 2006-08-25 18:37 ` Jouni Malinen
2006-08-25 18:46 ` Mohamed Abbas
3 siblings, 1 reply; 57+ messages in thread
From: Jouni Malinen @ 2006-08-25 18:37 UTC (permalink / raw)
To: Mohamed Abbas; +Cc: netdev, John W. Linville
On Mon, Aug 21, 2006 at 05:30:22PM -0700, Mohamed Abbas wrote:
> the attached patch will add support to handle these iw_handle
> SIOC[S/G]IWRATE, SIOC[S/G]IWTXPOW and SIOC[S/G]IWPOWER. It also added
> some changes in ieee80211_ioctl_giwrange function to report supported
> channels and rates. a call to ieee80211_hw_config is needed to infor
> the low level driver about these changes, I guess we might need to add
> flag to indicate which parameters was changed so the low level driver
> does not need to make extra calls.
Could you please separate SIOCSIWRATE from the rest. I did not go
through the details yet, but I do not think the proposed change here
would match the the way rate control was designed in the Devicescape
stack and I would not like to see this getting in before more careful
review and explanation of how this is expected to work. The way I see
rate settings working is that the control would be applied to the rate
control algorithm and not to the list of rates itself.
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER
2006-08-25 18:37 ` Jouni Malinen
@ 2006-08-25 18:46 ` Mohamed Abbas
0 siblings, 0 replies; 57+ messages in thread
From: Mohamed Abbas @ 2006-08-25 18:46 UTC (permalink / raw)
To: Jouni Malinen; +Cc: netdev, John W. Linville
I will separate each pair of S/G in separate patch so it will be easier
to discuss each set separately. I will provide the patch this weekend
taking into account the comments provided
Thanks
Mohamed
Jouni Malinen wrote:
>On Mon, Aug 21, 2006 at 05:30:22PM -0700, Mohamed Abbas wrote:
>
>
>
>>the attached patch will add support to handle these iw_handle
>>SIOC[S/G]IWRATE, SIOC[S/G]IWTXPOW and SIOC[S/G]IWPOWER. It also added
>>some changes in ieee80211_ioctl_giwrange function to report supported
>>channels and rates. a call to ieee80211_hw_config is needed to infor
>>the low level driver about these changes, I guess we might need to add
>>flag to indicate which parameters was changed so the low level driver
>>does not need to make extra calls.
>>
>>
>
>Could you please separate SIOCSIWRATE from the rest. I did not go
>through the details yet, but I do not think the proposed change here
>would match the the way rate control was designed in the Devicescape
>stack and I would not like to see this getting in before more careful
>review and explanation of how this is expected to work. The way I see
>rate settings working is that the control would be applied to the rate
>control algorithm and not to the list of rates itself.
>
>
>
^ permalink raw reply [flat|nested] 57+ messages in thread
* [PATCH 0/7] d80211: support more wireless command
2006-08-23 15:46 ` Jiri Benc
@ 2006-08-28 20:37 ` mabbas
0 siblings, 0 replies; 57+ messages in thread
From: mabbas @ 2006-08-28 20:37 UTC (permalink / raw)
To: netdev; +Cc: Jiri Benc, John W. Linville
the following patches are based on earlier patched. I did separate each
set of command into its own patch with enhanced based on you comments.
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [PATCH 01/18] d80211: LED triggers
2006-08-21 7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
` (2 preceding siblings ...)
2006-08-23 18:16 ` Jiri Benc
@ 2006-09-22 11:59 ` Jiri Benc
3 siblings, 0 replies; 57+ messages in thread
From: Jiri Benc @ 2006-09-22 11:59 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Jouni Malinen, John W. Linville
On Mon, 21 Aug 2006 09:41:08 +0200, Johannes Berg wrote:
> This patch makes d80211 export LED triggers for rx/tx and introduces
> functions to allow device drivers to query the trigger names for setting
> default triggers. It also cleans up the Makefile LED related stuff.
Applied to my tree with two changes (agreed by Johannes):
- added #include <linux/list.h> and <linux/spinlock.h> to workaround
problems with leds.h
- added "select NEW_LEDS" to Kconfig
Thanks for the patch!
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 57+ messages in thread
end of thread, other threads:[~2006-09-22 11:59 UTC | newest]
Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-21 7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
2006-08-21 7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
2006-08-22 0:30 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
2006-08-22 0:36 ` [PATCH 02/3] d80211: iwlist scan Mohamed Abbas
2006-08-23 15:46 ` Jiri Benc
2006-08-28 20:37 ` [PATCH 0/7] d80211: support more wireless command mabbas
2006-08-22 0:38 ` [PATCH 03/3] d80211: adhoc Mohamed Abbas
2006-08-23 15:51 ` Jiri Benc
2006-08-23 15:19 ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Jiri Benc
2006-08-25 18:37 ` Jouni Malinen
2006-08-25 18:46 ` Mohamed Abbas
2006-08-22 16:54 ` [PATCH 01/18] d80211: LED triggers Jouni Malinen
2006-08-22 18:38 ` Jiri Benc
2006-08-23 7:02 ` Johannes Berg
2006-08-23 18:16 ` Jiri Benc
2006-08-24 7:03 ` Johannes Berg
2006-09-22 11:59 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 02/18] d80211: master link Johannes Berg
2006-08-21 8:13 ` Johannes Berg
2006-08-21 19:08 ` Jiri Benc
2006-08-22 7:49 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 03/18] d80211: pointers as extended booleans Johannes Berg
2006-08-22 6:43 ` Bill Fink
2006-08-22 8:39 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 04/18] d80211: use kzalloc() Johannes Berg
2006-08-21 7:41 ` [PATCH 05/18] d80211: get rid of WME bitfield Johannes Berg
2006-08-21 7:41 ` [PATCH 06/18] d80211: rework rate control registration Johannes Berg
2006-08-21 19:19 ` Jiri Benc
2006-08-22 8:33 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 07/18] d80211: get rid of sta_aid in favour of keeping track of TIM Johannes Berg
2006-08-22 18:36 ` Jiri Benc
2006-08-23 7:04 ` Johannes Berg
2006-08-23 10:04 ` [PATCH] " Johannes Berg
2006-08-23 10:05 ` Johannes Berg
2006-08-23 10:16 ` [PATCH ] " Johannes Berg
2006-08-21 7:41 ` [PATCH 08/18] d80211: clean up exports Johannes Berg
2006-08-22 16:44 ` Jouni Malinen
2006-08-23 7:01 ` Johannes Berg
2006-08-23 10:03 ` [PATCH] " Johannes Berg
2006-08-21 7:41 ` [PATCH 09/18] d80211: move out rate control registration code Johannes Berg
2006-08-21 7:41 ` [PATCH 10/18] d80211: clean up includes Johannes Berg
2006-08-21 7:41 ` [PATCH 11/18] d80211: clean up qdisc requeue Johannes Berg
2006-08-21 19:31 ` Jiri Benc
2006-08-22 7:48 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 12/18] d80211: fix some sparse warnings Johannes Berg
2006-08-22 18:55 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 13/18] d80211: clean up some coding style issues Johannes Berg
2006-08-21 19:35 ` Jiri Benc
2006-08-22 8:27 ` Johannes Berg
2006-08-21 7:41 ` [PATCH 14/18] d80211: make lowlevel TX framedump option visible Johannes Berg
2006-08-21 7:41 ` [PATCH 15/18] d80211: surface IBSS debug Johannes Berg
2006-08-21 7:41 ` [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define Johannes Berg
2006-08-22 19:00 ` Jiri Benc
2006-08-23 7:05 ` Johannes Berg
2006-08-23 9:46 ` Jiri Benc
2006-08-21 7:41 ` [PATCH 17/18] d80211: surface powersave debug switch Johannes Berg
2006-08-21 7:41 ` [PATCH 18/18] d80211: fix some documentation 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).