linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/7] New patch series for merge
@ 2007-08-23 22:21 Michael Buesch
  2007-08-23 22:21 ` [patch 1/7] b43: Change Kconfig help text Michael Buesch
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Michael Buesch @ 2007-08-23 22:21 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, bcm43xx-dev

Hi John,

This patch series catches wireless-dev up to my
current wireless-development patchset.

Please merge this into wireless-dev.


-- 


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

* [patch 1/7] b43: Change Kconfig help text
  2007-08-23 22:21 [patch 0/7] New patch series for merge Michael Buesch
@ 2007-08-23 22:21 ` Michael Buesch
  2007-08-23 22:21 ` [patch 2/7] b43: Fix oops when firmware not found Michael Buesch
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2007-08-23 22:21 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Larry Finger

Hopefully people can understand this better.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Larry Finger <larry.finger@lwfinger.net>

Index: wireless-dev-new/drivers/net/wireless/b43/Kconfig
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/Kconfig	2007-08-23 22:55:18.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/Kconfig	2007-08-23 23:31:09.000000000 +0200
@@ -1,21 +1,31 @@
 config B43
 	tristate "Broadcom 43xx wireless support (mac80211 stack)"
-	depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && EXPERIMENTAL
+	depends on SSB_POSSIBLE && MAC80211 && WLAN_80211
 	select SSB
 	select FW_LOADER
 	select HW_RANDOM
 	---help---
-	  This is an experimental driver for the Broadcom 43xx wireless chip,
-	  found in the Apple Airport Extreme and various other devices. This
-	  driver supports 802.11a and 802.11g, but not 802.11b. As a result,
-	  BCM4301 and BCM4303 are not supported - use b43legacy instead.
-	  It is safe to include both b43 and b43legacy as the ssb driver will
-	  load the correct version for your device.
+	  b43 is a driver for the Broadcom 43xx series wireless devices.
+
+	  Check "lspci" for something like
+	  "Broadcom Corporation BCM43XX 802.11 Wireless LAN Controller"
+	  to determine whether you own such a device.
+
+	  This driver supports the new BCM43xx IEEE 802.11G devices, but not
+	  the old IEEE 802.11B devices. Old devices are supported by
+	  the b43legacy driver.
+	  Note that this has nothing to do with the standard that your AccessPoint
+	  supports (A, B, G or a combination).
+	  IEEE 802.11G devices can talk to IEEE 802.11B AccessPoints.
+
+	  It is safe to include both b43 and b43legacy as the underlying glue
+	  layer will automatically load the correct version for your device.
 
 	  This driver uses V4 firmware, which must be installed separately using
 	  b43-fwcutter.
 
 	  This driver can be built as a module (recommended) that will be called "b43".
+	  If unsure, say M.
 
 # Auto-select SSB PCI-HOST support, if possible
 config B43_PCI_AUTOSELECT
@@ -32,8 +42,8 @@ config B43_PCICORE_AUTOSELECT
 	default y
 
 config B43_PCMCIA
-	bool "Broadcom 43xx PCMCIA device support"
-	depends on B43 && SSB_PCMCIAHOST_POSSIBLE
+	bool "Broadcom 43xx PCMCIA device support (EXPERIMENTAL)"
+	depends on B43 && SSB_PCMCIAHOST_POSSIBLE && EXPERIMENTAL
 	select SSB_PCMCIAHOST
 	---help---
 	  Broadcom 43xx PCMCIA device support.
@@ -41,7 +51,7 @@ config B43_PCMCIA
 	  Support for 16bit PCMCIA devices.
 	  Please note that most PC-CARD devices are _NOT_ 16bit PCMCIA
 	  devices, but 32bit CardBUS devices. CardBUS devices are supported
-	  by "B43 PCI device support".
+	  out of the box by b43.
 
 	  With this config option you can drive b43 cards in
 	  CompactFlash formfactor in a PCMCIA adaptor.

-- 


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

* [patch 2/7] b43: Fix oops when firmware not found
  2007-08-23 22:21 [patch 0/7] New patch series for merge Michael Buesch
  2007-08-23 22:21 ` [patch 1/7] b43: Change Kconfig help text Michael Buesch
@ 2007-08-23 22:21 ` Michael Buesch
  2007-08-23 22:21 ` [patch 3/7] b43: allow disabling hardware encryption Michael Buesch
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2007-08-23 22:21 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Larry Finger

Add a return statement.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Larry Finger <larry.finger@lwfinger.net>

Index: wireless-dev-new/drivers/net/wireless/b43/main.c
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/main.c	2007-08-23 23:41:27.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/main.c	2007-08-23 23:41:34.000000000 +0200
@@ -1601,6 +1601,7 @@ static int do_request_fw(struct b43_wlde
 	if (err) {
 		b43err(dev->wl, "Firmware file \"%s\" not found "
 		       "or load failed.\n", path);
+		return err;
 	}
 	if ((*fw)->size < sizeof(struct b43_fw_header))
 		goto err_format;

-- 


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

* [patch 3/7] b43: allow disabling hardware encryption
  2007-08-23 22:21 [patch 0/7] New patch series for merge Michael Buesch
  2007-08-23 22:21 ` [patch 1/7] b43: Change Kconfig help text Michael Buesch
  2007-08-23 22:21 ` [patch 2/7] b43: Fix oops when firmware not found Michael Buesch
@ 2007-08-23 22:21 ` Michael Buesch
  2007-08-23 22:21 ` [patch 4/7] b43: Add debugfs file to extract LO calibration data Michael Buesch
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2007-08-23 22:21 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Johannes Berg

From: Johannes Berg <johannes@sipsolutions.net>

For debugging it seems useful to be able to turn off
hardware encryption. With the changes I made to mac80211
that is now simple.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Michael Buesch <mb@bu3sch.de>

Index: wireless-dev-new/drivers/net/wireless/b43/main.c
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/main.c	2007-08-23 23:32:08.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/main.c	2007-08-23 23:36:22.000000000 +0200
@@ -104,6 +104,10 @@ static int modparam_hwpctl;
 module_param_named(hwpctl, modparam_hwpctl, int, 0444);
 MODULE_PARM_DESC(hwpctl, "Enable hardware-side power control (default off)");
 
+static int modparam_nohwcrypt;
+module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
+MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
+
 static const struct ssb_device_id b43_ssb_tbl[] = {
 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5),
 	SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 6),
@@ -2872,6 +2876,9 @@ static int b43_dev_set_key(struct ieee80
 	u8 index;
 	int err = -EINVAL;
 
+	if (modparam_nohwcrypt)
+		return -ENOSPC; /* User disabled HW-crypto */
+
 	if (!dev)
 		return -ENODEV;
 	switch (key->alg) {

-- 


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

* [patch 4/7] b43: Add debugfs file to extract LO calibration data
  2007-08-23 22:21 [patch 0/7] New patch series for merge Michael Buesch
                   ` (2 preceding siblings ...)
  2007-08-23 22:21 ` [patch 3/7] b43: allow disabling hardware encryption Michael Buesch
@ 2007-08-23 22:21 ` Michael Buesch
  2007-08-23 22:21 ` [patch 5/7] b43: Fix hwcrypto keyidx for new firmware Michael Buesch
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2007-08-23 22:21 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Larry Finger

Add a file to debugfs to extract the Local Oscillator
calibration data.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Larry Finger <larry.finger@lwfinger.net>

Index: wireless-dev-new/drivers/net/wireless/b43/debugfs.c
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/debugfs.c	2007-08-22 00:42:34.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/debugfs.c	2007-08-22 01:38:36.000000000 +0200
@@ -374,6 +374,88 @@ static ssize_t txpower_g_write_file(stru
 	return res;
 }
 
+static size_t append_lo_table(size_t pos, char *buf, const size_t len,
+			      struct b43_loctl table[B43_NR_BB][B43_NR_RF])
+{
+	unsigned int i, j;
+	struct b43_loctl *ctl;
+
+	for (i = 0; i < B43_NR_BB; i++) {
+		for (j = 0; j < B43_NR_RF; j++) {
+			ctl = &(table[i][j]);
+			fappend("(bbatt %2u, rfatt %2u)  ->  "
+				"(I %+3d, Q %+3d, Used: %d, Calibrated: %d)\n",
+				i, j, ctl->i, ctl->q,
+				ctl->used,
+				b43_loctl_is_calibrated(ctl));
+		}
+	}
+
+	return pos;
+}
+
+static ssize_t loctls_read_file(struct file *file, char __user *userbuf,
+				size_t count, loff_t *ppos)
+{
+	struct b43_wldev *dev = file->private_data;
+	const size_t len = ARRAY_SIZE(big_buffer);
+	char *buf = big_buffer;
+	size_t pos = 0;
+	ssize_t res;
+	unsigned long flags;
+	struct b43_txpower_lo_control *lo;
+	unsigned int i;
+
+	mutex_lock(&big_buffer_mutex);
+	mutex_lock(&dev->wl->mutex);
+	spin_lock_irqsave(&dev->wl->irq_lock, flags);
+	if (b43_status(dev) < B43_STAT_INITIALIZED) {
+		fappend("Not initialized\n");
+		goto out;
+	}
+	if (dev->phy.type != B43_PHYTYPE_G) {
+		fappend("Device is not a G-PHY\n");
+		goto out;
+	}
+
+	lo = dev->phy.lo_control;
+	fappend("-- Local Oscillator calibration data --\n\n");
+	fappend("Measured: %d,  Rebuild: %d,  HW-power-control: %d\n",
+		lo->lo_measured,
+		lo->rebuild,
+		dev->phy.hardware_power_control);
+	fappend("TX Bias: 0x%02X,  TX Magn: 0x%02X\n",
+		lo->tx_bias, lo->tx_magn);
+	fappend("Power Vector: 0x%08X%08X\n",
+		(unsigned int)((lo->power_vector & 0xFFFFFFFF00000000ULL) >> 32),
+		(unsigned int)(lo->power_vector & 0x00000000FFFFFFFFULL));
+	fappend("\nControl table WITH PADMIX:\n");
+	pos = append_lo_table(pos, buf, len, lo->with_padmix);
+	fappend("\nControl table WITHOUT PADMIX:\n");
+	pos = append_lo_table(pos, buf, len, lo->no_padmix);
+	fappend("\nUsed RF attenuation values:  Value(WithPadmix flag)\n");
+	for (i = 0; i < lo->rfatt_list.len; i++) {
+		fappend("%u(%d), ",
+			lo->rfatt_list.list[i].att,
+			lo->rfatt_list.list[i].with_padmix);
+	}
+	fappend("\n");
+	fappend("\nUsed Baseband attenuation values:\n");
+	for (i = 0; i < lo->bbatt_list.len; i++) {
+		fappend("%u, ",
+			lo->bbatt_list.list[i].att);
+	}
+	fappend("\n");
+
+out:
+	spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
+	mutex_unlock(&dev->wl->mutex);
+	res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
+	mutex_unlock(&big_buffer_mutex);
+
+	return res;
+}
+
 #undef fappend
 
 static struct file_operations drvinfo_fops = {
@@ -405,6 +487,12 @@ static struct file_operations restart_fo
 	.open = open_file_generic,
 };
 
+static struct file_operations loctls_fops = {
+	.read = loctls_read_file,
+	.open = open_file_generic,
+};
+
+
 int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
 {
 	return !!(dev->dfsentry && dev->dfsentry->dyn_debug[feature]);
@@ -499,6 +587,10 @@ void b43_debugfs_add_device(struct b43_w
 						dev, &restart_fops);
 	if (IS_ERR(e->dentry_restart))
 		e->dentry_restart = NULL;
+	e->dentry_loctls = debugfs_create_file("loctls", 0400, e->subdir,
+					       dev, &loctls_fops);
+	if (IS_ERR(e->dentry_loctls))
+		e->dentry_loctls = NULL;
 
 	b43_add_dynamic_debug(dev);
 }
@@ -513,6 +605,7 @@ void b43_debugfs_remove_device(struct b4
 	if (!e)
 		return;
 	b43_remove_dynamic_debug(dev);
+	debugfs_remove(e->dentry_loctls);
 	debugfs_remove(e->dentry_tsf);
 	debugfs_remove(e->dentry_txstat);
 	debugfs_remove(e->dentry_restart);
Index: wireless-dev-new/drivers/net/wireless/b43/debugfs.h
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/debugfs.h	2007-08-22 00:42:34.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/debugfs.h	2007-08-22 00:42:34.000000000 +0200
@@ -34,6 +34,7 @@ struct b43_dfsentry {
 	struct dentry *dentry_txstat;
 	struct dentry *dentry_txpower_g;
 	struct dentry *dentry_restart;
+	struct dentry *dentry_loctls;
 
 	struct b43_wldev *dev;
 

-- 


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

* [patch 5/7] b43: Fix hwcrypto keyidx for new firmware.
  2007-08-23 22:21 [patch 0/7] New patch series for merge Michael Buesch
                   ` (3 preceding siblings ...)
  2007-08-23 22:21 ` [patch 4/7] b43: Add debugfs file to extract LO calibration data Michael Buesch
@ 2007-08-23 22:21 ` Michael Buesch
  2007-08-23 22:21 ` [patch 6/7] b43: Add missing stuff to pwork Michael Buesch
  2007-08-23 22:22 ` [patch 7/7] b43: Fix and cleanup hwcrypto Michael Buesch
  6 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2007-08-23 22:21 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, bcm43xx-dev

This fixes crypto-RX on new firmware.

Signed-off-by: Michael Buesch <mb@bu3sch.de>

Index: wireless-dev-new/drivers/net/wireless/b43/main.c
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/main.c	2007-08-23 23:36:22.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/main.c	2007-08-23 23:40:23.000000000 +0200
@@ -730,13 +730,18 @@ static void key_write(struct b43_wldev *
 static void keymac_write(struct b43_wldev *dev, u8 index, const u8 * addr)
 {
 	u32 addrtmp[2];
+	u8 per_sta_keys_start = 8;
 
-	B43_WARN_ON(index < 4 + 4);
-	/* We have two default TX keys and two default RX keys.
-	 * Physical mac 0 is mapped to physical key 8.
+	if (b43_new_kidx_api(dev))
+		per_sta_keys_start = 4;
+
+	B43_WARN_ON(index < per_sta_keys_start);
+	/* We have two default TX keys and possibly two default RX keys.
+	 * Physical mac 0 is mapped to physical key 4 or 8, depending
+	 * on the firmware version.
 	 * So we must adjust the index here.
 	 */
-	index -= 8;
+	index -= per_sta_keys_start;
 
 	addrtmp[0] = addr[0];
 	addrtmp[0] |= ((u32) (addr[1]) << 8);
@@ -774,16 +779,20 @@ static void do_key_write(struct b43_wlde
 			 const u8 * key, size_t key_len, const u8 * mac_addr)
 {
 	u8 buf[B43_SEC_KEYSIZE];
+	u8 per_sta_keys_start = 8;
+
+	if (b43_new_kidx_api(dev))
+		per_sta_keys_start = 4;
 
 	B43_WARN_ON(index >= dev->max_nr_keys);
 	B43_WARN_ON(key_len > B43_SEC_KEYSIZE);
 
 	memset(buf, 0, sizeof(buf));
-	if (index >= 8)
+	if (index >= per_sta_keys_start)
 		keymac_write(dev, index, buf);	/* First zero out mac. */
 	memcpy(buf, key, key_len);
 	key_write(dev, index, algorithm, buf);
-	if (index >= 8)
+	if (index >= per_sta_keys_start)
 		keymac_write(dev, index, mac_addr);
 
 	dev->key[index].algorithm = algorithm;

-- 


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

* [patch 6/7] b43: Add missing stuff to pwork
  2007-08-23 22:21 [patch 0/7] New patch series for merge Michael Buesch
                   ` (4 preceding siblings ...)
  2007-08-23 22:21 ` [patch 5/7] b43: Fix hwcrypto keyidx for new firmware Michael Buesch
@ 2007-08-23 22:21 ` Michael Buesch
  2007-08-23 22:22 ` [patch 7/7] b43: Fix and cleanup hwcrypto Michael Buesch
  6 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2007-08-23 22:21 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, bcm43xx-dev

This adds missing stuff for new cards to pwork.

Signed-off-by: Michael Buesch <mb@bu3sch.de>

Index: wireless-dev-new/drivers/net/wireless/b43/main.c
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/main.c	2007-08-23 23:40:23.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/main.c	2007-08-23 23:41:00.000000000 +0200
@@ -2308,14 +2308,29 @@ static void b43_periodic_every120sec(str
 	b43_mac_suspend(dev);
 	b43_lo_g_measure(dev);
 	b43_mac_enable(dev);
+	if (b43_has_hardware_pctl(phy))
+		b43_lo_g_ctl_mark_all_unused(dev);
 }
 
 static void b43_periodic_every60sec(struct b43_wldev *dev)
 {
-	b43_lo_g_ctl_mark_all_unused(dev);
+	struct b43_phy *phy = &dev->phy;
+
+	if (!b43_has_hardware_pctl(phy))
+		b43_lo_g_ctl_mark_all_unused(dev);
 	if (dev->dev->bus->sprom.r1.boardflags_lo & B43_BFL_RSSI) {
 		b43_mac_suspend(dev);
 		b43_calc_nrssi_slope(dev);
+		if ((phy->radio_ver == 0x2050) && (phy->radio_rev == 8)) {
+			u8 old_chan = phy->channel;
+
+			/* VCO Calibration */
+			if (old_chan >= 8)
+				b43_radio_selectchannel(dev, 1, 0);
+			else
+				b43_radio_selectchannel(dev, 13, 0);
+			b43_radio_selectchannel(dev, old_chan, 0);
+		}
 		b43_mac_enable(dev);
 	}
 }

-- 


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

* [patch 7/7] b43: Fix and cleanup hwcrypto
  2007-08-23 22:21 [patch 0/7] New patch series for merge Michael Buesch
                   ` (5 preceding siblings ...)
  2007-08-23 22:21 ` [patch 6/7] b43: Add missing stuff to pwork Michael Buesch
@ 2007-08-23 22:22 ` Michael Buesch
  2007-08-24 10:08   ` Johannes Berg
  6 siblings, 1 reply; 11+ messages in thread
From: Michael Buesch @ 2007-08-23 22:22 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Johannes Berg

This fixes bugs and does a cleanup of the hwcrypto stuff.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Johannes Berg <johannes@sipsolutions.net>

Index: wireless-dev-new/drivers/net/wireless/b43/b43.h
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/b43.h	2007-08-23 22:55:18.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/b43.h	2007-08-24 00:14:00.000000000 +0200
@@ -571,8 +571,10 @@ struct b43_stats {
 };
 
 struct b43_key {
-	void *keyconf;
-	bool enabled;
+	/* If keyconf is NULL, this key is disabled.
+	 * keyconf is a cookie. Don't derefenrence it outside of the set_key
+	 * path, because b43 doesn't own it. */
+	struct ieee80211_key_conf *keyconf;
 	u8 algorithm;
 };
 
Index: wireless-dev-new/drivers/net/wireless/b43/main.c
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/main.c	2007-08-23 23:42:20.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/main.c	2007-08-24 00:03:09.000000000 +0200
@@ -806,31 +806,29 @@ static int b43_key_write(struct b43_wlde
 {
 	int i;
 	int sta_keys_start;
+	bool removal = 0;
 
 	if (key_len > B43_SEC_KEYSIZE)
 		return -EINVAL;
 	if (index < 0) {
-		/* Per station key with associated MAC address.
-		 * Look if it already exists, if yes update, otherwise
-		 * allocate a new key.
-		 */
+		/* Either pairwise key or address is 00:00:00:00:00:00
+		 * for transmit-only keys. Search the index. */
 		if (b43_new_kidx_api(dev))
 			sta_keys_start = 4;
 		else
 			sta_keys_start = 8;
 		for (i = sta_keys_start; i < dev->max_nr_keys; i++) {
 			if (dev->key[i].keyconf == keyconf) {
-				/*
-				 * we already have this key so we must be
-				 * in removal (there is no update)
-				 */
+				/* we already have this key so we must be
+				 * in removal (there is no update) */
+				removal = 1;
 				index = i;
 				break;
 			}
 		}
 		if (index < 0) {
 			for (i = sta_keys_start; i < dev->max_nr_keys; i++) {
-				if (!dev->key[i].enabled) {
+				if (!dev->key[i].keyconf) {
 					/* found empty */
 					index = i;
 					break;
@@ -851,6 +849,7 @@ static int b43_key_write(struct b43_wlde
 		do_key_write(dev, index + 4, algorithm, key, key_len, NULL);
 	}
 	keyconf->hw_key_idx = index;
+	dev->key[index].keyconf = removal ? NULL : keyconf;
 
 	return 0;
 }
@@ -864,7 +863,7 @@ static void b43_clear_keys(struct b43_wl
 	for (i = 0; i < dev->max_nr_keys; i++) {
 		do_key_write(dev, i, B43_SEC_ALGO_NONE,
 			     zero, B43_SEC_KEYSIZE, zero);
-		dev->key[i].enabled = 0;
+		dev->key[i].keyconf = NULL;
 	}
 }
 
@@ -2960,7 +2959,6 @@ static int b43_dev_set_key(struct ieee80
 		}
 		if (err)
 			goto out_unlock;
-		dev->key[key->hw_key_idx].enabled = 1;
 
 		if (algorithm == B43_SEC_ALGO_WEP40 ||
 		    algorithm == B43_SEC_ALGO_WEP104) {
@@ -2974,16 +2972,11 @@ static int b43_dev_set_key(struct ieee80
 		static const u8 zero[B43_SEC_KEYSIZE] = { 0 };
 
 		algorithm = B43_SEC_ALGO_NONE;
-		if (is_broadcast_ether_addr(addr)) {
-			err = b43_key_write(dev, index, algorithm,
-					    zero, B43_SEC_KEYSIZE,
-					    NULL, key);
-		} else {
-			err = b43_key_write(dev, -1, algorithm,
-					    zero, B43_SEC_KEYSIZE,
-					    addr, key);
-		}
-		dev->key[key->hw_key_idx].enabled = 0;
+		err = b43_key_write(dev, index, algorithm,
+				    zero, B43_SEC_KEYSIZE,
+				    NULL, key);
+		if (err)
+			goto out_unlock;
 		break;
 	}
 	default:
Index: wireless-dev-new/drivers/net/wireless/b43/xmit.c
===================================================================
--- wireless-dev-new.orig/drivers/net/wireless/b43/xmit.c	2007-08-23 22:55:18.000000000 +0200
+++ wireless-dev-new/drivers/net/wireless/b43/xmit.c	2007-08-24 00:06:28.000000000 +0200
@@ -234,23 +234,20 @@ static void generate_txhdr_fw4(struct b4
 
 		B43_WARN_ON(key_idx >= dev->max_nr_keys);
 		key = &(dev->key[key_idx]);
+		B43_WARN_ON(!key->keyconf);
 
-		if (key->enabled) {
-			/* Hardware appends ICV. */
-			plcp_fragment_len += txctl->icv_len;
-
-			key_idx = b43_kidx_to_fw(dev, key_idx);
-			mac_ctl |= (key_idx << B43_TX4_MAC_KEYIDX_SHIFT) &
-			    B43_TX4_MAC_KEYIDX;
-			mac_ctl |=
-			    (key->
-			     algorithm << B43_TX4_MAC_KEYALG_SHIFT) &
-			    B43_TX4_MAC_KEYALG;
-			wlhdr_len = ieee80211_get_hdrlen(fctl);
-			iv_len = min((size_t) txctl->iv_len,
-				     ARRAY_SIZE(txhdr->iv));
-			memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
-		}
+		/* Hardware appends ICV. */
+		plcp_fragment_len += txctl->icv_len;
+
+		key_idx = b43_kidx_to_fw(dev, key_idx);
+		mac_ctl |= (key_idx << B43_TX4_MAC_KEYIDX_SHIFT) &
+			   B43_TX4_MAC_KEYIDX;
+		mac_ctl |= (key->algorithm << B43_TX4_MAC_KEYALG_SHIFT) &
+			   B43_TX4_MAC_KEYALG;
+		wlhdr_len = ieee80211_get_hdrlen(fctl);
+		iv_len = min((size_t) txctl->iv_len,
+			     ARRAY_SIZE(txhdr->iv));
+		memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
 	}
 	b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->plcp),
 			      plcp_fragment_len, rate);

-- 


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

* Re: [patch 7/7] b43: Fix and cleanup hwcrypto
  2007-08-23 22:22 ` [patch 7/7] b43: Fix and cleanup hwcrypto Michael Buesch
@ 2007-08-24 10:08   ` Johannes Berg
  2007-08-24 10:16     ` Michael Buesch
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Berg @ 2007-08-24 10:08 UTC (permalink / raw)
  To: Michael Buesch; +Cc: John Linville, linux-wireless, bcm43xx-dev

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

On Fri, 2007-08-24 at 00:22 +0200, Michael Buesch wrote:

>  struct b43_key {
> -	void *keyconf;
> -	bool enabled;
> +	/* If keyconf is NULL, this key is disabled.
> +	 * keyconf is a cookie. Don't derefenrence it outside of the set_key
> +	 * path, because b43 doesn't own it. */
> +	struct ieee80211_key_conf *keyconf;

Just for clarification, you're allowed to dereference it as well if you
wish but most things you can do with it (e.g. change hw key index) are
racy.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

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

* Re: [patch 7/7] b43: Fix and cleanup hwcrypto
  2007-08-24 10:08   ` Johannes Berg
@ 2007-08-24 10:16     ` Michael Buesch
  2007-08-24 10:27       ` Johannes Berg
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Buesch @ 2007-08-24 10:16 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless, bcm43xx-dev

On Friday 24 August 2007 12:08:32 Johannes Berg wrote:
> On Fri, 2007-08-24 at 00:22 +0200, Michael Buesch wrote:
> 
> >  struct b43_key {
> > -	void *keyconf;
> > -	bool enabled;
> > +	/* If keyconf is NULL, this key is disabled.
> > +	 * keyconf is a cookie. Don't derefenrence it outside of the set_key
> > +	 * path, because b43 doesn't own it. */
> > +	struct ieee80211_key_conf *keyconf;
> 
> Just for clarification, you're allowed to dereference it as well if you
> wish but most things you can do with it (e.g. change hw key index) are
> racy.

That's what "because b43 doesn't own it" means. :)

-- 
Greetings Michael.

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

* Re: [patch 7/7] b43: Fix and cleanup hwcrypto
  2007-08-24 10:16     ` Michael Buesch
@ 2007-08-24 10:27       ` Johannes Berg
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2007-08-24 10:27 UTC (permalink / raw)
  To: Michael Buesch; +Cc: John Linville, linux-wireless, bcm43xx-dev

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

On Fri, 2007-08-24 at 12:16 +0200, Michael Buesch wrote:
> On Friday 24 August 2007 12:08:32 Johannes Berg wrote:
> > On Fri, 2007-08-24 at 00:22 +0200, Michael Buesch wrote:
> > 
> > >  struct b43_key {
> > > -	void *keyconf;
> > > -	bool enabled;
> > > +	/* If keyconf is NULL, this key is disabled.
> > > +	 * keyconf is a cookie. Don't derefenrence it outside of the set_key
> > > +	 * path, because b43 doesn't own it. */
> > > +	struct ieee80211_key_conf *keyconf;
> > 
> > Just for clarification, you're allowed to dereference it as well if you
> > wish but most things you can do with it (e.g. change hw key index) are
> > racy.
> 
> That's what "because b43 doesn't own it" means. :)

I missed the "outside of the set_key" part, sorry.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

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

end of thread, other threads:[~2007-08-24 10:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-23 22:21 [patch 0/7] New patch series for merge Michael Buesch
2007-08-23 22:21 ` [patch 1/7] b43: Change Kconfig help text Michael Buesch
2007-08-23 22:21 ` [patch 2/7] b43: Fix oops when firmware not found Michael Buesch
2007-08-23 22:21 ` [patch 3/7] b43: allow disabling hardware encryption Michael Buesch
2007-08-23 22:21 ` [patch 4/7] b43: Add debugfs file to extract LO calibration data Michael Buesch
2007-08-23 22:21 ` [patch 5/7] b43: Fix hwcrypto keyidx for new firmware Michael Buesch
2007-08-23 22:21 ` [patch 6/7] b43: Add missing stuff to pwork Michael Buesch
2007-08-23 22:22 ` [patch 7/7] b43: Fix and cleanup hwcrypto Michael Buesch
2007-08-24 10:08   ` Johannes Berg
2007-08-24 10:16     ` Michael Buesch
2007-08-24 10:27       ` Johannes Berg

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