Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 09/13] wl1271: Update join usage
From: Luciano Coelho @ 2009-08-27 21:00 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, juuso.oikarinen, kalle.valo
In-Reply-To: <1251406807-31495-1-git-send-email-luciano.coelho@nokia.com>

From: Juuso Oikarinen <juuso.oikarinen@nokia.com>

Update the usage of join's, including using actual beacon interval and
dtim from AP, and configuring a basic rate set from AP.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |   12 ++++++++
 drivers/net/wireless/wl12xx/wl1271_cmd.c  |   15 +++-------
 drivers/net/wireless/wl12xx/wl1271_cmd.h  |    3 +-
 drivers/net/wireless/wl12xx/wl1271_main.c |   42 ++++++++++++++++++++++-------
 4 files changed, 50 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 671dc5a..05eb29c 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -104,6 +104,8 @@ enum {
 				  CFG_RX_CTL_EN | CFG_RX_BCN_EN |     \
 				  CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
 
+#define WL1271_DEFAULT_BASIC_RATE_SET (ACX_RATE_MASK_ALL)
+
 #define WL1271_FW_NAME "wl1271-fw.bin"
 #define WL1271_NVS_NAME "wl1271-nvs.bin"
 
@@ -118,6 +120,9 @@ enum {
 #define WL1271_ELP_HW_STATE_ASLEEP 0
 #define WL1271_ELP_HW_STATE_IRQ    1
 
+#define WL1271_DEFAULT_BEACON_INT  100
+#define WL1271_DEFAULT_DTIM_PERIOD 1
+
 enum wl1271_state {
 	WL1271_STATE_OFF,
 	WL1271_STATE_ON,
@@ -369,6 +374,13 @@ struct wl1271 {
 	/* Our association ID */
 	u16 aid;
 
+	/* Beacon parameters */
+	u16 beacon_int;
+	u8 dtim_period;
+
+	/* currently configured rate set */
+	u32 basic_rate_set;
+
 	/* The current band */
 	enum ieee80211_band band;
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index bd65b38..35a6e67 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -175,11 +175,9 @@ int wl1271_cmd_cal(struct wl1271 *wl)
 	return ret;
 }
 
-int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
-		    u16 beacon_interval, u8 wait)
+int wl1271_cmd_join(struct wl1271 *wl)
 {
 	static bool do_cal = true;
-	unsigned long timeout;
 	struct wl1271_cmd_join *join;
 	int ret, i;
 	u8 *bssid;
@@ -213,9 +211,9 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
 	join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS |
 		RATE_MASK_5_5MBPS | RATE_MASK_11MBPS;
 
-	join->beacon_interval = beacon_interval;
-	join->dtim_interval = dtim_interval;
-	join->bss_type = bss_type;
+	join->beacon_interval = wl->beacon_int;
+	join->dtim_interval = wl->dtim_period;
+	join->bss_type = wl->bss_type;
 	join->channel = wl->channel;
 	join->ssid_len = wl->ssid_len;
 	memcpy(join->ssid, wl->ssid, wl->ssid_len);
@@ -239,14 +237,11 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
 		goto out_free;
 	}
 
-	timeout = msecs_to_jiffies(JOIN_TIMEOUT);
-
 	/*
 	 * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
 	 * simplify locking we just sleep instead, for now
 	 */
-	if (wait)
-		msleep(10);
+	msleep(10);
 
 out_free:
 	kfree(join);
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 7c4d3aa..63bc441 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -30,8 +30,7 @@
 struct acx_header;
 
 int wl1271_cmd_send(struct wl1271 *wl, u16 type, void *buf, size_t buf_len);
-int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
-		    u16 beacon_interval, u8 wait);
+int wl1271_cmd_join(struct wl1271 *wl);
 int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
 int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
 int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 0f5958d..f5e757d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -394,8 +394,7 @@ static void wl1271_filter_work(struct work_struct *work)
 	if (ret < 0)
 		goto out;
 
-	/* FIXME: replace the magic numbers with proper definitions */
-	ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
+	ret = wl1271_cmd_join(wl);
 	if (ret < 0)
 		goto out_sleep;
 
@@ -673,8 +672,7 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
 		memcpy(wl->ssid, conf->ssid, wl->ssid_len);
 
 	if (wl->bss_type != BSS_TYPE_IBSS) {
-		/* FIXME: replace the magic numbers with proper definitions */
-		ret = wl1271_cmd_join(wl, wl->bss_type, 5, 100, 1);
+		ret = wl1271_cmd_join(wl);
 		if (ret < 0)
 			goto out_sleep;
 	}
@@ -697,8 +695,7 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
 		if (ret < 0)
 			goto out_sleep;
 
-		/* FIXME: replace the magic numbers with proper definitions */
-		ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
+		ret = wl1271_cmd_join(wl);
 
 		if (ret < 0)
 			goto out_sleep;
@@ -739,8 +736,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
 		u8 old_channel = wl->channel;
 		wl->channel = channel;
 
-		/* FIXME: use beacon interval provided by mac80211 */
-		ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
+		ret = wl1271_cmd_join(wl);
 		if (ret < 0) {
 			wl->channel = old_channel;
 			goto out_sleep;
@@ -1017,8 +1013,17 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 
 	if (changed & BSS_CHANGED_ASSOC) {
 		if (bss_conf->assoc) {
+			wl->beacon_int = bss_conf->beacon_int;
+			wl->dtim_period = bss_conf->dtim_period;
 			wl->aid = bss_conf->aid;
 
+			ret = wl1271_cmd_join(wl);
+			if (ret < 0) {
+				wl1271_warning("Association configuration "
+					       "failed %d", ret);
+				goto out_sleep;
+			}
+
 			ret = wl1271_cmd_build_ps_poll(wl, wl->aid);
 			if (ret < 0)
 				goto out_sleep;
@@ -1034,7 +1039,14 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 				if (ret < 0)
 					goto out_sleep;
 			}
+		} else {
+			/* use defaults when not associated */
+			wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
+			wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
+			wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
+			wl->aid = 0;
 		}
+
 	}
 
 	if (changed & BSS_CHANGED_ERP_SLOT) {
@@ -1067,13 +1079,20 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 	}
 
 	if (changed & BSS_CHANGED_BASIC_RATES) {
-		u32 enabled_rates = wl1271_enabled_rates_get(
+		wl->basic_rate_set = wl1271_enabled_rates_get(
 			wl, bss_conf->basic_rates);
-		ret = wl1271_acx_rate_policies(wl, enabled_rates);
+		ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
+
 		if (ret < 0) {
 			wl1271_warning("Set rate policies failed %d", ret);
 			goto out_sleep;
 		}
+		ret = wl1271_cmd_join(wl);
+		if (ret < 0) {
+			wl1271_warning("Join with new basic rate "
+				       "set failed %d", ret);
+			goto out_sleep;
+		}
 	}
 
 out_sleep:
@@ -1270,6 +1289,9 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 	wl->psm_requested = false;
 	wl->tx_queue_stopped = false;
 	wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
+	wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
+	wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
+	wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
 	wl->band = IEEE80211_BAND_2GHZ;
 
 	/* We use the default power on sleep time until we know which chip
-- 
1.5.6.5


^ permalink raw reply related

* [PATCH 04/13] wl1271: Correct TKIP header space handling in TX path
From: Luciano Coelho @ 2009-08-27 20:59 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, juuso.oikarinen, kalle.valo
In-Reply-To: <1251406807-31495-1-git-send-email-luciano.coelho@nokia.com>

From: Juuso Oikarinen <juuso.oikarinen@nokia.com>

Correct the position to which TKIP header space is appended for TX
packets.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_main.c |    9 +++------
 drivers/net/wireless/wl12xx/wl1271_tx.c   |   27 +++++++++++++++++----------
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 7faa65f..4fb6138 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1161,12 +1161,9 @@ static int wl1271_register_hw(struct wl1271 *wl)
 
 static int wl1271_init_ieee80211(struct wl1271 *wl)
 {
-	/*
-	 * The tx descriptor buffer and the TKIP space.
-	 *
-	 * FIXME: add correct 1271 descriptor size
-	 */
-	wl->hw->extra_tx_headroom = WL1271_TKIP_IV_SPACE;
+	/* The tx descriptor buffer and the TKIP space. */
+	wl->hw->extra_tx_headroom = WL1271_TKIP_IV_SPACE +
+		sizeof(struct wl1271_tx_hw_descr);
 
 	/* unit us */
 	/* FIXME: find a proper value */
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c
index 162f026..1ad1bc3 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.c
@@ -92,6 +92,14 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
 
 	desc = (struct wl1271_tx_hw_descr *) skb->data;
 
+	/* relocate space for security header */
+	if (extra) {
+		void *framestart = skb->data + sizeof(*desc);
+		u16 fc = *(u16 *)(framestart + extra);
+		int hdrlen = ieee80211_hdrlen(fc);
+		memmove(framestart, framestart + extra, hdrlen);
+	}
+
 	/* configure packet life time */
 	desc->start_time = jiffies_to_usecs(jiffies) - wl->time_offset;
 	desc->life_time = TX_HW_MGMT_PKT_LIFETIME_TU;
@@ -257,7 +265,6 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
 
 	struct ieee80211_tx_info *info;
 	struct sk_buff *skb;
-	u32 header_len;
 	u16 seq;
 	int id = result->id;
 
@@ -295,22 +302,22 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
 		wl->tx_security_seq_32++;
 	wl->tx_security_seq_16 = seq;
 
-	/* get header len */
+	/* remove private header from packet */
+	skb_pull(skb, sizeof(struct wl1271_tx_hw_descr));
+
+	/* remove TKIP header space if present */
 	if (info->control.hw_key &&
-	    info->control.hw_key->alg == ALG_TKIP)
-		header_len = WL1271_TKIP_IV_SPACE +
-			sizeof(struct wl1271_tx_hw_descr);
-	else
-		header_len = sizeof(struct wl1271_tx_hw_descr);
+	    info->control.hw_key->alg == ALG_TKIP) {
+		int hdrlen = ieee80211_get_hdrlen_from_skb(skb);
+		memmove(skb->data + WL1271_TKIP_IV_SPACE, skb->data, hdrlen);
+		skb_pull(skb, WL1271_TKIP_IV_SPACE);
+	}
 
 	wl1271_debug(DEBUG_TX, "tx status id %u skb 0x%p failures %u rate 0x%x"
 		     " status 0x%x",
 		     result->id, skb, result->ack_failures,
 		     result->rate_class_index, result->status);
 
-	/* remove private header from packet */
-	skb_pull(skb, header_len);
-
 	/* return the packet to the stack */
 	ieee80211_tx_status(wl->hw, skb);
 	wl->tx_frames[result->id] = NULL;
-- 
1.5.6.5


^ permalink raw reply related

* [PATCH 06/13] wl1271: mask aid bits 14 and 15 in ps-poll template
From: Luciano Coelho @ 2009-08-27 21:00 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, juuso.oikarinen, kalle.valo
In-Reply-To: <1251406807-31495-1-git-send-email-luciano.coelho@nokia.com>

From: Juuso Oikarinen <juuso.oikarinen@nokia.com>

In ps-poll template aid bits 14 and 15 were not masked as required by
the standard. Mask them so that aid is sent in correct format.

This patch is a direct port of the respective patch for the wl1251
driver by Kalle Valo.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_cmd.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 1ee1b2b..bd65b38 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -682,7 +682,10 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid)
 
 	memcpy(template.bssid, wl->bssid, ETH_ALEN);
 	memcpy(template.ta, wl->mac_addr, ETH_ALEN);
-	template.aid = aid;
+
+	/* aid in PS-Poll has its two MSBs each set to 1 */
+	template.aid = cpu_to_le16(1 << 15 | 1 << 14 | aid);
+
 	template.fc = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
 
 	return wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, &template,
-- 
1.5.6.5


^ permalink raw reply related

* [PATCH 01/13] wl1271: remove unecessary qual parameter from rx status
From: Luciano Coelho @ 2009-08-27 20:59 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, juuso.oikarinen, kalle.valo
In-Reply-To: <1251406807-31495-1-git-send-email-luciano.coelho@nokia.com>

The qual element in ieee80211_rx_status is not used anymore, so we don't need
to set it in the wl1271_rx_status() function.  This saves a bit of time in
the RX path.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_rx.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index ad8b690..5d8d401 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -91,12 +91,6 @@ static void wl1271_rx_status(struct wl1271 *wl,
 	 */
 	status->signal = desc->rssi;
 
-	/* FIXME: Should this be optimized? */
-	status->qual = (desc->rssi - WL1271_RX_MIN_RSSI) * 100 /
-		(WL1271_RX_MAX_RSSI - WL1271_RX_MIN_RSSI);
-	status->qual = min(status->qual, 100);
-	status->qual = max(status->qual, 0);
-
 	/*
 	 * FIXME: In wl1251, the SNR should be divided by two.  In wl1271 we
 	 * need to divide by two for now, but TI has been discussing about
-- 
1.5.6.5


^ permalink raw reply related

* [PATCH 05/13] wl1271: Implement delayed entry into ELP
From: Luciano Coelho @ 2009-08-27 20:59 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, juuso.oikarinen, kalle.valo
In-Reply-To: <1251406807-31495-1-git-send-email-luciano.coelho@nokia.com>

From: Juuso Oikarinen <juuso.oikarinen@nokia.com>

Implement delayed entry into ELP. This will promote the following:
 - Less redundant sleep/wake cycles (better perf)
 - Avoids known firmware issues with going to ELP too fast after an
   operation

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |    1 +
 drivers/net/wireless/wl12xx/wl1271_main.c |    1 +
 drivers/net/wireless/wl12xx/wl1271_ps.c   |   46 ++++++++++++++++++++---------
 drivers/net/wireless/wl12xx/wl1271_ps.h   |    2 +-
 4 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index e575dcc..c455dcb 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -373,6 +373,7 @@ struct wl1271 {
 	bool elp;
 
 	struct completion *elp_compl;
+	struct delayed_work elp_work;
 
 	/* we can be in psm, but not in elp, we have to differentiate */
 	bool psm;
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 4fb6138..1a5e575 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1227,6 +1227,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 	skb_queue_head_init(&wl->tx_queue);
 
 	INIT_WORK(&wl->filter_work, wl1271_filter_work);
+	INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work);
 	wl->channel = WL1271_DEFAULT_CHANNEL;
 	wl->scanning = false;
 	wl->default_key = 0;
diff --git a/drivers/net/wireless/wl12xx/wl1271_ps.c b/drivers/net/wireless/wl12xx/wl1271_ps.c
index 1dc74b0..7a3b53e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_ps.c
+++ b/drivers/net/wireless/wl12xx/wl1271_ps.c
@@ -27,25 +27,43 @@
 
 #define WL1271_WAKEUP_TIMEOUT 500
 
-/* Routines to toggle sleep mode while in ELP */
-void wl1271_ps_elp_sleep(struct wl1271 *wl)
+void wl1271_elp_work(struct work_struct *work)
 {
+	struct delayed_work *dwork;
+	struct wl1271 *wl;
+
+	dwork = container_of(work, struct delayed_work, work);
+	wl = container_of(dwork, struct wl1271, elp_work);
+
+	wl1271_debug(DEBUG_PSM, "elp work");
+
+	mutex_lock(&wl->mutex);
+
 	/*
-	 * FIXME: due to a problem in the firmware (causing a firmware
-	 * crash), ELP entry is prevented below. Remove the "true" to
-	 * re-enable ELP entry.
+	 * FIXME: below, by means of the "true", ELP has been disabled for now
+	 * to work around a firmware bug. To be enabled upon receiving a new
+	 * firmware version.
 	 */
 	if (true || wl->elp || !wl->psm)
-		return;
+		goto out;
 
-	/*
-	 * Go to ELP unless there is work already pending - pending work
-	 * will immediately wakeup the chipset anyway.
-	 */
-	if (!work_pending(&wl->irq_work) && !work_pending(&wl->tx_work)) {
-		wl1271_debug(DEBUG_PSM, "chip to elp");
-		wl1271_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP);
-		wl->elp = true;
+	wl1271_debug(DEBUG_PSM, "chip to elp");
+	wl1271_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP);
+	wl->elp = true;
+
+out:
+	mutex_unlock(&wl->mutex);
+}
+
+#define ELP_ENTRY_DELAY  5
+
+/* Routines to toggle sleep mode while in ELP */
+void wl1271_ps_elp_sleep(struct wl1271 *wl)
+{
+	if (wl->psm) {
+		cancel_delayed_work(&wl->elp_work);
+		queue_delayed_work(wl->hw->workqueue, &wl->elp_work,
+				   msecs_to_jiffies(ELP_ENTRY_DELAY));
 	}
 }
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_ps.h b/drivers/net/wireless/wl12xx/wl1271_ps.h
index de2bd3c..779653d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_ps.h
+++ b/drivers/net/wireless/wl12xx/wl1271_ps.h
@@ -30,6 +30,6 @@
 int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode);
 void wl1271_ps_elp_sleep(struct wl1271 *wl);
 int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake);
-
+void wl1271_elp_work(struct work_struct *work);
 
 #endif /* __WL1271_PS_H__ */
-- 
1.5.6.5


^ permalink raw reply related

* [PATCH 03/13] wl1271: Security sequence number handling for TX (for WPA)
From: Luciano Coelho @ 2009-08-27 20:59 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, juuso.oikarinen, kalle.valo
In-Reply-To: <1251406807-31495-1-git-send-email-luciano.coelho@nokia.com>

From: Juuso Oikarinen <juuso.oikarinen@nokia.com>

Add security sequence number handling to the driver TX data path needed
by WPA.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |    5 +++++
 drivers/net/wireless/wl12xx/wl1271_cmd.c  |   11 +++++++++--
 drivers/net/wireless/wl12xx/wl1271_cmd.h  |    3 ++-
 drivers/net/wireless/wl12xx/wl1271_main.c |   13 +++++++++++--
 drivers/net/wireless/wl12xx/wl1271_tx.c   |   11 +++++++++++
 5 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 55818f9..e575dcc 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -337,6 +337,11 @@ struct wl1271 {
 	/* Pending TX frames */
 	struct sk_buff *tx_frames[16];
 
+	/* Security sequence number counters */
+	u8 tx_security_last_seq;
+	u16 tx_security_seq_16;
+	u32 tx_security_seq_32;
+
 	/* FW Rx counter */
 	u32 rx_counter;
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 2a4351f..1ee1b2b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -228,6 +228,10 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
 
 	join->ctrl |= wl->session_counter << WL1271_JOIN_CMD_TX_SESSION_OFFSET;
 
+	/* reset TX security counters */
+	wl->tx_security_last_seq = 0;
+	wl->tx_security_seq_16 = 0;
+	wl->tx_security_seq_32 = 0;
 
 	ret = wl1271_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join));
 	if (ret < 0) {
@@ -759,7 +763,8 @@ out:
 }
 
 int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
-		       u8 key_size, const u8 *key, const u8 *addr)
+		       u8 key_size, const u8 *key, const u8 *addr,
+		       u32 tx_seq_32, u16 tx_seq_16)
 {
 	struct wl1271_cmd_set_keys *cmd;
 	int ret = 0;
@@ -777,12 +782,14 @@ int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
 	cmd->key_size = key_size;
 	cmd->key_type = key_type;
 
+	cmd->ac_seq_num16[0] = tx_seq_16;
+	cmd->ac_seq_num32[0] = tx_seq_32;
+
 	/* we have only one SSID profile */
 	cmd->ssid_profile = 0;
 
 	cmd->id = id;
 
-	/* FIXME: this is from wl1251, needs to be checked */
 	if (key_type == KEY_TKIP) {
 		/*
 		 * We get the key in the following form:
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 951a844..7c4d3aa 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -49,7 +49,8 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid);
 int wl1271_cmd_build_probe_req(struct wl1271 *wl, u8 *ssid, size_t ssid_len);
 int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id);
 int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
-		       u8 key_size, const u8 *key, const u8 *addr);
+		       u8 key_size, const u8 *key, const u8 *addr,
+		       u32 tx_seq_32, u16 tx_seq_16);
 
 enum wl1271_commands {
 	CMD_INTERROGATE     = 1,    /*use this to read information elements*/
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index d9169b4..7faa65f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -592,6 +592,9 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
 	wl->tx_blocks_available = 0;
 	wl->tx_results_count = 0;
 	wl->tx_packets_count = 0;
+	wl->tx_security_last_seq = 0;
+	wl->tx_security_seq_16 = 0;
+	wl->tx_security_seq_32 = 0;
 	wl->time_offset = 0;
 	wl->session_counter = 0;
 	for (i = 0; i < NUM_TX_QUEUES; i++)
@@ -824,6 +827,8 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	struct wl1271 *wl = hw->priv;
 	const u8 *addr;
 	int ret;
+	u32 tx_seq_32 = 0;
+	u16 tx_seq_16 = 0;
 	u8 key_type;
 
 	static const u8 bcast_addr[ETH_ALEN] =
@@ -862,11 +867,15 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		key_type = KEY_TKIP;
 
 		key_conf->hw_key_idx = key_conf->keyidx;
+		tx_seq_32 = wl->tx_security_seq_32;
+		tx_seq_16 = wl->tx_security_seq_16;
 		break;
 	case ALG_CCMP:
 		key_type = KEY_AES;
 
 		key_conf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
+		tx_seq_32 = wl->tx_security_seq_32;
+		tx_seq_16 = wl->tx_security_seq_16;
 		break;
 	default:
 		wl1271_error("Unknown key algo 0x%x", key_conf->alg);
@@ -880,7 +889,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		ret = wl1271_cmd_set_key(wl, KEY_ADD_OR_REPLACE,
 					 key_conf->keyidx, key_type,
 					 key_conf->keylen, key_conf->key,
-					 addr);
+					 addr, tx_seq_32, tx_seq_16);
 		if (ret < 0) {
 			wl1271_error("Could not add or replace key");
 			goto out_sleep;
@@ -891,7 +900,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		ret = wl1271_cmd_set_key(wl, KEY_REMOVE,
 					 key_conf->keyidx, key_type,
 					 key_conf->keylen, key_conf->key,
-					 addr);
+					 addr, 0, 0);
 		if (ret < 0) {
 			wl1271_error("Could not remove key");
 			goto out_sleep;
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c
index 0c19688..162f026 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.c
@@ -258,6 +258,7 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
 	struct ieee80211_tx_info *info;
 	struct sk_buff *skb;
 	u32 header_len;
+	u16 seq;
 	int id = result->id;
 
 	/* check for id legality */
@@ -284,6 +285,16 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
 	/* info->status.retry_count = result->ack_failures; */
 	wl->stats.retry_count += result->ack_failures;
 
+	/* update security sequence number */
+	seq = wl->tx_security_seq_16 +
+		(result->lsb_security_sequence_number -
+		 wl->tx_security_last_seq);
+	wl->tx_security_last_seq = result->lsb_security_sequence_number;
+
+	if (seq < wl->tx_security_seq_16)
+		wl->tx_security_seq_32++;
+	wl->tx_security_seq_16 = seq;
+
 	/* get header len */
 	if (info->control.hw_key &&
 	    info->control.hw_key->alg == ALG_TKIP)
-- 
1.5.6.5


^ permalink raw reply related

* [PATCH 02/13] wl1271: Correction to TX block allocation calculation
From: Luciano Coelho @ 2009-08-27 20:59 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, juuso.oikarinen, kalle.valo
In-Reply-To: <1251406807-31495-1-git-send-email-luciano.coelho@nokia.com>

From: Juuso Oikarinen <juuso.oikarinen@nokia.com>

Correct the TX path implementation to allocate sufficient blocks in the
firmware for TX packets.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_tx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c
index ff22125..0c19688 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.c
@@ -58,7 +58,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra)
 	/* approximate the number of blocks required for this packet
 	   in the firmware */
 	/* FIXME: try to figure out what is done here and make it cleaner */
-	total_blocks = (skb->len) >> TX_HW_BLOCK_SHIFT_DIV;
+	total_blocks = (total_len) >> TX_HW_BLOCK_SHIFT_DIV;
 	excluded = (total_blocks << 2) + (skb->len & 0xff) + 34;
 	total_blocks += (excluded > 252) ? 2 : 1;
 	total_blocks += TX_HW_BLOCK_SPARE;
-- 
1.5.6.5


^ permalink raw reply related

* [PATCH 00/13] wl1271: patch set with various improvements
From: Luciano Coelho @ 2009-08-27 20:59 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, juuso.oikarinen, kalle.valo

Hi John,

Here is a bunch of patches with some improvements to the wl1271 driver.  A few
of them fix some issues with TX, some workaround for problems we have
identified and other general improvements.  I'm also adding Juuso Oikarinen as
one of the module authors, since he's one of the main wl1271 developers as
well.

Cheers,
Luca.

Juuso Oikarinen (11):
  wl1271: Correction to TX block allocation calculation
  wl1271: Security sequence number handling for TX (for WPA)
  wl1271: Correct TKIP header space handling in TX path
  wl1271: Implement delayed entry into ELP
  wl1271: mask aid bits 14 and 15 in ps-poll template
  wl1271: Implementation for SPI busy word checking
  wl1271: Configure rate policies based on AP rates
  wl1271: Update join usage
  wl1271: Corrections to TX path
  wl1271: use workqueue provided by mac80211 instead of the default
  wl1271: Clear probe-request template after scan

Luciano Coelho (2):
  wl1271: remove unecessary qual parameter from rx status
  wl1271: added Juuso Oikarinen as module author

 drivers/net/wireless/wl12xx/wl1271.h       |   35 +++++++++-
 drivers/net/wireless/wl12xx/wl1271_acx.c   |    4 +-
 drivers/net/wireless/wl12xx/wl1271_acx.h   |    3 +-
 drivers/net/wireless/wl12xx/wl1271_cmd.c   |   31 +++++----
 drivers/net/wireless/wl12xx/wl1271_cmd.h   |    6 +-
 drivers/net/wireless/wl12xx/wl1271_event.c |    4 +
 drivers/net/wireless/wl12xx/wl1271_init.c  |    2 +-
 drivers/net/wireless/wl12xx/wl1271_main.c  |  105 ++++++++++++++++++++++------
 drivers/net/wireless/wl12xx/wl1271_ps.c    |   46 +++++++++----
 drivers/net/wireless/wl12xx/wl1271_ps.h    |    2 +-
 drivers/net/wireless/wl12xx/wl1271_rx.c    |    6 --
 drivers/net/wireless/wl12xx/wl1271_spi.c   |   69 ++++++++++++++++++-
 drivers/net/wireless/wl12xx/wl1271_tx.c    |   48 +++++++++----
 13 files changed, 275 insertions(+), 86 deletions(-)


^ permalink raw reply

* [PATCH v2] b43: Implement antenna diversity support for LP-PHY
From: Gábor Stefanik @ 2009-08-27 20:49 UTC (permalink / raw)
  To: John Linville, Michael Buesch, Larry Finger, Mark Huijgen
  Cc: Broadcom Wireless, linux-wireless

The A/G-PHY changes are fallout fixes from the enum change,
which in turn allows the LP-PHY code to be much simpler.
The antenna_to_phyctl change is a fix for a potential
existing bug that this patch may otherwise trigger.

Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
---
v2: Fix a typo.

 drivers/net/wireless/b43/main.c       |    3 ++-
 drivers/net/wireless/b43/phy_a.c      |    2 +-
 drivers/net/wireless/b43/phy_common.h |   10 +++++-----
 drivers/net/wireless/b43/phy_g.c      |    2 +-
 drivers/net/wireless/b43/phy_lp.c     |    9 ++++++++-
 5 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 289e06c..3b038c9 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
 		return B43_TXH_PHY_ANT2;
 	case B43_ANTENNA3:
 		return B43_TXH_PHY_ANT3;
-	case B43_ANTENNA_AUTO:
+	case B43_ANTENNA_AUTO0:
+	case B43_ANTENNA_AUTO1:
 		return B43_TXH_PHY_ANT01AUTO;
 	}
 	B43_WARN_ON(1);
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 816e028..809ec97 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 
 	tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
 	tmp &= ~B43_PHY_BBANDCFG_RXANT;
-	tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+	tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 	    << B43_PHY_BBANDCFG_RXANT_SHIFT;
 	b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index b47a0f5..28e3846 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -49,11 +49,11 @@ enum b43_interference_mitigation {
 
 /* Antenna identifiers */
 enum {
-	B43_ANTENNA0,		/* Antenna 0 */
-	B43_ANTENNA1,		/* Antenna 0 */
-	B43_ANTENNA_AUTO1,	/* Automatic, starting with antenna 1 */
-	B43_ANTENNA_AUTO0,	/* Automatic, starting with antenna 0 */
-	B43_ANTENNA2,
+	B43_ANTENNA0 = 0,	/* Antenna 0 */
+	B43_ANTENNA1 = 1,	/* Antenna 1 */
+	B43_ANTENNA_AUTO0 = 2,	/* Automatic, starting with antenna 0 */
+	B43_ANTENNA_AUTO1 = 3,	/* Automatic, starting with antenna 1 */
+	B43_ANTENNA2 = 4,
 	B43_ANTENNA3 = 8,
 
 	B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index c6c9d2f..c6d639d 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 
 	tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
 	tmp &= ~B43_PHY_BBANDCFG_RXANT;
-	tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+	tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 			<< B43_PHY_BBANDCFG_RXANT_SHIFT;
 	b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index 837d952..fded6e5 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -2204,7 +2204,14 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
 
 static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 {
-	//TODO
+	if (dev->phy.rev >= 2)
+		return; // rev2+ doesn't support antenna diversity
+
+	if (B43_WARN_ON(antenna > B43_ANTENNA_AUTO1))
+		return;
+
+	b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFD, antenna & 0x2);
+	b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFE, antenna & 0x1);
 }
 
 static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)
-- 
1.6.2.4




^ permalink raw reply related

* Re: [PATCH] b43: Implement antenna diversity support for LP-PHY
From: Gábor Stefanik @ 2009-08-27 20:41 UTC (permalink / raw)
  To: Michael Buesch
  Cc: John Linville, Larry Finger, Mark Huijgen, Broadcom Wireless,
	linux-wireless
In-Reply-To: <200908272231.19632.mb@bu3sch.de>

2009/8/27 Michael Buesch <mb@bu3sch.de>:
> On Thursday 27 August 2009 20:56:22 Gábor Stefanik wrote:
>> The A/G-PHY changes are fallout fixes from the enum change,
>> which in turn allows the LP-PHY code to be much simpler.
>> The antenna_to_phyctl change is a fix for a potential
>> existing bug that this patch may otherwise trigger.
>>
>> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
>> ---
>> Note that according to recent spec changes, the A/G-PHY
>> antenna diversity routines also need to be updated.
>> However, I'm not lumping those changes into this patch
>> (this is for LP-PHY).
>>
>>  drivers/net/wireless/b43/main.c       |    3 ++-
>>  drivers/net/wireless/b43/phy_a.c      |    2 +-
>>  drivers/net/wireless/b43/phy_common.h |   10 +++++-----
>>  drivers/net/wireless/b43/phy_g.c      |    2 +-
>>  drivers/net/wireless/b43/phy_lp.c     |   11 ++++++++++-
>>  5 files changed, 19 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
>> index 289e06c..3b038c9 100644
>> --- a/drivers/net/wireless/b43/main.c
>> +++ b/drivers/net/wireless/b43/main.c
>> @@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
>>               return B43_TXH_PHY_ANT2;
>>       case B43_ANTENNA3:
>>               return B43_TXH_PHY_ANT3;
>> -     case B43_ANTENNA_AUTO:
>> +     case B43_ANTENNA_AUTO0:
>> +     case B43_ANTENNA_AUTO1:
>>               return B43_TXH_PHY_ANT01AUTO;
>>       }
>>       B43_WARN_ON(1);
>> diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
>> index 816e028..809ec97 100644
>> --- a/drivers/net/wireless/b43/phy_a.c
>> +++ b/drivers/net/wireless/b43/phy_a.c
>> @@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
>>
>>       tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
>>       tmp &= ~B43_PHY_BBANDCFG_RXANT;
>> -     tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
>> +     tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
>>           << B43_PHY_BBANDCFG_RXANT_SHIFT;
>>       b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
>>
>> diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
>> index b47a0f5..28e3846 100644
>> --- a/drivers/net/wireless/b43/phy_common.h
>> +++ b/drivers/net/wireless/b43/phy_common.h
>> @@ -49,11 +49,11 @@ enum b43_interference_mitigation {
>>
>>  /* Antenna identifiers */
>>  enum {
>> -     B43_ANTENNA0,           /* Antenna 0 */
>> -     B43_ANTENNA1,           /* Antenna 0 */
>> -     B43_ANTENNA_AUTO1,      /* Automatic, starting with antenna 1 */
>> -     B43_ANTENNA_AUTO0,      /* Automatic, starting with antenna 0 */
>> -     B43_ANTENNA2,
>> +     B43_ANTENNA0 = 0,       /* Antenna 0 */
>> +     B43_ANTENNA1 = 1,       /* Antenna 1 */
>> +     B43_ANTENNA_AUTO0 = 2,  /* Automatic, starting with antenna 0 */
>> +     B43_ANTENNA_AUTO1 = 3,  /* Automatic, starting with antenna 1 */
>> +     B43_ANTENNA2 = 4,
>>       B43_ANTENNA3 = 8,
>>
>>       B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
>> diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
>> index c6c9d2f..c6d639d 100644
>> --- a/drivers/net/wireless/b43/phy_g.c
>> +++ b/drivers/net/wireless/b43/phy_g.c
>> @@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
>>
>>       tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
>>       tmp &= ~B43_PHY_BBANDCFG_RXANT;
>> -     tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
>> +     tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
>>                       << B43_PHY_BBANDCFG_RXANT_SHIFT;
>>       b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
>>
>> diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
>> index 837d952..055c0f7 100644
>> --- a/drivers/net/wireless/b43/phy_lp.c
>> +++ b/drivers/net/wireless/b43/phy_lp.c
>> @@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
>>
>>  static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
>>  {
>> -     //TODO
>> +     int autodiv = ;
>
> Does this compile?

That's a typo. Also, the autodiv variable shouldn't be there at all.
Will respin.

>
>> +
>> +     if (dev->phy.rev >= 2)
>> +             return; // rev2+ doesn't support antenna diversity
>> +
>> +     if (B43_WARN_ON(antenna > B43_ANTENNA_AUTO1))
>> +             return;
>> +
>> +     b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFD, antenna & 0x2);
>> +     b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFE, antenna & 0x1);
>>  }
>>
>>  static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)
>
>
>
> --
> Greetings, Michael.
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

^ permalink raw reply

* Re: [PATCH] b43: Implement antenna diversity support for LP-PHY
From: Michael Buesch @ 2009-08-27 20:31 UTC (permalink / raw)
  To: Gábor Stefanik
  Cc: John Linville, Larry Finger, Mark Huijgen, Broadcom Wireless,
	linux-wireless
In-Reply-To: <4A96D6D6.3050201@gmail.com>

On Thursday 27 August 2009 20:56:22 Gábor Stefanik wrote:
> The A/G-PHY changes are fallout fixes from the enum change,
> which in turn allows the LP-PHY code to be much simpler.
> The antenna_to_phyctl change is a fix for a potential
> existing bug that this patch may otherwise trigger.
> 
> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
> ---
> Note that according to recent spec changes, the A/G-PHY
> antenna diversity routines also need to be updated.
> However, I'm not lumping those changes into this patch
> (this is for LP-PHY).
> 
>  drivers/net/wireless/b43/main.c       |    3 ++-
>  drivers/net/wireless/b43/phy_a.c      |    2 +-
>  drivers/net/wireless/b43/phy_common.h |   10 +++++-----
>  drivers/net/wireless/b43/phy_g.c      |    2 +-
>  drivers/net/wireless/b43/phy_lp.c     |   11 ++++++++++-
>  5 files changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
> index 289e06c..3b038c9 100644
> --- a/drivers/net/wireless/b43/main.c
> +++ b/drivers/net/wireless/b43/main.c
> @@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
>  		return B43_TXH_PHY_ANT2;
>  	case B43_ANTENNA3:
>  		return B43_TXH_PHY_ANT3;
> -	case B43_ANTENNA_AUTO:
> +	case B43_ANTENNA_AUTO0:
> +	case B43_ANTENNA_AUTO1:
>  		return B43_TXH_PHY_ANT01AUTO;
>  	}
>  	B43_WARN_ON(1);
> diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
> index 816e028..809ec97 100644
> --- a/drivers/net/wireless/b43/phy_a.c
> +++ b/drivers/net/wireless/b43/phy_a.c
> @@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
>  
>  	tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
>  	tmp &= ~B43_PHY_BBANDCFG_RXANT;
> -	tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
> +	tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
>  	    << B43_PHY_BBANDCFG_RXANT_SHIFT;
>  	b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
>  
> diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
> index b47a0f5..28e3846 100644
> --- a/drivers/net/wireless/b43/phy_common.h
> +++ b/drivers/net/wireless/b43/phy_common.h
> @@ -49,11 +49,11 @@ enum b43_interference_mitigation {
>  
>  /* Antenna identifiers */
>  enum {
> -	B43_ANTENNA0,		/* Antenna 0 */
> -	B43_ANTENNA1,		/* Antenna 0 */
> -	B43_ANTENNA_AUTO1,	/* Automatic, starting with antenna 1 */
> -	B43_ANTENNA_AUTO0,	/* Automatic, starting with antenna 0 */
> -	B43_ANTENNA2,
> +	B43_ANTENNA0 = 0,	/* Antenna 0 */
> +	B43_ANTENNA1 = 1,	/* Antenna 1 */
> +	B43_ANTENNA_AUTO0 = 2,	/* Automatic, starting with antenna 0 */
> +	B43_ANTENNA_AUTO1 = 3,	/* Automatic, starting with antenna 1 */
> +	B43_ANTENNA2 = 4,
>  	B43_ANTENNA3 = 8,
>  
>  	B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
> diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
> index c6c9d2f..c6d639d 100644
> --- a/drivers/net/wireless/b43/phy_g.c
> +++ b/drivers/net/wireless/b43/phy_g.c
> @@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
>  
>  	tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
>  	tmp &= ~B43_PHY_BBANDCFG_RXANT;
> -	tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
> +	tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
>  			<< B43_PHY_BBANDCFG_RXANT_SHIFT;
>  	b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
>  
> diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
> index 837d952..055c0f7 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
>  
>  static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
>  {
> -	//TODO
> +	int autodiv = ;

Does this compile?

> +
> +	if (dev->phy.rev >= 2)
> +		return; // rev2+ doesn't support antenna diversity
> +
> +	if (B43_WARN_ON(antenna > B43_ANTENNA_AUTO1))
> +		return;
> +
> +	b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFD, antenna & 0x2);
> +	b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFE, antenna & 0x1);
>  }
>  
>  static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)



-- 
Greetings, Michael.

^ permalink raw reply

* Re: [PATCH 4/4] ath5k: add hardware CCMP encyption support
From: Bob Copeland @ 2009-08-27 19:17 UTC (permalink / raw)
  To: Pavel Roskin
  Cc: linville, jirislaby, mickflemm, lrodriguez, linux-wireless,
	ath5k-devel
In-Reply-To: <1251338971.17295.17.camel@mj>

Subject: [PATCH] ath5k: clarify srev comparison for CCMP check

As Pavel Roskin noted, the check for mac version as copied from
legacy_hal made no sense.  This replaces it with the equivalent
and makes up a suitable #define for the mac version legacy_hal
checked.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
---

On Wed, Aug 26, 2009 at 10:09:31PM -0400, Pavel Roskin wrote:
> On Mon, 2009-08-24 at 23:00 -0400, Bob Copeland wrote:
> > +	ah->ah_aes_support =
> > +		(ee->ee_version >= AR5K_EEPROM_VERSION_5_0 &&
> > +		 !AR5K_EEPROM_AES_DIS(ee->ee_misc5) &&
> > +		 (ah->ah_mac_version > (AR5K_SREV_AR5212 >> 4) ||
> > +		  (ah->ah_mac_version == (AR5K_SREV_AR5212 >> 4) &&
> > +		   ah->ah_mac_revision >= (AR5K_SREV_AR5211 >> 4))));
> 
> The above use of ah->ah_mac_revision is clearly incorrect.  You are
> comparing a revision with a symbol for a version.
> 
> I suggest that you use ah_mac_srev instead.  Before this patch,
> ah_mac_revision was a write-only variable and was a good candidate for
> removal.
> 
> The last three quoted lines are equivalent to (ah->ah_mac_srev >= 0x54)

Ok, here's a fixup.  I'm not sure if 0x54 was really intended since we
don't know what srev that is, but this assumes legacy hal is correct.

 drivers/net/wireless/ath/ath5k/ath5k.h  |    1 +
 drivers/net/wireless/ath/ath5k/attach.c |    7 ++-----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index cdc79cd..1275ba0 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -306,6 +306,7 @@ struct ath5k_srev_name {
 #define AR5K_SREV_AR5311B	0x30 /* Spirit */
 #define AR5K_SREV_AR5211	0x40 /* Oahu */
 #define AR5K_SREV_AR5212	0x50 /* Venice */
+#define AR5K_SREV_AR5212_V4	0x54 /* ??? */
 #define AR5K_SREV_AR5213	0x55 /* ??? */
 #define AR5K_SREV_AR5213A	0x59 /* Hainan */
 #define AR5K_SREV_AR2413	0x78 /* Griffin lite */
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index 109ab7b..4819f39 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -318,12 +318,9 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 
 	/* Crypto settings */
 	ee = &ah->ah_capabilities.cap_eeprom;
-	ah->ah_aes_support =
+	ah->ah_aes_support = srev >= AR5K_SREV_AR5212_V4 &&
 		(ee->ee_version >= AR5K_EEPROM_VERSION_5_0 &&
-		 !AR5K_EEPROM_AES_DIS(ee->ee_misc5) &&
-		 (ah->ah_mac_version > (AR5K_SREV_AR5212 >> 4) ||
-		  (ah->ah_mac_version == (AR5K_SREV_AR5212 >> 4) &&
-		   ah->ah_mac_revision >= (AR5K_SREV_AR5211 >> 4))));
+		 !AR5K_EEPROM_AES_DIS(ee->ee_misc5));
 
 	if (srev >= AR5K_SREV_AR2414) {
 		ah->ah_combined_mic = true;
-- 
1.6.2.5



-- 
Bob Copeland %% www.bobcopeland.com


^ permalink raw reply related

* [PATCH] b43: Implement antenna diversity support for LP-PHY
From: Gábor Stefanik @ 2009-08-27 18:56 UTC (permalink / raw)
  To: John Linville, Michael Buesch, Larry Finger, Mark Huijgen
  Cc: Broadcom Wireless, linux-wireless

The A/G-PHY changes are fallout fixes from the enum change,
which in turn allows the LP-PHY code to be much simpler.
The antenna_to_phyctl change is a fix for a potential
existing bug that this patch may otherwise trigger.

Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
---
Note that according to recent spec changes, the A/G-PHY
antenna diversity routines also need to be updated.
However, I'm not lumping those changes into this patch
(this is for LP-PHY).

 drivers/net/wireless/b43/main.c       |    3 ++-
 drivers/net/wireless/b43/phy_a.c      |    2 +-
 drivers/net/wireless/b43/phy_common.h |   10 +++++-----
 drivers/net/wireless/b43/phy_g.c      |    2 +-
 drivers/net/wireless/b43/phy_lp.c     |   11 ++++++++++-
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 289e06c..3b038c9 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
 		return B43_TXH_PHY_ANT2;
 	case B43_ANTENNA3:
 		return B43_TXH_PHY_ANT3;
-	case B43_ANTENNA_AUTO:
+	case B43_ANTENNA_AUTO0:
+	case B43_ANTENNA_AUTO1:
 		return B43_TXH_PHY_ANT01AUTO;
 	}
 	B43_WARN_ON(1);
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 816e028..809ec97 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 
 	tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
 	tmp &= ~B43_PHY_BBANDCFG_RXANT;
-	tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+	tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 	    << B43_PHY_BBANDCFG_RXANT_SHIFT;
 	b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index b47a0f5..28e3846 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -49,11 +49,11 @@ enum b43_interference_mitigation {
 
 /* Antenna identifiers */
 enum {
-	B43_ANTENNA0,		/* Antenna 0 */
-	B43_ANTENNA1,		/* Antenna 0 */
-	B43_ANTENNA_AUTO1,	/* Automatic, starting with antenna 1 */
-	B43_ANTENNA_AUTO0,	/* Automatic, starting with antenna 0 */
-	B43_ANTENNA2,
+	B43_ANTENNA0 = 0,	/* Antenna 0 */
+	B43_ANTENNA1 = 1,	/* Antenna 1 */
+	B43_ANTENNA_AUTO0 = 2,	/* Automatic, starting with antenna 0 */
+	B43_ANTENNA_AUTO1 = 3,	/* Automatic, starting with antenna 1 */
+	B43_ANTENNA2 = 4,
 	B43_ANTENNA3 = 8,
 
 	B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index c6c9d2f..c6d639d 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 
 	tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
 	tmp &= ~B43_PHY_BBANDCFG_RXANT;
-	tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+	tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 			<< B43_PHY_BBANDCFG_RXANT_SHIFT;
 	b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index 837d952..055c0f7 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
 
 static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 {
-	//TODO
+	int autodiv = ;
+
+	if (dev->phy.rev >= 2)
+		return; // rev2+ doesn't support antenna diversity
+
+	if (B43_WARN_ON(antenna > B43_ANTENNA_AUTO1))
+		return;
+
+	b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFD, antenna & 0x2);
+	b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFE, antenna & 0x1);
 }
 
 static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)
-- 
1.6.2.4




^ permalink raw reply related

* Re: [PATCH] rt2x00: Cleanup rt2x00mac_bss_info_changed()
From: Ivo van Doorn @ 2009-08-27 18:49 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless
In-Reply-To: <1251358806.20531.9.camel@johannes.local>

On Thursday 27 August 2009, Johannes Berg wrote:
> On Wed, 2009-08-26 at 21:04 +0200, Ivo van Doorn wrote:
> > Since patch "rt2x00: bss_info_changed() callback is allowed to sleep" the
> > variable delayed wasn't used anymore. This means it can be removed
> > along with the call to schedule_work which depended on that variable.
> 
> I just wanted to say thanks for doing all the cleanups. It's really nice
> to see all my work on making callbacks non-atomic pay off in that way :)

yeah those kind of optimizations really help with the drivers. :)

I still have some other cleanups, but this was the easiest and most obvious one,
the others involve changing locking mechanisms so need better verification.

Ivo


^ permalink raw reply

* Re: [RFC/RFT] b43: Implement antenna diversity support for LP-PHY
From: Larry Finger @ 2009-08-27 18:39 UTC (permalink / raw)
  To: Gábor Stefanik
  Cc: John Linville, Michael Buesch, Mark Huijgen, Broadcom Wireless,
	linux-wireless
In-Reply-To: <4A96CE28.3040800@gmail.com>

Gábor Stefanik wrote:
> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
> ---
> This intentionally deviates slightly from the spec (writing
> the antenna ID in one pass instead of two) - please test if
> this works. (I don't have the tools to test if it actually
> selects the right antenna.)
> 
> The A/G-PHY changes are fallout fixes from the enum change,
> which in turn allows the LP-PHY code to be much simpler.
> The antenna_to_phyctl change is a fix for a potential
> existing bug that this patch may otherwise trigger.
> 
> drivers/net/wireless/b43/main.c       |    3 ++-
> drivers/net/wireless/b43/phy_a.c      |    2 +-
> drivers/net/wireless/b43/phy_common.h |   10 +++++-----
> drivers/net/wireless/b43/phy_g.c      |    2 +-
> drivers/net/wireless/b43/phy_lp.c     |   11 ++++++++++-
> 5 files changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/main.c
> b/drivers/net/wireless/b43/main.c
> index 289e06c..3b038c9 100644
> --- a/drivers/net/wireless/b43/main.c
> +++ b/drivers/net/wireless/b43/main.c
> @@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
>         return B43_TXH_PHY_ANT2;
>     case B43_ANTENNA3:
>         return B43_TXH_PHY_ANT3;
> -    case B43_ANTENNA_AUTO:
> +    case B43_ANTENNA_AUTO0:
> +    case B43_ANTENNA_AUTO1:
>         return B43_TXH_PHY_ANT01AUTO;
>     }
>     B43_WARN_ON(1);
> diff --git a/drivers/net/wireless/b43/phy_a.c
> b/drivers/net/wireless/b43/phy_a.c
> index 816e028..809ec97 100644
> --- a/drivers/net/wireless/b43/phy_a.c
> +++ b/drivers/net/wireless/b43/phy_a.c
> @@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct
> b43_wldev *dev, int antenna)
> 
>     tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
>     tmp &= ~B43_PHY_BBANDCFG_RXANT;
> -    tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
> +    tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
>         << B43_PHY_BBANDCFG_RXANT_SHIFT;
>     b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
> 
> diff --git a/drivers/net/wireless/b43/phy_common.h
> b/drivers/net/wireless/b43/phy_common.h
> index b47a0f5..a6a90df 100644
> --- a/drivers/net/wireless/b43/phy_common.h
> +++ b/drivers/net/wireless/b43/phy_common.h
> @@ -49,11 +49,11 @@ enum b43_interference_mitigation {
> 
> /* Antenna identifiers */
> enum {
> -    B43_ANTENNA0,        /* Antenna 0 */
> -    B43_ANTENNA1,        /* Antenna 0 */
> -    B43_ANTENNA_AUTO1,    /* Automatic, starting with antenna 1 */
> -    B43_ANTENNA_AUTO0,    /* Automatic, starting with antenna 0 */
> -    B43_ANTENNA2,
> +    B43_ANTENNA0 = 0,    /* Antenna 0 */
> +    B43_ANTENNA1 = 1,    /* Antenna 1 */
> +    B43_ANTENNA_AUTO0 = 2,    /* Automatic, starting with antenna 0 */
> +    B43_ANTENNA_AUTO1 = 3,    /* Automatic, starting with antenna 1 */
> +    B43_ANTENNA2 = 4,
>     B43_ANTENNA3 = 8,
> 
>     B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
> diff --git a/drivers/net/wireless/b43/phy_g.c
> b/drivers/net/wireless/b43/phy_g.c
> index c6c9d2f..c6d639d 100644
> --- a/drivers/net/wireless/b43/phy_g.c
> +++ b/drivers/net/wireless/b43/phy_g.c
> @@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct
> b43_wldev *dev, int antenna)
> 
>     tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
>     tmp &= ~B43_PHY_BBANDCFG_RXANT;
> -    tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
> +    tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
>             << B43_PHY_BBANDCFG_RXANT_SHIFT;
>     b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
> 
> diff --git a/drivers/net/wireless/b43/phy_lp.c
> b/drivers/net/wireless/b43/phy_lp.c
> index 837d952..457357a 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
> 
> static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
> {
> -    //TODO
> +    int autodiv = ;
> +
> +    if (dev->phy.rev >= 2)
> +        return; // rev2+ doesn't support antenna diversity
> +
> +    if (B43_WARN_ON(antenna > B43_ANTENNA_AUTO1))
> +        return;
> +
> +    /* NOTE: The spec breaks this up into 2 writes - please test */
> +    b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFC, antenna);
> }
> 
> static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)

Sorry, but the spec for this routine was updated 1.5 hours ago.

As to the two-stage write, the spec does match the original code. Who
knows what happens in the device. As it adds little to the routine, I
would suggest implementing it the way the original code does.

Larry

^ permalink raw reply

* Re: [ath5k-devel] [PATCH 1/2] ath5k: fix uninitialized value use in ath5k_eeprom_read_turbo_modes()
From: Luis R. Rodriguez @ 2009-08-27 18:25 UTC (permalink / raw)
  To: Bob Copeland
  Cc: Nick Kossifidis, Pavel Roskin, ath5k-devel, linux-wireless,
	John W. Linville
In-Reply-To: <b6c5339f0908271117q3a893d4dma9df0ac441091dbf@mail.gmail.com>

On Thu, Aug 27, 2009 at 11:17 AM, Bob Copeland<bcopeland@gmail.com> wrote:
> On Thu, Aug 27, 2009 at 8:58 AM, Nick Kossifidis<mickflemm@gmail.com> wrote:
>> 2009/8/27 Pavel Roskin <proski@gnu.org>:
>
>> Current code works fine (i 've checked it against various cards),
>> there is nothing wrong
>> with having another function for reading turbo modes, i find it's
>> cleaner that way.
>
> Well, we also don't use the turbo modes at all and that's where the
> error is (IIRC) so it shouldn't have any impact. :)

Again, why don't we just remove all that fucking turbo cruft?

  Luis

^ permalink raw reply

* Re: [PATCH] iw: fix NL80211_STA_INFO_PLINK_STATE printing in station dump
From: Johannes Berg @ 2009-08-27 18:22 UTC (permalink / raw)
  To: Brian Cavagnolo; +Cc: linux-wireless
In-Reply-To: <1251396920-3954-1-git-send-email-brian@cozybit.com>

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

On Thu, 2009-08-27 at 11:15 -0700, Brian Cavagnolo wrote:
> NL80211_STA_INFO_PLINK_STATE is a u8, not a u16.  This bug was causing
> unexpected output on big endian machines.

Applied, thanks.

johannes

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

^ permalink raw reply

* [RFC/RFT] b43: Implement antenna diversity support for LP-PHY
From: Gábor Stefanik @ 2009-08-27 18:19 UTC (permalink / raw)
  To: John Linville, Michael Buesch, Larry Finger, Mark Huijgen
  Cc: Broadcom Wireless, linux-wireless

Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
---
This intentionally deviates slightly from the spec (writing
the antenna ID in one pass instead of two) - please test if
this works. (I don't have the tools to test if it actually
selects the right antenna.)

The A/G-PHY changes are fallout fixes from the enum change,
which in turn allows the LP-PHY code to be much simpler.
The antenna_to_phyctl change is a fix for a potential
existing bug that this patch may otherwise trigger.

 drivers/net/wireless/b43/main.c       |    3 ++-
 drivers/net/wireless/b43/phy_a.c      |    2 +-
 drivers/net/wireless/b43/phy_common.h |   10 +++++-----
 drivers/net/wireless/b43/phy_g.c      |    2 +-
 drivers/net/wireless/b43/phy_lp.c     |   11 ++++++++++-
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 289e06c..3b038c9 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
 		return B43_TXH_PHY_ANT2;
 	case B43_ANTENNA3:
 		return B43_TXH_PHY_ANT3;
-	case B43_ANTENNA_AUTO:
+	case B43_ANTENNA_AUTO0:
+	case B43_ANTENNA_AUTO1:
 		return B43_TXH_PHY_ANT01AUTO;
 	}
 	B43_WARN_ON(1);
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 816e028..809ec97 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 
 	tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
 	tmp &= ~B43_PHY_BBANDCFG_RXANT;
-	tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+	tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 	    << B43_PHY_BBANDCFG_RXANT_SHIFT;
 	b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index b47a0f5..a6a90df 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -49,11 +49,11 @@ enum b43_interference_mitigation {
 
 /* Antenna identifiers */
 enum {
-	B43_ANTENNA0,		/* Antenna 0 */
-	B43_ANTENNA1,		/* Antenna 0 */
-	B43_ANTENNA_AUTO1,	/* Automatic, starting with antenna 1 */
-	B43_ANTENNA_AUTO0,	/* Automatic, starting with antenna 0 */
-	B43_ANTENNA2,
+	B43_ANTENNA0 = 0,	/* Antenna 0 */
+	B43_ANTENNA1 = 1,	/* Antenna 1 */
+	B43_ANTENNA_AUTO0 = 2,	/* Automatic, starting with antenna 0 */
+	B43_ANTENNA_AUTO1 = 3,	/* Automatic, starting with antenna 1 */
+	B43_ANTENNA2 = 4,
 	B43_ANTENNA3 = 8,
 
 	B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index c6c9d2f..c6d639d 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 
 	tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
 	tmp &= ~B43_PHY_BBANDCFG_RXANT;
-	tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
+	tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
 			<< B43_PHY_BBANDCFG_RXANT_SHIFT;
 	b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
 
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index 837d952..457357a 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
 
 static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
 {
-	//TODO
+	int autodiv = ;
+
+	if (dev->phy.rev >= 2)
+		return; // rev2+ doesn't support antenna diversity
+
+	if (B43_WARN_ON(antenna > B43_ANTENNA_AUTO1))
+		return;
+
+	/* NOTE: The spec breaks this up into 2 writes - please test */
+	b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFC, antenna);
 }
 
 static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)
-- 
1.6.2.4




^ permalink raw reply related

* Re: [ath5k-devel] [PATCH 1/2] ath5k: fix uninitialized value use in ath5k_eeprom_read_turbo_modes()
From: Bob Copeland @ 2009-08-27 18:17 UTC (permalink / raw)
  To: Nick Kossifidis
  Cc: Pavel Roskin, ath5k-devel, linux-wireless, John W. Linville
In-Reply-To: <40f31dec0908270558y2a3a565bvcc7e470b7f2644c6@mail.gmail.com>

On Thu, Aug 27, 2009 at 8:58 AM, Nick Kossifidis<mickflemm@gmail.com> wrote:
> 2009/8/27 Pavel Roskin <proski@gnu.org>:

> Current code works fine (i 've checked it against various cards),
> there is nothing wrong
> with having another function for reading turbo modes, i find it's
> cleaner that way.

Well, we also don't use the turbo modes at all and that's where the
error is (IIRC) so it shouldn't have any impact. :)

-- 
Bob Copeland %% www.bobcopeland.com

^ permalink raw reply

* [PATCH] iw: fix NL80211_STA_INFO_PLINK_STATE printing in station dump
From: Brian Cavagnolo @ 2009-08-27 18:15 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Brian Cavagnolo
In-Reply-To: <iw1>

NL80211_STA_INFO_PLINK_STATE is a u8, not a u16.  This bug was causing
unexpected output on big endian machines.

Signed-off-by: Brian Cavagnolo <brian@cozybit.com>
---
 station.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/station.c b/station.c
index 0fff92d..a4865f9 100644
--- a/station.c
+++ b/station.c
@@ -127,7 +127,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 		printf("\n\tmesh plid:\t%d",
 			nla_get_u16(sinfo[NL80211_STA_INFO_PLID]));
 	if (sinfo[NL80211_STA_INFO_PLINK_STATE]) {
-		switch (nla_get_u16(sinfo[NL80211_STA_INFO_PLINK_STATE])) {
+		switch (nla_get_u8(sinfo[NL80211_STA_INFO_PLINK_STATE])) {
 		case LISTEN:
 			strcpy(state_name, "LISTEN");
 			break;
-- 
1.6.0.4


^ permalink raw reply related

* Re: [PATCH] rndis_wlan: increase scan timer delay
From: Jussi Kivilinna @ 2009-08-27 18:06 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-wireless, John W. Linville
In-Reply-To: <1251382153.11788.3.camel@localhost.localdomain>

Quoting "Dan Williams" <dcbw@redhat.com>:

> On Thu, 2009-08-27 at 13:43 +0300, Jussi Kivilinna wrote:
>> Please, don't merge this after all. Blocks scan too long and breaks
>> NetworkManager/wpa_supplicant.
>
> Hmm, it shouldn't.  I've seen other cards (ath5k a/b/g) take 5 to 8
> seconds to scan when they scan all the bands.  iwlwifi sometimes takes 5
> seconds to scan as well.  That should all be valid.
>

You're right, increasing delay exposed bug that caused reconnects.  
With short delay (re)scans didn't block so long and connection was  
established faster. With 6 sec connection was established eventually.

I'll send bug fix (workaround really, hw sometimes sends extra media  
connect events when setting WPA keys, which needs to be ignored) and  
resend this patch in two patch set after more testing.

-Jussi


^ permalink raw reply

* Re: [PATCH] iwlagn: show_version() displays confusing/wrong firmware version
From: Bjørn Mork @ 2009-08-27 16:50 UTC (permalink / raw)
  To: reinette chatre; +Cc: Zhu, Yi, linux-wireless@vger.kernel.org
In-Reply-To: <1251386952.3805.23.camel@rc-desk>

reinette chatre <reinette.chatre@intel.com> writes:

> Since 2.6.31 is considered a done deal and this is surely not the
> required "earth shattering" fix (see [1]) I cannot push this as a fix
> into Linus's repo at this time. This display problem will not exist in
> 2.6.32.

Ah, I see. Yes, that looks even better.  I feel a bit stupid for not
checking iwlwifi-2.6.git before sending this.  Thanks for your patience.


Bjørn

^ permalink raw reply

* Re: [PATCH] iwlagn: show_version() displays confusing/wrong firmware version
From: reinette chatre @ 2009-08-27 15:29 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: Zhu, Yi, linux-wireless@vger.kernel.org
In-Reply-To: <87r5uxb8fi.fsf@nemi.mork.no>

Hi Bjørn,

On Thu, 2009-08-27 at 08:09 -0700, Bjørn Mork wrote:
> reinette chatre <reinette.chatre@intel.com> writes:
> > Which kernel/repo is your patch based on?
> 
> Oh, sorry for not including that vital information.  I'm afraid it is
> against Linus' tree at 
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> and not any of the wireless/networking trees.

Since 2.6.31 is considered a done deal and this is surely not the
required "earth shattering" fix (see [1]) I cannot push this as a fix
into Linus's repo at this time. This display problem will not exist in
2.6.32.

Reinette

[1] http://article.gmane.org/gmane.linux.kernel.wireless.general/38579


^ permalink raw reply

* Re: [PATCH] iwlagn: show_version() displays confusing/wrong firmware version
From: Bjørn Mork @ 2009-08-27 15:09 UTC (permalink / raw)
  To: reinette chatre; +Cc: Zhu, Yi, linux-wireless@vger.kernel.org
In-Reply-To: <1251385041.3805.17.camel@rc-desk>

reinette chatre <reinette.chatre@intel.com> writes:

> Hi Bjørn,
>
> Which kernel/repo is your patch based on?

Oh, sorry for not including that vital information.  I'm afraid it is
against Linus' tree at 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
and not any of the wireless/networking trees.

"git log drivers/net/wireless/iwlwifi/iwl-agn.c" shows this as the last
commit affecting iwl-agn.c before my change:

commit 872ed1902f511a8947021c562f5728a5bf0640b5
Author: Reinette Chatre <reinette.chatre@intel.com>
Date:   Thu Jul 9 10:33:37 2009 -0700

    iwlwifi: only show active power level via sysfs
    


Bjørn

^ permalink raw reply

* [PATCH v2] b43: Enable LP-PHY support by default and remove Kconfig warning
From: Gábor Stefanik @ 2009-08-27 15:24 UTC (permalink / raw)
  To: John Linville, Michael Buesch, Larry Finger, Mark Huijgen
  Cc: Broadcom Wireless, linux-wireless

The most common LP-PHY device, BCM4312, is now fully functional.
So, no need to say "probably won't work for you" anymore.
It's also not "for debuggers and developers only", as it is
perfectly usable for end-users now (at least for BCM4312).

Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
---
This replaces the "remove scary message" patch.

V2: Fix pastebin damage.

 drivers/net/wireless/b43/Kconfig |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 237b1aa..2af3b35 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -82,15 +82,13 @@ config B43_NPHY
 config B43_PHY_LP
 	bool "Support for low-power (LP-PHY) devices (EXPERIMENTAL)"
 	depends on B43 && EXPERIMENTAL
+	default y
 	---help---
 	  Support for the LP-PHY.
 	  The LP-PHY is a low-power PHY built into some notebooks
 	  and embedded devices. It supports 802.11a/g
 	  (802.11a support is optional, and currently disabled).
 
-	  This is heavily experimental, and probably will not work for you.
-	  Say N unless you want to help debug the driver.
-
 # This config option automatically enables b43 LEDS support,
 # if it's possible.
 config B43_LEDS
-- 
1.6.2.4



^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox