netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/12] d80211: pull request
@ 2007-01-03 18:05 Jiri Benc
  2007-01-03 18:05 ` [PATCH 1/12] d80211: Fix passing of invalid pointer Jiri Benc
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

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

David Kimdon:
      d80211: clear ifsta->associated flag when authentication starts
      d80211: inhibit duplicate authentication requests when setting bssid

Jan Kiszka:
      d80211: Reinit keys on mode change

Jiri Benc:
      d80211: simplify classify_1d
      d80211: small documentation fix
      d80211: do not cancel uninitialized work

Johannes Berg:
      d80211: add missing \n in skb queue warning

Michael Buesch:
      d80211: Fix passing of invalid pointer
      d80211: Fix 64bit printk warnings
      d80211: Turn PHYmode list from an array into a linked list
      d80211: constify ieee80211_ops pointer

Zhu Yi:
      d80211: fix classify_1d() priority selection

 include/net/d80211.h         |   31 +++++++--------
 net/d80211/ieee80211.c       |   89 +++++++++++++++++-------------------------
 net/d80211/ieee80211_i.h     |    9 +++-
 net/d80211/ieee80211_iface.c |    5 +-
 net/d80211/ieee80211_ioctl.c |   69 ++++++++++++++++-----------------
 net/d80211/ieee80211_scan.c  |   83 ++++++++++++++++++---------------------
 net/d80211/ieee80211_sta.c   |   55 +++++++++++++++-----------
 net/d80211/ieee80211_sysfs.c |   10 ++---
 net/d80211/wme.c             |   19 +--------
 9 files changed, 170 insertions(+), 200 deletions(-)


-- 
Jiri Benc
SUSE Labs

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

* [PATCH 1/12] d80211: Fix passing of invalid pointer
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 2/12] d80211: Fix 64bit printk warnings Jiri Benc
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Michael Buesch <mb@bu3sch.de>

ieee80211_hw pointers have to be passed to ops->set_key()
and ops->get_tsf().

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

---

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

0690925f2f99f6d43322ec8507eaabdcf1435c3c
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index 6b45895..cb1da56 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -227,8 +227,8 @@ #if 0
 		 * really much point in disabling the keys at this point. */
 		memset(addr, 0xff, ETH_ALEN);
 		if (local->ops->set_key)
-			local->ops->set_key(dev, DISABLE_KEY, addr,
-					   local->keys[i], 0);
+			local->ops->set_key(local_to_hw(local), DISABLE_KEY, addr,
+					    local->keys[i], 0);
 #endif
 		ieee80211_key_free(sdata->keys[i]);
 	}
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index df7a238..0d46c66 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1362,7 +1362,7 @@ #ifdef CONFIG_D80211_IBSS_DEBUG
 		static unsigned long last_tsf_debug = 0;
 		u64 tsf;
 		if (local->ops->get_tsf)
-			tsf = local->ops->get_tsf(local->mdev);
+			tsf = local->ops->get_tsf(local_to_hw(local));
 		else
 			tsf = -1LLU;
 		if (time_after(jiffies, last_tsf_debug + 5 * HZ)) {
-- 
1.3.0


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

* [PATCH 2/12] d80211: Fix 64bit printk warnings
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
  2007-01-03 18:05 ` [PATCH 1/12] d80211: Fix passing of invalid pointer Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 3/12] d80211: fix classify_1d() priority selection Jiri Benc
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Michael Buesch <mb@bu3sch.de>

Fix several warnings due to incompatible datatypes on
64bit platforms.

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

---

 net/d80211/ieee80211_sta.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

eabaa6c4f7b0546bbb5dcb9835d70d2858035bc0
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 0d46c66..35fb571 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1368,9 +1368,12 @@ #ifdef CONFIG_D80211_IBSS_DEBUG
 		if (time_after(jiffies, last_tsf_debug + 5 * HZ)) {
 			printk(KERN_DEBUG "RX beacon SA=" MAC_FMT " BSSID="
 			       MAC_FMT " TSF=0x%llx BCN=0x%llx diff=%lld "
-			       "@%ld\n",
+			       "@%lu\n",
 			       MAC_ARG(mgmt->sa), MAC_ARG(mgmt->bssid),
-			       tsf, timestamp, tsf - timestamp, jiffies);
+			       (unsigned long long)tsf,
+			       (unsigned long long)timestamp,
+			       (unsigned long long)(tsf - timestamp),
+			       jiffies);
 			last_tsf_debug = jiffies;
 		}
 #endif /* CONFIG_D80211_IBSS_DEBUG */
@@ -2693,7 +2696,7 @@ ieee80211_sta_scan_result(struct net_dev
 		if (buf) {
 			memset(&iwe, 0, sizeof(iwe));
 			iwe.cmd = IWEVCUSTOM;
-			sprintf(buf, "tsf=%016llx", bss->timestamp);
+			sprintf(buf, "tsf=%016llx", (unsigned long long)(bss->timestamp));
 			iwe.u.data.length = strlen(buf);
 			current_ev = iwe_stream_add_point(current_ev, end_buf,
 							  &iwe, buf);
-- 
1.3.0


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

* [PATCH 3/12] d80211: fix classify_1d() priority selection
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
  2007-01-03 18:05 ` [PATCH 1/12] d80211: Fix passing of invalid pointer Jiri Benc
  2007-01-03 18:05 ` [PATCH 2/12] d80211: Fix 64bit printk warnings Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 4/12] d80211: simplify classify_1d Jiri Benc
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Zhu Yi <yi.zhu@intel.com>

I don't see any reason why packets with DSCP=0x40 should have lower IEEE
802.1D priority than packets with DSCP=0x20. Spare > Background. No?

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

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

d131a5bef49c2d56e0a7063aaa8753b4749144d1
diff --git a/net/d80211/wme.c b/net/d80211/wme.c
index b9505dc..f26fe6c 100644
--- a/net/d80211/wme.c
+++ b/net/d80211/wme.c
@@ -131,9 +131,9 @@ #endif /* CONFIG_NET_SCHED */
 	dscp = ip->tos & 0xfc;
 	switch (dscp) {
 	case 0x20:
-		return 2;
-	case 0x40:
 		return 1;
+	case 0x40:
+		return 2;
 	case 0x60:
 		return 3;
 	case 0x80:
-- 
1.3.0


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

* [PATCH 4/12] d80211: simplify classify_1d
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (2 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 3/12] d80211: fix classify_1d() priority selection Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 5/12] d80211: Turn PHYmode list from an array into a linked list Jiri Benc
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

The switch in classify_1d can be simplified to a bit operation.

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

---

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

e874890656210a235fbcfe0935717f86e5d179d9
diff --git a/net/d80211/wme.c b/net/d80211/wme.c
index f26fe6c..0624ad8 100644
--- a/net/d80211/wme.c
+++ b/net/d80211/wme.c
@@ -129,24 +129,9 @@ #endif /* CONFIG_NET_SCHED */
 	ip = (struct iphdr *) (skb->data + offset);
 
 	dscp = ip->tos & 0xfc;
-	switch (dscp) {
-	case 0x20:
-		return 1;
-	case 0x40:
-		return 2;
-	case 0x60:
-		return 3;
-	case 0x80:
-		return 4;
-	case 0xa0:
-		return 5;
-	case 0xc0:
-		return 6;
-	case 0xe0:
-		return 7;
-	default:
+	if (dscp & 0x1c)
 		return 0;
-	}
+	return dscp >> 5;
 }
 
 
-- 
1.3.0


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

* [PATCH 5/12] d80211: Turn PHYmode list from an array into a linked list
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (3 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 4/12] d80211: simplify classify_1d Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 6/12] d80211: add missing \n in skb queue warning Jiri Benc
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Michael Buesch <mb@bu3sch.de>

This turns the PHY-modes list into a linked list.
The advantage is that drivers can add modes dynamically, as they probe
them and don't have to settle to a given arraysize at the beginning
of probing.

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

---

 include/net/d80211.h         |   27 ++++++--------
 net/d80211/ieee80211.c       |   80 ++++++++++++++++------------------------
 net/d80211/ieee80211_i.h     |    7 +++-
 net/d80211/ieee80211_ioctl.c |   69 +++++++++++++++++------------------
 net/d80211/ieee80211_scan.c  |   83 ++++++++++++++++++++----------------------
 net/d80211/ieee80211_sta.c   |   40 +++++++++++---------
 net/d80211/ieee80211_sysfs.c |   10 ++---
 7 files changed, 148 insertions(+), 168 deletions(-)

65f2120cf1b41abd6720604ab6c41b80017d6227
diff --git a/include/net/d80211.h b/include/net/d80211.h
index c7e5bb3..dc7822f 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -107,12 +107,14 @@ enum {
 	NUM_IEEE80211_MODES = 5
 };
 
-struct ieee80211_hw_modes {
-	int mode;
-	int num_channels;
-	struct ieee80211_channel *channels;
-	int num_rates;
-        struct ieee80211_rate *rates;
+struct ieee80211_hw_mode {
+	int mode; /* MODE_IEEE80211... */
+	int num_channels; /* Number of channels (below) */
+	struct ieee80211_channel *channels; /* Array of supported channels */
+	int num_rates; /* Number of rates (below) */
+        struct ieee80211_rate *rates; /* Array of supported rates */
+
+	struct list_head list; /* Internal, don't touch */
 };
 
 struct ieee80211_tx_queue_params {
@@ -450,9 +452,7 @@ typedef enum {
 	SET_KEY, DISABLE_KEY, REMOVE_ALL_KEYS,
 } set_key_cmd;
 
-/* This is driver-visible part of the per-hw state the stack keeps.
- * If you change something in here, call ieee80211_update_hw() to
- * notify the stack about the change. */
+/* This is driver-visible part of the per-hw state the stack keeps. */
 struct ieee80211_hw {
 	/* these are assigned by d80211, don't write */
 	int index;
@@ -542,9 +542,6 @@ #define IEEE80211_HW_TKIP_REQ_PHASE2_KEY
 	/* This is maximum value for rssi reported by this device */
 	int maxssi;
 
-	int num_modes;
-	struct ieee80211_hw_modes *modes;
-
 	/* Number of available hardware TX queues for data packets.
 	 * WMM requires at least four queues. */
 	int queues;
@@ -780,9 +777,9 @@ #else
 #endif
 }
 
-/* Call this function if you changed the hardware description after
- * ieee80211_register_hw */
-int ieee80211_update_hw(struct ieee80211_hw *hw);
+/* Register a new hardware PHYMODE capability to the stack. */
+int ieee80211_register_hwmode(struct ieee80211_hw *hw,
+			      struct ieee80211_hw_mode *mode);
 
 /* Unregister a hardware device. This function instructs 802.11 code to free
  * allocated resources and unregister netdevices from the kernel. */
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 13484fb..c528be1 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1906,7 +1906,8 @@ int ieee80211_if_config_beacon(struct ne
 
 int ieee80211_hw_config(struct ieee80211_local *local)
 {
-	int i, ret = 0;
+	struct ieee80211_hw_mode *mode;
+	int ret = 0;
 
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
 	printk(KERN_DEBUG "HW CONFIG: channel=%d freq=%d "
@@ -1917,12 +1918,10 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */
 	if (local->ops->config)
 		ret = local->ops->config(local_to_hw(local), &local->hw.conf);
 
-	for (i = 0; i < local->hw.num_modes; i++) {
-		struct ieee80211_hw_modes *mode = &local->hw.modes[i];
+	list_for_each_entry(mode, &local->modes_list, list) {
 		if (mode->mode == local->hw.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(local);
@@ -2502,10 +2501,10 @@ ieee80211_rx_h_data(struct ieee80211_txr
 static struct ieee80211_rate *
 ieee80211_get_rate(struct ieee80211_local *local, int phymode, int hw_rate)
 {
-	int m, r;
+	struct ieee80211_hw_mode *mode;
+	int r;
 
-	for (m = 0; m < local->hw.num_modes; m++) {
-		struct ieee80211_hw_modes *mode = &local->hw.modes[m];
+	list_for_each_entry(mode, &local->modes_list, list) {
 		if (mode->mode != phymode)
 			continue;
 		for (r = 0; r < mode->num_rates; r++) {
@@ -4341,24 +4340,6 @@ void ieee80211_if_mgmt_setup(struct net_
 	dev->destructor = ieee80211_if_free;
 }
 
-static void ieee80211_precalc_modes(struct ieee80211_local *local)
-{
-	struct ieee80211_hw_modes *mode;
-	struct ieee80211_rate *rate;
-	struct ieee80211_hw *hw = &local->hw;
-	int m, r;
-
-	local->hw_modes = 0;
-	for (m = 0; m < hw->num_modes; m++) {
-		mode = &hw->modes[m];
-		local->hw_modes |= 1 << mode->mode;
-		for (r = 0; r < mode->num_rates; r++) {
-			rate = &mode->rates[r];
-			rate->rate_inv = CHAN_UTIL_RATE_LCM / rate->rate;
-		}
-	}
-}
-
 int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
 				 const char *name)
 {
@@ -4451,6 +4432,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(
 	local->hw.priv = (char *)mdev->priv +
 			 ((sizeof(struct ieee80211_sub_if_data) +
 			   NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
+	local->hw.queues = 1; /* default */
 
 	local->mdev = mdev;
 	local->rx_pre_handlers = ieee80211_rx_pre_handlers;
@@ -4472,6 +4454,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(
 
         init_timer(&local->scan.timer); /* clear it out */
 
+	INIT_LIST_HEAD(&local->modes_list);
+
 	spin_lock_init(&local->sub_if_lock);
 	INIT_LIST_HEAD(&local->sub_if_list);
 
@@ -4536,9 +4520,6 @@ int ieee80211_register_hw(struct ieee802
 
 	local->hw.conf.beacon_int = 1000;
 
-	/* Don't care about the result */
-	ieee80211_update_hw(local_to_hw(local));
-
 	result = sta_info_start(local);
 	if (result < 0)
 		goto fail_sta_info;
@@ -4623,35 +4604,38 @@ fail_sysfs:
 }
 EXPORT_SYMBOL(ieee80211_register_hw);
 
-int ieee80211_update_hw(struct ieee80211_hw *hw)
+int ieee80211_register_hwmode(struct ieee80211_hw *hw,
+			      struct ieee80211_hw_mode *mode)
 {
 	struct ieee80211_local *local = hw_to_local(hw);
+	struct ieee80211_rate *rate;
+	int i;
 
-	/* Backwards compatibility for low-level drivers that do not set number
-	 * of TX queues. */
-	if (hw->queues == 0)
-		hw->queues = 1;
-
-	if (!hw->modes || !hw->modes->channels || !hw->modes->rates ||
-	    !hw->modes->num_channels || !hw->modes->num_rates)
-		return -EINVAL;
+	INIT_LIST_HEAD(&mode->list);
+	list_add_tail(&mode->list, &local->modes_list);
 
-	ieee80211_precalc_modes(local);
-	local->hw.conf.phymode = hw->modes[0].mode;
-	local->curr_rates = hw->modes[0].rates;
-	local->num_curr_rates = hw->modes[0].num_rates;
-	ieee80211_prepare_rates(local);
+	local->hw_modes |= (1 << mode->mode);
+	for (i = 0; i < mode->num_rates; i++) {
+		rate = &(mode->rates[i]);
+		rate->rate_inv = CHAN_UTIL_RATE_LCM / rate->rate;
+	}
 
-	local->hw.conf.freq = local->hw.modes[0].channels[0].freq;
-	local->hw.conf.channel = local->hw.modes[0].channels[0].chan;
-	local->hw.conf.channel_val = local->hw.modes[0].channels[0].val;
+	if (!local->curr_rates) {
+		/* Default to this mode */
+		local->hw.conf.phymode = mode->mode;
+		local->curr_rates = mode->rates;
+		local->num_curr_rates = mode->num_rates;
+		ieee80211_prepare_rates(local);
+		local->hw.conf.freq = mode->channels[0].freq;
+		local->hw.conf.channel = mode->channels[0].chan;
+		local->hw.conf.channel_val = mode->channels[0].val;
+	}
 
 	ieee80211_init_client(local->mdev);
-	/* FIXME: Invoke config to allow driver to set the channel. */
 
 	return 0;
 }
-EXPORT_SYMBOL(ieee80211_update_hw);
+EXPORT_SYMBOL(ieee80211_register_hwmode);
 
 void ieee80211_unregister_hw(struct ieee80211_hw *hw)
 {
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index a7a4bc9..63077b0 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -180,7 +180,7 @@ struct ieee80211_passive_scan {
 	int channel; /* channel to be scanned */
         int tries;
 
-        int mode_idx;
+	struct ieee80211_hw_mode *mode;
         int chan_idx;
 
 	int freq;
@@ -335,6 +335,9 @@ struct ieee80211_local {
 
 	struct ieee80211_ops *ops;
 
+	/* List of registered struct ieee80211_hw_mode */
+	struct list_head modes_list;
+
 	struct net_device *mdev; /* wmaster# - "master" 802.11 device */
 	struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
 	int open_count;
@@ -424,7 +427,7 @@ #define IEEE80211_IRQSAFE_QUEUE_LIMIT 12
         spinlock_t sub_if_lock; /* mutex for STA data structures */
         struct list_head sub_if_list;
 	int sta_scanning;
-	int scan_hw_mode_idx;
+	struct ieee80211_hw_mode *scan_hw_mode;
 	int scan_channel_idx;
 	enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
 	unsigned long last_scan_completed;
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index 6c262e8..81a6e82 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -119,43 +119,45 @@ static int ieee80211_ioctl_get_hw_featur
 	struct ieee80211_local *local = dev->ieee80211_ptr;
 	u8 *pos = param->u.hw_features.data;
 	int left = param_len - (pos - (u8 *) param);
-	int mode, i;
+	int i;
 	struct hostapd_ioctl_hw_modes_hdr *hdr;
 	struct ieee80211_rate_data *rate;
 	struct ieee80211_channel_data *chan;
+	struct ieee80211_hw_mode *mode;
 
 	param->u.hw_features.flags = 0;
 	if (local->hw.flags & IEEE80211_HW_DATA_NULLFUNC_ACK)
 		param->u.hw_features.flags |= HOSTAP_HW_FLAG_NULLFUNC_OK;
 
-	param->u.hw_features.num_modes = local->hw.num_modes;
-	for (mode = 0; mode < local->hw.num_modes; mode++) {
+	param->u.hw_features.num_modes = 0;
+	list_for_each_entry(mode, &local->modes_list, list) {
 		int clen, rlen;
-		struct ieee80211_hw_modes *m = &local->hw.modes[mode];
-		clen = m->num_channels * sizeof(struct ieee80211_channel_data);
-		rlen = m->num_rates * sizeof(struct ieee80211_rate_data);
+
+		param->u.hw_features.num_modes++;
+		clen = mode->num_channels * sizeof(struct ieee80211_channel_data);
+		rlen = mode->num_rates * sizeof(struct ieee80211_rate_data);
 		if (left < sizeof(*hdr) + clen + rlen)
 			return -E2BIG;
 		left -= sizeof(*hdr) + clen + rlen;
 
 		hdr = (struct hostapd_ioctl_hw_modes_hdr *) pos;
-		hdr->mode = m->mode;
-		hdr->num_channels = m->num_channels;
-		hdr->num_rates = m->num_rates;
+		hdr->mode = mode->mode;
+		hdr->num_channels = mode->num_channels;
+		hdr->num_rates = mode->num_rates;
 
 		pos = (u8 *) (hdr + 1);
 		chan = (struct ieee80211_channel_data *) pos;
-		for (i = 0; i < m->num_channels; i++) {
-			chan[i].chan = m->channels[i].chan;
-			chan[i].freq = m->channels[i].freq;
-			chan[i].flag = m->channels[i].flag;
+		for (i = 0; i < mode->num_channels; i++) {
+			chan[i].chan = mode->channels[i].chan;
+			chan[i].freq = mode->channels[i].freq;
+			chan[i].flag = mode->channels[i].flag;
 		}
 		pos += clen;
 
 		rate = (struct ieee80211_rate_data *) pos;
-		for (i = 0; i < m->num_rates; i++) {
-			rate[i].rate = m->rates[i].rate;
-			rate[i].flags = m->rates[i].flags;
+		for (i = 0; i < mode->num_rates; i++) {
+			rate[i].rate = mode->rates[i].rate;
+			rate[i].flags = mode->rates[i].flags;
 		}
 		pos += rlen;
 	}
@@ -197,8 +199,8 @@ static int ieee80211_ioctl_scan(struct n
 		param->u.scan.last_rx = local->scan.rx_packets;
 		local->scan.rx_packets = -1;
 	}
-	param->u.scan.channel = local->hw.modes[local->scan.mode_idx].
-		channels[local->scan.chan_idx].chan;
+	param->u.scan.channel =
+		local->scan.mode->channels[local->scan.chan_idx].chan;
 
 	return 0;
 }
@@ -1349,19 +1351,16 @@ static int ieee80211_ioctl_set_channel_f
 					    struct prism2_hostapd_param *param)
 {
 	struct ieee80211_local *local = dev->ieee80211_ptr;
-	struct ieee80211_hw_modes *mode = NULL;
+	struct ieee80211_hw_mode *mode;
 	struct ieee80211_channel *chan = NULL;
 	int i;
 
-	for (i = 0; i < local->hw.num_modes; i++) {
-		mode = &local->hw.modes[i];
+	list_for_each_entry(mode, &local->modes_list, list) {
 		if (mode->mode == param->u.set_channel_flag.mode)
-			break;
-		mode = NULL;
+			goto found;
 	}
-
-	if (!mode)
-		return -ENOENT;
+	return -ENOENT;
+found:
 
 	for (i = 0; i < mode->num_channels; i++) {
 		chan = &mode->channels[i];
@@ -1698,10 +1697,10 @@ static void ieee80211_unmask_channel(str
 static int ieee80211_unmask_channels(struct net_device *dev)
 {
 	struct ieee80211_local *local = dev->ieee80211_ptr;
-	int m, c;
+	struct ieee80211_hw_mode *mode;
+	int c;
 
-	for (m = 0; m < local->hw.num_modes; m++) {
-		struct ieee80211_hw_modes *mode = &local->hw.modes[m];
+	list_for_each_entry(mode, &local->modes_list, list) {
 		for (c = 0; c < mode->num_channels; c++) {
 			ieee80211_unmask_channel(dev, mode->mode,
 						 &mode->channels[c]);
@@ -1799,7 +1798,8 @@ int ieee80211_ioctl_siwfreq(struct net_d
 			    struct iw_freq *freq, char *extra)
 {
 	struct ieee80211_local *local = dev->ieee80211_ptr;
-	int m, c, nfreq, set = 0;
+	struct ieee80211_hw_mode *mode;
+	int c, nfreq, set = 0;
 
 	/* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
 	if (freq->e == 0)
@@ -1814,8 +1814,7 @@ int ieee80211_ioctl_siwfreq(struct net_d
 			return -EINVAL;
 	}
 
-	for (m = 0; m < local->hw.num_modes; m++) {
-		struct ieee80211_hw_modes *mode = &local->hw.modes[m];
+	list_for_each_entry(mode, &local->modes_list, list) {
 		for (c = 0; c < mode->num_channels; c++) {
 			struct ieee80211_channel *chan = &mode->channels[c];
 			if (chan->flag & IEEE80211_CHAN_W_SCAN &&
@@ -2158,10 +2157,10 @@ static int ieee80211_ioctl_giwretry(stru
 
 static void ieee80211_ioctl_unmask_channels(struct ieee80211_local *local)
 {
-	int m, c;
+	struct ieee80211_hw_mode *mode;
+	int c;
 
-	for (m = 0; m < local->hw.num_modes; m++) {
-		struct ieee80211_hw_modes *mode = &local->hw.modes[m];
+	list_for_each_entry(mode, &local->modes_list, list) {
 		for (c = 0; c < mode->num_channels; c++) {
 			struct ieee80211_channel *chan = &mode->channels[c];
 			chan->flag |= IEEE80211_CHAN_W_SCAN;
diff --git a/net/d80211/ieee80211_scan.c b/net/d80211/ieee80211_scan.c
index 6db66f0..fe28f57 100644
--- a/net/d80211/ieee80211_scan.c
+++ b/net/d80211/ieee80211_scan.c
@@ -24,49 +24,49 @@ #define MAX_SCAN_WAIT 60
 #define SCAN_TXRX_THRESHOLD 75
 
 static void get_channel_params(struct ieee80211_local *local, int channel,
-				struct ieee80211_hw_modes **mode,
+				struct ieee80211_hw_mode **mode,
 				struct ieee80211_channel **chan)
 {
-	int m;
+	struct ieee80211_hw_mode *m;
 
-	for (m = 0; m < local->hw.num_modes; m++) {
-		*mode = &local->hw.modes[m];
-		if ((*mode)->mode == local->hw.conf.phymode)
+	list_for_each_entry(m, &local->modes_list, list) {
+		*mode = m;
+		if (m->mode == local->hw.conf.phymode)
 			break;
 	}
-	local->scan.mode_idx = m;
+	local->scan.mode = m;
 	local->scan.chan_idx = 0;
 	do {
-		*chan = &(*mode)->channels[local->scan.chan_idx];
-		if ((*chan)->chan == channel) {
+		*chan = &m->channels[local->scan.chan_idx];
+		if ((*chan)->chan == channel)
 			return;
-		}
 		local->scan.chan_idx++;
-	} while (local->scan.chan_idx < (*mode)->num_channels);
+	} while (local->scan.chan_idx < m->num_channels);
 	*chan = NULL;
 }
 
 
 static void next_chan_same_mode(struct ieee80211_local *local,
-				struct ieee80211_hw_modes **mode,
+				struct ieee80211_hw_mode **mode,
 				struct ieee80211_channel **chan)
 {
-	int m, prev;
+	struct ieee80211_hw_mode *m;
+	int prev;
 
-	for (m = 0; m < local->hw.num_modes; m++) {
-		*mode = &local->hw.modes[m];
-		if ((*mode)->mode == local->hw.conf.phymode)
+	list_for_each_entry(m, &local->modes_list, list) {
+		*mode = m;
+		if (m->mode == local->hw.conf.phymode)
 			break;
 	}
-	local->scan.mode_idx = m;
+	local->scan.mode = m;
 
 	/* Select next channel - scan only channels marked with W_SCAN flag */
 	prev = local->scan.chan_idx;
 	do {
 		local->scan.chan_idx++;
-		if (local->scan.chan_idx >= (*mode)->num_channels)
+		if (local->scan.chan_idx >= m->num_channels)
 			local->scan.chan_idx = 0;
-		*chan = &(*mode)->channels[local->scan.chan_idx];
+		*chan = &m->channels[local->scan.chan_idx];
 		if ((*chan)->flag & IEEE80211_CHAN_W_SCAN)
 			break;
 	} while (local->scan.chan_idx != prev);
@@ -74,43 +74,44 @@ static void next_chan_same_mode(struct i
 
 
 static void next_chan_all_modes(struct ieee80211_local *local,
-				struct ieee80211_hw_modes **mode,
+				struct ieee80211_hw_mode **mode,
 				struct ieee80211_channel **chan)
 {
-	int prev, prev_m;
-
-	if (local->scan.mode_idx >= local->hw.num_modes) {
-		local->scan.mode_idx = 0;
-		local->scan.chan_idx = 0;
-	}
+	struct ieee80211_hw_mode *prev_m;
+	int prev;
 
 	/* Select next channel - scan only channels marked with W_SCAN flag */
 	prev = local->scan.chan_idx;
-	prev_m = local->scan.mode_idx;
+	prev_m = local->scan.mode;
 	do {
-		*mode = &local->hw.modes[local->scan.mode_idx];
+		*mode = local->scan.mode;
 		local->scan.chan_idx++;
 		if (local->scan.chan_idx >= (*mode)->num_channels) {
+			struct list_head *next;
+
 			local->scan.chan_idx = 0;
-			local->scan.mode_idx++;
-			if (local->scan.mode_idx >= local->hw.num_modes)
-				local->scan.mode_idx = 0;
-			*mode = &local->hw.modes[local->scan.mode_idx];
+			next = (*mode)->list.next;
+			if (next == &local->modes_list)
+				next = next->next;
+			*mode = list_entry(next,
+					   struct ieee80211_hw_mode,
+					   list);
+			local->scan.mode = *mode;
 		}
 		*chan = &(*mode)->channels[local->scan.chan_idx];
 		if ((*chan)->flag & IEEE80211_CHAN_W_SCAN)
 			break;
 	} while (local->scan.chan_idx != prev ||
-		 local->scan.mode_idx != prev_m);
+		 local->scan.mode != prev_m);
 }
 
 
 static void ieee80211_scan_start(struct ieee80211_local *local,
 				 struct ieee80211_scan_conf *conf)
 {
-	int old_mode_idx = local->scan.mode_idx;
+	struct ieee80211_hw_mode *old_mode = local->scan.mode;
 	int old_chan_idx = local->scan.chan_idx;
-	struct ieee80211_hw_modes *mode = NULL;
+	struct ieee80211_hw_mode *mode = NULL;
 	struct ieee80211_channel *chan = NULL;
 	int ret;
 
@@ -189,7 +190,7 @@ #endif
 		if (ret == -EAGAIN) {
 			local->scan.timer.expires = jiffies +
 				(local->scan.interval * HZ / 100);
-			local->scan.mode_idx = old_mode_idx;
+			local->scan.mode = old_mode;
 			local->scan.chan_idx = old_chan_idx;
 		} else {
 			printk(KERN_DEBUG "%s: Got unknown error from "
@@ -207,23 +208,17 @@ #endif
 static void ieee80211_scan_stop(struct ieee80211_local *local,
 				struct ieee80211_scan_conf *conf)
 {
-	struct ieee80211_hw_modes *mode;
+	struct ieee80211_hw_mode *mode;
 	struct ieee80211_channel *chan;
 	int wait;
 
 	if (!local->ops->passive_scan)
 		return;
 
-	if (local->scan.mode_idx >= local->hw.num_modes) {
-		local->scan.mode_idx = 0;
-		local->scan.chan_idx = 0;
-	}
+	mode = local->scan.mode;
 
-	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];
 
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 35fb571..6edf17d 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1386,6 +1386,7 @@ #endif /* CONFIG_D80211_IBSS_DEBUG */
 	if (sdata->type == IEEE80211_IF_TYPE_IBSS && elems.supp_rates &&
 	    memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 &&
 	    (sta = sta_info_get(local, mgmt->sa))) {
+	    	struct ieee80211_hw_mode *mode;
 		struct ieee80211_rate *rates;
 		size_t num_rates;
 		u32 supp_rates, prev_rates;
@@ -1395,8 +1396,7 @@ #endif /* CONFIG_D80211_IBSS_DEBUG */
 		num_rates = local->num_curr_rates;
 		oper_mode = local->sta_scanning ? local->scan_oper_phymode :
 			local->hw.conf.phymode;
-		for (i = 0; i < local->hw.num_modes; i++) {
-			struct ieee80211_hw_modes *mode = &local->hw.modes[i];
+		list_for_each_entry(mode, &local->modes_list, list) {
 			if (oper_mode == mode->mode) {
 				rates = mode->rates;
 				num_rates = mode->num_rates;
@@ -1930,10 +1930,10 @@ static void ieee80211_sta_new_auth(struc
 
 static int ieee80211_ibss_allowed(struct ieee80211_local *local)
 {
-	int m, c;
+	struct ieee80211_hw_mode *mode;
+	int c;
 
-	for (m = 0; m < local->hw.num_modes; m++) {
-		struct ieee80211_hw_modes *mode = &local->hw.modes[m];
+	list_for_each_entry(mode, &local->modes_list, list) {
 		if (mode->mode != local->hw.conf.phymode)
 			continue;
 		for (c = 0; c < mode->num_channels; c++) {
@@ -2388,10 +2388,10 @@ static int ieee80211_sta_restore_oper_ch
 
 static int ieee80211_active_scan(struct ieee80211_local *local)
 {
-	int m, c;
+	struct ieee80211_hw_mode *mode;
+	int c;
 
-	for (m = 0; m < local->hw.num_modes; m++) {
-		struct ieee80211_hw_modes *mode = &local->hw.modes[m];
+	list_for_each_entry(mode, &local->modes_list, list) {
 		if (mode->mode != local->hw.conf.phymode)
 			continue;
 		for (c = 0; c < mode->num_channels; c++) {
@@ -2438,7 +2438,7 @@ static void ieee80211_sta_scan_work(void
 	struct net_device *dev = ptr;
 	struct ieee80211_local *local = dev->ieee80211_ptr;
         struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-	struct ieee80211_hw_modes *mode;
+	struct ieee80211_hw_mode *mode;
 	struct ieee80211_channel *chan;
 	int skip;
 	unsigned long next_delay = 0;
@@ -2448,10 +2448,9 @@ static void ieee80211_sta_scan_work(void
 
 	switch (local->scan_state) {
 	case SCAN_SET_CHANNEL:
-		mode = &local->hw.modes[local->scan_hw_mode_idx];
-		if (local->scan_hw_mode_idx >= local->hw.num_modes ||
-		    (local->scan_hw_mode_idx + 1 == local->hw.num_modes &&
-		     local->scan_channel_idx >= mode->num_channels)) {
+		mode = local->scan_hw_mode;
+		if (local->scan_hw_mode->list.next == &local->modes_list &&
+		    local->scan_channel_idx >= mode->num_channels) {
 			if (ieee80211_sta_restore_oper_chan(dev)) {
 				printk(KERN_DEBUG "%s: failed to restore "
 				       "operational channel after scan\n",
@@ -2491,10 +2490,13 @@ #endif
 		}
 
 		local->scan_channel_idx++;
-		if (local->scan_channel_idx >=
-		    local->hw.modes[local->scan_hw_mode_idx].num_channels) {
-			local->scan_hw_mode_idx++;
-			local->scan_channel_idx = 0;
+		if (local->scan_channel_idx >= local->scan_hw_mode->num_channels) {
+			if (local->scan_hw_mode->list.next != &local->modes_list) {
+				local->scan_hw_mode = list_entry(local->scan_hw_mode->list.next,
+								 struct ieee80211_hw_mode,
+								 list);
+				local->scan_channel_idx = 0;
+			}
 		}
 
 		if (skip)
@@ -2580,7 +2582,9 @@ int ieee80211_sta_req_scan(struct net_de
 	} else
 		local->scan_ssid_len = 0;
 	local->scan_state = SCAN_SET_CHANNEL;
-	local->scan_hw_mode_idx = 0;
+	local->scan_hw_mode = list_entry(local->modes_list.next,
+					 struct ieee80211_hw_mode,
+					 list);
 	local->scan_channel_idx = 0;
 	INIT_WORK(&local->scan_work, ieee80211_sta_scan_work, dev);
 	schedule_work(&local->scan_work);
diff --git a/net/d80211/ieee80211_sysfs.c b/net/d80211/ieee80211_sysfs.c
index 6a60077..b9d0973 100644
--- a/net/d80211/ieee80211_sysfs.c
+++ b/net/d80211/ieee80211_sysfs.c
@@ -189,15 +189,13 @@ __IEEE80211_LOCAL_SHOW(tx_power_reductio
 static ssize_t ieee80211_local_fmt_modes(struct ieee80211_local *local,
 					 char *buf)
 {
-	int i;
-	struct ieee80211_hw_modes *mode;
+	struct ieee80211_hw_mode *mode;
 	char *p = buf;
 
-	/* FIXME: locking against ieee80211_update_hw? */
-	for (i = 0; i < local->hw.num_modes; i++) {
-		mode = &local->hw.modes[i];
+	/* FIXME: Locking? Could register a mode in the meantime. */
+	list_for_each_entry(mode, &local->modes_list, list)
 		p += sprintf(p, "%s\n", ieee80211_mode_str_short(mode->mode));
-	}
+
 	return (p - buf);
 }
 __IEEE80211_LOCAL_SHOW(modes);
-- 
1.3.0


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

* [PATCH 6/12] d80211: add missing \n in skb queue warning
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (4 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 5/12] d80211: Turn PHYmode list from an array into a linked list Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 7/12] d80211: constify ieee80211_ops pointer Jiri Benc
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Johannes Berg <johannes@sipsolutions.net>

This just adds a missing \n I noticed when I got the warning (see my
other mail)

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

---

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

f069487d2f2a306471ed1d5fca0ed5a00730ddef
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index c528be1..c833642 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4683,7 +4683,7 @@ void ieee80211_unregister_hw(struct ieee
 
 	if (skb_queue_len(&local->skb_queue)
 			|| skb_queue_len(&local->skb_queue_unreliable))
-		printk(KERN_WARNING "%s: skb_queue not empty",
+		printk(KERN_WARNING "%s: skb_queue not empty\n",
 		       local->mdev->name);
 	skb_queue_purge(&local->skb_queue);
 	skb_queue_purge(&local->skb_queue_unreliable);
-- 
1.3.0


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

* [PATCH 7/12] d80211: constify ieee80211_ops pointer
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (5 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 6/12] d80211: add missing \n in skb queue warning Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 8/12] d80211: small documentation fix Jiri Benc
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Michael Buesch <mb@bu3sch.de>

const-ify the ieee80211_ops pointer to allow
* The compiler to do opimizations
* The drivers to declare this structure const.

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

---

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

9d037dc28e7f453a2dbda17284d78ae18d15f646
diff --git a/include/net/d80211.h b/include/net/d80211.h
index dc7822f..9cecbd8 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -740,7 +740,7 @@ struct ieee80211_ops {
  * priv_data_len.
  */
 struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
-					struct ieee80211_ops *ops);
+					const struct ieee80211_ops *ops);
 
 /* Register hardware device to the IEEE 802.11 code and kernel. Low-level
  * drivers must call this function before using any other IEEE 802.11
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index c833642..a5ae8a1 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4392,7 +4392,7 @@ static void rate_control_deinitialize(st
 }
 
 struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
-					      struct ieee80211_ops *ops)
+					const struct ieee80211_ops *ops)
 {
 	struct net_device *mdev;
         struct ieee80211_local *local;
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index 63077b0..6ba6a61 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -333,7 +333,7 @@ struct ieee80211_local {
 	 * it first anyway so they become a no-op */
 	struct ieee80211_hw hw;
 
-	struct ieee80211_ops *ops;
+	const struct ieee80211_ops *ops;
 
 	/* List of registered struct ieee80211_hw_mode */
 	struct list_head modes_list;
-- 
1.3.0


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

* [PATCH 8/12] d80211: small documentation fix
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (6 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 7/12] d80211: constify ieee80211_ops pointer Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 9/12] d80211: do not cancel uninitialized work Jiri Benc
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

ieee80211_register_hwmode is allowed to be called before ieee80211_register_hw.

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

---

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

acc7a635825dfc3b077630d8be621504ac71637e
diff --git a/include/net/d80211.h b/include/net/d80211.h
index 9cecbd8..65a5d36 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -744,7 +744,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(
 
 /* Register hardware device to the IEEE 802.11 code and kernel. Low-level
  * drivers must call this function before using any other IEEE 802.11
- * function. */
+ * function except ieee80211_register_hwmode. */
 int ieee80211_register_hw(struct ieee80211_hw *hw);
 
 /* driver can use this and ieee80211_get_rx_led_name to get the
-- 
1.3.0


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

* [PATCH 9/12] d80211: do not cancel uninitialized work
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (7 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 8/12] d80211: small documentation fix Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 10/12] d80211: clear ifsta->associated flag when authentication starts Jiri Benc
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

When ops->hw_scan is set, scan_work is never initialized thus canceling it
causes weird problems.

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

---

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

82c4e75463da9d3f38540198c4594cafe336b3e1
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index a5ae8a1..056b26c 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -2082,7 +2082,8 @@ void ieee80211_if_shutdown(struct net_de
 	case IEEE80211_IF_TYPE_IBSS:
 		sdata->u.sta.state = IEEE80211_DISABLED;
 		cancel_delayed_work(&sdata->u.sta.work);
-		if (local->scan_work.data == sdata->dev) {
+		if (!local->ops->hw_scan &&
+		    local->scan_work.data == sdata->dev) {
 			local->sta_scanning = 0;
 			cancel_delayed_work(&local->scan_work);
 			flush_scheduled_work();
@@ -4660,7 +4661,7 @@ void ieee80211_unregister_hw(struct ieee
 
 	if (local->stat_time)
 		del_timer_sync(&local->stat_timer);
-	if (local->scan_work.data) {
+	if (!local->ops->hw_scan && local->scan_work.data) {
 		local->sta_scanning = 0;
 		cancel_delayed_work(&local->scan_work);
 		flush_scheduled_work();
-- 
1.3.0


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

* [PATCH 10/12] d80211: clear ifsta->associated flag when authentication starts
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (8 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 9/12] d80211: do not cancel uninitialized work Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 11/12] d80211: inhibit duplicate authentication requests when setting bssid Jiri Benc
  2007-01-03 18:05 ` [PATCH 12/12] d80211: Reinit keys on mode change Jiri Benc
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

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

The 'associated' flag might be set if a previous association did not
end cleanly.  If the 'associated' flag is left set here then when
association succeeds ieee80211_set_associated() will think there is
nothing to report and will not inform userspace of the event.

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

---

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

90be57e78c95bd0e66a2047c39d91156d63d6f4c
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 6edf17d..77a8308 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1923,7 +1923,7 @@ static void ieee80211_sta_new_auth(struc
 	printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name,
 	       ifsta->auth_alg);
 	ifsta->auth_transaction = -1;
-	ifsta->auth_tries = ifsta->assoc_tries = 0;
+	ifsta->associated = ifsta->auth_tries = ifsta->assoc_tries = 0;
 	ieee80211_authenticate(dev, ifsta);
 }
 
-- 
1.3.0


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

* [PATCH 11/12] d80211: inhibit duplicate authentication requests when setting bssid
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (9 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 10/12] d80211: clear ifsta->associated flag when authentication starts Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  2007-01-03 18:05 ` [PATCH 12/12] d80211: Reinit keys on mode change Jiri Benc
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

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

If we are already authenticating don't send another authentication
request.

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

---

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

ca363cfd2c934d40dd0c24a52e58921d355b3c01
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 77a8308..32c2bbe 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -2354,7 +2354,7 @@ int ieee80211_sta_set_bssid(struct net_d
 		ifsta->bssid_set = 0;
 	else
 		ifsta->bssid_set = 1;
-	if (ifsta->ssid_set)
+	if (ifsta->ssid_set && ifsta->state != IEEE80211_AUTHENTICATE)
 		ieee80211_sta_new_auth(dev, ifsta);
 
 	return 0;
-- 
1.3.0


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

* [PATCH 12/12] d80211: Reinit keys on mode change
  2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
                   ` (10 preceding siblings ...)
  2007-01-03 18:05 ` [PATCH 11/12] d80211: inhibit duplicate authentication requests when setting bssid Jiri Benc
@ 2007-01-03 18:05 ` Jiri Benc
  11 siblings, 0 replies; 13+ messages in thread
From: Jiri Benc @ 2007-01-03 18:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: netdev

From: Jan Kiszka <jan.kiszka@web.de>

Switching the interface mode with some encryption keys set and then later
touching any key, triggers an oops because ieee80211_if_reinit fails to
NULL'ify the related pointers after free'ing the key on mode change. Long
explanation, simple fix below.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Jiri Benc <jbenc@suse.cz>

---

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

ff6a6797032d232d07be32594fdd7369cd927382
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index cb1da56..1a0b8cd 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -231,6 +231,7 @@ #if 0
 					    local->keys[i], 0);
 #endif
 		ieee80211_key_free(sdata->keys[i]);
+		sdata->keys[i] = NULL;
 	}
 
 	/* Shouldn't be necessary but won't hurt */
-- 
1.3.0


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

end of thread, other threads:[~2007-01-03 18:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-03 18:05 [PATCH 0/12] d80211: pull request Jiri Benc
2007-01-03 18:05 ` [PATCH 1/12] d80211: Fix passing of invalid pointer Jiri Benc
2007-01-03 18:05 ` [PATCH 2/12] d80211: Fix 64bit printk warnings Jiri Benc
2007-01-03 18:05 ` [PATCH 3/12] d80211: fix classify_1d() priority selection Jiri Benc
2007-01-03 18:05 ` [PATCH 4/12] d80211: simplify classify_1d Jiri Benc
2007-01-03 18:05 ` [PATCH 5/12] d80211: Turn PHYmode list from an array into a linked list Jiri Benc
2007-01-03 18:05 ` [PATCH 6/12] d80211: add missing \n in skb queue warning Jiri Benc
2007-01-03 18:05 ` [PATCH 7/12] d80211: constify ieee80211_ops pointer Jiri Benc
2007-01-03 18:05 ` [PATCH 8/12] d80211: small documentation fix Jiri Benc
2007-01-03 18:05 ` [PATCH 9/12] d80211: do not cancel uninitialized work Jiri Benc
2007-01-03 18:05 ` [PATCH 10/12] d80211: clear ifsta->associated flag when authentication starts Jiri Benc
2007-01-03 18:05 ` [PATCH 11/12] d80211: inhibit duplicate authentication requests when setting bssid Jiri Benc
2007-01-03 18:05 ` [PATCH 12/12] d80211: Reinit keys on mode change Jiri Benc

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).