All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository
@ 2005-03-13  0:17 Jouni Malinen
  2005-03-13  0:28 ` [PATCH wireless-2.6 1/10] hostap: Clear station statistic on accounting start Jouni Malinen
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:17 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, jkmaline

Following patches bring wireless-2.6 tree up to date with the Host AP
repository. First nine patches in the series do not have other
dependencies. The last patch requires an update for the Linux wireless
extensions which is not yet in the wireless-2.6, so this patch may
remain pending for now. I updated the proposal for WE-18 earlier today
and sent it to Jean. Hopefully, it will get to wireless-2.6 tree some
time soon.

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 1/10] hostap: Clear station statistic on accounting start
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
@ 2005-03-13  0:28 ` Jouni Malinen
  2005-03-13  0:29 ` [PATCH wireless-2.6 2/10] hostap: Include asm/io.h Jouni Malinen
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:28 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Added support for larger number of BSSes in scan results by using local BSS
list to fill in APs that are missing from firmware scan results (firmware limit
seemed to be 32 APs at least in some versions); this requires STA firmware
version 1.7.x or newer and WPA enabled.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_80211_rx.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_80211_rx.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_80211_rx.c	2005-03-12 16:10:42.000000000 -0800
@@ -361,14 +361,13 @@
 				 int stype)
 {
 	struct hostap_ieee80211_mgmt *mgmt;
-	int left;
+	int left, chan = 0;
 	u8 *pos;
 	u8 *ssid = NULL, *wpa = NULL, *rsn = NULL;
 	size_t ssid_len = 0, wpa_len = 0, rsn_len = 0;
 	struct hostap_bss_info *bss;
 
-	if (!local->wpa ||
-	    skb->len < IEEE80211_MGMT_HDR_LEN + sizeof(mgmt->u.beacon))
+	if (skb->len < IEEE80211_MGMT_HDR_LEN + sizeof(mgmt->u.beacon))
 		return;
 
 	mgmt = (struct hostap_ieee80211_mgmt *) skb->data;
@@ -395,6 +394,10 @@
 			rsn = pos;
 			rsn_len = pos[1] + 2;
 			break;
+		case WLAN_EID_DS_PARAMS:
+			if (pos[1] >= 1)
+				chan = pos[2];
+			break;
 		}
 		left -= 2 + pos[1];
 		pos += 2 + pos[1];
@@ -425,6 +428,7 @@
 			bss->rsn_ie_len = rsn_len;
 		} else
 			bss->rsn_ie_len = 0;
+		bss->chan = chan;
 	}
 	__hostap_expire_bss(local);
 	spin_unlock(&local->lock);
Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_ioctl.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_ioctl.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_ioctl.c	2005-03-12 16:10:42.000000000 -0800
@@ -1768,7 +1768,7 @@
 				      struct hostap_bss_info *bss, u8 *bssid,
 				      char *current_ev, char *end_buf)
 {
-	int i;
+	int i, chan;
 	struct iw_event iwe;
 	char *current_val;
 	u16 capabilities;
@@ -1814,8 +1814,12 @@
 
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = SIOCGIWMODE;
-	capabilities = le16_to_cpu(hostscan ? hscan->capability :
-				   scan->capability);
+	if (bss) {
+		capabilities = bss->capab_info;
+	} else {
+		capabilities = le16_to_cpu(hostscan ? hscan->capability :
+					   scan->capability);
+	}
 	if (capabilities & (WLAN_CAPABILITY_ESS |
 			    WLAN_CAPABILITY_IBSS)) {
 		if (capabilities & WLAN_CAPABILITY_ESS)
@@ -1829,26 +1833,38 @@
 
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = SIOCGIWFREQ;
-	iwe.u.freq.m = freq_list[le16_to_cpu(hostscan ? hscan->chid :
-					     scan->chid) - 1] * 100000;
-	iwe.u.freq.e = 1;
-	iwe.len = IW_EV_FREQ_LEN;
-	current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
-					  IW_EV_FREQ_LEN);
-
-	memset(&iwe, 0, sizeof(iwe));
-	iwe.cmd = IWEVQUAL;
-	if (hostscan) {
-		iwe.u.qual.level = le16_to_cpu(hscan->sl);
-		iwe.u.qual.noise = le16_to_cpu(hscan->anl);
+	if (hscan || scan) {
+		chan = hostscan ? hscan->chid : scan->chid;
+	} else if (bss) {
+		chan = bss->chan;
 	} else {
-		iwe.u.qual.level = HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->sl));
-		iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(
-			le16_to_cpu(scan->anl));
+		chan = 0;
+	}
+
+	if (chan > 0) {
+		iwe.u.freq.m = freq_list[le16_to_cpu(chan - 1)] * 100000;
+		iwe.u.freq.e = 1;
+		iwe.len = IW_EV_FREQ_LEN;
+		current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
+						  IW_EV_FREQ_LEN);
+	}
+
+	if (scan || hscan) {
+		memset(&iwe, 0, sizeof(iwe));
+		iwe.cmd = IWEVQUAL;
+		if (hostscan) {
+			iwe.u.qual.level = le16_to_cpu(hscan->sl);
+			iwe.u.qual.noise = le16_to_cpu(hscan->anl);
+		} else {
+			iwe.u.qual.level =
+				HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->sl));
+			iwe.u.qual.noise =
+				HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->anl));
+		}
+		iwe.len = IW_EV_QUAL_LEN;
+		current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
+						  IW_EV_QUAL_LEN);
 	}
-	iwe.len = IW_EV_QUAL_LEN;
-	current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
-					  IW_EV_QUAL_LEN);
 
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = SIOCGIWENCODE;
@@ -1860,45 +1876,54 @@
 	iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
 	current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, "");
 
-	memset(&iwe, 0, sizeof(iwe));
-	iwe.cmd = SIOCGIWRATE;
-	current_val = current_ev + IW_EV_LCP_LEN;
-	pos = hostscan ? hscan->sup_rates : scan->sup_rates;
-	for (i = 0; i < sizeof(scan->sup_rates); i++) {
-		if (pos[i] == 0)
-			break;
-		/* Bit rate given in 500 kb/s units (+ 0x80) */
-		iwe.u.bitrate.value = ((pos[i] & 0x7f) * 500000);
-		current_val = iwe_stream_add_value(
-			current_ev, current_val, end_buf, &iwe,
-			IW_EV_PARAM_LEN);
-	}
-	/* Check if we added any event */
-	if ((current_val - current_ev) > IW_EV_LCP_LEN)
-		current_ev = current_val;
-
-	memset(&iwe, 0, sizeof(iwe));
-	iwe.cmd = IWEVCUSTOM;
-	sprintf(buf, "bcn_int=%d",
-		le16_to_cpu(hostscan ? hscan->beacon_interval :
-			    scan->beacon_interval));
-	iwe.u.data.length = strlen(buf);
-	current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
+	/* TODO: add SuppRates into BSS table */
+	if (scan || hscan) {
+		memset(&iwe, 0, sizeof(iwe));
+		iwe.cmd = SIOCGIWRATE;
+		current_val = current_ev + IW_EV_LCP_LEN;
+		pos = hostscan ? hscan->sup_rates : scan->sup_rates;
+		for (i = 0; i < sizeof(scan->sup_rates); i++) {
+			if (pos[i] == 0)
+				break;
+			/* Bit rate given in 500 kb/s units (+ 0x80) */
+			iwe.u.bitrate.value = ((pos[i] & 0x7f) * 500000);
+			current_val = iwe_stream_add_value(
+				current_ev, current_val, end_buf, &iwe,
+				IW_EV_PARAM_LEN);
+		}
+		/* Check if we added any event */
+		if ((current_val - current_ev) > IW_EV_LCP_LEN)
+			current_ev = current_val;
+	}
 
-	memset(&iwe, 0, sizeof(iwe));
-	iwe.cmd = IWEVCUSTOM;
-	sprintf(buf, "resp_rate=%d", le16_to_cpu(hostscan ? hscan->rate :
-						 scan->rate));
-	iwe.u.data.length = strlen(buf);
-	current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
+	/* TODO: add BeaconInt,resp_rate,atim into BSS table */
+	if (scan || hscan) {
+		memset(&iwe, 0, sizeof(iwe));
+		iwe.cmd = IWEVCUSTOM;
+		sprintf(buf, "bcn_int=%d",
+			le16_to_cpu(hostscan ? hscan->beacon_interval :
+				    scan->beacon_interval));
+		iwe.u.data.length = strlen(buf);
+		current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
+						  buf);
 
-	if (hostscan && (capabilities & WLAN_CAPABILITY_IBSS)) {
 		memset(&iwe, 0, sizeof(iwe));
 		iwe.cmd = IWEVCUSTOM;
-		sprintf(buf, "atim=%d", le16_to_cpu(hscan->atim));
+		sprintf(buf, "resp_rate=%d", le16_to_cpu(hostscan ?
+							 hscan->rate :
+							 scan->rate));
 		iwe.u.data.length = strlen(buf);
 		current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
 						  buf);
+
+		if (hostscan && (capabilities & WLAN_CAPABILITY_IBSS)) {
+			memset(&iwe, 0, sizeof(iwe));
+			iwe.cmd = IWEVCUSTOM;
+			sprintf(buf, "atim=%d", le16_to_cpu(hscan->atim));
+			iwe.u.data.length = strlen(buf);
+			current_ev = iwe_stream_add_point(current_ev, end_buf,
+							  &iwe, buf);
+		}
 	}
 
 	if (bss && bss->wpa_ie_len > 0 && bss->wpa_ie_len <= MAX_WPA_IE_LEN ) {
@@ -1948,6 +1973,12 @@
 
 	spin_lock_bh(&local->lock);
 
+	list_for_each(ptr, &local->bss_list) {
+		struct hostap_bss_info *bss;
+		bss = list_entry(ptr, struct hostap_bss_info, list);
+		bss->included = 0;
+	}
+
 	hostscan = local->last_scan_type == PRISM2_HOSTSCAN;
 	entries = hostscan ? local->last_hostscan_results_count :
 		local->last_scan_results_count;
@@ -1965,6 +1996,7 @@
 			struct hostap_bss_info *bss;
 			bss = list_entry(ptr, struct hostap_bss_info, list);
 			if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) {
+				bss->included = 1;
 				current_ev = __prism2_translate_scan(
 					local, scan, hscan, hostscan, bss,
 					bssid, current_ev, end_buf);
@@ -1984,6 +2016,25 @@
 		}
 	}
 
+	/* Prism2 firmware has limits (32 at least in some versions) for number
+	 * of BSSes in scan results. Extend this limit by using local BSS list.
+	 */
+	list_for_each(ptr, &local->bss_list) {
+		struct hostap_bss_info *bss;
+		bss = list_entry(ptr, struct hostap_bss_info, list);
+		if (bss->included)
+			continue;
+		current_ev = __prism2_translate_scan(local, NULL, NULL, 0, bss,
+						     bss->bssid, current_ev,
+						     end_buf);
+		/* Check if there is space for one more entry */
+		if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) {
+			/* Ask user space to try again with a bigger buffer */
+			spin_unlock_bh(&local->lock);
+			return -E2BIG;
+		}
+	}
+
 	spin_unlock_bh(&local->lock);
 
 	return current_ev - buffer;
Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_wlan.h
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_wlan.h	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_wlan.h	2005-03-12 16:10:42.000000000 -0800
@@ -630,6 +630,8 @@
 	size_t wpa_ie_len;
 	u8 rsn_ie[MAX_WPA_IE_LEN];
 	size_t rsn_ie_len;
+	int chan;
+	int included;
 };
 
 

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 2/10] hostap: Include asm/io.h
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
  2005-03-13  0:28 ` [PATCH wireless-2.6 1/10] hostap: Clear station statistic on accounting start Jouni Malinen
@ 2005-03-13  0:29 ` Jouni Malinen
  2005-03-22 23:13   ` Jeff Garzik
  2005-03-13  0:30 ` [PATCH wireless-2.6 3/10] hostap: Disable interrupts before Genesis mode Jouni Malinen
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:29 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Include asm/io.h into hostap_{pci,plx}.c since this seems to be needed
for ARM on Linux 2.6.x and this file is already included into
hostap_cs.c anyway.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_pci.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_pci.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_pci.c	2005-03-12 16:10:50.000000000 -0800
@@ -17,6 +17,7 @@
 
 #include <linux/ioport.h>
 #include <linux/pci.h>
+#include <asm/io.h>
 
 #include "hostap_wlan.h"
 
Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_plx.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_plx.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_plx.c	2005-03-12 16:10:50.000000000 -0800
@@ -20,6 +20,7 @@
 
 #include <linux/ioport.h>
 #include <linux/pci.h>
+#include <asm/io.h>
 
 #include "hostap_wlan.h"
 

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 3/10] hostap: Disable interrupts before Genesis mode
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
  2005-03-13  0:28 ` [PATCH wireless-2.6 1/10] hostap: Clear station statistic on accounting start Jouni Malinen
  2005-03-13  0:29 ` [PATCH wireless-2.6 2/10] hostap: Include asm/io.h Jouni Malinen
@ 2005-03-13  0:30 ` Jouni Malinen
  2005-03-13  0:31 ` [PATCH wireless-2.6 4/10] hostap: Add support for multi-func SanDisk ConnectPlus Jouni Malinen
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:30 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Disable interrupts before trying to initialize card after Genesis mode
download. This seems to be required at least with SanDisk ConnectPlus,
but seems to be a good idea in generic, so just do it with all cards.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_download.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_download.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_download.c	2005-03-12 16:10:52.000000000 -0800
@@ -464,6 +464,11 @@
 	local->hw_downloading = 0;
 
 	PDEBUG(DEBUG_EXTRA2, "Trying to initialize card\n");
+	/*
+	 * Make sure the INIT command does not generate a command completion
+	 * event by disabling interrupts.
+	 */
+	hfa384x_disable_interrupts(dev);
 	if (prism2_hw_init(dev, 1)) {
 		printk(KERN_DEBUG "%s: Initialization after genesis mode "
 		       "download failed\n", dev->name);


-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 4/10] hostap: Add support for multi-func SanDisk ConnectPlus
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
                   ` (2 preceding siblings ...)
  2005-03-13  0:30 ` [PATCH wireless-2.6 3/10] hostap: Disable interrupts before Genesis mode Jouni Malinen
@ 2005-03-13  0:31 ` Jouni Malinen
  2005-03-13  0:32 ` [PATCH wireless-2.6 5/10] hostap: Fix procfs rmdir after ifname change Jouni Malinen
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:31 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Added support for the special initialization needed for the
wireless part of multi-function SanDisk ConnectPlus CF cards
(manfid 0xd601, 0x0101).

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_cs.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_cs.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_cs.c	2005-03-12 16:10:53.000000000 -0800
@@ -217,6 +217,137 @@
 	return 0;
 }
 
+
+/*
+ * SanDisk CompactFlash WLAN Flashcard - Product Manual v1.0
+ * Document No. 20-10-00058, January 2004
+ * http://www.sandisk.com/pdf/industrial/ProdManualCFWLANv1.0.pdf
+ */
+#define SANDISK_WLAN_ACTIVATION_OFF 0x40
+#define SANDISK_HCR_OFF 0x42
+
+
+static void sandisk_set_iobase(local_info_t *local)
+{
+	int res;
+	conf_reg_t reg;
+
+	reg.Function = 0;
+	reg.Action = CS_WRITE;
+	reg.Offset = 0x10; /* 0x3f0 IO base 1 */
+	reg.Value = local->link->io.BasePort1 & 0x00ff;
+	res = pcmcia_access_configuration_register(local->link->handle, &reg);
+	if (res != CS_SUCCESS) {
+		printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
+		       " res=%d\n", res);
+	}
+	udelay(10);
+
+	reg.Function = 0;
+	reg.Action = CS_WRITE;
+	reg.Offset = 0x12; /* 0x3f2 IO base 2 */
+	reg.Value = (local->link->io.BasePort1 & 0xff00) >> 8;
+	res = pcmcia_access_configuration_register(local->link->handle, &reg);
+	if (res != CS_SUCCESS) {
+		printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
+		       " res=%d\n", res);
+	}
+}
+
+
+static void sandisk_write_hcr(local_info_t *local, int hcr)
+{
+	struct net_device *dev = local->dev;
+	int i;
+
+	HFA384X_OUTB(0x80, SANDISK_WLAN_ACTIVATION_OFF);
+	udelay(50);
+	for (i = 0; i < 10; i++) {
+		HFA384X_OUTB(hcr, SANDISK_HCR_OFF);
+	}
+	udelay(55);
+	HFA384X_OUTB(0x45, SANDISK_WLAN_ACTIVATION_OFF);
+}
+
+
+static void sandisk_enable_wireless(struct net_device *dev)
+{
+	int res;
+	conf_reg_t reg;
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
+	tuple_t tuple;
+	cisparse_t parse;
+	u_char buf[64];
+
+	if (local->link->io.NumPorts1 < 0x42) {
+		/* Not enough ports to be SanDisk multi-function card */
+		return;
+	}
+
+	tuple.DesiredTuple = CISTPL_MANFID;
+	tuple.Attributes = TUPLE_RETURN_COMMON;
+	tuple.TupleData = buf;
+	tuple.TupleDataMax = sizeof(buf);
+	tuple.TupleOffset = 0;
+	if (pcmcia_get_first_tuple(local->link->handle, &tuple) ||
+	    pcmcia_get_tuple_data(local->link->handle, &tuple) ||
+	    pcmcia_parse_tuple(local->link->handle, &tuple, &parse) ||
+	    parse.manfid.manf != 0xd601 || parse.manfid.card != 0x0101) {
+		/* No SanDisk manfid found */
+		return;
+	}
+
+	tuple.DesiredTuple = CISTPL_LONGLINK_MFC;
+	if (pcmcia_get_first_tuple(local->link->handle, &tuple) ||
+	    pcmcia_get_tuple_data(local->link->handle, &tuple) ||
+	    pcmcia_parse_tuple(local->link->handle, &tuple, &parse) ||
+		parse.longlink_mfc.nfn < 2) {
+		/* No multi-function links found */
+		return;
+	}
+
+	printk(KERN_DEBUG "%s: Multi-function SanDisk ConnectPlus detected"
+	       " - using vendor-specific initialization\n", dev->name);
+	local->sandisk_connectplus = 1;
+
+	reg.Function = 0;
+	reg.Action = CS_WRITE;
+	reg.Offset = CISREG_COR;
+	reg.Value = COR_SOFT_RESET;
+	res = pcmcia_access_configuration_register(local->link->handle, &reg);
+	if (res != CS_SUCCESS) {
+		printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
+		       dev->name, res);
+		return;
+	}
+	mdelay(5);
+
+	reg.Function = 0;
+	reg.Action = CS_WRITE;
+	reg.Offset = CISREG_COR;
+	/*
+	 * Do not enable interrupts here to avoid some bogus events. Interrupts
+	 * will be enabled during the first cor_sreset call.
+	 */
+	reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA;
+	res = pcmcia_access_configuration_register(local->link->handle, &reg);
+	if (res != CS_SUCCESS) {
+		printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
+		       dev->name, res);
+		return;
+	}
+	mdelay(5);
+
+	sandisk_set_iobase(local);
+
+	HFA384X_OUTB(0xc5, SANDISK_WLAN_ACTIVATION_OFF);
+	udelay(10);
+	HFA384X_OUTB(0x4b, SANDISK_WLAN_ACTIVATION_OFF);
+	udelay(10);
+}
+
+
 static void prism2_pccard_cor_sreset(local_info_t *local)
 {
 	int res;
@@ -247,9 +378,11 @@
 		return;
 	}
 
-	mdelay(2);
+	mdelay(local->sandisk_connectplus ? 5 : 2);
 
 	reg.Value &= ~COR_SOFT_RESET;
+	if (local->sandisk_connectplus)
+		reg.Value |= COR_IREQ_ENA;
 	res = pcmcia_access_configuration_register(local->link->handle, &reg);
 	if (res != CS_SUCCESS) {
 		printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
@@ -257,7 +390,10 @@
 		return;
 	}
 
-	mdelay(2);
+	mdelay(local->sandisk_connectplus ? 5 : 2);
+
+	if (local->sandisk_connectplus)
+		sandisk_set_iobase(local);
 }
 
 
@@ -270,6 +406,11 @@
 	if (!prism2_pccard_card_present(local))
 	       return;
 
+	if (local->sandisk_connectplus) {
+		sandisk_write_hcr(local, hcr);
+		return;
+	}
+
 	reg.Function = 0;
 	reg.Action = CS_READ;
 	reg.Offset = CISREG_COR;
@@ -643,6 +784,8 @@
 
 	local->shutdown = 0;
 
+	sandisk_enable_wireless(dev);
+
 	ret = prism2_hw_config(dev, 1);
 	if (!ret) {
 		ret = hostap_hw_ready(dev);
Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_wlan.h
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_wlan.h	2005-03-12 16:10:42.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_wlan.h	2005-03-12 16:10:53.000000000 -0800
@@ -895,6 +895,7 @@
 #ifdef PRISM2_PCCARD
 	dev_node_t node;
 	dev_link_t *link;
+	int sandisk_connectplus;
 #endif /* PRISM2_PCCARD */
 
 #ifdef PRISM2_PLX


-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 5/10] hostap: Fix procfs rmdir after ifname change
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
                   ` (3 preceding siblings ...)
  2005-03-13  0:31 ` [PATCH wireless-2.6 4/10] hostap: Add support for multi-func SanDisk ConnectPlus Jouni Malinen
@ 2005-03-13  0:32 ` Jouni Malinen
  2005-03-13  0:32 ` [PATCH wireless-2.6 6/10] hostap: Clear station statistic on accounting start Jouni Malinen
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:32 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Fixed /proc/net/hostap/wlan# removing to use name from the procfs
instead of from the netdevice. This allows the procfs entry be removed
nicely even if the network interface has been renamed.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_proc.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_proc.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_proc.c	2005-03-12 16:10:55.000000000 -0800
@@ -456,8 +456,8 @@
 #ifndef PRISM2_NO_PROCFS_DEBUG
 		remove_proc_entry("debug", local->proc);
 #endif /* PRISM2_NO_PROCFS_DEBUG */
-		if (local->ddev != NULL && hostap_proc != NULL)
-			remove_proc_entry(local->ddev->name, hostap_proc);
+		if (hostap_proc != NULL)
+			remove_proc_entry(local->proc->name, hostap_proc);
 	}
 }
 

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 6/10] hostap: Clear station statistic on accounting start
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
                   ` (4 preceding siblings ...)
  2005-03-13  0:32 ` [PATCH wireless-2.6 5/10] hostap: Fix procfs rmdir after ifname change Jouni Malinen
@ 2005-03-13  0:32 ` Jouni Malinen
  2005-03-13  0:34 ` [PATCH wireless-2.6 7/10] hostap: Rate limiting for debug messages Jouni Malinen
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:32 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

>From Gunter Burchardt <gbur@informatik.uni-rostock.de>

Added new ioctl command for hostapd to clear station specific
accounting data when starting a new accounting session.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_ap.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_ap.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_ap.c	2005-03-12 16:10:56.000000000 -0800
@@ -2582,6 +2582,31 @@
 }
 
 
+static int prism2_hostapd_sta_clear_stats(struct ap_data *ap,
+					  struct prism2_hostapd_param *param)
+{
+	struct sta_info *sta;
+	int rate;
+
+	spin_lock_bh(&ap->sta_table_lock);
+	sta = ap_get_sta(ap, param->sta_addr);
+	if (sta) {
+		sta->rx_packets = sta->tx_packets = 0;
+		sta->rx_bytes = sta->tx_bytes = 0;
+		for (rate = 0; rate < WLAN_RATE_COUNT; rate++) {
+			sta->tx_count[rate] = 0;
+			sta->rx_count[rate] = 0;
+		}
+	}
+	spin_unlock_bh(&ap->sta_table_lock);
+
+	if (!sta)
+		return -ENOENT;
+
+	return 0;
+}
+
+
 static int prism2_hostapd(struct ap_data *ap,
 			  struct prism2_hostapd_param *param)
 {
@@ -2597,6 +2622,8 @@
 		return prism2_hostapd_get_info_sta(ap, param);
 	case PRISM2_HOSTAPD_SET_FLAGS_STA:
 		return prism2_hostapd_set_flags_sta(ap, param);
+	case PRISM2_HOSTAPD_STA_CLEAR_STATS:
+		return prism2_hostapd_sta_clear_stats(ap, param);
 	default:
 		printk(KERN_WARNING "prism2_hostapd: unknown cmd=%d\n",
 		       param->cmd);
Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_common.h
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_common.h	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_common.h	2005-03-12 16:10:56.000000000 -0800
@@ -482,6 +482,7 @@
 	PRISM2_HOSTAPD_SET_GENERIC_ELEMENT = 12,
 	PRISM2_HOSTAPD_MLME = 13,
 	PRISM2_HOSTAPD_SCAN_REQ = 14,
+	PRISM2_HOSTAPD_STA_CLEAR_STATS = 15,
 };
 
 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024



-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 7/10] hostap: Rate limiting for debug messages
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
                   ` (5 preceding siblings ...)
  2005-03-13  0:32 ` [PATCH wireless-2.6 6/10] hostap: Clear station statistic on accounting start Jouni Malinen
@ 2005-03-13  0:34 ` Jouni Malinen
  2005-03-22 23:11   ` Jeff Garzik
  2005-03-13  0:34 ` [PATCH wireless-2.6 8/10] hostap: Improved suspend Jouni Malinen
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:34 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Limit rate of debug messages for interrupts before card is ready. This
could happen when multiple devices are sharing the same interrupt.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_hw.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c	2005-03-12 16:10:40.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_hw.c	2005-03-12 16:10:58.000000000 -0800
@@ -2790,8 +2790,10 @@
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0);
 
 	if (local->func->card_present && !local->func->card_present(local)) {
-		printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
-		       dev->name);
+		if (net_ratelimit()) {
+			printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
+			       dev->name);
+		}
 		return IRQ_HANDLED;
 	}
 

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 8/10] hostap: Improved suspend
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
                   ` (6 preceding siblings ...)
  2005-03-13  0:34 ` [PATCH wireless-2.6 7/10] hostap: Rate limiting for debug messages Jouni Malinen
@ 2005-03-13  0:34 ` Jouni Malinen
  2005-03-13  0:35 ` [PATCH wireless-2.6 9/10] hostap: Filter disconnect events Jouni Malinen
  2005-03-13  0:41 ` [PATCH wireless-2.6 10/10] hostap: Update to use the new WE18 proposal Jouni Malinen
  9 siblings, 0 replies; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:34 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Improved suspend operation: disable firmware (hostap_cs) and
generate disconnect event to trigger wpa_supplicant to reassociate
immediately after resume.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_cs.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_cs.c	2005-03-12 16:10:53.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_cs.c	2005-03-12 16:10:59.000000000 -0800
@@ -870,6 +870,7 @@
 				netif_stop_queue(dev);
 				netif_device_detach(dev);
 			}
+			prism2_suspend(dev);
 			pcmcia_release_configuration(link->handle);
 		}
 		break;
Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_hw.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c	2005-03-12 16:10:58.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_hw.c	2005-03-12 16:10:59.000000000 -0800
@@ -3594,6 +3594,28 @@
 }
 
 
+#ifndef PRISM2_PLX
+static void prism2_suspend(struct net_device *dev)
+{
+	struct hostap_interface *iface;
+	struct local_info *local;
+	union iwreq_data wrqu;
+
+	iface = dev->priv;
+	local = iface->local;
+
+	/* Send disconnect event, e.g., to trigger reassociation after resume
+	 * if wpa_supplicant is used. */
+	memset(&wrqu, 0, sizeof(wrqu));
+	wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+	wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL);
+
+	/* Disable hardware and firmware */
+	prism2_hw_shutdown(dev, 0);
+}
+#endif /* PRISM2_PLX */
+
+
 /* These might at some point be compiled separately and used as separate
  * kernel modules or linked into one */
 #ifdef PRISM2_DOWNLOAD_SUPPORT
Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_pci.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_pci.c	2005-03-12 16:10:50.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_pci.c	2005-03-12 16:10:59.000000000 -0800
@@ -393,7 +393,7 @@
 		netif_stop_queue(dev);
 		netif_device_detach(dev);
 	}
-	prism2_hw_shutdown(dev, 0);
+	prism2_suspend(dev);
 	pci_save_state(pdev);
 	pci_disable_device(pdev);
 	pci_set_power_state(pdev, 3);


-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 9/10] hostap: Filter disconnect events
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
                   ` (7 preceding siblings ...)
  2005-03-13  0:34 ` [PATCH wireless-2.6 8/10] hostap: Improved suspend Jouni Malinen
@ 2005-03-13  0:35 ` Jouni Malinen
  2005-03-13  0:41 ` [PATCH wireless-2.6 10/10] hostap: Update to use the new WE18 proposal Jouni Malinen
  9 siblings, 0 replies; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:35 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Filter out sequential disconnect events to make race condition with
received EAPOL frames less likely to happen (this improves
authentication success rate with some APs that send EAPOL frames very
quickly after the (re)association response).

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_info.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_info.c	2005-03-12 16:10:39.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_info.c	2005-03-12 16:11:01.000000000 -0800
@@ -428,7 +428,16 @@
 		memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
 	}
 	wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-	wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL);
+
+	/*
+	 * Filter out sequential disconnect events in order not to cause a
+	 * flood of SIOCGIWAP events that have a race condition with EAPOL
+	 * frames and can confuse wpa_supplicant about the current association
+	 * status.
+	 */
+	if (connected || local->prev_linkstatus_connected)
+		wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL);
+	local->prev_linkstatus_connected = connected;
 }
 
 
Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_wlan.h
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_wlan.h	2005-03-12 16:10:53.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_wlan.h	2005-03-12 16:11:01.000000000 -0800
@@ -833,6 +833,7 @@
 #define PRISM2_INFO_PENDING_LINKSTATUS 0
 #define PRISM2_INFO_PENDING_SCANRESULTS 1
 	int prev_link_status; /* previous received LinkStatus info */
+	int prev_linkstatus_connected;
 	u8 preferred_ap[6]; /* use this AP if possible */
 
 #ifdef PRISM2_CALLBACK


-- 
Jouni Malinen                                            PGP id EFC895FA

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

* [PATCH wireless-2.6 10/10] hostap: Update to use the new WE18 proposal
  2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
                   ` (8 preceding siblings ...)
  2005-03-13  0:35 ` [PATCH wireless-2.6 9/10] hostap: Filter disconnect events Jouni Malinen
@ 2005-03-13  0:41 ` Jouni Malinen
  2005-03-22 23:11   ` Jeff Garzik
  9 siblings, 1 reply; 16+ messages in thread
From: Jouni Malinen @ 2005-03-13  0:41 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Note: This depends on WE18 patch being applied first.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_ioctl.c
===================================================================
--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_ioctl.c	2005-03-12 16:10:42.000000000 -0800
+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_ioctl.c	2005-03-12 16:39:05.000000000 -0800
@@ -1000,7 +1000,7 @@
 	}
 
 	range->we_version_compiled = WIRELESS_EXT;
-	range->we_version_source = 16;
+	range->we_version_source = 18;
 
 	range->retry_capa = IW_RETRY_LIMIT;
 	range->retry_flags = IW_RETRY_LIMIT;
@@ -1076,6 +1076,9 @@
 				IW_EVENT_CAPA_MASK(IWEVREGISTERED) |
 				IW_EVENT_CAPA_MASK(IWEVEXPIRED));
 
+	range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
+		IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
+
 	return 0;
 }
 
@@ -1731,10 +1734,15 @@
 	struct hostap_interface *iface;
 	local_info_t *local;
 	int ret;
+	u8 *ssid = NULL, ssid_len = 0;
+	struct iw_scan_req *req = (struct iw_scan_req *) extra;
 
 	iface = netdev_priv(dev);
 	local = iface->local;
 
+	if (data->length < sizeof(struct iw_scan_req))
+		req = NULL;
+
 	if (local->iw_mode == IW_MODE_MASTER) {
 		/* In master mode, we just return the results of our local
 		 * tables, so we don't need to start anything...
@@ -1746,8 +1754,19 @@
 	if (!local->dev_enabled)
 		return -ENETDOWN;
 
+	if (req && data->flags & IW_SCAN_THIS_ESSID) {
+		ssid = req->essid;
+		ssid_len = req->essid_len;
+
+		if (ssid_len &&
+		    ((local->iw_mode != IW_MODE_INFRA &&
+		      local->iw_mode != IW_MODE_ADHOC) ||
+		     (local->sta_fw_ver < PRISM2_FW_VER(1,3,1))))
+			return -EOPNOTSUPP;
+	}
+
 	if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1))
-		ret = prism2_request_hostscan(dev, NULL, 0);
+		ret = prism2_request_hostscan(dev, ssid, ssid_len);
 	else
 		ret = prism2_request_scan(dev);
 
@@ -1926,32 +1945,20 @@
 		}
 	}
 
-	if (bss && bss->wpa_ie_len > 0 && bss->wpa_ie_len <= MAX_WPA_IE_LEN ) {
-		u8 *p = buf;
-		p += sprintf(p, "wpa_ie=");
-		for (i = 0; i < bss->wpa_ie_len; i++) {
-			p += sprintf(p, "%02x", bss->wpa_ie[i]);
-		}
-
+	if (bss && bss->wpa_ie_len > 0 && bss->wpa_ie_len <= MAX_WPA_IE_LEN) {
 		memset(&iwe, 0, sizeof(iwe));
-		iwe.cmd = IWEVCUSTOM;
-		iwe.u.data.length = strlen(buf);
+		iwe.cmd = IWEVGENIE;
+		iwe.u.data.length = bss->wpa_ie_len;
 		current_ev = iwe_stream_add_point(
-			current_ev, end_buf, &iwe, buf);
+			current_ev, end_buf, &iwe, bss->wpa_ie);
 	}
 
-	if (bss && bss->rsn_ie_len > 0 && bss->rsn_ie_len <= MAX_WPA_IE_LEN ) {
-		u8 *p = buf;
-		p += sprintf(p, "rsn_ie=");
-		for (i = 0; i < bss->rsn_ie_len; i++) {
-			p += sprintf(p, "%02x", bss->rsn_ie[i]);
-		}
-
+	if (bss && bss->rsn_ie_len > 0 && bss->rsn_ie_len <= MAX_WPA_IE_LEN) {
 		memset(&iwe, 0, sizeof(iwe));
-		iwe.cmd = IWEVCUSTOM;
-		iwe.u.data.length = strlen(buf);
+		iwe.cmd = IWEVGENIE;
+		iwe.u.data.length = bss->rsn_ie_len;
 		current_ev = iwe_stream_add_point(
-			current_ev, end_buf, &iwe, buf);
+			current_ev, end_buf, &iwe, bss->rsn_ie);
 	}
 
 	return current_ev;
@@ -3098,6 +3105,387 @@
 #endif /* PRISM2_DOWNLOAD_SUPPORT */
 
 
+static int prism2_set_genericelement(struct net_device *dev, u8 *elem,
+				     size_t len)
+{
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
+	u8 *buf;
+
+	/*
+	 * Add 16-bit length in the beginning of the buffer because Prism2 RID
+	 * includes it.
+	 */
+	buf = kmalloc(len + 2, GFP_KERNEL);
+	if (buf == NULL)
+		return -ENOMEM;
+
+	*((u16 *) buf) = cpu_to_le16(len);
+	memcpy(buf + 2, elem, len);
+
+	kfree(local->generic_elem);
+	local->generic_elem = buf;
+	local->generic_elem_len = len + 2;
+
+	return local->func->set_rid(local->dev, HFA384X_RID_GENERICELEMENT,
+				    buf, len + 2);
+}
+
+
+static int prism2_ioctl_siwauth(struct net_device *dev,
+				struct iw_request_info *info,
+				struct iw_param *data, char *extra)
+{
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
+
+	switch (data->flags & IW_AUTH_INDEX) {
+	case IW_AUTH_WPA_VERSION:
+	case IW_AUTH_CIPHER_PAIRWISE:
+	case IW_AUTH_CIPHER_GROUP:
+	case IW_AUTH_KEY_MGMT:
+		/*
+		 * Host AP driver does not use these parameters and allows
+		 * wpa_supplicant to control them internally.
+		 */
+		break;
+	case IW_AUTH_TKIP_COUNTERMEASURES:
+		local->tkip_countermeasures = data->value;
+		break;
+	case IW_AUTH_DROP_UNENCRYPTED:
+		local->drop_unencrypted = data->value;
+		break;
+	case IW_AUTH_80211_AUTH_ALG:
+		local->auth_algs = data->value;
+		break;
+	case IW_AUTH_WPA_ENABLED:
+		if (data->value == 0) {
+			local->wpa = 0;
+			if (local->sta_fw_ver < PRISM2_FW_VER(1,7,0))
+				break;
+			prism2_set_genericelement(dev, "", 0);
+			local->host_roaming = 0;
+			local->privacy_invoked = 0;
+			if (hostap_set_word(dev, HFA384X_RID_SSNHANDLINGMODE,
+					    0) ||
+			    hostap_set_roaming(local) ||
+			    hostap_set_encryption(local) ||
+			    local->func->reset_port(dev))
+				return -EINVAL;
+			break;
+		}
+		if (local->sta_fw_ver < PRISM2_FW_VER(1,7,0))
+			return -EOPNOTSUPP;
+		local->host_roaming = 2;
+		local->privacy_invoked = 1;
+		local->wpa = 1;
+		if (hostap_set_word(dev, HFA384X_RID_SSNHANDLINGMODE, 1) ||
+		    hostap_set_roaming(local) ||
+		    hostap_set_encryption(local) ||
+		    local->func->reset_port(dev))
+			return -EINVAL;
+		break;
+	case IW_AUTH_RX_UNENCRYPTED_EAPOL:
+		local->ieee_802_1x = data->value;
+		break;
+	case IW_AUTH_PRIVACY_INVOKED:
+		local->privacy_invoked = data->value;
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+	return 0;
+}
+
+
+static int prism2_ioctl_giwauth(struct net_device *dev,
+				struct iw_request_info *info,
+				struct iw_param *data, char *extra)
+{
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
+
+	switch (data->flags & IW_AUTH_INDEX) {
+	case IW_AUTH_WPA_VERSION:
+	case IW_AUTH_CIPHER_PAIRWISE:
+	case IW_AUTH_CIPHER_GROUP:
+	case IW_AUTH_KEY_MGMT:
+		/*
+		 * Host AP driver does not use these parameters and allows
+		 * wpa_supplicant to control them internally.
+		 */
+		return -EOPNOTSUPP;
+	case IW_AUTH_TKIP_COUNTERMEASURES:
+		data->value = local->tkip_countermeasures;
+		break;
+	case IW_AUTH_DROP_UNENCRYPTED:
+		data->value = local->drop_unencrypted;
+		break;
+	case IW_AUTH_80211_AUTH_ALG:
+		data->value = local->auth_algs;
+		break;
+	case IW_AUTH_WPA_ENABLED:
+		data->value = local->wpa;
+		break;
+	case IW_AUTH_RX_UNENCRYPTED_EAPOL:
+		data->value = local->ieee_802_1x;
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+	return 0;
+}
+
+
+static int prism2_ioctl_siwencodeext(struct net_device *dev,
+				     struct iw_request_info *info,
+				     struct iw_point *erq, char *extra)
+{
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
+	struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
+	int i, ret = 0;
+	struct hostap_crypto_ops *ops;
+	struct prism2_crypt_data **crypt;
+	void *sta_ptr;
+	u8 *addr;
+	const char *alg, *module;
+
+	i = erq->flags & IW_ENCODE_INDEX;
+	if (i > WEP_KEYS)
+		return -EINVAL;
+	if (i < 1 || i > WEP_KEYS)
+		i = local->tx_keyidx;
+	else
+		i--;
+	if (i < 0 || i >= WEP_KEYS)
+		return -EINVAL;
+
+	addr = ext->addr.sa_data;
+	if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff &&
+	    addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) {
+		sta_ptr = NULL;
+		crypt = &local->crypt[i];
+	} else {
+		if (i != 0)
+			return -EINVAL;
+		sta_ptr = ap_crypt_get_ptrs(local->ap, addr, 0, &crypt);
+		if (sta_ptr == NULL) {
+			if (local->iw_mode == IW_MODE_INFRA) {
+				/*
+				 * TODO: add STA entry for the current AP so
+				 * that unicast key can be used. For now, this
+				 * is emulated by using default key idx 0.
+				 */
+				i = 0;
+				crypt = &local->crypt[i];
+			} else
+				return -EINVAL;
+		}
+	}
+
+	if ((erq->flags & IW_ENCODE_DISABLED) ||
+	    ext->alg == IW_ENCODE_ALG_NONE) {
+		if (*crypt)
+			prism2_crypt_delayed_deinit(local, crypt);
+		goto done;
+	}
+
+	switch (ext->alg) {
+	case IW_ENCODE_ALG_WEP:
+		alg = "WEP";
+		module = "hostap_crypt_wep";
+		break;
+	case IW_ENCODE_ALG_TKIP:
+		alg = "TKIP";
+		module = "hostap_crypt_tkip";
+		break;
+	case IW_ENCODE_ALG_CCMP:
+		alg = "CCMP";
+		module = "hostap_crypt_ccmp";
+		break;
+	default:
+		printk(KERN_DEBUG "%s: unsupported algorithm %d\n",
+		       local->dev->name, ext->alg);
+		ret = -EOPNOTSUPP;
+		goto done;
+	}
+
+	ops = hostap_get_crypto_ops(alg);
+	if (ops == NULL) {
+		request_module(module);
+		ops = hostap_get_crypto_ops(alg);
+	}
+	if (ops == NULL) {
+		printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n",
+		       local->dev->name, alg);
+		ret = -EOPNOTSUPP;
+		goto done;
+	}
+
+	if (sta_ptr || ext->alg != IW_ENCODE_ALG_WEP) {
+		/*
+		 * Per station encryption and other than WEP algorithms
+		 * require host-based encryption, so force them on
+		 * automatically.
+		 */
+		local->host_decrypt = local->host_encrypt = 1;
+	}
+
+	if (*crypt == NULL || (*crypt)->ops != ops) {
+		struct prism2_crypt_data *new_crypt;
+
+		prism2_crypt_delayed_deinit(local, crypt);
+
+		new_crypt = (struct prism2_crypt_data *)
+			kmalloc(sizeof(struct prism2_crypt_data), GFP_KERNEL);
+		if (new_crypt == NULL) {
+			ret = -ENOMEM;
+			goto done;
+		}
+		memset(new_crypt, 0, sizeof(struct prism2_crypt_data));
+		new_crypt->ops = ops;
+		new_crypt->priv = new_crypt->ops->init(i);
+		if (new_crypt->priv == NULL) {
+			kfree(new_crypt);
+			ret = -EINVAL;
+			goto done;
+		}
+
+		*crypt = new_crypt;
+	}
+
+	/*
+	 * TODO: if ext_flags does not have IW_ENCODE_EXT_RX_SEQ_VALID, the
+	 * existing seq# should not be changed.
+	 * TODO: if ext_flags has IW_ENCODE_EXT_TX_SEQ_VALID, next TX seq#
+	 * should be changed to something else than zero.
+	 */
+	if ((!(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) || ext->key_len > 0)
+	    && (*crypt)->ops->set_key &&
+	    (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
+				   (*crypt)->priv) < 0) {
+		printk(KERN_DEBUG "%s: key setting failed\n",
+		       local->dev->name);
+		ret = -EINVAL;
+		goto done;
+	}
+
+	if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
+		if (!sta_ptr)
+			local->tx_keyidx = i;
+		else if (i) {
+			ret = -EINVAL;
+			goto done;
+		}
+	}
+
+
+	if (sta_ptr == NULL && ext->key_len > 0) {
+		int first = 1, j;
+		for (j = 0; j < WEP_KEYS; j++) {
+			if (j != i && local->crypt[j]) {
+				first = 0;
+				break;
+			}
+		}
+		if (first)
+			local->tx_keyidx = i;
+	}
+
+ done:
+	if (sta_ptr)
+		hostap_handle_sta_release(sta_ptr);
+
+	local->open_wep = erq->flags & IW_ENCODE_OPEN;
+
+	/*
+	 * Do not reset port0 if card is in Managed mode since resetting will
+	 * generate new IEEE 802.11 authentication which may end up in looping
+	 * with IEEE 802.1X. Prism2 documentation seem to require port reset
+	 * after WEP configuration. However, keys are apparently changed at
+	 * least in Managed mode.
+	 */
+	if (ret == 0 &&
+	    (hostap_set_encryption(local) ||
+	     (local->iw_mode != IW_MODE_INFRA &&
+	      local->func->reset_port(local->dev))))
+		ret = -EINVAL;
+
+	return ret;
+}
+
+
+static int prism2_ioctl_giwencodeext(struct net_device *dev,
+				     struct iw_request_info *info,
+				     struct iw_point *erq, char *extra)
+{
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
+	struct prism2_crypt_data **crypt;
+	void *sta_ptr;
+	int max_key_len, i;
+	struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
+	u8 *addr;
+
+	max_key_len = erq->length - sizeof(*ext);
+	if (max_key_len < 0)
+		return -EINVAL;
+
+	i = erq->flags & IW_ENCODE_INDEX;
+	if (i < 1 || i > WEP_KEYS)
+		i = local->tx_keyidx;
+	else
+		i--;
+
+	addr = ext->addr.sa_data;
+	if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff &&
+	    addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) {
+		sta_ptr = NULL;
+		crypt = &local->crypt[i];
+	} else {
+		i = 0;
+		sta_ptr = ap_crypt_get_ptrs(local->ap, addr, 0, &crypt);
+		if (sta_ptr == NULL)
+			return -EINVAL;
+	}
+	erq->flags = i + 1;
+	memset(ext, 0, sizeof(*ext));
+
+	if (*crypt == NULL || (*crypt)->ops == NULL) {
+		ext->alg = IW_ENCODE_ALG_NONE;
+		ext->key_len = 0;
+		erq->flags |= IW_ENCODE_DISABLED;
+	} else {
+		if (strcmp((*crypt)->ops->name, "WEP") == 0)
+			ext->alg = IW_ENCODE_ALG_WEP;
+		else if (strcmp((*crypt)->ops->name, "TKIP") == 0)
+			ext->alg = IW_ENCODE_ALG_TKIP;
+		else if (strcmp((*crypt)->ops->name, "CCMP") == 0)
+			ext->alg = IW_ENCODE_ALG_CCMP;
+		else
+			return -EINVAL;
+
+		if ((*crypt)->ops->get_key) {
+			ext->key_len =
+				(*crypt)->ops->get_key(ext->key,
+						       max_key_len,
+						       ext->tx_seq,
+						       (*crypt)->priv);
+			if (ext->key_len &&
+			    (ext->alg == IW_ENCODE_ALG_TKIP ||
+			     ext->alg == IW_ENCODE_ALG_CCMP))
+				ext->ext_flags |= IW_ENCODE_EXT_TX_SEQ_VALID;
+		}
+	}
+
+	if (sta_ptr)
+		hostap_handle_sta_release(sta_ptr);
+
+	return 0;
+}
+
+
 static int prism2_ioctl_set_encryption(local_info_t *local,
 				       struct prism2_hostapd_param *param,
 				       int param_len)
@@ -3342,33 +3730,76 @@
 }
 
 
+static int prism2_ioctl_siwgenie(struct net_device *dev,
+				 struct iw_request_info *info,
+				 struct iw_point *data, char *extra)
+{
+	return prism2_set_genericelement(dev, extra, data->length);
+}
+
+
+static int prism2_ioctl_giwgenie(struct net_device *dev,
+				 struct iw_request_info *info,
+				 struct iw_point *data, char *extra)
+{
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
+	int len = local->generic_elem_len - 2;
+
+	if (len <= 0 || local->generic_elem == NULL) {
+		data->length = 0;
+		return 0;
+	}
+
+	if (data->length < len)
+		return -E2BIG;
+
+	data->length = len;
+	memcpy(extra, local->generic_elem + 2, len);
+
+	return 0;
+}
+
+
 static int prism2_ioctl_set_generic_element(local_info_t *local,
 					    struct prism2_hostapd_param *param,
 					    int param_len)
 {
 	int max_len, len;
-	u8 *buf;
 
 	len = param->u.generic_elem.len;
 	max_len = param_len - PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN;
 	if (max_len < 0 || max_len < len)
 		return -EINVAL;
 
-	/* Add 16-bit length in the beginning of the buffer because Prism2 RID
-	 * includes it. */
-	buf = kmalloc(len + 2, GFP_KERNEL);
-	if (buf == NULL)
-		return -ENOMEM;
+	return prism2_set_genericelement(local->dev,
+					 param->u.generic_elem.data, len);
+}
 
-	*((u16 *) buf) = cpu_to_le16(len);
-	memcpy(buf + 2, param->u.generic_elem.data, len);
 
-	kfree(local->generic_elem);
-	local->generic_elem = buf;
-	local->generic_elem_len = len + 2;
+static int prism2_ioctl_siwmlme(struct net_device *dev,
+				struct iw_request_info *info,
+				struct iw_point *data, char *extra)
+{
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
+	struct iw_mlme *mlme = (struct iw_mlme *) extra;
+	u16 reason;
 
-	return local->func->set_rid(local->dev, HFA384X_RID_GENERICELEMENT,
-				    buf, len + 2);
+	reason = cpu_to_le16(mlme->reason_code);
+
+	switch (mlme->cmd) {
+	case IW_MLME_DEAUTH:
+		return prism2_sta_send_mgmt(local, mlme->addr.sa_data,
+					    WLAN_FC_STYPE_DEAUTH,
+					    (u8 *) &reason, 2);
+	case IW_MLME_DISASSOC:
+		return prism2_sta_send_mgmt(local, mlme->addr.sa_data,
+					    WLAN_FC_STYPE_DISASSOC,
+					    (u8 *) &reason, 2);
+	default:
+		return -EOPNOTSUPP;
+	}
 }
 
 
@@ -3532,7 +3963,7 @@
 	iw_handler_get_thrspy,				/* SIOCGIWTHRSPY */
 	(iw_handler) prism2_ioctl_siwap,		/* SIOCSIWAP */
 	(iw_handler) prism2_ioctl_giwap,		/* SIOCGIWAP */
-	(iw_handler) NULL,				/* -- hole -- */
+	(iw_handler) prism2_ioctl_siwmlme,		/* SIOCSIWMLME */
 	(iw_handler) prism2_ioctl_giwaplist,		/* SIOCGIWAPLIST */
 	(iw_handler) prism2_ioctl_siwscan,		/* SIOCSIWSCAN */
 	(iw_handler) prism2_ioctl_giwscan,		/* SIOCGIWSCAN */
@@ -3556,6 +3987,16 @@
 	(iw_handler) prism2_ioctl_giwencode,		/* SIOCGIWENCODE */
 	(iw_handler) prism2_ioctl_siwpower,		/* SIOCSIWPOWER */
 	(iw_handler) prism2_ioctl_giwpower,		/* SIOCGIWPOWER */
+	(iw_handler) NULL,				/* -- hole -- */
+	(iw_handler) NULL,				/* -- hole -- */
+	(iw_handler) prism2_ioctl_siwgenie,		/* SIOCSIWGENIE */
+	(iw_handler) prism2_ioctl_giwgenie,		/* SIOCGIWGENIE */
+	(iw_handler) prism2_ioctl_siwauth,		/* SIOCSIWAUTH */
+	(iw_handler) prism2_ioctl_giwauth,		/* SIOCGIWAUTH */
+	(iw_handler) prism2_ioctl_siwencodeext,		/* SIOCSIWENCODEEXT */
+	(iw_handler) prism2_ioctl_giwencodeext,		/* SIOCGIWENCODEEXT */
+	(iw_handler) NULL,				/* SIOCSIWPMKSA */
+	(iw_handler) NULL,				/* -- hole -- */
 };
 
 static const iw_handler prism2_private_handler[] =


-- 
Jouni Malinen                                            PGP id EFC895FA

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

* Re: [PATCH wireless-2.6 10/10] hostap: Update to use the new WE18 proposal
  2005-03-13  0:41 ` [PATCH wireless-2.6 10/10] hostap: Update to use the new WE18 proposal Jouni Malinen
@ 2005-03-22 23:11   ` Jeff Garzik
  0 siblings, 0 replies; 16+ messages in thread
From: Jeff Garzik @ 2005-03-22 23:11 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: netdev

applied all 10 patches to wireless-2.6 (after applying WE18 from JeanT).

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

* Re: [PATCH wireless-2.6 7/10] hostap: Rate limiting for debug messages
  2005-03-13  0:34 ` [PATCH wireless-2.6 7/10] hostap: Rate limiting for debug messages Jouni Malinen
@ 2005-03-22 23:11   ` Jeff Garzik
  2005-03-25  2:46     ` Jouni Malinen
  0 siblings, 1 reply; 16+ messages in thread
From: Jeff Garzik @ 2005-03-22 23:11 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: netdev

Jouni Malinen wrote:
> Limit rate of debug messages for interrupts before card is ready. This
> could happen when multiple devices are sharing the same interrupt.
> 
> Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
> 
> Index: jm-wireless-2.6/drivers/net/wireless/hostap/hostap_hw.c
> ===================================================================
> --- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c	2005-03-12 16:10:40.000000000 -0800
> +++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_hw.c	2005-03-12 16:10:58.000000000 -0800
> @@ -2790,8 +2790,10 @@
>  	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0);
>  
>  	if (local->func->card_present && !local->func->card_present(local)) {
> -		printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
> -		       dev->name);
> +		if (net_ratelimit()) {
> +			printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
> +			       dev->name);
> +		}
>  		return IRQ_HANDLED;


Patch is OK, but it highlights a bug:

You should return IRQ_NONE if the interrupt is not intended for your 
hardware.

	Jeff

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

* Re: [PATCH wireless-2.6 2/10] hostap: Include asm/io.h
  2005-03-13  0:29 ` [PATCH wireless-2.6 2/10] hostap: Include asm/io.h Jouni Malinen
@ 2005-03-22 23:13   ` Jeff Garzik
  0 siblings, 0 replies; 16+ messages in thread
From: Jeff Garzik @ 2005-03-22 23:13 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: netdev

Jouni Malinen wrote:
> Include asm/io.h into hostap_{pci,plx}.c since this seems to be needed
> for ARM on Linux 2.6.x and this file is already included into
> hostap_cs.c anyway.
> 
> Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>

Patch is correct, but description is incorrect:

asm/io.h is a required include for any driver that uses the bus IO 
functions {in,out,read,write}[bwlq].  It's not just ARM, but instead is 
required for all platforms.

	Jeff

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

* Re: [PATCH wireless-2.6 7/10] hostap: Rate limiting for debug messages
  2005-03-22 23:11   ` Jeff Garzik
@ 2005-03-25  2:46     ` Jouni Malinen
  2005-03-25  3:54       ` Jeff Garzik
  0 siblings, 1 reply; 16+ messages in thread
From: Jouni Malinen @ 2005-03-25  2:46 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

On Tue, Mar 22, 2005 at 06:11:52PM -0500, Jeff Garzik wrote:

> >--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c 
> >2005-03-12 16:10:40.000000000 -0800
> >+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_hw.c	2005-03-12 
> >16:10:58.000000000 -0800
> >@@ -2790,8 +2790,10 @@
> > 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0);
> > 
> > 	if (local->func->card_present && !local->func->card_present(local)) {
> >-		printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
> >-		       dev->name);
> >+		if (net_ratelimit()) {
> >+			printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
> >+			       dev->name);
> >+		}
> > 		return IRQ_HANDLED;


> Patch is OK, but it highlights a bug:
> 
> You should return IRQ_NONE if the interrupt is not intended for your 
> hardware.

I'm trying to remember why this was set to IRQ_HANDLED, not IRQ_NONE..
If I remember correctly, every now and then, an interrupt is generated
when removing the PC Card and this ends up getting here. In other words,
the interrupt was actually sort of generated by the hardware device
controlled by the driver. Should this return IRQ_NONE even in that case?
I thought that could end up disabling the IRQ which could also affect
other devices that are sharing the same IRQ.

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* Re: [PATCH wireless-2.6 7/10] hostap: Rate limiting for debug messages
  2005-03-25  2:46     ` Jouni Malinen
@ 2005-03-25  3:54       ` Jeff Garzik
  0 siblings, 0 replies; 16+ messages in thread
From: Jeff Garzik @ 2005-03-25  3:54 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: netdev

Jouni Malinen wrote:
> On Tue, Mar 22, 2005 at 06:11:52PM -0500, Jeff Garzik wrote:
> 
> 
>>>--- jm-wireless-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c 
>>>2005-03-12 16:10:40.000000000 -0800
>>>+++ jm-wireless-2.6/drivers/net/wireless/hostap/hostap_hw.c	2005-03-12 
>>>16:10:58.000000000 -0800
>>>@@ -2790,8 +2790,10 @@
>>>	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0);
>>>
>>>	if (local->func->card_present && !local->func->card_present(local)) {
>>>-		printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
>>>-		       dev->name);
>>>+		if (net_ratelimit()) {
>>>+			printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
>>>+			       dev->name);
>>>+		}
>>>		return IRQ_HANDLED;
> 
> 
> 
>>Patch is OK, but it highlights a bug:
>>
>>You should return IRQ_NONE if the interrupt is not intended for your 
>>hardware.
> 
> 
> I'm trying to remember why this was set to IRQ_HANDLED, not IRQ_NONE..
> If I remember correctly, every now and then, an interrupt is generated
> when removing the PC Card and this ends up getting here. In other words,
> the interrupt was actually sort of generated by the hardware device
> controlled by the driver. Should this return IRQ_NONE even in that case?
> I thought that could end up disabling the IRQ which could also affect
> other devices that are sharing the same IRQ.

Well, it should only disable the irq if you get a bunch of interrupts, 
not just one or two.

Looking at prism2_interrupt(), there are several cases where you really 
want to return IRQ_NONE.

If the hardware is gone, and you get continual interrupts, there's 
something wrong (with the cardbus h/w?) that returning IRQ_HANDLED won't 
fix.

	Jeff

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

end of thread, other threads:[~2005-03-25  3:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-13  0:17 [PATCH wireless-2.6 0/10] hostap: Updates from Host AP repository Jouni Malinen
2005-03-13  0:28 ` [PATCH wireless-2.6 1/10] hostap: Clear station statistic on accounting start Jouni Malinen
2005-03-13  0:29 ` [PATCH wireless-2.6 2/10] hostap: Include asm/io.h Jouni Malinen
2005-03-22 23:13   ` Jeff Garzik
2005-03-13  0:30 ` [PATCH wireless-2.6 3/10] hostap: Disable interrupts before Genesis mode Jouni Malinen
2005-03-13  0:31 ` [PATCH wireless-2.6 4/10] hostap: Add support for multi-func SanDisk ConnectPlus Jouni Malinen
2005-03-13  0:32 ` [PATCH wireless-2.6 5/10] hostap: Fix procfs rmdir after ifname change Jouni Malinen
2005-03-13  0:32 ` [PATCH wireless-2.6 6/10] hostap: Clear station statistic on accounting start Jouni Malinen
2005-03-13  0:34 ` [PATCH wireless-2.6 7/10] hostap: Rate limiting for debug messages Jouni Malinen
2005-03-22 23:11   ` Jeff Garzik
2005-03-25  2:46     ` Jouni Malinen
2005-03-25  3:54       ` Jeff Garzik
2005-03-13  0:34 ` [PATCH wireless-2.6 8/10] hostap: Improved suspend Jouni Malinen
2005-03-13  0:35 ` [PATCH wireless-2.6 9/10] hostap: Filter disconnect events Jouni Malinen
2005-03-13  0:41 ` [PATCH wireless-2.6 10/10] hostap: Update to use the new WE18 proposal Jouni Malinen
2005-03-22 23:11   ` Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.