Skip to contentSkip to conversation

Host AP update

PATCH In review Jouni Malinen 4 participants 29 messages Nov 8, 2004 – Nov 14, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Host AP update

Jeff,

Here's an update to Host AP code in wireless-2.6 tree. This brings in number of small fixes from my CVS repository. This messages has the changes in BitKeeper format from bksend and following 12 messages have the patches one by one as unified diffs.

I have couple of additional patches pending for wireless-2.6 updates (wireless extensions 17 and 18; changes to PCI API in Linux 2.6.10-rc1). I'll send WE17 and PCI changes once you update wireless-2.6. WE18 change requires an update to wireless extensions, so it may need to wait somewhat longer or we could start testing WE18 in wireless-2.6 if that is desired.

I keep getting questions about getting Host AP driver to linux-2.6 tree. What would be needed to make this happen? I would assume this would be easiest to do this from wireless-2.6 tree once the new patches are in. Any other changes that would be required to get the driver in suitable state for merging into Linux 2.6 releases?

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================

[email protected], 2004-11-07 22:28:31-08:00, [email protected]
Host AP: Fix netif_carrier_off() in non-client modes

Connection status is reported properly only in client modes, so do not try to set netif_carrier_off() in non-client modes. Previously, Master mode may end up being in state where netif_carrier was left off and this may break things like bridging.

[email protected], 2004-11-07 22:25:11-08:00, [email protected]
Host AP: Fix PRISM2_IO_DEBUG

From Mark Glines <[email protected]>:
I just noticed PRISM2_IO_DEBUG doesn't work. This patch gets it working again. I checked the development CVS snapshot, looks like its still broken there.

jkm: in addition, fix the other PRISM2_IO_DEBUG function

[email protected], 2004-11-07 22:21:13-08:00, [email protected]
Host AP: Use void * instead of unsigned long with {read,write}{b,w}

Start using void * instead of unsigned long with {read,write}{b,w} to silence compiler warning with Linux 2.6.9-rc2.

[email protected], 2004-11-07 22:17:27-08:00, [email protected]
Host AP: Fix card enabling after firmware download

Fix card enabling after firmware download in case any of the netdevs were up when the download was started.

[email protected], 2004-11-07 22:13:57-08:00, [email protected]
Host AP: Do not bridge packets to unauthorized ports

Fix inner-BSS bridge (ap_bridge_packets=1) not to bridge packets to unauthorized ports when IEEE 802.1X/WPA is used (i.e., require that the STA completes authentication before capturing packets in the inner bridge); previously, only association status was used and an attacker could have capture packets to any MAC address even without having proper credentials for using the network (although, the packets were dropped because the controlled port for the STA was unauthorized).

[email protected], 2004-11-07 22:10:36-08:00, [email protected]
Host AP: Fix compilation with PRISM2_NO_STATION_MODES defined.

[email protected], 2004-11-07 22:03:38-08:00, [email protected]
Host AP: Prevent STAs from associating using AP address

Prevent STAs from authenticating with AP address (i.e., spoofing AP MAC address). The inner bridge implementation intercepts packets before they are passed to Linux net stack, so using AP MAC address would prevent AP from seeing the packet properly.

[email protected], 2004-11-07 21:59:51-08:00, [email protected]
Host AP: Fix hw address changing for wifi# interface

Update wifi# interface MAC address when changing addresses. Without this, MAC address change does not work correctly with the new interface design (wifi#/wlan0#).

[email protected], 2004-11-07 21:56:29-08:00, [email protected]
Host AP: Remove ioctl debug messages

Remove debug message from unsupported ioctls. Some of common ioctls triggered these (e.g., SIOCGMIIPHY, SIOCGMIIREG, SIOCSMIIREG, SIOCDEVPRIVATE) and filled debug logs with unwanted messages.

[email protected], 2004-11-07 21:49:46-08:00, [email protected]
Host AP: Ignore (Re)AssocResp messages silently

Ignore (Re)AssocResp silently since these are not currently needed but are still received when WPA/RSN mode is enabled.

[email protected], 2004-11-07 21:34:28-08:00, [email protected]
Host AP: Fix interface packet counters

Fix wlan#/wifi# interface packet counters (both are supposed to see data packets once; wlan# was counting TX twice and wifi# did not count TX or RX at all for most cases).

[email protected], 2004-11-07 20:24:23-08:00, [email protected]
Host AP: Disable EAPOL TX/RX debug messages

 hostap.c          |    1 +
 hostap_80211_rx.c |   12 +++++++++++-
 hostap_80211_tx.c |   12 ++++++------
 hostap_ap.c       |   22 +++++++++++++++++++++-
 hostap_ap.h       |    1 +
 hostap_hw.c       |   12 +++++++++---
 hostap_ioctl.c    |   20 +++++++++++---------
 hostap_pci.c      |   22 ++++++++++++----------
 hostap_plx.c      |   19 +++++++++----------
 hostap_wlan.h     |    8 +++++---
 10 files changed, 86 insertions(+), 43 deletions(-)
drivers/net/wireless/hostap/hostap.c +1 -0
diff -Nru a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
@@ -808,6 +808,7 @@
 		iface = list_entry(ptr, struct hostap_interface, list);
 		memcpy(iface->dev->dev_addr, addr->sa_data, ETH_ALEN);
 	}
+	memcpy(local->dev->dev_addr, addr->sa_data, ETH_ALEN);
 	read_unlock_bh(&local->iface_lock);
 
 	return 0;
drivers/net/wireless/hostap/hostap_80211_rx.c +11 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -475,6 +475,13 @@
 		    stype == WLAN_FC_STYPE_PROBE_RESP)) {
 		hostap_rx_sta_beacon(local, skb, stype);
 		return -1;
+	} else if (type == WLAN_FC_TYPE_MGMT &&
+		   (stype == WLAN_FC_STYPE_ASSOC_RESP ||
+		    stype == WLAN_FC_STYPE_REASSOC_RESP)) {
+		/* Ignore (Re)AssocResp silently since these are not currently
+		 * needed but are still received when WPA/RSN mode is enabled.
+		 */
+		return -1;
 	} else {
 		printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled"
 		       " management frame in non-Host AP mode (type=%d:%d)\n",
@@ -689,6 +696,9 @@
 	void *sta = NULL;
 	int keyidx = 0;
 
+	iface->stats.rx_packets++;
+	iface->stats.rx_bytes += skb->len;
+
 	/* dev is the master radio device; change this to be the default
 	 * virtual interface (this may be changed to WDS device below) */
 	dev = local->ddev;
@@ -1025,7 +1035,7 @@
 			if (skb2 == NULL)
 				printk(KERN_DEBUG "%s: skb_clone failed for "
 				       "multicast frame\n", dev->name);
-		} else if (hostap_is_sta_assoc(local->ap, dst)) {
+		} else if (hostap_is_sta_authorized(local->ap, dst)) {
 			/* send frame directly to the associated STA using
 			 * wireless media and not passing to higher layers */
 			local->ap->bridged_unicast++;
drivers/net/wireless/hostap/hostap_80211_tx.c +6 -6
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -379,7 +379,7 @@
 		printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb "
 		       "(len=%d)\n", dev->name, skb->len);
 		ret = 0;
-		meta->iface->stats.tx_dropped++;
+		iface->stats.tx_dropped++;
 		goto fail;
 	}
 
@@ -405,13 +405,13 @@
 			hostap_dump_tx_80211(dev->name, skb);
 
 			ret = 0; /* drop packet */
-			meta->iface->stats.tx_dropped++;
+			iface->stats.tx_dropped++;
 			goto fail;
 		}
 		break;
 	case AP_TX_DROP:
 		ret = 0; /* drop packet */
-		meta->iface->stats.tx_dropped++;
+		iface->stats.tx_dropped++;
 		goto fail;
 	case AP_TX_RETRY:
 		goto fail;
@@ -488,11 +488,11 @@
 
 	if (local->func->tx == NULL || local->func->tx(skb, dev)) {
 		ret = 0;
-		meta->iface->stats.tx_dropped++;
+		iface->stats.tx_dropped++;
 	} else {
 		ret = 0;
-		meta->iface->stats.tx_packets++;
-		meta->iface->stats.tx_bytes += skb->len;
+		iface->stats.tx_packets++;
+		iface->stats.tx_bytes += skb->len;
 	}
 
  fail:
drivers/net/wireless/hostap/hostap_ap.c +21 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
@@ -1329,7 +1329,8 @@
 	status_code = __le16_to_cpu(*pos);
 	pos++;
 
-	if (ap_control_mac_deny(&ap->mac_restrictions, hdr->addr2)) {
+	if (memcmp(dev->dev_addr, hdr->addr2, ETH_ALEN) == 0 ||
+	    ap_control_mac_deny(&ap->mac_restrictions, hdr->addr2)) {
 		txt = "authentication denied";
 		resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
 		goto fail;
@@ -3060,6 +3061,24 @@
 
 
 /* Called only as a tasklet (software IRQ) */
+int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr)
+{
+	struct sta_info *sta;
+	int ret = 0;
+
+	spin_lock(&ap->sta_table_lock);
+	sta = ap_get_sta(ap, sta_addr);
+	if (sta != NULL && (sta->flags & WLAN_STA_ASSOC) && !sta->ap &&
+	    ((sta->flags & WLAN_STA_AUTHORIZED) ||
+	     ap->local->ieee_802_1x == 0))
+		ret = 1;
+	spin_unlock(&ap->sta_table_lock);
+
+	return ret;
+}
+
+
+/* Called only as a tasklet (software IRQ) */
 int hostap_add_sta(struct ap_data *ap, u8 *sta_addr)
 {
 	struct sta_info *sta;
@@ -3218,6 +3237,7 @@
 EXPORT_SYMBOL(hostap_update_sta_ps);
 EXPORT_SYMBOL(hostap_handle_sta_rx);
 EXPORT_SYMBOL(hostap_is_sta_assoc);
+EXPORT_SYMBOL(hostap_is_sta_authorized);
 EXPORT_SYMBOL(hostap_add_sta);
 EXPORT_SYMBOL(hostap_update_rates);
 EXPORT_SYMBOL(hostap_add_wds_links);
drivers/net/wireless/hostap/hostap_ap.h +1 -0
diff -Nru a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h
@@ -255,6 +255,7 @@
 			     struct hostap_ieee80211_hdr *hdr,
 			     struct prism2_crypt_data **crypt, void **sta_ptr);
 int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr);
+int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr);
 int hostap_add_sta(struct ap_data *ap, u8 *sta_addr);
 int hostap_update_rx_stats(struct ap_data *ap,
 			   struct hostap_ieee80211_hdr *hdr,
drivers/net/wireless/hostap/hostap_hw.c +9 -3
diff -Nru a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
@@ -1483,7 +1483,10 @@
 	if (prism2_hw_init2(dev, initial))
 		return 1;
 
-	if (!local->pri_only && !initial) {
+	/* Enable firmware if secondary image is loaded and at least one of the
+	 * netdevices is up. */
+	if (!local->pri_only &&
+	    (initial == 0 || (initial == 2 && local->num_dev_open > 0))) {
 		if (!local->dev_enabled)
 			prism2_callback(local, PRISM2_CALLBACK_ENABLE);
 		local->dev_enabled = 1;
@@ -3396,8 +3399,11 @@
 					   "", dev_template);
 
 	if (local->ddev) {
-		netif_carrier_off(local->dev);
-		netif_carrier_off(local->ddev);
+		if (local->iw_mode == IW_MODE_INFRA ||
+		    local->iw_mode == IW_MODE_ADHOC) {
+			netif_carrier_off(local->dev);
+			netif_carrier_off(local->ddev);
+		}
 		hostap_init_proc(local);
 		hostap_init_ap_proc(local);
 		return 0;
drivers/net/wireless/hostap/hostap_ioctl.c +11 -9
diff -Nru a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -597,6 +597,7 @@
 }
 
 
+#ifndef PRISM2_NO_STATION_MODES
 static int hostap_join_ap(struct net_device *dev)
 {
 	struct hostap_interface *iface = dev->priv;
@@ -634,6 +635,7 @@
 
 	return 0;
 }
+#endif /* PRISM2_NO_STATION_MODES */
 
 
 static int prism2_ioctl_siwap(struct net_device *dev,
@@ -1106,6 +1108,13 @@
 	if (double_reset && local->func->reset_port(dev))
 		return -EINVAL;
 
+	if (local->iw_mode != IW_MODE_INFRA && local->iw_mode != IW_MODE_ADHOC)
+	{
+		/* netif_carrier is used only in client modes for now, so make
+		 * sure carrier is on when moving to non-client modes. */
+		netif_carrier_on(local->dev);
+		netif_carrier_on(local->ddev);
+	}
 	return 0;
 }
 
@@ -1586,7 +1595,8 @@
 
 #else /* !PRISM2_NO_STATION_MODES */
 
-static inline int prism2_request_hostscan(struct net_device *dev)
+static inline int prism2_request_hostscan(struct net_device *dev,
+					  u8 *ssid, u8 ssid_len)
 {
 	return -EOPNOTSUPP;
 }
@@ -3452,14 +3462,6 @@
 		break;
 
 	default:
-		if (cmd >= SIOCSIWCOMMIT && cmd <= SIOCGIWPOWER) {
-			/* unsupport wireless extensions get through here - do
-			 * not report these to debug log */
-			ret = -EOPNOTSUPP;
-			break;
-		}
-		printk(KERN_DEBUG "%s unsupported ioctl(0x%04x)\n",
-		       dev->name, cmd);
 		ret = -EOPNOTSUPP;
 		break;
 	}
drivers/net/wireless/hostap/hostap_pci.c +12 -10
diff -Nru a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
@@ -56,7 +56,7 @@
 
 	spin_lock_irqsave(&local->lock, flags);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
-	writeb(v, dev->mem_start + a);
+	writeb(v, (void *) dev->mem_start + a);
 	spin_unlock_irqrestore(&local->lock, flags);
 }
 
@@ -68,7 +68,7 @@
 	u8 v;
 
 	spin_lock_irqsave(&local->lock, flags);
-	v = readb(dev->mem_start + a);
+	v = readb((void *) dev->mem_start + a);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
 	spin_unlock_irqrestore(&local->lock, flags);
 	return v;
@@ -82,7 +82,7 @@
 
 	spin_lock_irqsave(&local->lock, flags);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
-	writew(v, dev->mem_start + a);
+	writew(v, (void *) dev->mem_start + a);
 	spin_unlock_irqrestore(&local->lock, flags);
 }
 
@@ -94,7 +94,7 @@
 	u16 v;
 
 	spin_lock_irqsave(&local->lock, flags);
-	v = readw(dev->mem_start + a);
+	v = readw((void *) dev->mem_start + a);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
 	spin_unlock_irqrestore(&local->lock, flags);
 	return v;
@@ -109,12 +109,14 @@
 
 #else /* PRISM2_IO_DEBUG */
 
-#define HFA384X_OUTB(v,a) writeb((v), dev->mem_start + (a))
-#define HFA384X_INB(a) (u8) readb(dev->mem_start + (a))
-#define HFA384X_OUTW(v,a) writew((v), dev->mem_start + (a))
-#define HFA384X_INW(a) (u16) readw(dev->mem_start + (a))
-#define HFA384X_OUTW_DATA(v,a) writew(cpu_to_le16(v), dev->mem_start + (a))
-#define HFA384X_INW_DATA(a) (u16) le16_to_cpu(readw(dev->mem_start + (a)))
+#define HFA384X_OUTB(v,a) writeb((v), (void *) dev->mem_start + (a))
+#define HFA384X_INB(a) (u8) readb((void *) dev->mem_start + (a))
+#define HFA384X_OUTW(v,a) writew((v), (void *) dev->mem_start + (a))
+#define HFA384X_INW(a) (u16) readw((void *) dev->mem_start + (a))
+#define HFA384X_OUTW_DATA(v,a) \
+	writew(cpu_to_le16(v), (void *) dev->mem_start + (a))
+#define HFA384X_INW_DATA(a) (u16) \
+	le16_to_cpu(readw((void *) dev->mem_start + (a)))
 
 #endif /* PRISM2_IO_DEBUG */
 
drivers/net/wireless/hostap/hostap_plx.c +9 -10
diff -Nru a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
@@ -247,7 +247,7 @@
 
 	/* Set sreset bit of COR and clear it after hold time */
 
-	if (local->attr_mem == 0) {
+	if (local->attr_mem == NULL) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
 		outb(corsave | COR_SRESET, local->cor_offset);
@@ -271,7 +271,7 @@
 {
 	unsigned char corsave;
 
-	if (local->attr_mem == 0) {
+	if (local->attr_mem == NULL) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
 		outb(corsave | COR_SRESET, local->cor_offset);
@@ -306,7 +306,7 @@
 };
 
 
-static int prism2_plx_check_cis(unsigned long attr_mem, int attr_len,
+static int prism2_plx_check_cis(void *attr_mem, int attr_len,
 				unsigned int *cor_offset,
 				unsigned int *cor_index)
 {
@@ -401,7 +401,7 @@
 	unsigned int pccard_ioaddr, plx_ioaddr;
 	unsigned long pccard_attr_mem;
 	unsigned int pccard_attr_len;
-	unsigned long attr_mem = 0;
+	void *attr_mem = NULL;
 	unsigned int cor_offset, cor_index;
 	u32 reg;
 	local_info_t *local = NULL;
@@ -422,7 +422,7 @@
 
 	if (tmd7160) {
 		/* TMD7160 */
-		attr_mem = 0; /* no access to PC Card attribute memory */
+		attr_mem = NULL; /* no access to PC Card attribute memory */
 
 		printk(KERN_INFO "TMD7160 PCI/PCMCIA adapter: io=0x%x, "
 		       "irq=%d, pccard_io=0x%x\n",
@@ -448,9 +448,8 @@
 			goto fail;
 
 
-		attr_mem = (unsigned long) ioremap(pccard_attr_mem,
-						   pccard_attr_len);
-		if (!attr_mem) {
+		attr_mem = ioremap(pccard_attr_mem, pccard_attr_len);
+		if (attr_mem == NULL) {
 			printk(KERN_ERR "%s: cannot remap attr_mem\n",
 			       dev_info);
 			goto fail;
@@ -532,7 +531,7 @@
 		free_irq(dev->irq, dev);
 
 	if (attr_mem)
-		iounmap((void *) attr_mem);
+		iounmap(attr_mem);
 
 	pci_disable_device(pdev);
 
@@ -550,7 +549,7 @@
 	hfa384x_disable_interrupts(dev);
 
 	if (iface->local->attr_mem)
-		iounmap((void *) iface->local->attr_mem);
+		iounmap(iface->local->attr_mem);
 	if (dev->irq)
 		free_irq(dev->irq, dev);
 
drivers/net/wireless/hostap/hostap_wlan.h +5 -3
diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -895,7 +895,7 @@
 #endif /* PRISM2_PCCARD */
 
 #ifdef PRISM2_PLX
-	unsigned long attr_mem;
+	void *attr_mem;
 	unsigned int cor_offset;
 #endif /* PRISM2_PLX */
 
@@ -1006,7 +1006,8 @@
 static inline void prism2_io_debug_add(struct net_device *dev, int cmd,
 				       int reg, int value)
 {
-	local_info_t *local = dev->priv;
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
 
 	if (!local->io_debug_enabled)
 		return;
@@ -1023,7 +1024,8 @@
 
 static inline void prism2_io_debug_error(struct net_device *dev, int err)
 {
-	local_info_t *local = dev->priv;
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
 	unsigned long flags;
 
 	if (!local->io_debug_enabled)

===================================================================

This BitKeeper patch contains the following changesets:
1.1862..1.1873
## Wrapped with gzip_uu ##

M'XL( (X3CT$ ^U=87/:1K?^#+]BV\S-A<1@[:XD)/PF4\=V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R@^&I<DGV6\6WMSM]Q^M\.8']_NZ?/M)38("'+#T9X['_^FFQ[]6 MI'.::%]?+.1%/--+,@K\Y]TX%;=&\4#=P*ZXD+J()^VK4']\/C(+QA/@BU3H M',^Y@ZIRY\;]CF[JC%N_SQLL+3+4XW.K2XQ[/-_W<"/0H6E3:UX*BAEU:V%A M.NZ"/8[5GV[FR=#W1#_K>'][4PN[BB*PE*]0KP4U_6;I<HN4]$67B=J#ZLJN MIV)D\I(( .1^3>T$J]?")7E%\.*;I3M.<E0]A'K5(PV6&,G55<NUR9$&=XU$ M 1DV$DD-M,XS[>#)NU]WN6-^\8X^G;V!@469Y)=;NBPOFD9)E,LSG30^OH'/ M2:GOE.^\^+D=P"P^3\QBL.(L/NM94+M\Y\K<.@UO?_=L5\_EC_&=\7M]+XO! MPU-[Q9GI;L?3@ZZQ,^P4^BXM,]ORTK376:NLZAY/"#_<"'3(;.[:*]">^_=C M/?VP] JLUUFQFH99^)!-0Q\FE8;(LL0#(&+. /?&,%6PSVJJ2$8?[FS-#46I M^C!6WV/9#7/VU!/ GA^FN0&,^ME2#=4[6,$M+.71Y3GJ4)AN3/286&[#=*D9 MTZ5F-QM@P!#%1/@^;@J 3#G>(WN84\6&8;,/HA%:QZ!/,7PP+:S);Y@65[4[ M$YV%<2*[HE?J^9B1]:XG/?D!Q@0[>;YF[O)87$U6'Z!=W(^PTU%;Y&\+QL8F MZG#=)*\4NK'VR^?C]2.]J_/$?9XZ?L A@"E,[O)5!-)C!=@;) K\>8+[$X5> MUU68PG%5,9T^W+# E0OQ%_WVPIR<M[GX-IN/E?.^^S<2]"/1?^]?2<!$'3[U M_Y2HHX9V(NK(QJ4AH^!Z7"/[0G$B<+,24.!A+H%[%4&J$A(O(R_4.V3O"?9$ CC0QDI4> XV.,,/[_JZ@;F?:[KX0%\!)!K?C_9BI#-M%E

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

PATCH 1/12 Host AP: Disable EAPOL TX/RX debug messages

drivers/net/wireless/hostap/hostap_80211_rx.c +2 -2
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -934,7 +934,7 @@
 		    hostap_is_eapol_frame(local, skb)) {
 			/* pass unencrypted EAPOL frames even if encryption is
 			 * configured */
-			printk(KERN_DEBUG "%s: RX: IEEE 802.1X - passing "
+			PDEBUG(DEBUG_EXTRA2, "%s: RX: IEEE 802.1X - passing "
 			       "unencrypted EAPOL frame\n", local->dev->name);
 		} else {
 			printk(KERN_DEBUG "%s: encryption configured, but RX "
@@ -963,7 +963,7 @@
 	 * the received frame. */
 	if (local->ieee_802_1x && local->iw_mode == IW_MODE_MASTER) {
 		if (ethertype == ETH_P_PAE) {
-			printk(KERN_DEBUG "%s: RX: IEEE 802.1X frame\n",
+			PDEBUG(DEBUG_EXTRA2, "%s: RX: IEEE 802.1X frame\n",
 			       dev->name);
 			if (local->hostapd && local->apdev) {
 				/* Send IEEE 802.1X frames to the user
drivers/net/wireless/hostap/hostap_80211_tx.c +1 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -442,7 +442,7 @@
 	if (local->ieee_802_1x && meta->ethertype == ETH_P_PAE && tx.crypt &&
 	    !(fc & WLAN_FC_ISWEP)) {
 		no_encrypt = 1;
-		printk(KERN_DEBUG "%s: TX: IEEE 802.1X - passing "
+		PDEBUG(DEBUG_EXTRA2, "%s: TX: IEEE 802.1X - passing "
 		       "unencrypted EAPOL frame\n", dev->name);
 		tx.crypt = NULL; /* no encryption for IEEE 802.1X frames */
 	}
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#2 lore raw

Re: [PATCH wireless-2.6 1/12] Host AP: Disable EAPOL TX/RX debug messages

applied patches 1-9

#3 lore raw

PATCH 2/12 Host AP: Fix interface packet counters

In reply to Jouni Malinen

Fix wlan#/wifi# interface packet counters (both are supposed to see data packets once; wlan# was counting TX twice and wifi# did not count TX or RX at all for most cases).

drivers/net/wireless/hostap/hostap_80211_rx.c +3 -0
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -689,6 +689,9 @@
 	void *sta = NULL;
 	int keyidx = 0;
 
+	iface->stats.rx_packets++;
+	iface->stats.rx_bytes += skb->len;
+
 	/* dev is the master radio device; change this to be the default
 	 * virtual interface (this may be changed to WDS device below) */
 	dev = local->ddev;
drivers/net/wireless/hostap/hostap_80211_tx.c +6 -6
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -379,7 +379,7 @@
 		printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb "
 		       "(len=%d)\n", dev->name, skb->len);
 		ret = 0;
-		meta->iface->stats.tx_dropped++;
+		iface->stats.tx_dropped++;
 		goto fail;
 	}
 
@@ -405,13 +405,13 @@
 			hostap_dump_tx_80211(dev->name, skb);
 
 			ret = 0; /* drop packet */
-			meta->iface->stats.tx_dropped++;
+			iface->stats.tx_dropped++;
 			goto fail;
 		}
 		break;
 	case AP_TX_DROP:
 		ret = 0; /* drop packet */
-		meta->iface->stats.tx_dropped++;
+		iface->stats.tx_dropped++;
 		goto fail;
 	case AP_TX_RETRY:
 		goto fail;
@@ -488,11 +488,11 @@
 
 	if (local->func->tx == NULL || local->func->tx(skb, dev)) {
 		ret = 0;
-		meta->iface->stats.tx_dropped++;
+		iface->stats.tx_dropped++;
 	} else {
 		ret = 0;
-		meta->iface->stats.tx_packets++;
-		meta->iface->stats.tx_bytes += skb->len;
+		iface->stats.tx_packets++;
+		iface->stats.tx_bytes += skb->len;
 	}
 
  fail:
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#4 lore raw

PATCH 3/12 Host AP: Ignore (Re)AssocResp messages silently

In reply to Jouni Malinen

Ignore (Re)AssocResp silently since these are not currently needed but are still received when WPA/RSN mode is enabled.

drivers/net/wireless/hostap/hostap_80211_rx.c +7 -0
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -475,6 +475,13 @@
 		    stype == WLAN_FC_STYPE_PROBE_RESP)) {
 		hostap_rx_sta_beacon(local, skb, stype);
 		return -1;
+	} else if (type == WLAN_FC_TYPE_MGMT &&
+		   (stype == WLAN_FC_STYPE_ASSOC_RESP ||
+		    stype == WLAN_FC_STYPE_REASSOC_RESP)) {
+		/* Ignore (Re)AssocResp silently since these are not currently
+		 * needed but are still received when WPA/RSN mode is enabled.
+		 */
+		return -1;
 	} else {
 		printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled"
 		       " management frame in non-Host AP mode (type=%d:%d)\n",
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#5 lore raw

PATCH 4/12 Host AP: Remove ioctl debug messages

In reply to Jouni Malinen

Remove debug message from unsupported ioctls. Some of common ioctls triggered these (e.g., SIOCGMIIPHY, SIOCGMIIREG, SIOCSMIIREG, SIOCDEVPRIVATE) and filled debug logs with unwanted messages.

drivers/net/wireless/hostap/hostap_ioctl.c +0 -8
diff -Nru a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -3452,14 +3452,6 @@
 		break;
 
 	default:
-		if (cmd >= SIOCSIWCOMMIT && cmd <= SIOCGIWPOWER) {
-			/* unsupport wireless extensions get through here - do
-			 * not report these to debug log */
-			ret = -EOPNOTSUPP;
-			break;
-		}
-		printk(KERN_DEBUG "%s unsupported ioctl(0x%04x)\n",
-		       dev->name, cmd);
 		ret = -EOPNOTSUPP;
 		break;
 	}
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#6 lore raw

PATCH 5/12 Host AP: Fix hw address changing for wifi# interface

In reply to Jouni Malinen

Update wifi# interface MAC address when changing addresses. Without this, MAC address change does not work correctly with the new interface design (wifi#/wlan0#).

drivers/net/wireless/hostap/hostap.c +1 -0
diff -Nru a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
@@ -808,6 +808,7 @@
 		iface = list_entry(ptr, struct hostap_interface, list);
 		memcpy(iface->dev->dev_addr, addr->sa_data, ETH_ALEN);
 	}
+	memcpy(local->dev->dev_addr, addr->sa_data, ETH_ALEN);
 	read_unlock_bh(&local->iface_lock);
 
 	return 0;
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#7 lore raw

PATCH 6/12 Host AP: Prevent STAs from associating using AP address

In reply to Jouni Malinen

Prevent STAs from authenticating with AP address (i.e., spoofing AP MAC address). The inner bridge implementation intercepts packets before they are passed to Linux net stack, so using AP MAC address would prevent AP from seeing the packet properly.

drivers/net/wireless/hostap/hostap_ap.c +2 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
@@ -1329,7 +1329,8 @@
 	status_code = __le16_to_cpu(*pos);
 	pos++;
 
-	if (ap_control_mac_deny(&ap->mac_restrictions, hdr->addr2)) {
+	if (memcmp(dev->dev_addr, hdr->addr2, ETH_ALEN) == 0 ||
+	    ap_control_mac_deny(&ap->mac_restrictions, hdr->addr2)) {
 		txt = "authentication denied";
 		resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
 		goto fail;
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#8 lore raw

PATCH 7/12 Host AP: Fix compilation with PRISM2_NO_STATION_MODES defined.

In reply to Jouni Malinen
drivers/net/wireless/hostap/hostap_ioctl.c +4 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -597,6 +597,7 @@
 }
 
 
+#ifndef PRISM2_NO_STATION_MODES
 static int hostap_join_ap(struct net_device *dev)
 {
 	struct hostap_interface *iface = dev->priv;
@@ -634,6 +635,7 @@
 
 	return 0;
 }
+#endif /* PRISM2_NO_STATION_MODES */
 
 
 static int prism2_ioctl_siwap(struct net_device *dev,
@@ -1586,7 +1588,8 @@
 
 #else /* !PRISM2_NO_STATION_MODES */
 
-static inline int prism2_request_hostscan(struct net_device *dev)
+static inline int prism2_request_hostscan(struct net_device *dev,
+					  u8 *ssid, u8 ssid_len)
 {
 	return -EOPNOTSUPP;
 }
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#9 lore raw

PATCH 8/12 Host AP: Do not bridge packets to unauthorized ports

In reply to Jouni Malinen

Fix inner-BSS bridge (ap_bridge_packets=1) not to bridge packets to unauthorized ports when IEEE 802.1X/WPA is used (i.e., require that the STA completes authentication before capturing packets in the inner bridge); previously, only association status was used and an attacker could have capture packets to any MAC address even without having proper credentials for using the network (although, the packets were dropped because the controlled port for the STA was unauthorized).

drivers/net/wireless/hostap/hostap_80211_rx.c +1 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -1035,7 +1035,7 @@
 			if (skb2 == NULL)
 				printk(KERN_DEBUG "%s: skb_clone failed for "
 				       "multicast frame\n", dev->name);
-		} else if (hostap_is_sta_assoc(local->ap, dst)) {
+		} else if (hostap_is_sta_authorized(local->ap, dst)) {
 			/* send frame directly to the associated STA using
 			 * wireless media and not passing to higher layers */
 			local->ap->bridged_unicast++;
drivers/net/wireless/hostap/hostap_ap.c +19 -0
diff -Nru a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
@@ -3061,6 +3061,24 @@
 
 
 /* Called only as a tasklet (software IRQ) */
+int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr)
+{
+	struct sta_info *sta;
+	int ret = 0;
+
+	spin_lock(&ap->sta_table_lock);
+	sta = ap_get_sta(ap, sta_addr);
+	if (sta != NULL && (sta->flags & WLAN_STA_ASSOC) && !sta->ap &&
+	    ((sta->flags & WLAN_STA_AUTHORIZED) ||
+	     ap->local->ieee_802_1x == 0))
+		ret = 1;
+	spin_unlock(&ap->sta_table_lock);
+
+	return ret;
+}
+
+
+/* Called only as a tasklet (software IRQ) */
 int hostap_add_sta(struct ap_data *ap, u8 *sta_addr)
 {
 	struct sta_info *sta;
@@ -3219,6 +3237,7 @@
 EXPORT_SYMBOL(hostap_update_sta_ps);
 EXPORT_SYMBOL(hostap_handle_sta_rx);
 EXPORT_SYMBOL(hostap_is_sta_assoc);
+EXPORT_SYMBOL(hostap_is_sta_authorized);
 EXPORT_SYMBOL(hostap_add_sta);
 EXPORT_SYMBOL(hostap_update_rates);
 EXPORT_SYMBOL(hostap_add_wds_links);
drivers/net/wireless/hostap/hostap_ap.h +1 -0
diff -Nru a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h
@@ -255,6 +255,7 @@
 			     struct hostap_ieee80211_hdr *hdr,
 			     struct prism2_crypt_data **crypt, void **sta_ptr);
 int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr);
+int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr);
 int hostap_add_sta(struct ap_data *ap, u8 *sta_addr);
 int hostap_update_rx_stats(struct ap_data *ap,
 			   struct hostap_ieee80211_hdr *hdr,
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#10 lore raw

PATCH 9/12 Host AP: Fix card enabling after firmware download

In reply to Jouni Malinen

Fix card enabling after firmware download in case any of the netdevs were up when the download was started.

drivers/net/wireless/hostap/hostap_hw.c +4 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
@@ -1483,7 +1483,10 @@
 	if (prism2_hw_init2(dev, initial))
 		return 1;
 
-	if (!local->pri_only && !initial) {
+	/* Enable firmware if secondary image is loaded and at least one of the
+	 * netdevices is up. */
+	if (!local->pri_only &&
+	    (initial == 0 || (initial == 2 && local->num_dev_open > 0))) {
 		if (!local->dev_enabled)
 			prism2_callback(local, PRISM2_CALLBACK_ENABLE);
 		local->dev_enabled = 1;
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#11 lore raw

PATCH 10/12 Host AP: Use void * instead of unsigned long with {read,write}{b,w}

In reply to Jouni Malinen

Start using void * instead of unsigned long with {read,write}{b,w} to silence compiler warning with Linux 2.6.9-rc2.

drivers/net/wireless/hostap/hostap_pci.c +12 -10
diff -Nru a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
@@ -56,7 +56,7 @@
 
 	spin_lock_irqsave(&local->lock, flags);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
-	writeb(v, dev->mem_start + a);
+	writeb(v, (void *) dev->mem_start + a);
 	spin_unlock_irqrestore(&local->lock, flags);
 }
 
@@ -68,7 +68,7 @@
 	u8 v;
 
 	spin_lock_irqsave(&local->lock, flags);
-	v = readb(dev->mem_start + a);
+	v = readb((void *) dev->mem_start + a);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
 	spin_unlock_irqrestore(&local->lock, flags);
 	return v;
@@ -82,7 +82,7 @@
 
 	spin_lock_irqsave(&local->lock, flags);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
-	writew(v, dev->mem_start + a);
+	writew(v, (void *) dev->mem_start + a);
 	spin_unlock_irqrestore(&local->lock, flags);
 }
 
@@ -94,7 +94,7 @@
 	u16 v;
 
 	spin_lock_irqsave(&local->lock, flags);
-	v = readw(dev->mem_start + a);
+	v = readw((void *) dev->mem_start + a);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
 	spin_unlock_irqrestore(&local->lock, flags);
 	return v;
@@ -109,12 +109,14 @@
 
 #else /* PRISM2_IO_DEBUG */
 
-#define HFA384X_OUTB(v,a) writeb((v), dev->mem_start + (a))
-#define HFA384X_INB(a) (u8) readb(dev->mem_start + (a))
-#define HFA384X_OUTW(v,a) writew((v), dev->mem_start + (a))
-#define HFA384X_INW(a) (u16) readw(dev->mem_start + (a))
-#define HFA384X_OUTW_DATA(v,a) writew(cpu_to_le16(v), dev->mem_start + (a))
-#define HFA384X_INW_DATA(a) (u16) le16_to_cpu(readw(dev->mem_start + (a)))
+#define HFA384X_OUTB(v,a) writeb((v), (void *) dev->mem_start + (a))
+#define HFA384X_INB(a) (u8) readb((void *) dev->mem_start + (a))
+#define HFA384X_OUTW(v,a) writew((v), (void *) dev->mem_start + (a))
+#define HFA384X_INW(a) (u16) readw((void *) dev->mem_start + (a))
+#define HFA384X_OUTW_DATA(v,a) \
+	writew(cpu_to_le16(v), (void *) dev->mem_start + (a))
+#define HFA384X_INW_DATA(a) (u16) \
+	le16_to_cpu(readw((void *) dev->mem_start + (a)))
 
 #endif /* PRISM2_IO_DEBUG */
 
drivers/net/wireless/hostap/hostap_plx.c +9 -10
diff -Nru a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
@@ -247,7 +247,7 @@
 
 	/* Set sreset bit of COR and clear it after hold time */
 
-	if (local->attr_mem == 0) {
+	if (local->attr_mem == NULL) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
 		outb(corsave | COR_SRESET, local->cor_offset);
@@ -271,7 +271,7 @@
 {
 	unsigned char corsave;
 
-	if (local->attr_mem == 0) {
+	if (local->attr_mem == NULL) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
 		outb(corsave | COR_SRESET, local->cor_offset);
@@ -306,7 +306,7 @@
 };
 
 
-static int prism2_plx_check_cis(unsigned long attr_mem, int attr_len,
+static int prism2_plx_check_cis(void *attr_mem, int attr_len,
 				unsigned int *cor_offset,
 				unsigned int *cor_index)
 {
@@ -401,7 +401,7 @@
 	unsigned int pccard_ioaddr, plx_ioaddr;
 	unsigned long pccard_attr_mem;
 	unsigned int pccard_attr_len;
-	unsigned long attr_mem = 0;
+	void *attr_mem = NULL;
 	unsigned int cor_offset, cor_index;
 	u32 reg;
 	local_info_t *local = NULL;
@@ -422,7 +422,7 @@
 
 	if (tmd7160) {
 		/* TMD7160 */
-		attr_mem = 0; /* no access to PC Card attribute memory */
+		attr_mem = NULL; /* no access to PC Card attribute memory */
 
 		printk(KERN_INFO "TMD7160 PCI/PCMCIA adapter: io=0x%x, "
 		       "irq=%d, pccard_io=0x%x\n",
@@ -448,9 +448,8 @@
 			goto fail;
 
 
-		attr_mem = (unsigned long) ioremap(pccard_attr_mem,
-						   pccard_attr_len);
-		if (!attr_mem) {
+		attr_mem = ioremap(pccard_attr_mem, pccard_attr_len);
+		if (attr_mem == NULL) {
 			printk(KERN_ERR "%s: cannot remap attr_mem\n",
 			       dev_info);
 			goto fail;
@@ -532,7 +531,7 @@
 		free_irq(dev->irq, dev);
 
 	if (attr_mem)
-		iounmap((void *) attr_mem);
+		iounmap(attr_mem);
 
 	pci_disable_device(pdev);
 
@@ -550,7 +549,7 @@
 	hfa384x_disable_interrupts(dev);
 
 	if (iface->local->attr_mem)
-		iounmap((void *) iface->local->attr_mem);
+		iounmap(iface->local->attr_mem);
 	if (dev->irq)
 		free_irq(dev->irq, dev);
 
drivers/net/wireless/hostap/hostap_wlan.h +1 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -895,7 +895,7 @@
 #endif /* PRISM2_PCCARD */
 
 #ifdef PRISM2_PLX
-	unsigned long attr_mem;
+	void *attr_mem;
 	unsigned int cor_offset;
 #endif /* PRISM2_PLX */
 
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#12 lore raw

Re: [PATCH wireless-2.6 10/12] Host AP: Use void * instead of unsigned long with {read,write}{b,w}

Quoted 53 lines · Jouni Malinen

Start using void * instead of unsigned long with {read,write}{b,w} to silence compiler warning with Linux 2.6.9-rc2.

diff -Nru a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c

drivers/net/wireless/hostap/hostap_pci.c +4 -8
@@ -56,7 +56,7 @@
 
 	spin_lock_irqsave(&local->lock, flags);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
-	writeb(v, dev->mem_start + a);
+	writeb(v, (void *) dev->mem_start + a);
 	spin_unlock_irqrestore(&local->lock, flags);
 }
 
@@ -68,7 +68,7 @@
 	u8 v;
 
 	spin_lock_irqsave(&local->lock, flags);
-	v = readb(dev->mem_start + a);
+	v = readb((void *) dev->mem_start + a);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
 	spin_unlock_irqrestore(&local->lock, flags);
 	return v;
@@ -82,7 +82,7 @@
 
 	spin_lock_irqsave(&local->lock, flags);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
-	writew(v, dev->mem_start + a);
+	writew(v, (void *) dev->mem_start + a);
 	spin_unlock_irqrestore(&local->lock, flags);
 }
 
@@ -94,7 +94,7 @@
 	u16 v;
 
 	spin_lock_irqsave(&local->lock, flags);
-	v = readw(dev->mem_start + a);
+	v = readw((void *) dev->mem_start + a);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
 	spin_unlock_irqrestore(&local->lock, flags);
 	return v;
@@ -109,12 +109,14 @@
 
 #else /* PRISM2_IO_DEBUG */
 
-#define HFA384X_OUTB(v,a) writeb((v), dev->mem_start + (a))
-#define HFA384X_INB(a) (u8) readb(dev->mem_start + (a))
-#define HFA384X_OUTW(v,a) writew((v), dev->mem_start + (a))
-#define HFA384X_INW(a) (u16) readw(dev->mem_start + (a))

drivers/net/wireless/hostap/hostap_pci.c line 119

Quoted 10 lines
drivers/net/wireless/hostap/hostap_pci.c +8 -2
-#define HFA384X_OUTW_DATA(v,a) writew(cpu_to_le16(v), dev->mem_start + (a))
-#define HFA384X_INW_DATA(a) (u16) le16_to_cpu(readw(dev->mem_start + (a)))
+#define HFA384X_OUTB(v,a) writeb((v), (void *) dev->mem_start + (a))
+#define HFA384X_INB(a) (u8) readb((void *) dev->mem_start + (a))
+#define HFA384X_OUTW(v,a) writew((v), (void *) dev->mem_start + (a))
+#define HFA384X_INW(a) (u16) readw((void *) dev->mem_start + (a))
+#define HFA384X_OUTW_DATA(v,a) \
+	writew(cpu_to_le16(v), (void *) dev->mem_start + (a))
+#define HFA384X_INW_DATA(a) (u16) \
+	le16_to_cpu(readw((void *) dev->mem_start + (a)))

Two comments:

1) that should be "void __iomem *" not "void *" for MMIO memory pointers

2) don't bother using dev->mem_start, that is normally used for passing options or an ISA memory address from userland to the kernel. Store the result of ioremap() in a private 'void __iomem *' pointer instead.

Quoted 31 lines

diff -Nru a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c

drivers/net/wireless/hostap/hostap_plx.c +3 -3
@@ -247,7 +247,7 @@
 
 	/* Set sreset bit of COR and clear it after hold time */
 
-	if (local->attr_mem == 0) {
+	if (local->attr_mem == NULL) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
 		outb(corsave | COR_SRESET, local->cor_offset);
@@ -271,7 +271,7 @@
 {
 	unsigned char corsave;
 
-	if (local->attr_mem == 0) {
+	if (local->attr_mem == NULL) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
 		outb(corsave | COR_SRESET, local->cor_offset);
@@ -306,7 +306,7 @@
 };
 
 
-static int prism2_plx_check_cis(unsigned long attr_mem, int attr_len,
+static int prism2_plx_check_cis(void *attr_mem, int attr_len,
 				unsigned int *cor_offset,
 				unsigned int *cor_index)
 {

drivers/net/wireless/hostap/hostap_plx.c line 407

Quoted 8 lines
drivers/net/wireless/hostap/hostap_plx.c +1 -1
@@ -401,7 +401,7 @@
 	unsigned int pccard_ioaddr, plx_ioaddr;
 	unsigned long pccard_attr_mem;
 	unsigned int pccard_attr_len;
-	unsigned long attr_mem = 0;
+	void *attr_mem = NULL;
 	unsigned int cor_offset, cor_index;
 	u32 reg;
 	local_info_t *local = NULL;

void __iomem *

Quoted 43 lines
drivers/net/wireless/hostap/hostap_plx.c +5 -6
@@ -422,7 +422,7 @@
 
 	if (tmd7160) {
 		/* TMD7160 */
-		attr_mem = 0; /* no access to PC Card attribute memory */
+		attr_mem = NULL; /* no access to PC Card attribute memory */
 
 		printk(KERN_INFO "TMD7160 PCI/PCMCIA adapter: io=0x%x, "
 		       "irq=%d, pccard_io=0x%x\n",
@@ -448,9 +448,8 @@
 			goto fail;
 
 
-		attr_mem = (unsigned long) ioremap(pccard_attr_mem,
-						   pccard_attr_len);
-		if (!attr_mem) {
+		attr_mem = ioremap(pccard_attr_mem, pccard_attr_len);
+		if (attr_mem == NULL) {
 			printk(KERN_ERR "%s: cannot remap attr_mem\n",
 			       dev_info);
 			goto fail;
@@ -532,7 +531,7 @@
 		free_irq(dev->irq, dev);
 
 	if (attr_mem)
-		iounmap((void *) attr_mem);
+		iounmap(attr_mem);
 
 	pci_disable_device(pdev);
 
@@ -550,7 +549,7 @@
 	hfa384x_disable_interrupts(dev);
 
 	if (iface->local->attr_mem)
-		iounmap((void *) iface->local->attr_mem);
+		iounmap(iface->local->attr_mem);
 	if (dev->irq)
 		free_irq(dev->irq, dev);
 

diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h

drivers/net/wireless/hostap/hostap_wlan.h line 900

Quoted 7 lines
drivers/net/wireless/hostap/hostap_wlan.h +1 -1
@@ -895,7 +895,7 @@
 #endif /* PRISM2_PCCARD */
 
 #ifdef PRISM2_PLX
-	unsigned long attr_mem;
+	void *attr_mem;
 	unsigned int cor_offset;
 #endif /* PRISM2_PLX */

void __iomem *

#13 lore raw

PATCH 10/16 Host AP: Use void __iomem * with {read,write}{b,w}

Start using void __iomem * instead of unsigned long with {read,write}{b,w} to silence compiler warning with Linux 2.6.9-rc2 and newer.

drivers/net/wireless/hostap/hostap_pci.c +51 -24
diff -Nru a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
@@ -50,25 +50,25 @@
 
 static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	unsigned long flags;
 
 	spin_lock_irqsave(&local->lock, flags);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
-	writeb(v, dev->mem_start + a);
+	writeb(v, local->mem_start + a);
 	spin_unlock_irqrestore(&local->lock, flags);
 }
 
 static inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	unsigned long flags;
 	u8 v;
 
 	spin_lock_irqsave(&local->lock, flags);
-	v = readb(dev->mem_start + a);
+	v = readb(local->mem_start + a);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
 	spin_unlock_irqrestore(&local->lock, flags);
 	return v;
@@ -76,25 +76,25 @@
 
 static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	unsigned long flags;
 
 	spin_lock_irqsave(&local->lock, flags);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
-	writew(v, dev->mem_start + a);
+	writew(v, local->mem_start + a);
 	spin_unlock_irqrestore(&local->lock, flags);
 }
 
 static inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	unsigned long flags;
 	u16 v;
 
 	spin_lock_irqsave(&local->lock, flags);
-	v = readw(dev->mem_start + a);
+	v = readw(local->mem_start + a);
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
 	spin_unlock_irqrestore(&local->lock, flags);
 	return v;
@@ -109,12 +109,40 @@
 
 #else /* PRISM2_IO_DEBUG */
 
-#define HFA384X_OUTB(v,a) writeb((v), dev->mem_start + (a))
-#define HFA384X_INB(a) (u8) readb(dev->mem_start + (a))
-#define HFA384X_OUTW(v,a) writew((v), dev->mem_start + (a))
-#define HFA384X_INW(a) (u16) readw(dev->mem_start + (a))
-#define HFA384X_OUTW_DATA(v,a) writew(cpu_to_le16(v), dev->mem_start + (a))
-#define HFA384X_INW_DATA(a) (u16) le16_to_cpu(readw(dev->mem_start + (a)))
+static inline void hfa384x_outb(struct net_device *dev, int a, u8 v)
+{
+	struct hostap_interface *iface = netdev_priv(dev);
+	local_info_t *local = iface->local;
+	writeb(v, local->mem_start + a);
+}
+
+static inline u8 hfa384x_inb(struct net_device *dev, int a)
+{
+	struct hostap_interface *iface = netdev_priv(dev);
+	local_info_t *local = iface->local;
+	return readb(local->mem_start + a);
+}
+
+static inline void hfa384x_outw(struct net_device *dev, int a, u16 v)
+{
+	struct hostap_interface *iface = netdev_priv(dev);
+	local_info_t *local = iface->local;
+	writew(v, local->mem_start + a);
+}
+
+static inline u16 hfa384x_inw(struct net_device *dev, int a)
+{
+	struct hostap_interface *iface = netdev_priv(dev);
+	local_info_t *local = iface->local;
+	return readw(local->mem_start + a);
+}
+
+#define HFA384X_OUTB(v,a) hfa384x_outb(dev, (a), (v))
+#define HFA384X_INB(a) hfa384x_inb(dev, (a))
+#define HFA384X_OUTW(v,a) hfa384x_outw(dev, (a), (v))
+#define HFA384X_INW(a) hfa384x_inw(dev, (a))
+#define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), cpu_to_le16((v)))
+#define HFA384X_INW_DATA(a) (u16) le16_to_cpu(hfa384x_inw(dev, (a)))
 
 #endif /* PRISM2_IO_DEBUG */
 
@@ -232,7 +260,7 @@
 			    const struct pci_device_id *id)
 {
 	unsigned long phymem;
-	unsigned long mem = 0;
+	void __iomem *mem = NULL;
 	local_info_t *local = NULL;
 	struct net_device *dev = NULL;
 	static int cards_found /* = 0 */;
@@ -249,8 +277,8 @@
 		goto err_out_disable;
 	}
 
-	mem = (unsigned long) ioremap(phymem, pci_resource_len(pdev, 0));
-	if (!mem) {
+	mem = ioremap(phymem, pci_resource_len(pdev, 0));
+	if (mem == NULL) {
 		printk(KERN_ERR "prism2: Cannot remap PCI memory region\n") ;
 		goto fail;
 	}
@@ -267,8 +295,7 @@
 	cards_found++;
 
         dev->irq = pdev->irq;
-        dev->mem_start = mem;
-        dev->mem_end = mem + pci_resource_len(pdev, 0);
+        local->mem_start = mem;
 
 	prism2_pci_cor_sreset(local);
 
@@ -297,7 +324,7 @@
 		free_irq(dev->irq, dev);
 
 	if (mem)
-		iounmap((void *) mem);
+		iounmap(mem);
 
 	release_mem_region(phymem, pci_resource_len(pdev, 0));
 
@@ -312,8 +339,8 @@
 static void prism2_pci_remove(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
-	struct hostap_interface *iface = dev->priv;
-	unsigned long mem_start;
+	struct hostap_interface *iface = netdev_priv(dev);
+	void __iomem *mem_start;
 
 	/* Reset the hardware, and ensure interrupts are disabled. */
 	prism2_pci_cor_sreset(iface->local);
@@ -322,10 +349,10 @@
 	if (dev->irq)
 		free_irq(dev->irq, dev);
 
-	mem_start = dev->mem_start;
+	mem_start = iface->local->mem_start;
 	prism2_free_local_data(dev);
 
-	iounmap((void *) mem_start);
+	iounmap(mem_start);
 
 	release_mem_region(pci_resource_start(pdev, 0),
 			   pci_resource_len(pdev, 0));
drivers/net/wireless/hostap/hostap_plx.c +9 -10
diff -Nru a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
@@ -247,7 +247,7 @@
 
 	/* Set sreset bit of COR and clear it after hold time */
 
-	if (local->attr_mem == 0) {
+	if (local->attr_mem == NULL) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
 		outb(corsave | COR_SRESET, local->cor_offset);
@@ -271,7 +271,7 @@
 {
 	unsigned char corsave;
 
-	if (local->attr_mem == 0) {
+	if (local->attr_mem == NULL) {
 		/* TMD7160 - COR at card's first I/O addr */
 		corsave = inb(local->cor_offset);
 		outb(corsave | COR_SRESET, local->cor_offset);
@@ -306,7 +306,7 @@
 };
 
 
-static int prism2_plx_check_cis(unsigned long attr_mem, int attr_len,
+static int prism2_plx_check_cis(void __iomem *attr_mem, int attr_len,
 				unsigned int *cor_offset,
 				unsigned int *cor_index)
 {
@@ -401,7 +401,7 @@
 	unsigned int pccard_ioaddr, plx_ioaddr;
 	unsigned long pccard_attr_mem;
 	unsigned int pccard_attr_len;
-	unsigned long attr_mem = 0;
+	void __iomem *attr_mem = NULL;
 	unsigned int cor_offset, cor_index;
 	u32 reg;
 	local_info_t *local = NULL;
@@ -422,7 +422,7 @@
 
 	if (tmd7160) {
 		/* TMD7160 */
-		attr_mem = 0; /* no access to PC Card attribute memory */
+		attr_mem = NULL; /* no access to PC Card attribute memory */
 
 		printk(KERN_INFO "TMD7160 PCI/PCMCIA adapter: io=0x%x, "
 		       "irq=%d, pccard_io=0x%x\n",
@@ -448,9 +448,8 @@
 			goto fail;
 
 
-		attr_mem = (unsigned long) ioremap(pccard_attr_mem,
-						   pccard_attr_len);
-		if (!attr_mem) {
+		attr_mem = ioremap(pccard_attr_mem, pccard_attr_len);
+		if (attr_mem == NULL) {
 			printk(KERN_ERR "%s: cannot remap attr_mem\n",
 			       dev_info);
 			goto fail;
@@ -532,7 +531,7 @@
 		free_irq(dev->irq, dev);
 
 	if (attr_mem)
-		iounmap((void *) attr_mem);
+		iounmap(attr_mem);
 
 	pci_disable_device(pdev);
 
@@ -550,7 +549,7 @@
 	hfa384x_disable_interrupts(dev);
 
 	if (iface->local->attr_mem)
-		iounmap((void *) iface->local->attr_mem);
+		iounmap(iface->local->attr_mem);
 	if (dev->irq)
 		free_irq(dev->irq, dev);
 
drivers/net/wireless/hostap/hostap_wlan.h +2 -1
diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -895,11 +895,12 @@
 #endif /* PRISM2_PCCARD */
 
 #ifdef PRISM2_PLX
-	unsigned long attr_mem;
+	void __iomem *attr_mem;
 	unsigned int cor_offset;
 #endif /* PRISM2_PLX */
 
 #ifdef PRISM2_PCI
+	void __iomem *mem_start;
 #ifdef PRISM2_BUS_MASTER
 	/* bus master for BAP0 (TX) */
 	int bus_m0_tx_idx;
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
Applied
#14 lore raw

Re: [PATCH wireless-2.6 10/16] Host AP: Use void __iomem * with {read,write}{b,w}

applied patches 10-16 to wireless-2.6 (and thus netdev-2.6, and thus -mm).

#15 lore raw

PATCH 11/12 Host AP: Fix PRISM2_IO_DEBUG

In reply to Jouni Malinen
Quoted 1 line

From Mark Glines <[email protected]>:

I just noticed PRISM2_IO_DEBUG doesn't work. This patch gets it working again. I checked the development CVS snapshot, looks like its still broken there.

jkm: in addition, fix the other PRISM2_IO_DEBUG function

drivers/net/wireless/hostap/hostap_wlan.h +4 -2
diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -1006,7 +1006,8 @@
 static inline void prism2_io_debug_add(struct net_device *dev, int cmd,
 				       int reg, int value)
 {
-	local_info_t *local = dev->priv;
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
 
 	if (!local->io_debug_enabled)
 		return;
@@ -1023,7 +1024,8 @@
 
 static inline void prism2_io_debug_error(struct net_device *dev, int err)
 {
-	local_info_t *local = dev->priv;
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
 	unsigned long flags;
 
 	if (!local->io_debug_enabled)
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#16 lore raw

Re: [PATCH wireless-2.6 11/12] Host AP: Fix PRISM2_IO_DEBUG

Quoted 24 lines · Jouni Malinen
Quoted 1 line

From Mark Glines <[email protected]>:

I just noticed PRISM2_IO_DEBUG doesn't work. This patch gets it working again. I checked the development CVS snapshot, looks like its still broken there.

jkm: in addition, fix the other PRISM2_IO_DEBUG function

diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h

drivers/net/wireless/hostap/hostap_wlan.h +2 -1
@@ -1006,7 +1006,8 @@
 static inline void prism2_io_debug_add(struct net_device *dev, int cmd,
 				       int reg, int value)
 {
-	local_info_t *local = dev->priv;
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
 
 	if (!local->io_debug_enabled)
 		return;

drivers/net/wireless/hostap/hostap_wlan.h line 1029

Quoted 7 lines
drivers/net/wireless/hostap/hostap_wlan.h +2 -1
@@ -1023,7 +1024,8 @@
 
 static inline void prism2_io_debug_error(struct net_device *dev, int err)
 {
-	local_info_t *local = dev->priv;
+	struct hostap_interface *iface = dev->priv;
+	local_info_t *local = iface->local;
 	unsigned long flags;

it is preferred to use netdev_priv() rather than directly referring to dev->priv.

Jeff

#17 lore raw

PATCH 11/16 Host AP: Fix PRISM2_IO_DEBUG

Quoted 1 line

From Mark Glines <[email protected]>:

I just noticed PRISM2_IO_DEBUG doesn't work. This patch gets it working again. I checked the development CVS snapshot, looks like its still broken there.

jkm: in addition, fix the other PRISM2_IO_DEBUG function

drivers/net/wireless/hostap/hostap_wlan.h +4 -2
diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -1004,7 +1004,8 @@
 static inline void prism2_io_debug_add(struct net_device *dev, int cmd,
 				       int reg, int value)
 {
-	local_info_t *local = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
+	local_info_t *local = iface->local;
 
 	if (!local->io_debug_enabled)
 		return;
@@ -1021,7 +1022,8 @@
 
 static inline void prism2_io_debug_error(struct net_device *dev, int err)
 {
-	local_info_t *local = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
+	local_info_t *local = iface->local;
 	unsigned long flags;
 
 	if (!local->io_debug_enabled)
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#18 lore raw

PATCH 12/12 Host AP: Fix netif_carrier_off() in non-client modes

In reply to Jouni Malinen

Connection status is reported properly only in client modes, so do not try to set netif_carrier_off() in non-client modes. Previously, Master mode may end up being in state where netif_carrier was left off and this may break things like bridging.

drivers/net/wireless/hostap/hostap_hw.c +5 -2
diff -Nru a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
@@ -3399,8 +3399,11 @@
 					   "", dev_template);
 
 	if (local->ddev) {
-		netif_carrier_off(local->dev);
-		netif_carrier_off(local->ddev);
+		if (local->iw_mode == IW_MODE_INFRA ||
+		    local->iw_mode == IW_MODE_ADHOC) {
+			netif_carrier_off(local->dev);
+			netif_carrier_off(local->ddev);
+		}
 		hostap_init_proc(local);
 		hostap_init_ap_proc(local);
 		return 0;
drivers/net/wireless/hostap/hostap_ioctl.c +7 -0
diff -Nru a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -1108,6 +1108,13 @@
 	if (double_reset && local->func->reset_port(dev))
 		return -EINVAL;
 
+	if (local->iw_mode != IW_MODE_INFRA && local->iw_mode != IW_MODE_ADHOC)
+	{
+		/* netif_carrier is used only in client modes for now, so make
+		 * sure carrier is on when moving to non-client modes. */
+		netif_carrier_on(local->dev);
+		netif_carrier_on(local->ddev);
+	}
 	return 0;
 }
 
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#19 lore raw
In reply to Jouni Malinen
Quoted 7 lines · Jouni Malinen

Jeff,

Here's an update to Host AP code in wireless-2.6 tree. This brings in number of small fixes from my CVS repository. This messages has the changes in BitKeeper format from bksend and following 12 messages have the patches one by one as unified diffs.

Quoted 6 lines

I have couple of additional patches pending for wireless-2.6 updates (wireless extensions 17 and 18; changes to PCI API in Linux 2.6.10-rc1). I'll send WE17 and PCI changes once you update wireless-2.6. WE18 change requires an update to wireless extensions, so it may need to wait somewhat longer or we could start testing WE18 in wireless-2.6 if that is desired.

Feel free to push experimental (but tested!) code to wireless-2.6.

Quoted 2 lines

I keep getting questions about getting Host AP driver to linux-2.6 tree. What would be needed to make this happen? I would assume this

Andrew Morton's "-mm" kernels are essentially a staging area for pushing changes to the upstream kernel. I pulled the latest wireless-2.6 tree (includes your latest patches #1 - #9) into my netdev-2.6 queue. netdev-2.6, in turn, is automatically pulled by Andrew, into his -mm tree. It will get wider review and testing here.

Quoted 3 lines

would be easiest to do this from wireless-2.6 tree once the new patches are in. Any other changes that would be required to get the driver in suitable state for merging into Linux 2.6 releases?

A key goal I have for HostAP is that portions of HostAP code should be bundled into a generic "lib80211" kernel module, for use by various low-level and "softmac" 802.11 device drivers.

The Intel Centrino driver folks are already using HostAP in this capacity, and I _think_ their changes were fairly minimal and cosmetic.
If the changes are indeed minimal, I think it's better to merge
those changes before sending HostAP stuff upstream.

To emphasize that the upstream-bound HostAP code is a generic library (well, parts of it), I would prefer that the kernel module name, and API prefixes, use some name other than 'hostap_'. 'wifi_' or 'ieee80211_' or whatever, I don't care. Just something "more generic".

I would rather perform mass renaming of functions and files before merging upstream.

Quoted 2 lines

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

IMHO the bksend stuff is useless. I prefer "plain ole patches", like the ones you sent in emails '1/12' through '12/12' in this thread.

WRT the patches you sent, as I mentioned, #1 - #9 were applied. Please update #10 and #11 per comments, and then resend #10 - #12.

Jeff

#20 lore raw

Hi.

(I cutted down the CC list.)

Quoted 1 line · Jeff Garzik

A key goal I have for HostAP is that portions of HostAP code should be bundled into a generic "lib80211" kernel module, for use by various low-level and "softmac" 802.11 device drivers.

This sentence made me curious... does that mean the efforts which recently have been discussed here (to bring a generic 802.11 stack to the kernel) are going to be replaced by the described goal? Or is it an addition to Vladimir's work?

Bye, Mike

#21 lore raw
Quoted 10 lines · Michael Renzmann

Hi.

(I cutted down the CC list.)

Quoted 1 line · Jeff Garzik

A key goal I have for HostAP is that portions of HostAP code should be bundled into a generic "lib80211" kernel module, for use by various low-level and "softmac" 802.11 device drivers.

This sentence made me curious... does that mean the efforts which recently have been discussed here (to bring a generic 802.11 stack to the kernel) are going to be replaced by the described goal? Or is it an addition to Vladimir's work?

Hopefully Vladmir's work will plug right in.. I hope he's still working on it!

Jeff

#22 lore raw

On Tuesday 09 November 2004 17:26, Jeff Garzik wrote:
JG> Michael Renzmann wrote:
JG> > Hi.
JG> >
JG> > (I cutted down the CC list.)
JG> >
JG> > Jeff Garzik wrote:
JG> >
JG> >> A key goal I have for HostAP is that portions of HostAP code should be JG> >> bundled into a generic "lib80211" kernel module, for use by various JG> >> low-level and "softmac" 802.11 device drivers.
JG> >
JG> >
JG> > This sentence made me curious... does that mean the efforts which JG> > recently have been discussed here (to bring a generic 802.11 stack to JG> > the kernel) are going to be replaced by the described goal? Or is it an JG> > addition to Vladimir's work?
JG>
JG> Hopefully Vladmir's work will plug right in.. I hope he's still working JG> on it!
JG>
JG> Jeff

I do, but I had some very long interrupt - sometimes I should also do my primary job. I'll be back shortly.

#23 lore raw
In reply to Jeff Garzik
Quoted 5 lines · Jeff Garzik

Andrew Morton's "-mm" kernels are essentially a staging area for pushing changes to the upstream kernel. I pulled the latest wireless-2.6 tree (includes your latest patches #1 - #9) into my netdev-2.6 queue. netdev-2.6, in turn, is automatically pulled by Andrew, into his -mm tree. It will get wider review and testing here.

Thanks! I'll send couple of more patches to update the driver to Linux 2.6.10-rc1.

Quoted 3 lines

A key goal I have for HostAP is that portions of HostAP code should be bundled into a generic "lib80211" kernel module, for use by various low-level and "softmac" 802.11 device drivers.

Agreed.

Quoted 4 lines

The Intel Centrino driver folks are already using HostAP in this capacity, and I _think_ their changes were fairly minimal and cosmetic.
If the changes are indeed minimal, I think it's better to merge
those changes before sending HostAP stuff upstream.

I haven't went through all the changes in Intel driver, but at least IEEE 802.11g support is going to require quite a bit more work and IEEE 802.11a and Atheros-like hardware even more.

Quoted 7 lines

To emphasize that the upstream-bound HostAP code is a generic library (well, parts of it), I would prefer that the kernel module name, and API prefixes, use some name other than 'hostap_'. 'wifi_' or 'ieee80211_' or whatever, I don't care. Just something "more generic".

I would rather perform mass renaming of functions and files before merging upstream.

I can start cleaning up some of the functions and renaming them in the code. However, I still want to finalize couple of things in my employment agreement before starting doing more "non-Host AP" things. I would thus prefer to be able to get current Host AP driver merged upstream before doing full merge with other drivers (I would add at least net80211/madwifi to the list with Intel drivers). This would allow me to maintain stable version of Host AP driver without having to do too much work with an external CVS repository and start working on wireless-2.6 for the generic library and merging.

Quoted 2 lines

IMHO the bksend stuff is useless. I prefer "plain ole patches", like the ones you sent in emails '1/12' through '12/12' in this thread.

OK.

Quoted 2 lines

WRT the patches you sent, as I mentioned, #1 - #9 were applied. Please update #10 and #11 per comments, and then resend #10 - #12.

I have updated #10 and #11 and added couple of more patches (13..16) to match with the Linux 2.6.10-rc1 pull into wireless-2.6. I'll re-send 10..12 and send 13..16.

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

PATCH 12/16 Host AP: Fix netif_carrier_off() in non-client modes

In reply to Jouni Malinen

Connection status is reported properly only in client modes, so do not try to set netif_carrier_off() in non-client modes. Previously, Master mode may end up being in state where netif_carrier was left off and this may break things like bridging.

drivers/net/wireless/hostap/hostap_hw.c +5 -2
diff -Nru a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
@@ -3399,8 +3399,11 @@
 					   "", dev_template);
 
 	if (local->ddev) {
-		netif_carrier_off(local->dev);
-		netif_carrier_off(local->ddev);
+		if (local->iw_mode == IW_MODE_INFRA ||
+		    local->iw_mode == IW_MODE_ADHOC) {
+			netif_carrier_off(local->dev);
+			netif_carrier_off(local->ddev);
+		}
 		hostap_init_proc(local);
 		hostap_init_ap_proc(local);
 		return 0;
drivers/net/wireless/hostap/hostap_ioctl.c +7 -0
diff -Nru a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -1108,6 +1108,13 @@
 	if (double_reset && local->func->reset_port(dev))
 		return -EINVAL;
 
+	if (local->iw_mode != IW_MODE_INFRA && local->iw_mode != IW_MODE_ADHOC)
+	{
+		/* netif_carrier is used only in client modes for now, so make
+		 * sure carrier is on when moving to non-client modes. */
+		netif_carrier_on(local->dev);
+		netif_carrier_on(local->ddev);
+	}
 	return 0;
 }
 
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#25 lore raw

PATCH 13/16 Host AP: pci_register_driver() return value changes

In reply to Jouni Malinen

Changed pci_register_driver() calls to match with the new behavior in Linux 2.6.10-rc1.

drivers/net/wireless/hostap/hostap_pci.c +1 -8
diff -Nru a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
@@ -414,14 +414,7 @@
 {
 	printk(KERN_INFO "%s: %s\n", dev_info, version);
 
-	if (pci_register_driver(&prism2_pci_drv_id) <= 0) {
-		printk("hostap_pci: No devices found, driver not "
-		       "installed.\n");
-		pci_unregister_driver(&prism2_pci_drv_id);
-		return -ENODEV;
-	}
-
-	return 0;
+	return pci_register_driver(&prism2_pci_drv_id);
 }
 
 
drivers/net/wireless/hostap/hostap_plx.c +1 -8
diff -Nru a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
@@ -575,14 +575,7 @@
 {
 	printk(KERN_INFO "%s: %s\n", dev_info, version);
 
-	if (pci_register_driver(&prism2_plx_drv_id) <= 0) {
-		printk("hostap_plx: No devices found, driver not "
-		       "installed.\n");
-		pci_unregister_driver(&prism2_plx_drv_id);
-		return -ENODEV;
-	}
-
-	return 0;
+	return pci_register_driver(&prism2_plx_drv_id);
 }
 
 
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#26 lore raw

PATCH 14/16 Host AP: Updated to use Linux wireless extensions v17

In reply to Jouni Malinen

Patch from Jean Tourrilhes <[email protected]>:

HostAP WE-17 support:
- allow large scan requests
- export event capability
- new spy data handling

jkm: removed support for old WE versions (ifdefs)

drivers/net/wireless/hostap/hostap.c +6 -2
diff -Nru a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
@@ -890,8 +890,12 @@
 
 	/* kernel callbacks */
 	dev->get_stats = hostap_get_stats;
-	if (main_dev || (iface && iface->type == HOSTAP_INTERFACE_MAIN))
-		dev->get_wireless_stats =  hostap_get_wireless_stats;
+	if (iface) {
+		/* Currently, we point to the proper spy_data only on
+		 * the main_dev. This could be fixed. Jean II */
+		iface->wireless_data.spy_data = &iface->spy_data;
+		dev->wireless_data = &iface->wireless_data;
+	}
 	dev->wireless_handlers =
 		(struct iw_handler_def *) &hostap_iw_handler_def;
 	dev->do_ioctl = hostap_ioctl;
drivers/net/wireless/hostap/hostap_ioctl.c +26 -4
diff -Nru a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -13,6 +13,10 @@
 	local_info_t *local = iface->local;
 	struct iw_statistics *wstats;
 
+	/* Why are we doing that ? Jean II */
+	if (iface->type != HOSTAP_INTERFACE_MAIN)
+		return NULL;
+
 	wstats = &local->wstats;
 
 	wstats->status = 0;
@@ -989,6 +993,17 @@
 	range->min_frag = 256;
 	range->max_frag = 2346;
 
+	/* Event capability (kernel + driver) */
+	range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
+				IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) |
+				IW_EVENT_CAPA_MASK(SIOCGIWAP) |
+				IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
+	range->event_capa[1] = IW_EVENT_CAPA_K_1;
+	range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVTXDROP) |
+				IW_EVENT_CAPA_MASK(IWEVCUSTOM) |
+				IW_EVENT_CAPA_MASK(IWEVREGISTERED) |
+				IW_EVENT_CAPA_MASK(IWEVEXPIRED));
+
 	return 0;
 }
 
@@ -1818,13 +1833,14 @@
 
 /* Translate scan data returned from the card to a card independant
  * format that the Wireless Tools will understand - Jean II */
-static inline int prism2_translate_scan(local_info_t *local, char *buffer)
+static inline int prism2_translate_scan(local_info_t *local,
+					char *buffer, int buflen)
 {
 	struct hfa384x_scan_result *scan;
 	struct hfa384x_hostscan_result *hscan;
 	int entries, entry, hostscan;
 	char *current_ev = buffer;
-	char *end_buf = buffer + IW_SCAN_MAX_DATA;
+	char *end_buf = buffer + buflen;
 	u8 *bssid;
 	struct list_head *ptr;
 
@@ -1858,6 +1874,12 @@
 				local, scan, hscan, hostscan, NULL, 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);
@@ -1894,7 +1916,7 @@
 	}
 	local->scan_timestamp = 0;
 
-	res = prism2_translate_scan(local, extra);
+	res = prism2_translate_scan(local, extra, data->length);
 
 	if (res >= 0) {
 		data->length = res;
@@ -3372,7 +3394,7 @@
 	.standard	= (iw_handler *) prism2_handler,
 	.private	= (iw_handler *) prism2_private_handler,
 	.private_args	= (struct iw_priv_args *) prism2_priv,
-	.spy_offset	= offsetof(struct hostap_interface, spy_data),
+	.get_wireless_stats = hostap_get_wireless_stats,
 };
 
 
drivers/net/wireless/hostap/hostap_wlan.h +1 -5
diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -924,12 +924,8 @@
 	struct net_device *dev; /* pointer to this device */
 	struct local_info *local; /* pointer to shared private data */
 	struct net_device_stats stats;
-	/* Note: this data area must be at a fixed offset from dev->priv.
-	 * Unfortunately, this model does not fit the current Host AP netdev
-	 * data structure because this should really be in local_into_t that is
-	 * shared by all virtual interfaces. Currently, only the main data
-	 * device (wlan#) is used for iwspy entries. */
 	struct iw_spy_data spy_data; /* iwspy support */
+	struct iw_public_data wireless_data;
 
 	enum {
 		HOSTAP_INTERFACE_MASTER,
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#27 lore raw

PATCH 15/16 Host AP: Replaced direct dev->priv references with netdev_priv(dev).

In reply to Jouni Malinen
drivers/net/wireless/hostap/hostap.c +44 -22
diff -Nru a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
@@ -117,7 +117,7 @@
 	if (dev == NULL)
 		return NULL;
 
-	iface = dev->priv;
+	iface = netdev_priv(dev);
 	iface->dev = dev;
 	iface->local = local;
 	iface->type = type;
@@ -169,7 +169,7 @@
 	if (!dev)
 		return;
 
-	iface = dev->priv;
+	iface = netdev_priv(dev);
 
 	if (remove_from_list) {
 		list_del(&iface->list);
@@ -254,7 +254,7 @@
 	if (dev == NULL)
 		return -ENOMEM;
 
-	iface = dev->priv;
+	iface = netdev_priv(dev);
 	memcpy(iface->u.wds.remote_addr, remote_addr, ETH_ALEN);
 
 	local->wds_connections++;
@@ -351,18 +351,20 @@
 /* val is in host byte order */
 int hostap_set_word(struct net_device *dev, int rid, u16 val)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface;
 	u16 tmp = cpu_to_le16(val);
+	iface = netdev_priv(dev);
 	return iface->local->func->set_rid(dev, rid, &tmp, 2);
 }
 
 
 int hostap_set_string(struct net_device *dev, int rid, const char *val)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface;
 	char buf[MAX_SSID_LEN + 2];
 	int len;
 
+	iface = netdev_priv(dev);
 	len = strlen(val);
 	if (len > MAX_SSID_LEN)
 		return -1;
@@ -692,18 +694,22 @@
 
 struct net_device_stats *hostap_get_stats(struct net_device *dev)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface;
+	iface = netdev_priv(dev);
 	return &iface->stats;
 }
 
 
 static int prism2_close(struct net_device *dev)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 
 	PDEBUG(DEBUG_FLOW, "%s: prism2_close\n", dev->name);
 
+	iface = netdev_priv(dev);
+	local = iface->local;
+
 	if (dev == local->ddev) {
 		prism2_sta_deauth(local, WLAN_REASON_DEAUTH_LEAVING);
 	}
@@ -746,11 +752,14 @@
 
 static int prism2_open(struct net_device *dev)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 
 	PDEBUG(DEBUG_FLOW, "%s: prism2_open\n", dev->name);
 
+	iface = netdev_priv(dev);
+	local = iface->local;
+
 	if (local->no_pri) {
 		printk(KERN_DEBUG "%s: could not set interface UP - no PRI "
 		       "f/w\n", dev->name);
@@ -794,11 +803,14 @@
 
 static int prism2_set_mac_address(struct net_device *dev, void *p)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	struct list_head *ptr;
 	struct sockaddr *addr = p;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
+
 	if (local->func->set_rid(dev, HFA384X_RID_CNFOWNMACADDR, addr->sa_data,
 				 ETH_ALEN) < 0 || local->func->reset_port(dev))
 		return -EINVAL;
@@ -820,9 +832,11 @@
 void hostap_set_multicast_list_queue(void *data)
 {
 	struct net_device *dev = (struct net_device *) data;
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
 	if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE,
 			    local->is_promisc)) {
 		printk(KERN_INFO "%s: %sabling promiscuous mode failed\n",
@@ -838,9 +852,11 @@
 	 * some station firmware versions (FCSErr frames, invalid MACPort, etc.
 	 * corrupted incoming frames). This code is now commented out while the
 	 * problems are investigated. */
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
 	if ((dev->flags & IFF_ALLMULTI) || (dev->flags & IFF_PROMISC)) {
 		local->is_promisc = 1;
 	} else {
@@ -864,10 +880,13 @@
 
 static void prism2_tx_timeout(struct net_device *dev)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	struct hfa384x_regs regs;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
+
 	printk(KERN_WARNING "%s Tx timed out! Resetting card\n", dev->name);
 	netif_stop_queue(local->dev);
 
@@ -884,8 +903,9 @@
 void hostap_setup_dev(struct net_device *dev, local_info_t *local,
 		      int main_dev)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface;
 
+	iface = netdev_priv(dev);
 	ether_setup(dev);
 
 	/* kernel callbacks */
@@ -1039,11 +1059,13 @@
 
 int prism2_update_comms_qual(struct net_device *dev)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	int ret = 0;
 	struct hfa384x_comms_quality sq;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
 	if (!local->sta_fw_ver)
 		ret = -1;
 	else if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1)) {
@@ -1099,7 +1121,7 @@
 	meta = (struct hostap_skb_tx_data *) skb->cb;
 	memset(meta, 0, sizeof(*meta));
 	meta->magic = HOSTAP_SKB_TX_DATA_MAGIC;
-	meta->iface = dev->priv;
+	meta->iface = netdev_priv(dev);
 
 	skb->dev = dev;
 	skb->mac.raw = skb->nh.raw = skb->data;
drivers/net/wireless/hostap/hostap_80211_rx.c +9 -5
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -46,13 +46,15 @@
 int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
 		    struct hostap_80211_rx_status *rx_stats, int type)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	int hdrlen, phdrlen, head_need, tail_need;
 	u16 fc;
 	int prism_header, ret;
 	struct hostap_ieee80211_hdr *hdr;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
 	dev->last_rx = jiffies;
 
 	if (dev->type == ARPHRD_IEEE80211_PRISM) {
@@ -677,8 +679,8 @@
 void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
 		     struct hostap_80211_rx_status *rx_stats)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	struct hostap_ieee80211_hdr *hdr;
 	size_t hdrlen;
 	u16 fc, type, stype, sc;
@@ -696,13 +698,15 @@
 	void *sta = NULL;
 	int keyidx = 0;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
 	iface->stats.rx_packets++;
 	iface->stats.rx_bytes += skb->len;
 
 	/* dev is the master radio device; change this to be the default
 	 * virtual interface (this may be changed to WDS device below) */
 	dev = local->ddev;
-	iface = dev->priv;
+	iface = netdev_priv(dev);
 
 	hdr = (struct hostap_ieee80211_hdr *) skb->data;
 	stats = hostap_get_stats(dev);
drivers/net/wireless/hostap/hostap_80211_tx.c +20 -8
diff -Nru a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -38,8 +38,8 @@
  * device configuration. */
 int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	int need_headroom, need_tailroom = 0;
 	struct hostap_ieee80211_hdr hdr;
 	u16 fc, ethertype = 0;
@@ -51,6 +51,9 @@
 	int to_assoc_ap = 0;
 	struct hostap_skb_tx_data *meta;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
+
 	if (skb->len < ETH_HLEN) {
 		printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb "
 		       "(len=%d)\n", dev->name, skb->len);
@@ -237,12 +240,15 @@
 /* hard_start_xmit function for hostapd wlan#ap interfaces */
 int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	struct hostap_skb_tx_data *meta;
 	struct hostap_ieee80211_hdr *hdr;
 	u16 fc;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
+
 	if (skb->len < 10) {
 		printk(KERN_DEBUG "%s: hostap_mgmt_start_xmit: short skb "
 		       "(len=%d)\n", dev->name, skb->len);
@@ -280,12 +286,15 @@
 struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
 				   struct prism2_crypt_data *crypt)
 {
-	struct hostap_interface *iface = skb->dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	struct hostap_ieee80211_hdr *hdr;
 	u16 fc;
 	int hdr_len, res;
 
+	iface = netdev_priv(skb->dev);
+	local = iface->local;
+
 	if (skb->len < IEEE80211_DATA_HDR3_LEN) {
 		kfree_skb(skb);
 		return NULL;
@@ -342,8 +351,8 @@
  * Use hardware TX function to send the frame. */
 int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	int ret = 1;
 	u16 fc;
 	struct hostap_tx_data tx;
@@ -351,6 +360,9 @@
 	struct hostap_skb_tx_data *meta;
 	int no_encrypt = 0;
 	struct hostap_ieee80211_hdr *hdr;
+
+	iface = netdev_priv(dev);
+	local = iface->local;
 
 	tx.skb = skb;
 	tx.sta_ptr = NULL;
drivers/net/wireless/hostap/hostap_ap.c +22 -10
diff -Nru a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
@@ -915,16 +915,18 @@
 			     int type, int subtype, char *body,
 			     int body_len, u8 *addr, u16 tx_cb_idx)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	struct hostap_ieee80211_hdr *hdr;
 	u16 fc;
 	struct sk_buff *skb;
 	struct hostap_skb_tx_data *meta;
 	int hdrlen;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
 	dev = local->dev; /* always use master radio device */
-	iface = dev->priv;
+	iface = netdev_priv(dev);
 
 	if (!(dev->flags & IFF_UP)) {
 		PDEBUG(DEBUG_AP, "%s: prism2_send_mgmt - device is not UP - "
@@ -2252,11 +2254,14 @@
 void hostap_rx(struct net_device *dev, struct sk_buff *skb,
 	       struct hostap_80211_rx_status *rx_stats)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
 	u16 fc;
 	struct hostap_ieee80211_hdr *hdr;
 
+	iface = netdev_priv(dev);
+	local = iface->local;
+
 	if (skb->len < 16)
 		goto drop;
 
@@ -2359,9 +2364,9 @@
  * format that the Wireless Tools will understand - Jean II */
 static int prism2_ap_translate_scan(struct net_device *dev, char *buffer)
 {
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
-	struct ap_data *ap = local->ap;
+	struct hostap_interface *iface;
+	local_info_t *local;
+	struct ap_data *ap;
 	struct list_head *ptr;
 	struct iw_event iwe;
 	char *current_ev = buffer;
@@ -2370,6 +2375,10 @@
 	char buf[64];
 #endif
 
+	iface = netdev_priv(dev);
+	local = iface->local;
+	ap = local->ap;
+
 	spin_lock_bh(&ap->sta_table_lock);
 
 	for (ptr = ap->sta_list.next; ptr != NULL && ptr != &ap->sta_list;
@@ -2601,8 +2610,11 @@
 static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev)
 {
 	int ret = sta->tx_rate;
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
+
+	iface = netdev_priv(dev);
+	local = iface->local;
 
 	sta->tx_count[sta->tx_rate_idx]++;
 	sta->tx_since_last_failure++;
drivers/net/wireless/hostap/hostap_cs.c +28 -14

104 lines not on this page · raw message

drivers/net/wireless/hostap/hostap_download.c +5 -2
diff -Nru a/drivers/net/wireless/hostap/hostap_download.c b/drivers/net/wireless/hostap/hostap_download.c
@@ -3,8 +3,11 @@
 	u16 val, reg;
 	int i, tries;
 	unsigned long flags;
-	struct hostap_interface *iface = dev->priv;
-	local_info_t *local = iface->local;
+	struct hostap_interface *iface;
+	local_info_t *local;
+
+	iface = netdev_priv(dev);
+	local = iface->local;
 
 	if (local->no_pri) {
 		if (enable) {
drivers/net/wireless/hostap/hostap_hw.c +130 -53

407 lines not on this page · raw message

drivers/net/wireless/hostap/hostap_ioctl.c +220 -88

662 lines not on this page · raw message

drivers/net/wireless/hostap/hostap_pci.c +42 -19

129 lines not on this page · raw message

drivers/net/wireless/hostap/hostap_plx.c +36 -15

113 lines not on this page · raw message

drivers/net/wireless/hostap/hostap_wlan.h +3 -2
diff -Nru a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -635,7 +635,8 @@
 
 /* Per radio private Host AP data - shared by all net devices interfaces used
  * by each radio (wlan#, wlan#ap, wlan#sta, WDS).
- * ((struct hostap_interface *) dev->priv)->local points to this structure. */
+ * ((struct hostap_interface *) netdev_priv(dev))->local points to this
+ * structure. */
 struct local_info {
 	struct module *hw_module;
 	int card_idx;
@@ -918,7 +919,7 @@
 
 /* Per interface private Host AP data
  * Allocated for each net device that Host AP uses (wlan#, wlan#ap, wlan#sta,
- * WDS) and dev->priv points to this structure. */
+ * WDS) and netdev_priv(dev) points to this structure. */
 struct hostap_interface {
 	struct list_head list; /* list entry in Host AP interface list */
 	struct net_device *dev; /* pointer to this device */
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#28 lore raw

PATCH 16/16 Host AP: Replaced MODULE_PARM with module_param*

In reply to Jouni Malinen
drivers/net/wireless/hostap/hostap_ap.c +4 -4
diff -Nru a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
@@ -18,22 +18,22 @@
 
 static int other_ap_policy[MAX_PARM_DEVICES] = { AP_OTHER_AP_SKIP_ALL,
 						 DEF_INTS };
-MODULE_PARM(other_ap_policy, PARM_MIN_MAX "i");
+module_param_array(other_ap_policy, int, NULL, 0444);
 MODULE_PARM_DESC(other_ap_policy, "Other AP beacon monitoring policy (0-3)");
 
 static int ap_max_inactivity[MAX_PARM_DEVICES] = { AP_MAX_INACTIVITY_SEC,
 						   DEF_INTS };
-MODULE_PARM(ap_max_inactivity, PARM_MIN_MAX "i");
+module_param_array(ap_max_inactivity, int, NULL, 0444);
 MODULE_PARM_DESC(ap_max_inactivity, "AP timeout (in seconds) for station "
 		 "inactivity");
 
 static int ap_bridge_packets[MAX_PARM_DEVICES] = { 1, DEF_INTS };
-MODULE_PARM(ap_bridge_packets, PARM_MIN_MAX "i");
+module_param_array(ap_bridge_packets, int, NULL, 0444);
 MODULE_PARM_DESC(ap_bridge_packets, "Bridge packets directly between "
 		 "stations");
 
 static int autom_ap_wds[MAX_PARM_DEVICES] = { 0, DEF_INTS };
-MODULE_PARM(autom_ap_wds, PARM_MIN_MAX "i");
+module_param_array(autom_ap_wds, int, NULL, 0444);
 MODULE_PARM_DESC(autom_ap_wds, "Add WDS connections to other APs "
 		 "automatically");
 
drivers/net/wireless/hostap/hostap_cs.c +5 -5
diff -Nru a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
@@ -36,14 +36,14 @@
 MODULE_LICENSE("GPL");
 
 
-static unsigned int irq_mask = 0xdeb8;
-MODULE_PARM(irq_mask, "i");
+static int irq_mask = 0xdeb8;
+module_param(irq_mask, int, 0444);
 
 static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, NULL, 0444);
 
-static int ignore_cis_vcc = 0;
-MODULE_PARM(ignore_cis_vcc, "i");
+static int ignore_cis_vcc;
+module_param(ignore_cis_vcc, int, 0444);
 MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry");
 
 
drivers/net/wireless/hostap/hostap_hw.c +13 -14
diff -Nru a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
@@ -59,43 +59,43 @@
 /* #define final_version */
 
 static int mtu = 1500;
-MODULE_PARM(mtu, "i");
+module_param(mtu, int, 0444);
 MODULE_PARM_DESC(mtu, "Maximum transfer unit");
 
 static int channel[MAX_PARM_DEVICES] = { 3, DEF_INTS };
-MODULE_PARM(channel, PARM_MIN_MAX "i");
+module_param_array(channel, int, NULL, 0444);
 MODULE_PARM_DESC(channel, "Initial channel");
 
-static char *essid[MAX_PARM_DEVICES] = { "test" };
-MODULE_PARM(essid, PARM_MIN_MAX "s");
+static char essid[33] = "test";
+module_param_string(essid, essid, sizeof(essid), 0444);
 MODULE_PARM_DESC(essid, "Host AP's ESSID");
 
 static int iw_mode[MAX_PARM_DEVICES] = { IW_MODE_MASTER, DEF_INTS };
-MODULE_PARM(iw_mode, PARM_MIN_MAX "i");
+module_param_array(iw_mode, int, NULL, 0444);
 MODULE_PARM_DESC(iw_mode, "Initial operation mode");
 
 static int beacon_int[MAX_PARM_DEVICES] = { 100, DEF_INTS };
-MODULE_PARM(beacon_int, PARM_MIN_MAX "i");
+module_param_array(beacon_int, int, NULL, 0444);
 MODULE_PARM_DESC(beacon_int, "Beacon interval (1 = 1024 usec)");
 
 static int dtim_period[MAX_PARM_DEVICES] = { 1, DEF_INTS };
-MODULE_PARM(dtim_period, PARM_MIN_MAX "i");
+module_param_array(dtim_period, int, NULL, 0444);
 MODULE_PARM_DESC(dtim_period, "DTIM period");
 
 #if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER)
 static int bus_master_threshold_rx[MAX_PARM_DEVICES] = { 100, DEF_INTS };
-MODULE_PARM(bus_master_threshold_rx, "i");
+module_param_array(bus_master_threshold_rx, int, NULL, 0444);
 MODULE_PARM_DESC(bus_master_threshold_rx, "Packet length threshold for using "
 		 "PCI bus master on RX");
 
 static int bus_master_threshold_tx[MAX_PARM_DEVICES] = { 100, DEF_INTS };
-MODULE_PARM(bus_master_threshold_tx, "i");
+module_param_array(bus_master_threshold_tx, int, NULL, 0444);
 MODULE_PARM_DESC(bus_master_threshold_tx, "Packet length threshold for using "
 		 "PCI bus master on TX");
 #endif /* PRISM2_PCI and PRISM2_BUS_MASTER */
 
-static char *dev_template = "wlan%d";
-MODULE_PARM(dev_template, "s");
+static char dev_template[16] = "wlan%d";
+module_param_string(dev_template, dev_template, sizeof(dev_template), 0444);
 MODULE_PARM_DESC(dev_template, "Prefix for network device name (default: "
 		 "wlan%d)");
 
@@ -3346,9 +3346,8 @@
 		card_idx = 0;
 	local->card_idx = card_idx;
 
-	i = essid[card_idx] == NULL ? 0 : card_idx;
-	len = strlen(essid[i]);
-	memcpy(local->essid, essid[i],
+	len = strlen(essid);
+	memcpy(local->essid, essid,
 	       len > MAX_SSID_LEN ? MAX_SSID_LEN : len);
 	local->essid[MAX_SSID_LEN] = '\0';
 	i = GET_INT_PARM(iw_mode, card_idx);
drivers/net/wireless/hostap/hostap_plx.c +2 -2
diff -Nru a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
@@ -35,8 +35,8 @@
 MODULE_LICENSE("GPL");
 
 
-static int ignore_cis = 0;
-MODULE_PARM(ignore_cis, "i");
+static int ignore_cis;
+module_param(ignore_cis, int, 0444);
 MODULE_PARM_DESC(ignore_cis, "Do not verify manfid information in CIS");
 
 
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA