linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12
@ 2010-03-26 10:53 Luciano Coelho
  2010-03-26 10:53 ` [PATCH 01/24] wl1271: fix wl1271_spi driver name Luciano Coelho
                   ` (24 more replies)
  0 siblings, 25 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Hi John,

Here are 25 more patches for wl1271 which are still pending in our internal
tree.  Please apply. :)

Cheers,
Luca.

Juuso Oikarinen (17):
  wl1271: Clean up RX rate reporting
  wl1271: Add TX rate reporting
  wl1271: Fix memory leaks in SPI initialization
  wl1271: Fix memory leak in scan command handling
  wl1271: Configure clock-request drive mode to open-drain
  wl1271: Fix memory leak in cmd_data_path
  wl1271: Update busyword checking mechanism
  wl1271: Remove device MAC-address randomization
  wl1271: Disable connection monitoring while not associated
  wl1271: Fix ad-hoc mode handling
  wl1271: Update beacon interval properly for ad-hoc
  wl1271: Fix memory leak in firmware crash scenario
  wl1271: Configure probe-request template when associated
  wl1271: Disconnect if PSM entry fails
  wl1271: Configure HW connection monitor
  wl1271: Add keep-alive frame template support
  wl1271: Enable hardware keep alive messages

Luciano Coelho (4):
  wl1271: fix wl1271_spi driver name
  wl1271: wait for join command complete event
  wl1271: wait for disconnect command complete event
  wl1271: remove deprecated usage of RX status noise

Saravanan Dhanabal (1):
  wl1271: Fix msleep() delay while waiting for completion

Teemu Paasikivi (2):
  wl1271: Warnings caused by wrong format specifiers fixed
  wl1271: Removed checking of PSM from handling BSS_LOST_EVENT

 drivers/net/wireless/wl12xx/wl1271.h       |   14 +-
 drivers/net/wireless/wl12xx/wl1271_acx.c   |   73 ++++++++++-
 drivers/net/wireless/wl12xx/wl1271_acx.h   |   33 +++++-
 drivers/net/wireless/wl12xx/wl1271_boot.c  |   14 ++-
 drivers/net/wireless/wl12xx/wl1271_boot.h  |    7 +-
 drivers/net/wireless/wl12xx/wl1271_cmd.c   |   93 +++++++++++--
 drivers/net/wireless/wl12xx/wl1271_cmd.h   |    9 +-
 drivers/net/wireless/wl12xx/wl1271_conf.h  |   35 +++++
 drivers/net/wireless/wl12xx/wl1271_event.c |   40 +-----
 drivers/net/wireless/wl12xx/wl1271_init.c  |   46 +++++--
 drivers/net/wireless/wl12xx/wl1271_main.c  |  198 ++++++++++++++++++++++++----
 drivers/net/wireless/wl12xx/wl1271_rx.c    |   83 +-----------
 drivers/net/wireless/wl12xx/wl1271_rx.h    |    2 +-
 drivers/net/wireless/wl12xx/wl1271_sdio.c  |    4 +-
 drivers/net/wireless/wl12xx/wl1271_spi.c   |   71 ++++-------
 drivers/net/wireless/wl12xx/wl1271_tx.c    |   37 +++--
 drivers/net/wireless/wl12xx/wl1271_tx.h    |    1 +
 17 files changed, 513 insertions(+), 247 deletions(-)


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

* [PATCH 01/24] wl1271: fix wl1271_spi driver name
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 02/24] wl1271: Clean up RX rate reporting Luciano Coelho
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

When forward porting some patches to upstream, there was a mistake and the
wl1271_spi driver name remained, erroneously, as "wl1271".  This patch fixes
that.

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

diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index f44b05a..db6c9f5 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -442,7 +442,7 @@ static int __devexit wl1271_remove(struct spi_device *spi)
 
 static struct spi_driver wl1271_spi_driver = {
 	.driver = {
-		.name		= "wl1271",
+		.name		= "wl1271_spi",
 		.bus		= &spi_bus_type,
 		.owner		= THIS_MODULE,
 	},
-- 
1.6.3.3


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

* [PATCH 02/24] wl1271: Clean up RX rate reporting
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
  2010-03-26 10:53 ` [PATCH 01/24] wl1271: fix wl1271_spi driver name Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 03/24] wl1271: Add TX " Luciano Coelho
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

Clean up the code to convert a firmware rate class index into an index
for the rate configuration table.

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_conf.h |   26 +++++++++
 drivers/net/wireless/wl12xx/wl1271_main.c |   85 +++++++++++++++++++++++++++++
 drivers/net/wireless/wl12xx/wl1271_rx.c   |   76 +-------------------------
 drivers/net/wireless/wl12xx/wl1271_rx.h   |    2 +-
 4 files changed, 114 insertions(+), 75 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_conf.h b/drivers/net/wireless/wl12xx/wl1271_conf.h
index 7fcfe06..f63dd5e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_conf.h
+++ b/drivers/net/wireless/wl12xx/wl1271_conf.h
@@ -66,6 +66,32 @@ enum {
 };
 
 enum {
+	CONF_HW_RXTX_RATE_MCS7 = 0,
+	CONF_HW_RXTX_RATE_MCS6,
+	CONF_HW_RXTX_RATE_MCS5,
+	CONF_HW_RXTX_RATE_MCS4,
+	CONF_HW_RXTX_RATE_MCS3,
+	CONF_HW_RXTX_RATE_MCS2,
+	CONF_HW_RXTX_RATE_MCS1,
+	CONF_HW_RXTX_RATE_MCS0,
+	CONF_HW_RXTX_RATE_54,
+	CONF_HW_RXTX_RATE_48,
+	CONF_HW_RXTX_RATE_36,
+	CONF_HW_RXTX_RATE_24,
+	CONF_HW_RXTX_RATE_22,
+	CONF_HW_RXTX_RATE_18,
+	CONF_HW_RXTX_RATE_12,
+	CONF_HW_RXTX_RATE_11,
+	CONF_HW_RXTX_RATE_9,
+	CONF_HW_RXTX_RATE_6,
+	CONF_HW_RXTX_RATE_5_5,
+	CONF_HW_RXTX_RATE_2,
+	CONF_HW_RXTX_RATE_1,
+	CONF_HW_RXTX_RATE_MAX,
+	CONF_HW_RXTX_RATE_UNSUPPORTED = 0xff
+};
+
+enum {
 	CONF_SG_DISABLE = 0,
 	CONF_SG_PROTECTIVE,
 	CONF_SG_OPPORTUNISTIC
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 3daba6c..49779e5 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1816,6 +1816,36 @@ static struct ieee80211_channel wl1271_channels[] = {
 	{ .hw_value = 13, .center_freq = 2472, .max_power = 25 },
 };
 
+/* mapping to indexes for wl1271_rates */
+const static u8 wl1271_rate_to_idx_2ghz[] = {
+	/* MCS rates are used only with 11n */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS7 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS6 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS5 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS4 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS3 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS2 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS1 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS0 */
+
+	11,                            /* CONF_HW_RXTX_RATE_54   */
+	10,                            /* CONF_HW_RXTX_RATE_48   */
+	9,                             /* CONF_HW_RXTX_RATE_36   */
+	8,                             /* CONF_HW_RXTX_RATE_24   */
+
+	/* TI-specific rate */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_22   */
+
+	7,                             /* CONF_HW_RXTX_RATE_18   */
+	6,                             /* CONF_HW_RXTX_RATE_12   */
+	3,                             /* CONF_HW_RXTX_RATE_11   */
+	5,                             /* CONF_HW_RXTX_RATE_9    */
+	4,                             /* CONF_HW_RXTX_RATE_6    */
+	2,                             /* CONF_HW_RXTX_RATE_5_5  */
+	1,                             /* CONF_HW_RXTX_RATE_2    */
+	0                              /* CONF_HW_RXTX_RATE_1    */
+};
+
 /* can't be const, mac80211 writes to this */
 static struct ieee80211_supported_band wl1271_band_2ghz = {
 	.channels = wl1271_channels,
@@ -1898,6 +1928,35 @@ static struct ieee80211_channel wl1271_channels_5ghz[] = {
 	{ .hw_value = 165, .center_freq = 5825},
 };
 
+/* mapping to indexes for wl1271_rates_5ghz */
+const static u8 wl1271_rate_to_idx_5ghz[] = {
+	/* MCS rates are used only with 11n */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS7 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS6 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS5 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS4 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS3 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS2 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS1 */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_MCS0 */
+
+	7,                             /* CONF_HW_RXTX_RATE_54   */
+	6,                             /* CONF_HW_RXTX_RATE_48   */
+	5,                             /* CONF_HW_RXTX_RATE_36   */
+	4,                             /* CONF_HW_RXTX_RATE_24   */
+
+	/* TI-specific rate */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_22   */
+
+	3,                             /* CONF_HW_RXTX_RATE_18   */
+	2,                             /* CONF_HW_RXTX_RATE_12   */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_11   */
+	1,                             /* CONF_HW_RXTX_RATE_9    */
+	0,                             /* CONF_HW_RXTX_RATE_6    */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_5_5  */
+	CONF_HW_RXTX_RATE_UNSUPPORTED, /* CONF_HW_RXTX_RATE_2    */
+	CONF_HW_RXTX_RATE_UNSUPPORTED  /* CONF_HW_RXTX_RATE_1    */
+};
 
 static struct ieee80211_supported_band wl1271_band_5ghz = {
 	.channels = wl1271_channels_5ghz,
@@ -1906,6 +1965,11 @@ static struct ieee80211_supported_band wl1271_band_5ghz = {
 	.n_bitrates = ARRAY_SIZE(wl1271_rates_5ghz),
 };
 
+const static u8 *wl1271_band_rate_to_idx[] = {
+	[IEEE80211_BAND_2GHZ] = wl1271_rate_to_idx_2ghz,
+	[IEEE80211_BAND_5GHZ] = wl1271_rate_to_idx_5ghz
+};
+
 static const struct ieee80211_ops wl1271_ops = {
 	.start = wl1271_op_start,
 	.stop = wl1271_op_stop,
@@ -1923,6 +1987,27 @@ static const struct ieee80211_ops wl1271_ops = {
 	CFG80211_TESTMODE_CMD(wl1271_tm_cmd)
 };
 
+
+u8 wl1271_rate_to_idx(struct wl1271 *wl, int rate)
+{
+	u8 idx;
+
+	BUG_ON(wl->band >= sizeof(wl1271_band_rate_to_idx)/sizeof(u8 *));
+
+	if (unlikely(rate >= CONF_HW_RXTX_RATE_MAX)) {
+		wl1271_error("Illegal RX rate from HW: %d", rate);
+		return 0;
+	}
+
+	idx = wl1271_band_rate_to_idx[wl->band][rate];
+	if (unlikely(idx == CONF_HW_RXTX_RATE_UNSUPPORTED)) {
+		wl1271_error("Unsupported RX rate from HW: %d", rate);
+		return 0;
+	}
+
+	return idx;
+}
+
 static ssize_t wl1271_sysfs_show_bt_coex_state(struct device *dev,
 					       struct device_attribute *attr,
 					       char *buf)
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index b824c6c..a1a7953 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -41,66 +41,6 @@ static u32 wl1271_rx_get_buf_size(struct wl1271_fw_status *status,
 		RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV;
 }
 
-/* The values of this table must match the wl1271_rates[] array */
-static u8 wl1271_rx_rate_to_idx[] = {
-	/* MCS rates are used only with 11n */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS7 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS6 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS5 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS4 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS3 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS2 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS1 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS0 */
-
-	11,                         /* WL1271_RATE_54   */
-	10,                         /* WL1271_RATE_48   */
-	9,                          /* WL1271_RATE_36   */
-	8,                          /* WL1271_RATE_24   */
-
-	/* TI-specific rate */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_22   */
-
-	7,                          /* WL1271_RATE_18   */
-	6,                          /* WL1271_RATE_12   */
-	3,                          /* WL1271_RATE_11   */
-	5,                          /* WL1271_RATE_9    */
-	4,                          /* WL1271_RATE_6    */
-	2,                          /* WL1271_RATE_5_5  */
-	1,                          /* WL1271_RATE_2    */
-	0                           /* WL1271_RATE_1    */
-};
-
-/* The values of this table must match the wl1271_rates[] array */
-static u8 wl1271_5_ghz_rx_rate_to_idx[] = {
-	/* MCS rates are used only with 11n */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS7 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS6 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS5 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS4 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS3 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS2 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS1 */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_MCS0 */
-
-	7,                          /* WL1271_RATE_54   */
-	6,                          /* WL1271_RATE_48   */
-	5,                          /* WL1271_RATE_36   */
-	4,                          /* WL1271_RATE_24   */
-
-	/* TI-specific rate */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_22   */
-
-	3,                          /* WL1271_RATE_18   */
-	2,                          /* WL1271_RATE_12   */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_11   */
-	1,                          /* WL1271_RATE_9    */
-	0,                          /* WL1271_RATE_6    */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_5_5  */
-	WL1271_RX_RATE_UNSUPPORTED, /* WL1271_RATE_2    */
-	WL1271_RX_RATE_UNSUPPORTED  /* WL1271_RATE_1    */
-};
-
 static void wl1271_rx_status(struct wl1271 *wl,
 			     struct wl1271_rx_descriptor *desc,
 			     struct ieee80211_rx_status *status,
@@ -108,20 +48,8 @@ static void wl1271_rx_status(struct wl1271 *wl,
 {
 	memset(status, 0, sizeof(struct ieee80211_rx_status));
 
-	if ((desc->flags & WL1271_RX_DESC_BAND_MASK) ==
-	    WL1271_RX_DESC_BAND_BG) {
-		status->band = IEEE80211_BAND_2GHZ;
-		status->rate_idx = wl1271_rx_rate_to_idx[desc->rate];
-	} else if ((desc->flags & WL1271_RX_DESC_BAND_MASK) ==
-		 WL1271_RX_DESC_BAND_A) {
-		status->band = IEEE80211_BAND_5GHZ;
-		status->rate_idx = wl1271_5_ghz_rx_rate_to_idx[desc->rate];
-	} else
-		wl1271_warning("unsupported band 0x%x",
-			       desc->flags & WL1271_RX_DESC_BAND_MASK);
-
-	if (unlikely(status->rate_idx == WL1271_RX_RATE_UNSUPPORTED))
-		wl1271_warning("unsupported rate");
+	status->band = wl->band;
+	status->rate_idx = wl1271_rate_to_idx(wl, desc->rate);
 
 	/*
 	 * FIXME: Add mactime handling.  For IBSS (ad-hoc) we need to get the
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.h b/drivers/net/wireless/wl12xx/wl1271_rx.h
index 1ae6d17..b89be47 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.h
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.h
@@ -43,7 +43,6 @@
 #define RX_MAX_PACKET_ID 3
 
 #define NUM_RX_PKT_DESC_MOD_MASK   7
-#define WL1271_RX_RATE_UNSUPPORTED 0xFF
 
 #define RX_DESC_VALID_FCS         0x0001
 #define RX_DESC_MATCH_RXADDR1     0x0002
@@ -117,5 +116,6 @@ struct wl1271_rx_descriptor {
 } __attribute__ ((packed));
 
 void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status);
+u8 wl1271_rate_to_idx(struct wl1271 *wl, int rate);
 
 #endif
-- 
1.6.3.3


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

* [PATCH 03/24] wl1271: Add TX rate reporting
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
  2010-03-26 10:53 ` [PATCH 01/24] wl1271: fix wl1271_spi driver name Luciano Coelho
  2010-03-26 10:53 ` [PATCH 02/24] wl1271: Clean up RX rate reporting Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 04/24] wl1271: Fix memory leaks in SPI initialization Luciano Coelho
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

Add reporting of the used TX rate to mac80211 in the tx_status.

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_main.c |    1 +
 drivers/net/wireless/wl12xx/wl1271_tx.c   |   27 +++++++++++++++------------
 drivers/net/wireless/wl12xx/wl1271_tx.h   |    1 +
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 49779e5..8645030 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -2127,6 +2127,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
 		wl->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wl1271_band_5ghz;
 
 	wl->hw->queues = 4;
+	wl->hw->max_rates = 1;
 
 	SET_IEEE80211_DEV(wl->hw, wl1271_wl_to_dev(wl));
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c
index 6d109df..5712489 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.c
@@ -304,6 +304,8 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
 	struct ieee80211_tx_info *info;
 	struct sk_buff *skb;
 	int id = result->id;
+	int rate = -1;
+	u8 retries = 0;
 
 	/* check for id legality */
 	if (unlikely(id >= ACX_TX_DESCRIPTORS || wl->tx_frames[id] == NULL)) {
@@ -314,19 +316,22 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
 	skb = wl->tx_frames[id];
 	info = IEEE80211_SKB_CB(skb);
 
-	/* update packet status */
-	if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
-		if (result->status == TX_SUCCESS)
+	/* update the TX status info */
+	if (result->status == TX_SUCCESS) {
+		if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
 			info->flags |= IEEE80211_TX_STAT_ACK;
-		if (result->status & TX_RETRY_EXCEEDED) {
-			/* FIXME */
-			/* info->status.excessive_retries = 1; */
-			wl->stats.excessive_retries++;
-		}
+		rate = wl1271_rate_to_idx(wl, result->rate_class_index);
+		retries = result->ack_failures;
+	} else if (result->status == TX_RETRY_EXCEEDED) {
+		wl->stats.excessive_retries++;
+		retries = result->ack_failures;
 	}
 
-	/* FIXME */
-	/* info->status.retry_count = result->ack_failures; */
+	info->status.rates[0].idx = rate;
+	info->status.rates[0].count = retries;
+	info->status.rates[0].flags = 0;
+	info->status.ack_signal = -1;
+
 	wl->stats.retry_count += result->ack_failures;
 
 	/* update security sequence number */
@@ -350,8 +355,6 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
 		     result->id, skb, result->ack_failures,
 		     result->rate_class_index, result->status);
 
-	/* FIXME: do we need to tell the stack about the used rate? */
-
 	/* return the packet to the stack */
 	ieee80211_tx_status(wl->hw, skb);
 	wl->tx_frames[result->id] = NULL;
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.h b/drivers/net/wireless/wl12xx/wl1271_tx.h
index 5e6c27a..b03c95d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.h
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.h
@@ -159,5 +159,6 @@ static inline int wl1271_tx_ac_to_tid(int ac)
 void wl1271_tx_work(struct work_struct *work);
 void wl1271_tx_complete(struct wl1271 *wl);
 void wl1271_tx_flush(struct wl1271 *wl);
+u8 wl1271_rate_to_idx(struct wl1271 *wl, int rate);
 
 #endif
-- 
1.6.3.3


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

* [PATCH 04/24] wl1271: Fix memory leaks in SPI initialization
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (2 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 03/24] wl1271: Add TX " Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 05/24] wl1271: Fix memory leak in scan command handling Luciano Coelho
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

This patch fixes two memory leaks in the SPI initialization code.

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

diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index db6c9f5..39b7dea 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -104,6 +104,7 @@ static void wl1271_spi_reset(struct wl1271 *wl)
 	spi_message_add_tail(&t, &m);
 
 	spi_sync(wl_to_spi(wl), &m);
+	kfree(cmd);
 
 	wl1271_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
 }
@@ -158,6 +159,7 @@ static void wl1271_spi_init(struct wl1271 *wl)
 	spi_message_add_tail(&t, &m);
 
 	spi_sync(wl_to_spi(wl), &m);
+	kfree(cmd);
 
 	wl1271_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
 }
-- 
1.6.3.3


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

* [PATCH 05/24] wl1271: Fix memory leak in scan command handling
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (3 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 04/24] wl1271: Fix memory leaks in SPI initialization Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 06/24] wl1271: Configure clock-request drive mode to open-drain Luciano Coelho
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

This patch fixes a memory leak in the scan command handling code.

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

diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index d005729..dbed060 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -665,6 +665,7 @@ int wl1271_cmd_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
 
 out:
 	kfree(params);
+	kfree(trigger);
 	return ret;
 }
 
-- 
1.6.3.3


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

* [PATCH 06/24] wl1271: Configure clock-request drive mode to open-drain
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (4 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 05/24] wl1271: Fix memory leak in scan command handling Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 07/24] wl1271: Warnings caused by wrong format specifiers fixed Luciano Coelho
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

This patch configures the wl1271 chipset clock-request line to be
driver in open-drain mode instead of push-pull.

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_boot.c |    8 ++++++--
 drivers/net/wireless/wl12xx/wl1271_boot.h |    7 +++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index 41c6aff..4195298 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -451,11 +451,15 @@ int wl1271_boot(struct wl1271 *wl)
 
 	if (REF_CLOCK != 0) {
 		u16 val;
-		/* Set clock type */
+		/* Set clock type (open drain) */
 		val = wl1271_top_reg_read(wl, OCP_REG_CLK_TYPE);
 		val &= FREF_CLK_TYPE_BITS;
-		val |= CLK_REQ_PRCM;
 		wl1271_top_reg_write(wl, OCP_REG_CLK_TYPE, val);
+
+		/* Set clock pull mode (no pull) */
+		val = wl1271_top_reg_read(wl, OCP_REG_CLK_PULL);
+		val |= NO_PULL;
+		wl1271_top_reg_write(wl, OCP_REG_CLK_PULL, val);
 	} else {
 		u16 val;
 		/* Set clock polarity */
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.h b/drivers/net/wireless/wl12xx/wl1271_boot.h
index 412443e..95ecc52 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.h
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.h
@@ -53,10 +53,13 @@ struct wl1271_static_data {
 #define OCP_REG_POLARITY     0x0064
 #define OCP_REG_CLK_TYPE     0x0448
 #define OCP_REG_CLK_POLARITY 0x0cb2
+#define OCP_REG_CLK_PULL     0x0cb4
 
-#define CMD_MBOX_ADDRESS 0x407B4
 
-#define POLARITY_LOW BIT(1)
+#define CMD_MBOX_ADDRESS     0x407B4
+
+#define POLARITY_LOW         BIT(1)
+#define NO_PULL              (BIT(14) | BIT(15))
 
 #define FREF_CLK_TYPE_BITS     0xfffffe7f
 #define CLK_REQ_PRCM           0x100
-- 
1.6.3.3


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

* [PATCH 07/24] wl1271: Warnings caused by wrong format specifiers fixed
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (5 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 06/24] wl1271: Configure clock-request drive mode to open-drain Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 08/24] wl1271: Fix memory leak in cmd_data_path Luciano Coelho
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Teemu Paasikivi

From: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>

There were wrong format specifiers in wl1271_sdio.c in some debug
outputs. This has been causing warnings on some platforms.

Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_sdio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 3c03de7..abfe75b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -117,7 +117,7 @@ static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf,
 		else
 			ret = sdio_memcpy_fromio(func, buf, addr, len);
 
-		wl1271_debug(DEBUG_SDIO, "sdio read 53 addr 0x%x, %d bytes",
+		wl1271_debug(DEBUG_SDIO, "sdio read 53 addr 0x%x, %zu bytes",
 			     addr, len);
 		wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);
 	}
@@ -138,7 +138,7 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
 		wl1271_debug(DEBUG_SDIO, "sdio write 52 addr 0x%x, byte 0x%02x",
 			     addr, ((u8 *)buf)[0]);
 	} else {
-		wl1271_debug(DEBUG_SDIO, "sdio write 53 addr 0x%x, %d bytes",
+		wl1271_debug(DEBUG_SDIO, "sdio write 53 addr 0x%x, %zu bytes",
 			     addr, len);
 		wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);
 
-- 
1.6.3.3


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

* [PATCH 08/24] wl1271: Fix memory leak in cmd_data_path
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (6 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 07/24] wl1271: Warnings caused by wrong format specifiers fixed Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 09/24] wl1271: Update busyword checking mechanism Luciano Coelho
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

Fix a trivial memory leak in cmd_data_path.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_cmd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index dbed060..efd94f2 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -454,7 +454,7 @@ int wl1271_cmd_data_path(struct wl1271 *wl, bool enable)
 	if (ret < 0) {
 		wl1271_error("tx %s cmd for channel %d failed",
 			     enable ? "start" : "stop", cmd->channel);
-		return ret;
+		goto out;
 	}
 
 	wl1271_debug(DEBUG_BOOT, "tx %s cmd channel %d",
-- 
1.6.3.3


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

* [PATCH 09/24] wl1271: Update busyword checking mechanism
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (7 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 08/24] wl1271: Fix memory leak in cmd_data_path Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 10/24] wl1271: Remove device MAC-address randomization Luciano Coelho
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

After the busy-words, if the firmware did not complete by the end of the
first (fixed) busy-word, a flip of the CS line is required to enable clocking
out the actual read data.

This patch changes the mechanism such that the CS line is flipped after each
busyword.

Also, the busy-word mechanism is finally enabled, and the number of fixed
busywords reduced to the minimum.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271.h     |    9 +----
 drivers/net/wireless/wl12xx/wl1271_spi.c |   67 ++++++++++-------------------
 2 files changed, 24 insertions(+), 52 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 8f11506..c939680 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -147,14 +147,7 @@ struct wl1271_nvs_file {
  */
 #undef WL1271_80211A_ENABLED
 
-/*
- * FIXME: for the wl1271, a busy word count of 1 here will result in a more
- * optimal SPI interface. There is some SPI bug however, causing RXS time outs
- * with this mode occasionally on boot, so lets have three for now. A value of
- * three should make sure, that the chipset will always be ready, though this
- * will impact throughput and latencies slightly.
- */
-#define WL1271_BUSY_WORD_CNT 3
+#define WL1271_BUSY_WORD_CNT 1
 #define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32))
 
 #define WL1271_ELP_HW_STATE_ASLEEP 0
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 39b7dea..7a7db01 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -166,41 +166,17 @@ static void wl1271_spi_init(struct wl1271 *wl)
 
 #define WL1271_BUSY_WORD_TIMEOUT 1000
 
-/* FIXME: Check busy words, removed due to SPI bug */
-#if 0
-static void wl1271_spi_read_busy(struct wl1271 *wl, void *buf, size_t len)
+static int wl1271_spi_read_busy(struct wl1271 *wl)
 {
 	struct spi_transfer t[1];
 	struct spi_message m;
 	u32 *busy_buf;
 	int num_busy_bytes = 0;
 
-	wl1271_info("spi read BUSY!");
-
-	/*
-	 * Look for the non-busy word in the read buffer, and if found,
-	 * read in the remaining data into the buffer.
-	 */
-	busy_buf = (u32 *)buf;
-	for (; (u32)busy_buf < (u32)buf + len; busy_buf++) {
-		num_busy_bytes += sizeof(u32);
-		if (*busy_buf & 0x1) {
-			spi_message_init(&m);
-			memset(t, 0, sizeof(t));
-			memmove(buf, busy_buf, len - num_busy_bytes);
-			t[0].rx_buf = buf + (len - num_busy_bytes);
-			t[0].len = num_busy_bytes;
-			spi_message_add_tail(&t[0], &m);
-			spi_sync(wl_to_spi(wl), &m);
-			return;
-		}
-	}
-
 	/*
 	 * Read further busy words from SPI until a non-busy word is
 	 * encountered, then read the data itself into the buffer.
 	 */
-	wl1271_info("spi read BUSY-polling needed!");
 
 	num_busy_bytes = WL1271_BUSY_WORD_TIMEOUT;
 	busy_buf = wl->buffer_busyword;
@@ -210,28 +186,21 @@ static void wl1271_spi_read_busy(struct wl1271 *wl, void *buf, size_t len)
 		memset(t, 0, sizeof(t));
 		t[0].rx_buf = busy_buf;
 		t[0].len = sizeof(u32);
+		t[0].cs_change = true;
 		spi_message_add_tail(&t[0], &m);
 		spi_sync(wl_to_spi(wl), &m);
 
-		if (*busy_buf & 0x1) {
-			spi_message_init(&m);
-			memset(t, 0, sizeof(t));
-			t[0].rx_buf = buf;
-			t[0].len = len;
-			spi_message_add_tail(&t[0], &m);
-			spi_sync(wl_to_spi(wl), &m);
-			return;
-		}
+		if (*busy_buf & 0x1)
+			return 0;
 	}
 
 	/* The SPI bus is unresponsive, the read failed. */
-	memset(buf, 0, len);
 	wl1271_error("SPI read busy-word timeout!\n");
+	return -ETIMEDOUT;
 }
-#endif
 
 static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
-			 size_t len, bool fixed)
+				size_t len, bool fixed)
 {
 	struct spi_transfer t[3];
 	struct spi_message m;
@@ -254,22 +223,32 @@ static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf,
 
 	t[0].tx_buf = cmd;
 	t[0].len = 4;
+	t[0].cs_change = true;
 	spi_message_add_tail(&t[0], &m);
 
 	/* Busy and non busy words read */
 	t[1].rx_buf = busy_buf;
 	t[1].len = WL1271_BUSY_WORD_LEN;
+	t[1].cs_change = true;
 	spi_message_add_tail(&t[1], &m);
 
-	t[2].rx_buf = buf;
-	t[2].len = len;
-	spi_message_add_tail(&t[2], &m);
-
 	spi_sync(wl_to_spi(wl), &m);
 
-	/* FIXME: Check busy words, removed due to SPI bug */
-	/* if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1))
-	   wl1271_spi_read_busy(wl, buf, len); */
+	if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) &&
+	    wl1271_spi_read_busy(wl)) {
+		memset(buf, 0, len);
+		return;
+	}
+
+	spi_message_init(&m);
+	memset(t, 0, sizeof(t));
+
+	t[0].rx_buf = buf;
+	t[0].len = len;
+	t[0].cs_change = true;
+	spi_message_add_tail(&t[0], &m);
+
+	spi_sync(wl_to_spi(wl), &m);
 
 	wl1271_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd));
 	wl1271_dump(DEBUG_SPI, "spi_read buf <- ", buf, len);
-- 
1.6.3.3


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

* [PATCH 10/24] wl1271: Remove device MAC-address randomization
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (8 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 09/24] wl1271: Update busyword checking mechanism Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 11/24] wl1271: wait for join command complete event Luciano Coelho
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

This patch removes the MAC address randomization from the driver. This removes
a nasty Nokia-OUI dependency from the driver.

With this patch, unless an address is explicitly configured to the driver
by the user, only a zero address will be configured, and the driver will be
unable to start.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_main.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 8645030..4a2f1d7 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -2143,7 +2143,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
 	struct platform_device *plat_dev = NULL;
 	struct wl1271 *wl;
 	int i, ret;
-	static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf};
 
 	hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops);
 	if (!hw) {
@@ -2195,13 +2194,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
 	wl->state = WL1271_STATE_OFF;
 	mutex_init(&wl->mutex);
 
-	/*
-	 * FIXME: we should use a zero MAC address here, but for now we
-	 * generate a random Nokia address.
-	 */
-	memcpy(wl->mac_addr, nokia_oui, 3);
-	get_random_bytes(wl->mac_addr + 3, 3);
-
 	/* Apply default driver configuration. */
 	wl1271_conf_init(wl);
 
-- 
1.6.3.3


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

* [PATCH 11/24] wl1271: wait for join command complete event
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (9 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 10/24] wl1271: Remove device MAC-address randomization Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 12/24] wl1271: wait for disconnect " Luciano Coelho
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Poll for join command completion instead of waiting blindly for 10 msecs.
There is a timeout of 100 msecs, if the command doesn't complete by then, we
return an error code.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_boot.c |    3 +-
 drivers/net/wireless/wl12xx/wl1271_cmd.c  |   38 +++++++++++++++++++++++++----
 drivers/net/wireless/wl12xx/wl1271_cmd.h  |    1 +
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index 4195298..2c7e561 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -410,7 +410,8 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
 	/* unmask required mbox events  */
 	wl->event_mask = BSS_LOSE_EVENT_ID |
 		SCAN_COMPLETE_EVENT_ID |
-		PS_REPORT_EVENT_ID;
+		PS_REPORT_EVENT_ID |
+		JOIN_EVENT_COMPLETE_ID;
 
 	ret = wl1271_event_unmask(wl);
 	if (ret < 0) {
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index efd94f2..e677f97 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -34,6 +34,7 @@
 #include "wl1271_acx.h"
 #include "wl12xx_80211.h"
 #include "wl1271_cmd.h"
+#include "wl1271_event.h"
 
 /*
  * send command to firmware
@@ -248,6 +249,35 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl)
 	return ret;
 }
 
+/*
+ * Poll the mailbox event field until any of the bits in the mask is set or a
+ * timeout occurs (WL1271_EVENT_TIMEOUT in msecs)
+ */
+static int wl1271_cmd_wait_for_event(struct wl1271 *wl, u32 mask)
+{
+	u32 events_vector, event;
+	unsigned long timeout;
+
+	timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);
+
+	do {
+		if (time_after(jiffies, timeout))
+			return -ETIMEDOUT;
+
+		msleep(1);
+
+		/* read from both event fields */
+		wl1271_read(wl, wl->mbox_ptr[0], &events_vector,
+			    sizeof(events_vector), false);
+		event = events_vector & mask;
+		wl1271_read(wl, wl->mbox_ptr[1], &events_vector,
+			    sizeof(events_vector), false);
+		event |= events_vector & mask;
+	} while (!event);
+
+	return 0;
+}
+
 int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type)
 {
 	static bool do_cal = true;
@@ -318,11 +348,9 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type)
 		goto out_free;
 	}
 
-	/*
-	 * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
-	 * simplify locking we just sleep instead, for now
-	 */
-	msleep(10);
+	ret = wl1271_cmd_wait_for_event(wl, JOIN_EVENT_COMPLETE_ID);
+	if (ret < 0)
+		wl1271_error("cmd join event completion error");
 
 out_free:
 	kfree(join);
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 6324bbf..bdd7a3d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -123,6 +123,7 @@ enum cmd_templ {
 /* unit ms */
 #define WL1271_COMMAND_TIMEOUT     2000
 #define WL1271_CMD_TEMPL_MAX_SIZE  252
+#define WL1271_EVENT_TIMEOUT       100
 
 struct wl1271_cmd_header {
 	__le16 id;
-- 
1.6.3.3


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

* [PATCH 12/24] wl1271: wait for disconnect command complete event
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (10 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 11/24] wl1271: wait for join command complete event Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 13/24] wl1271: remove deprecated usage of RX status noise Luciano Coelho
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Wait for the DISCONNECT_EVENT_COMPLETE_ID event after sending a disconnect
command.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_boot.c |    5 +++--
 drivers/net/wireless/wl12xx/wl1271_cmd.c  |    6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index 2c7e561..7acef88 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -1,7 +1,7 @@
 /*
  * This file is part of wl1271
  *
- * Copyright (C) 2008-2009 Nokia Corporation
+ * Copyright (C) 2008-2010 Nokia Corporation
  *
  * Contact: Luciano Coelho <luciano.coelho@nokia.com>
  *
@@ -411,7 +411,8 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
 	wl->event_mask = BSS_LOSE_EVENT_ID |
 		SCAN_COMPLETE_EVENT_ID |
 		PS_REPORT_EVENT_ID |
-		JOIN_EVENT_COMPLETE_ID;
+		JOIN_EVENT_COMPLETE_ID |
+		DISCONNECT_EVENT_COMPLETE_ID;
 
 	ret = wl1271_event_unmask(wl);
 	if (ret < 0) {
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index e677f97..0aa2422 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -1,7 +1,7 @@
 /*
  * This file is part of wl1271
  *
- * Copyright (C) 2009 Nokia Corporation
+ * Copyright (C) 2009-2010 Nokia Corporation
  *
  * Contact: Luciano Coelho <luciano.coelho@nokia.com>
  *
@@ -942,6 +942,10 @@ int wl1271_cmd_disconnect(struct wl1271 *wl)
 		goto out_free;
 	}
 
+	ret = wl1271_cmd_wait_for_event(wl, DISCONNECT_EVENT_COMPLETE_ID);
+	if (ret < 0)
+		wl1271_error("cmd disconnect event completion error");
+
 out_free:
 	kfree(cmd);
 
-- 
1.6.3.3


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

* [PATCH 13/24] wl1271: remove deprecated usage of RX status noise
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (11 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 12/24] wl1271: wait for disconnect " Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 14/24] wl1271: Disable connection monitoring while not associated Luciano Coelho
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

The noise element in the ieee80211_rx_status struct has been deprecated in
commit "mac80211: deprecate RX status noise".  Remove the usage of this
element from wl1271_rx.c to avoid warnings.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_rx.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index a1a7953..ca44270 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -59,13 +59,6 @@ static void wl1271_rx_status(struct wl1271 *wl,
 	 */
 	status->signal = desc->rssi;
 
-	/*
-	 * 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
-	 * changing it.  This needs to be rechecked.
-	 */
-	status->noise = desc->rssi - (desc->snr >> 1);
-
 	status->freq = ieee80211_channel_to_frequency(desc->channel);
 
 	if (desc->flags & WL1271_RX_DESC_ENCRYPT_MASK) {
-- 
1.6.3.3


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

* [PATCH 14/24] wl1271: Disable connection monitoring while not associated
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (12 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 13/24] wl1271: remove deprecated usage of RX status noise Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 15/24] wl1271: Fix ad-hoc mode handling Luciano Coelho
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

The wl1271 does not support disabling the connection monitor feature.
Perform the next best thing by increasing the beacon-loss threshold and
BSS_LOSE event timeout to the maximum values.

This is needed, because we really don't want any random probe-requests during
scanning or especially while in ad-hoc mode and not beaconing.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_acx.c  |   18 ++++++++++++++----
 drivers/net/wireless/wl12xx/wl1271_acx.h  |    2 +-
 drivers/net/wireless/wl12xx/wl1271_init.c |    2 +-
 drivers/net/wireless/wl12xx/wl1271_main.c |   12 +++++++++++-
 4 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.c b/drivers/net/wireless/wl12xx/wl1271_acx.c
index 7e337ce..e7d1181 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.c
@@ -504,12 +504,17 @@ out:
 	return ret;
 }
 
-int wl1271_acx_conn_monit_params(struct wl1271 *wl)
+#define ACX_CONN_MONIT_DISABLE_VALUE  0xffffffff
+
+int wl1271_acx_conn_monit_params(struct wl1271 *wl, bool enable)
 {
 	struct acx_conn_monit_params *acx;
+	u32 threshold = ACX_CONN_MONIT_DISABLE_VALUE;
+	u32 timeout = ACX_CONN_MONIT_DISABLE_VALUE;
 	int ret;
 
-	wl1271_debug(DEBUG_ACX, "acx connection monitor parameters");
+	wl1271_debug(DEBUG_ACX, "acx connection monitor parameters: %s",
+		     enable ? "enabled" : "disabled");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
 	if (!acx) {
@@ -517,8 +522,13 @@ int wl1271_acx_conn_monit_params(struct wl1271 *wl)
 		goto out;
 	}
 
-	acx->synch_fail_thold = cpu_to_le32(wl->conf.conn.synch_fail_thold);
-	acx->bss_lose_timeout = cpu_to_le32(wl->conf.conn.bss_lose_timeout);
+	if (enable) {
+		threshold = wl->conf.conn.synch_fail_thold;
+		timeout = wl->conf.conn.bss_lose_timeout;
+	}
+
+	acx->synch_fail_thold = cpu_to_le32(threshold);
+	acx->bss_lose_timeout = cpu_to_le32(timeout);
 
 	ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS,
 				   acx, sizeof(*acx));
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.h b/drivers/net/wireless/wl12xx/wl1271_acx.h
index 8e5870f..b6eb0c1 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.h
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.h
@@ -1004,7 +1004,7 @@ int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold);
 int wl1271_acx_dco_itrim_params(struct wl1271 *wl);
 int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter);
 int wl1271_acx_beacon_filter_table(struct wl1271 *wl);
-int wl1271_acx_conn_monit_params(struct wl1271 *wl);
+int wl1271_acx_conn_monit_params(struct wl1271 *wl, bool enable);
 int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable);
 int wl1271_acx_sg_cfg(struct wl1271 *wl);
 int wl1271_acx_cca_threshold(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index d9335fc..987978c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -236,7 +236,7 @@ int wl1271_hw_init(struct wl1271 *wl)
 		goto out_free_memmap;
 
 	/* Initialize connection monitoring thresholds */
-	ret = wl1271_acx_conn_monit_params(wl);
+	ret = wl1271_acx_conn_monit_params(wl, false);
 	if (ret < 0)
 		goto out_free_memmap;
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 4a2f1d7..00e856c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -348,7 +348,7 @@ static int wl1271_plt_init(struct wl1271 *wl)
 		goto out_free_memmap;
 
 	/* Initialize connection monitoring thresholds */
-	ret = wl1271_acx_conn_monit_params(wl);
+	ret = wl1271_acx_conn_monit_params(wl, false);
 	if (ret < 0)
 		goto out_free_memmap;
 
@@ -1651,6 +1651,11 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 			if (ret < 0)
 				goto out_sleep;
 
+			/* enable the connection monitoring feature */
+			ret = wl1271_acx_conn_monit_params(wl, true);
+			if (ret < 0)
+				goto out_sleep;
+
 			/* If we want to go in PSM but we're not there yet */
 			if (test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags) &&
 			    !test_bit(WL1271_FLAG_PSM, &wl->flags)) {
@@ -1663,6 +1668,11 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 			/* use defaults when not associated */
 			clear_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags);
 			wl->aid = 0;
+
+			/* disable connection monitor features */
+			ret = wl1271_acx_conn_monit_params(wl, false);
+			if (ret < 0)
+				goto out_sleep;
 		}
 
 	}
-- 
1.6.3.3


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

* [PATCH 15/24] wl1271: Fix ad-hoc mode handling
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (13 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 14/24] wl1271: Disable connection monitoring while not associated Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 16/24] wl1271: Update beacon interval properly for ad-hoc Luciano Coelho
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

Fix the driver to better reflect the ad-hoc related configuration from the
mac80211.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |    2 +
 drivers/net/wireless/wl12xx/wl1271_main.c |   33 +++++++++++++++++++---------
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index c939680..37ad5cd 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -55,6 +55,7 @@ enum {
 	DEBUG_ACX	= BIT(13),
 	DEBUG_SDIO	= BIT(14),
 	DEBUG_FILTERS   = BIT(15),
+	DEBUG_ADHOC     = BIT(16),
 	DEBUG_ALL	= ~0,
 };
 
@@ -389,6 +390,7 @@ struct wl1271 {
 	u8 bssid[ETH_ALEN];
 	u8 mac_addr[ETH_ALEN];
 	u8 bss_type;
+	u8 set_bss_type;
 	u8 ssid[IW_ESSID_MAX_SIZE + 1];
 	u8 ssid_len;
 	int channel;
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 00e856c..49f37b0 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -958,9 +958,11 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
 	switch (vif->type) {
 	case NL80211_IFTYPE_STATION:
 		wl->bss_type = BSS_TYPE_STA_BSS;
+		wl->set_bss_type = BSS_TYPE_STA_BSS;
 		break;
 	case NL80211_IFTYPE_ADHOC:
 		wl->bss_type = BSS_TYPE_IBSS;
+		wl->set_bss_type = BSS_TYPE_STA_BSS;
 		break;
 	default:
 		ret = -EOPNOTSUPP;
@@ -1065,6 +1067,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
 	memset(wl->ssid, 0, IW_ESSID_MAX_SIZE + 1);
 	wl->ssid_len = 0;
 	wl->bss_type = MAX_BSS_TYPE;
+	wl->set_bss_type = MAX_BSS_TYPE;
 	wl->band = IEEE80211_BAND_2GHZ;
 
 	wl->rx_counter = 0;
@@ -1137,10 +1140,7 @@ static int wl1271_join_channel(struct wl1271 *wl, int channel)
 	/* pass through frames from all BSS */
 	wl1271_configure_filters(wl, FIF_OTHER_BSS);
 
-	/* the dummy join is performed always with STATION BSS type to allow
-	   also ad-hoc mode to listen to the surroundings without sending any
-	   beacons yet. */
-	ret = wl1271_cmd_join(wl, BSS_TYPE_STA_BSS);
+	ret = wl1271_cmd_join(wl, wl->set_bss_type);
 	if (ret < 0)
 		goto out;
 
@@ -1211,7 +1211,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
 	    test_bit(WL1271_FLAG_JOINED, &wl->flags)) {
 		wl->channel = channel;
 		/* FIXME: maybe use CMD_CHANNEL_SWITCH for this? */
-		ret = wl1271_cmd_join(wl, wl->bss_type);
+		ret = wl1271_cmd_join(wl, wl->set_bss_type);
 		if (ret < 0)
 			wl1271_warning("cmd join to update channel failed %d",
 				       ret);
@@ -1575,13 +1575,12 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 	if (ret < 0)
 		goto out;
 
-	if (wl->bss_type == BSS_TYPE_IBSS) {
-		/* FIXME: This implements rudimentary ad-hoc support -
-		   proper templates are on the wish list and notification
-		   on when they change. This patch will update the templates
-		   on every call to this function. */
+	if ((changed && BSS_CHANGED_BEACON) &&
+	    (wl->bss_type == BSS_TYPE_IBSS)) {
 		struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
 
+		wl1271_debug(DEBUG_ADHOC, "ad-hoc beacon updated");
+
 		if (beacon) {
 			struct ieee80211_hdr *hdr;
 
@@ -1613,6 +1612,18 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 		}
 	}
 
+	if ((changed & BSS_CHANGED_BEACON_ENABLED) &&
+	    (wl->bss_type == BSS_TYPE_IBSS)) {
+		wl1271_debug(DEBUG_ADHOC, "ad-hoc beaconing: %s",
+			     bss_conf->enable_beacon ? "enabled" : "disabled");
+
+		if (bss_conf->enable_beacon)
+			wl->set_bss_type = BSS_TYPE_IBSS;
+		else
+			wl->set_bss_type = BSS_TYPE_STA_BSS;
+		do_join = true;
+	}
+
 	if ((changed & BSS_CHANGED_BSSID) &&
 	    /*
 	     * Now we know the correct bssid, so we send a new join command
@@ -1707,7 +1718,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 	}
 
 	if (do_join) {
-		ret = wl1271_cmd_join(wl, wl->bss_type);
+		ret = wl1271_cmd_join(wl, wl->set_bss_type);
 		if (ret < 0) {
 			wl1271_warning("cmd join failed %d", ret);
 			goto out_sleep;
-- 
1.6.3.3


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

* [PATCH 16/24] wl1271: Update beacon interval properly for ad-hoc
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (14 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 15/24] wl1271: Fix ad-hoc mode handling Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 17/24] wl1271: Removed checking of PSM from handling BSS_LOST_EVENT Luciano Coelho
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

Configure the hardware beacon interval to whatever requested by the
mac80211.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |    3 +++
 drivers/net/wireless/wl12xx/wl1271_cmd.c  |    2 +-
 drivers/net/wireless/wl12xx/wl1271_main.c |   10 ++++++++++
 3 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 37ad5cd..c5559ef 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -452,6 +452,9 @@ struct wl1271 {
 	/* The current band */
 	enum ieee80211_band band;
 
+	/* Beaconing interval (needed for ad-hoc) */
+	u32 beacon_int;
+
 	/* Default key (for WEP) */
 	u32 default_key;
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 0aa2422..0dcb3c2 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -323,7 +323,7 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type)
 						   CONF_HW_BIT_RATE_24MBPS);
 	}
 
-	join->beacon_interval = cpu_to_le16(WL1271_DEFAULT_BEACON_INT);
+	join->beacon_interval = cpu_to_le16(wl->beacon_int);
 	join->dtim_interval = WL1271_DEFAULT_DTIM_PERIOD;
 
 	join->channel = wl->channel;
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 49f37b0..523e051 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1575,6 +1575,15 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 	if (ret < 0)
 		goto out;
 
+	if ((changed && BSS_CHANGED_BEACON_INT) &&
+	    (wl->bss_type == BSS_TYPE_IBSS)) {
+		wl1271_debug(DEBUG_ADHOC, "ad-hoc beacon interval updated: %d",
+			bss_conf->beacon_int);
+
+		wl->beacon_int = bss_conf->beacon_int;
+		do_join = true;
+	}
+
 	if ((changed && BSS_CHANGED_BEACON) &&
 	    (wl->bss_type == BSS_TYPE_IBSS)) {
 		struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
@@ -2193,6 +2202,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
 
 	INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work);
 	wl->channel = WL1271_DEFAULT_CHANNEL;
+	wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
 	wl->default_key = 0;
 	wl->rx_counter = 0;
 	wl->rx_config = WL1271_DEFAULT_RX_CONFIG;
-- 
1.6.3.3


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

* [PATCH 17/24] wl1271: Removed checking of PSM from handling BSS_LOST_EVENT
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (15 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 16/24] wl1271: Update beacon interval properly for ad-hoc Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 18/24] wl1271: Fix memory leak in firmware crash scenario Luciano Coelho
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Teemu Paasikivi

From: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>

Change the driver to call ieee80211_beacon_loss function always when
BSS_LOST_EVENT is received. Reason for the change is that entering PSM
might fail before driver receives BSS_LOST_EVENT. In such case the
driver would disable PSM and the stack would not be notified about beacon
loss and connection loss detection would be delayed by tens of seconds.

Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_event.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_event.c b/drivers/net/wireless/wl12xx/wl1271_event.c
index 4d35af9..a5c1910 100644
--- a/drivers/net/wireless/wl12xx/wl1271_event.c
+++ b/drivers/net/wireless/wl12xx/wl1271_event.c
@@ -173,9 +173,12 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
 	 * The BSS_LOSE_EVENT_ID is only needed while psm (and hence beacon
 	 * filtering) is enabled. Without PSM, the stack will receive all
 	 * beacons and can detect beacon loss by itself.
+	 *
+	 * As there's possibility that the driver disables PSM before receiving
+	 * BSS_LOSE_EVENT, beacon loss has to be reported to the stack.
+	 *
 	 */
-	if (vector & BSS_LOSE_EVENT_ID &&
-	    test_bit(WL1271_FLAG_PSM, &wl->flags)) {
+	if (vector & BSS_LOSE_EVENT_ID) {
 		wl1271_debug(DEBUG_EVENT, "BSS_LOSE_EVENT");
 
 		/* indicate to the stack, that beacons have been lost */
-- 
1.6.3.3


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

* [PATCH 18/24] wl1271: Fix memory leak in firmware crash scenario
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (16 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 17/24] wl1271: Removed checking of PSM from handling BSS_LOST_EVENT Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 19/24] wl1271: Configure probe-request template when associated Luciano Coelho
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

The driver tx-queue flush operation leaks broadcast-frames. This leak occurs
if the driver is shut down while there are frames in TX buffers (such as in
a firmware crash scenario.) Fix the leak.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_tx.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c
index 5712489..66b48b7 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.c
@@ -426,8 +426,10 @@ void wl1271_tx_flush(struct wl1271 *wl)
 
 		wl1271_debug(DEBUG_TX, "flushing skb 0x%p", skb);
 
-		if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS))
-				continue;
+		if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
+			kfree_skb(skb);
+			continue;
+		}
 
 		ieee80211_tx_status(wl->hw, skb);
 	}
@@ -437,8 +439,10 @@ void wl1271_tx_flush(struct wl1271 *wl)
 			skb = wl->tx_frames[i];
 			info = IEEE80211_SKB_CB(skb);
 
-			if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS))
+			if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
+				kfree_skb(skb);
 				continue;
+			}
 
 			ieee80211_tx_status(wl->hw, skb);
 			wl->tx_frames[i] = NULL;
-- 
1.6.3.3


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

* [PATCH 19/24] wl1271: Configure probe-request template when associated
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (17 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 18/24] wl1271: Fix memory leak in firmware crash scenario Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 20/24] wl1271: Disconnect if PSM entry fails Luciano Coelho
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

Configure a probe-request template to the wl1271 when associated - the
wl1271 will use this to attempt to recover a connection when beacon loss
is detected.

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_event.c |   12 ------------
 drivers/net/wireless/wl12xx/wl1271_main.c  |    9 +++++++++
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_event.c b/drivers/net/wireless/wl12xx/wl1271_event.c
index a5c1910..0e0808f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_event.c
+++ b/drivers/net/wireless/wl12xx/wl1271_event.c
@@ -31,14 +31,11 @@
 static int wl1271_event_scan_complete(struct wl1271 *wl,
 				      struct event_mailbox *mbox)
 {
-	int size = sizeof(struct wl12xx_probe_req_template);
 	wl1271_debug(DEBUG_EVENT, "status: 0x%x",
 		     mbox->scheduled_scan_status);
 
 	if (test_bit(WL1271_FLAG_SCANNING, &wl->flags)) {
 		if (wl->scan.state == WL1271_SCAN_BAND_DUAL) {
-			wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4,
-						NULL, size);
 			/* 2.4 GHz band scanned, scan 5 GHz band, pretend
 			 * to the wl1271_cmd_scan function that we are not
 			 * scanning as it checks that.
@@ -52,15 +49,6 @@ static int wl1271_event_scan_complete(struct wl1271 *wl,
 						WL1271_SCAN_BAND_5_GHZ,
 						wl->scan.probe_requests);
 		} else {
-			if (wl->scan.state == WL1271_SCAN_BAND_2_4_GHZ)
-				wl1271_cmd_template_set(wl,
-						CMD_TEMPL_CFG_PROBE_REQ_2_4,
-						NULL, size);
-			else
-				wl1271_cmd_template_set(wl,
-						CMD_TEMPL_CFG_PROBE_REQ_5,
-						NULL, size);
-
 			mutex_unlock(&wl->mutex);
 			ieee80211_scan_completed(wl->hw, false);
 			mutex_lock(&wl->mutex);
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 523e051..849c4ac 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1667,6 +1667,15 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 			if (ret < 0)
 				goto out_sleep;
 
+			/*
+			 * The SSID is intentionally set to NULL here - the
+			 * firmware will set the probe request with a
+			 * broadcast SSID regardless of what we set in the
+			 * template.
+			 */
+			ret = wl1271_cmd_build_probe_req(wl, NULL, 0,
+							 NULL, 0, wl->band);
+
 			ret = wl1271_acx_aid(wl, wl->aid);
 			if (ret < 0)
 				goto out_sleep;
-- 
1.6.3.3


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

* [PATCH 20/24] wl1271: Disconnect if PSM entry fails
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (18 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 19/24] wl1271: Configure probe-request template when associated Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 21/24] wl1271: Configure HW connection monitor Luciano Coelho
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

If PSM entry fails despite of retries, assume that the AP has been lost,
and indicate connection loss to the mac80211. This is much safer than
remaining in active mode.

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_event.c |   21 +++------------------
 1 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_event.c b/drivers/net/wireless/wl12xx/wl1271_event.c
index 0e0808f..4fc212a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_event.c
+++ b/drivers/net/wireless/wl12xx/wl1271_event.c
@@ -82,15 +82,8 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
 						 true);
 		} else {
 			wl1271_error("PSM entry failed, giving up.\n");
-			/* FIXME: this may need to be reconsidered. for now it
-			   is not possible to indicate to the mac80211
-			   afterwards that PSM entry failed. To maximize
-			   functionality (receiving data and remaining
-			   associated) make sure that we are in sync with the
-			   AP in regard of PSM mode. */
-			ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
-						 false);
 			wl->psm_entry_retry = 0;
+			*beacon_loss = true;
 		}
 		break;
 	case EVENT_ENTER_POWER_SAVE_SUCCESS:
@@ -180,16 +173,8 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
 			return ret;
 	}
 
-	if (wl->vif && beacon_loss) {
-		/* Obviously, it's dangerous to release the mutex while
-		   we are holding many of the variables in the wl struct.
-		   That's why it's done last in the function, and care must
-		   be taken that nothing more is done after this function
-		   returns. */
-		mutex_unlock(&wl->mutex);
-		ieee80211_beacon_loss(wl->vif);
-		mutex_lock(&wl->mutex);
-	}
+	if (wl->vif && beacon_loss)
+		ieee80211_connection_loss(wl->vif);
 
 	return 0;
 }
-- 
1.6.3.3


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

* [PATCH 21/24] wl1271: Configure HW connection monitor
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (19 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 20/24] wl1271: Disconnect if PSM entry fails Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 22/24] wl1271: Add keep-alive frame template support Luciano Coelho
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

This patch configures the mac80211 to not perform connection monitoring
(periodic probe-requests) and instead rely on the hardware to do it.

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_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 849c4ac..2df00ad 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -2155,7 +2155,8 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
 		IEEE80211_HW_BEACON_FILTER |
 		IEEE80211_HW_SUPPORTS_PS |
 		IEEE80211_HW_SUPPORTS_UAPSD |
-		IEEE80211_HW_HAS_RATE_CONTROL;
+		IEEE80211_HW_HAS_RATE_CONTROL |
+		IEEE80211_HW_CONNECTION_MONITOR;
 
 	wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
 		BIT(NL80211_IFTYPE_ADHOC);
-- 
1.6.3.3


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

* [PATCH 22/24] wl1271: Add keep-alive frame template support
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (20 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 21/24] wl1271: Configure HW connection monitor Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 23/24] wl1271: Enable hardware keep alive messages Luciano Coelho
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

Add support for keep-alive templates, which are indexed.

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_cmd.c  |   35 ++++++++++++++++++++++++-----
 drivers/net/wireless/wl12xx/wl1271_cmd.h  |    8 +++++-
 drivers/net/wireless/wl12xx/wl1271_init.c |   31 ++++++++++++++++++-------
 drivers/net/wireless/wl12xx/wl1271_main.c |    4 +-
 4 files changed, 60 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 0dcb3c2..0cb4cbb 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -698,7 +698,7 @@ out:
 }
 
 int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
-			    void *buf, size_t buf_len)
+			    void *buf, size_t buf_len, int index)
 {
 	struct wl1271_cmd_template_set *cmd;
 	int ret = 0;
@@ -719,6 +719,7 @@ int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
 	cmd->enabled_rates = cpu_to_le32(wl->conf.tx.rc_conf.enabled_rates);
 	cmd->short_retry_limit = wl->conf.tx.rc_conf.short_retry_limit;
 	cmd->long_retry_limit = wl->conf.tx.rc_conf.long_retry_limit;
+	cmd->index = index;
 
 	if (buf)
 		memcpy(cmd->template_data, buf, buf_len);
@@ -755,7 +756,7 @@ int wl1271_cmd_build_null_data(struct wl1271 *wl)
 		ptr = skb->data;
 	}
 
-	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, ptr, size);
+	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, ptr, size, 0);
 
 out:
 	dev_kfree_skb(skb);
@@ -766,6 +767,28 @@ out:
 
 }
 
+int wl1271_cmd_build_klv_null_data(struct wl1271 *wl)
+{
+	struct sk_buff *skb = NULL;
+	int ret = -ENOMEM;
+
+	skb = ieee80211_nullfunc_get(wl->hw, wl->vif);
+	if (!skb)
+		goto out;
+
+	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV,
+				      skb->data, skb->len,
+				      CMD_TEMPL_KLV_IDX_NULL_DATA);
+
+out:
+	dev_kfree_skb(skb);
+	if (ret)
+		wl1271_warning("cmd build klv null data failed %d", ret);
+
+	return ret;
+
+}
+
 int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid)
 {
 	struct sk_buff *skb;
@@ -776,7 +799,7 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid)
 		goto out;
 
 	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, skb->data,
-				      skb->len);
+				      skb->len, 0);
 
 out:
 	dev_kfree_skb(skb);
@@ -801,10 +824,10 @@ int wl1271_cmd_build_probe_req(struct wl1271 *wl,
 
 	if (band == IEEE80211_BAND_2GHZ)
 		ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4,
-					      skb->data, skb->len);
+					      skb->data, skb->len, 0);
 	else
 		ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
-					      skb->data, skb->len);
+					      skb->data, skb->len, 0);
 
 out:
 	dev_kfree_skb(skb);
@@ -829,7 +852,7 @@ int wl1271_build_qos_null_data(struct wl1271 *wl)
 	template.qos_ctrl = cpu_to_le16(0);
 
 	return wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, &template,
-				       sizeof(template));
+				       sizeof(template), 0);
 }
 
 int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id)
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index bdd7a3d..e1131bc 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -45,13 +45,14 @@ int wl1271_cmd_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
 		    const u8 *ie, size_t ie_len, u8 active_scan,
 		    u8 high_prio, u8 band, u8 probe_requests);
 int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
-			    void *buf, size_t buf_len);
+			    void *buf, size_t buf_len, int index);
 int wl1271_cmd_build_null_data(struct wl1271 *wl);
 int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid);
 int wl1271_cmd_build_probe_req(struct wl1271 *wl,
 			       const u8 *ssid, size_t ssid_len,
 			       const u8 *ie, size_t ie_len, u8 band);
 int wl1271_build_qos_null_data(struct wl1271 *wl);
+int wl1271_cmd_build_klv_null_data(struct wl1271 *wl);
 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,
@@ -101,6 +102,11 @@ enum wl1271_commands {
 
 #define MAX_CMD_PARAMS 572
 
+enum {
+	CMD_TEMPL_KLV_IDX_NULL_DATA = 0,
+	CMD_TEMPL_KLV_IDX_MAX = 4
+};
+
 enum cmd_templ {
 	CMD_TEMPL_NULL_DATA = 0,
 	CMD_TEMPL_BEACON,
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 987978c..0106663 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -51,50 +51,63 @@ static int wl1271_init_hwenc_config(struct wl1271 *wl)
 
 int wl1271_init_templates_config(struct wl1271 *wl)
 {
-	int ret;
+	int ret, i;
 
 	/* send empty templates for fw memory reservation */
 	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL,
-				      sizeof(struct wl12xx_probe_req_template));
+				      sizeof(struct wl12xx_probe_req_template),
+				      0);
 	if (ret < 0)
 		return ret;
 
 	if (wl1271_11a_enabled()) {
+		size_t size = sizeof(struct wl12xx_probe_req_template);
 		ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
-				NULL,
-				sizeof(struct wl12xx_probe_req_template));
+					      NULL, size, 0);
 		if (ret < 0)
 			return ret;
 	}
 
 	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL,
-				      sizeof(struct wl12xx_null_data_template));
+				      sizeof(struct wl12xx_null_data_template),
+				      0);
 	if (ret < 0)
 		return ret;
 
 	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, NULL,
-				      sizeof(struct wl12xx_ps_poll_template));
+				      sizeof(struct wl12xx_ps_poll_template),
+				      0);
 	if (ret < 0)
 		return ret;
 
 	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, NULL,
 				      sizeof
-				      (struct wl12xx_qos_null_data_template));
+				      (struct wl12xx_qos_null_data_template),
+				      0);
 	if (ret < 0)
 		return ret;
 
 	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL,
 				      sizeof
-				      (struct wl12xx_probe_resp_template));
+				      (struct wl12xx_probe_resp_template),
+				      0);
 	if (ret < 0)
 		return ret;
 
 	ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL,
 				      sizeof
-				      (struct wl12xx_beacon_template));
+				      (struct wl12xx_beacon_template),
+				      0);
 	if (ret < 0)
 		return ret;
 
+	for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
+		ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL,
+					      WL1271_CMD_TEMPL_MAX_SIZE, i);
+		if (ret < 0)
+			return ret;
+	}
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 2df00ad..afab52b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1596,7 +1596,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 			wl1271_ssid_set(wl, beacon);
 			ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON,
 						      beacon->data,
-						      beacon->len);
+						      beacon->len, 0);
 
 			if (ret < 0) {
 				dev_kfree_skb(beacon);
@@ -1611,7 +1611,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 			ret = wl1271_cmd_template_set(wl,
 						      CMD_TEMPL_PROBE_RESPONSE,
 						      beacon->data,
-						      beacon->len);
+						      beacon->len, 0);
 			dev_kfree_skb(beacon);
 			if (ret < 0)
 				goto out_sleep;
-- 
1.6.3.3


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

* [PATCH 23/24] wl1271: Enable hardware keep alive messages
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (21 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 22/24] wl1271: Add keep-alive frame template support Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 10:53 ` [PATCH 24/24] wl1271: Fix msleep() delay while waiting for completion Luciano Coelho
  2010-03-26 13:02 ` [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 John W. Linville
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Juuso Oikarinen

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

This patch will enable the hardware keep-alive mode, configure the required
template, configure keep-alive parameters, and re-order JOIN's and ACX_AID
in such a way that the keep-alive is activated.

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_acx.c  |   55 +++++++++++++++++++++++++++++
 drivers/net/wireless/wl12xx/wl1271_acx.h  |   31 ++++++++++++++++-
 drivers/net/wireless/wl12xx/wl1271_conf.h |    9 +++++
 drivers/net/wireless/wl12xx/wl1271_init.c |   13 +++++++
 drivers/net/wireless/wl12xx/wl1271_main.c |   33 ++++++++++++++++-
 5 files changed, 138 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.c b/drivers/net/wireless/wl12xx/wl1271_acx.c
index e7d1181..8f0bd5b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.c
@@ -1139,3 +1139,58 @@ out:
 	kfree(acx);
 	return ret;
 }
+
+int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable)
+{
+	struct wl1271_acx_keep_alive_mode *acx = NULL;
+	int ret = 0;
+
+	wl1271_debug(DEBUG_ACX, "acx keep alive mode: %d", enable);
+
+	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+	if (!acx) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	acx->enabled = enable;
+
+	ret = wl1271_cmd_configure(wl, ACX_KEEP_ALIVE_MODE, acx, sizeof(*acx));
+	if (ret < 0) {
+		wl1271_warning("acx keep alive mode failed: %d", ret);
+		goto out;
+	}
+
+out:
+	kfree(acx);
+	return ret;
+}
+int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid)
+{
+	struct wl1271_acx_keep_alive_config *acx = NULL;
+	int ret = 0;
+
+	wl1271_debug(DEBUG_ACX, "acx keep alive config");
+
+	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+	if (!acx) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	acx->period = cpu_to_le32(wl->conf.conn.keep_alive_interval);
+	acx->index = index;
+	acx->tpl_validation = tpl_valid;
+	acx->trigger = ACX_KEEP_ALIVE_NO_TX;
+
+	ret = wl1271_cmd_configure(wl, ACX_SET_KEEP_ALIVE_CONFIG,
+				   acx, sizeof(*acx));
+	if (ret < 0) {
+		wl1271_warning("acx keep alive config failed: %d", ret);
+		goto out;
+	}
+
+out:
+	kfree(acx);
+	return ret;
+}
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.h b/drivers/net/wireless/wl12xx/wl1271_acx.h
index b6eb0c1..15cc561 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.h
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.h
@@ -915,6 +915,33 @@ struct wl1271_acx_pm_config {
 	u8 padding[3];
 } __attribute__ ((packed));
 
+struct wl1271_acx_keep_alive_mode {
+	struct acx_header header;
+
+	u8 enabled;
+	u8 padding[3];
+} __attribute__ ((packed));
+
+enum {
+	ACX_KEEP_ALIVE_NO_TX = 0,
+	ACX_KEEP_ALIVE_PERIOD_ONLY
+};
+
+enum {
+	ACX_KEEP_ALIVE_TPL_INVALID = 0,
+	ACX_KEEP_ALIVE_TPL_VALID
+};
+
+struct wl1271_acx_keep_alive_config {
+	struct acx_header header;
+
+	__le32 period;
+	u8 index;
+	u8 tpl_validation;
+	u8 trigger;
+	u8 padding;
+} __attribute__ ((packed));
+
 enum {
 	ACX_WAKE_UP_CONDITIONS      = 0x0002,
 	ACX_MEM_CFG                 = 0x0003,
@@ -964,7 +991,7 @@ enum {
 	ACX_BET_ENABLE              = 0x0050,
 	ACX_RSSI_SNR_TRIGGER        = 0x0051,
 	ACX_RSSI_SNR_WEIGHTS        = 0x0051,
-	ACX_KEEP_ALIVE_MODE         = 0x0052,
+	ACX_KEEP_ALIVE_MODE         = 0x0053,
 	ACX_SET_KEEP_ALIVE_CONFIG   = 0x0054,
 	ACX_BA_SESSION_RESPONDER_POLICY = 0x0055,
 	ACX_BA_SESSION_INITIATOR_POLICY = 0x0056,
@@ -1031,5 +1058,7 @@ int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable);
 int wl1271_acx_arp_ip_filter(struct wl1271 *wl, bool enable, u8 *address,
 			     u8 version);
 int wl1271_acx_pm_config(struct wl1271 *wl);
+int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable);
+int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid);
 
 #endif /* __WL1271_ACX_H__ */
diff --git a/drivers/net/wireless/wl12xx/wl1271_conf.h b/drivers/net/wireless/wl12xx/wl1271_conf.h
index f63dd5e..82b5dab 100644
--- a/drivers/net/wireless/wl12xx/wl1271_conf.h
+++ b/drivers/net/wireless/wl12xx/wl1271_conf.h
@@ -955,6 +955,15 @@ struct conf_conn_settings {
 	 * Range 0 - 255
 	 */
 	u8 psm_entry_retries;
+
+	/*
+	 *
+	 * Specifies the interval of the connection keep-alive null-func
+	 * frame in ms.
+	 *
+	 * Range: 1000 - 3600000
+	 */
+	u32 keep_alive_interval;
 };
 
 enum {
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 0106663..8ec94ac 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -337,6 +337,19 @@ int wl1271_hw_init(struct wl1271 *wl)
 	if (ret < 0)
 		goto out_free_memmap;
 
+	/* disable all keep-alive templates */
+	for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
+		ret = wl1271_acx_keep_alive_config(wl, i,
+						   ACX_KEEP_ALIVE_TPL_INVALID);
+		if (ret < 0)
+			goto out_free_memmap;
+	}
+
+	/* disable the keep-alive feature */
+	ret = wl1271_acx_keep_alive_mode(wl, false);
+	if (ret < 0)
+		goto out_free_memmap;
+
 	return 0;
 
  out_free_memmap:
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index afab52b..033cef0 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -264,7 +264,8 @@ static struct conf_drv_settings default_conf = {
 		},
 		.bet_enable                  = CONF_BET_MODE_ENABLE,
 		.bet_max_consecutive         = 10,
-		.psm_entry_retries           = 3
+		.psm_entry_retries           = 3,
+		.keep_alive_interval         = 55000
 	},
 	.init = {
 		.radioparam = {
@@ -1203,6 +1204,9 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
 			wl->rate_set = CONF_TX_RATE_MASK_BASIC;
 			wl->sta_rate_set = 0;
 			wl1271_acx_rate_policies(wl);
+			wl1271_acx_keep_alive_config(
+				wl, CMD_TEMPL_KLV_IDX_NULL_DATA,
+				ACX_KEEP_ALIVE_TPL_INVALID);
 		}
 	}
 
@@ -1676,7 +1680,8 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 			ret = wl1271_cmd_build_probe_req(wl, NULL, 0,
 							 NULL, 0, wl->band);
 
-			ret = wl1271_acx_aid(wl, wl->aid);
+			/* Enable the keep-alive feature */
+			ret = wl1271_acx_keep_alive_mode(wl, true);
 			if (ret < 0)
 				goto out_sleep;
 
@@ -1700,6 +1705,10 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 
 			/* disable connection monitor features */
 			ret = wl1271_acx_conn_monit_params(wl, false);
+
+			/* Disable the keep-alive feature */
+			ret = wl1271_acx_keep_alive_mode(wl, false);
+
 			if (ret < 0)
 				goto out_sleep;
 		}
@@ -1744,6 +1753,26 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 		set_bit(WL1271_FLAG_JOINED, &wl->flags);
 	}
 
+	/*
+	 * The JOIN operation shuts down the firmware keep-alive as a side
+	 * effect, and the ACX_AID will start the keep-alive as a side effect.
+	 * Hence, for non-IBSS, the ACX_AID must always happen *after* the
+	 * JOIN operation, and the template config after the ACX_AID.
+	 */
+	if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
+		ret = wl1271_acx_aid(wl, wl->aid);
+		if (ret < 0)
+			goto out_sleep;
+		ret = wl1271_cmd_build_klv_null_data(wl);
+		if (ret < 0)
+			goto out_sleep;
+		ret = wl1271_acx_keep_alive_config(
+			wl, CMD_TEMPL_KLV_IDX_NULL_DATA,
+			ACX_KEEP_ALIVE_TPL_VALID);
+		if (ret < 0)
+			goto out_sleep;
+	}
+
 out_sleep:
 	wl1271_ps_elp_sleep(wl);
 
-- 
1.6.3.3


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

* [PATCH 24/24] wl1271: Fix msleep() delay while waiting for completion
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (22 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 23/24] wl1271: Enable hardware keep alive messages Luciano Coelho
@ 2010-03-26 10:53 ` Luciano Coelho
  2010-03-26 13:02 ` [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 John W. Linville
  24 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 10:53 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Saravanan Dhanabal

From: Saravanan Dhanabal <ext-saravanan.dhanabal@nokia.com>

After last transmission, the device goes to sleep earlier
than the configured dynamic power save timeout. If timeout
is set to 400ms, device enters into sleep mode at around
330ms since from last TX.

This patch removes the msleep(1), which causes the delay
after ELP wakeup. Replaced with udelay(10), the variation
is around 7-10ms.

Signed-off-by: Saravanan Dhanabal <ext-saravanan.dhanabal@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_cmd.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 0cb4cbb..f11f9f4 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -36,6 +36,8 @@
 #include "wl1271_cmd.h"
 #include "wl1271_event.h"
 
+#define WL1271_CMD_POLL_COUNT       5
+
 /*
  * send command to firmware
  *
@@ -52,6 +54,7 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
 	u32 intr;
 	int ret = 0;
 	u16 status;
+	u16 poll_count = 0;
 
 	cmd = buf;
 	cmd->id = cpu_to_le16(id);
@@ -73,7 +76,11 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
 			goto out;
 		}
 
-		msleep(1);
+		udelay(10);
+		poll_count++;
+		if (poll_count == WL1271_CMD_POLL_COUNT)
+			wl1271_info("cmd polling took over %d cycles",
+				    poll_count);
 
 		intr = wl1271_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
 	}
-- 
1.6.3.3


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

* Re: [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12
  2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
                   ` (23 preceding siblings ...)
  2010-03-26 10:53 ` [PATCH 24/24] wl1271: Fix msleep() delay while waiting for completion Luciano Coelho
@ 2010-03-26 13:02 ` John W. Linville
  2010-03-26 13:13   ` Luciano Coelho
  24 siblings, 1 reply; 29+ messages in thread
From: John W. Linville @ 2010-03-26 13:02 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

On Fri, Mar 26, 2010 at 12:53:09PM +0200, Luciano Coelho wrote:

> Here are 25 more patches for wl1271 which are still pending in our internal
> tree.  Please apply. :)

Are we catching-up?  Or will these dumps continue indefinitely?

John
-- 
John W. Linville                Someday the world will need a hero, and you
linville@tuxdriver.com                  might be all we have.  Be ready.

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

* Re: [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12
  2010-03-26 13:02 ` [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 John W. Linville
@ 2010-03-26 13:13   ` Luciano Coelho
  2010-03-26 13:26     ` John W. Linville
  0 siblings, 1 reply; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 13:13 UTC (permalink / raw)
  To: ext John W. Linville; +Cc: linux-wireless

On Fri, 2010-03-26 at 14:02 +0100, ext John W. Linville wrote:
> On Fri, Mar 26, 2010 at 12:53:09PM +0200, Luciano Coelho wrote:
> 
> > Here are 25 more patches for wl1271 which are still pending in our internal
> > tree.  Please apply. :)
> 
> Are we catching-up?  Or will these dumps continue indefinitely?

Now we have finally caught up! Sorry for the mess, but we haven't been
sending patches for a while and they really got delayed.

The idea from now on is to send them weekly (still in patch-sets), but
not so many at once.  We review and test our patches internally before
sending upstream, that's why we have to send them in batches.

I'm currently reconsidering this process and trying to figure out how we
can do things in a simpler way.  We are already doing all our mac80211
work upstream, but for the driver we haven't found a good solution yet.

Would you prefer to pull stuff from a git tree instead of applying the
patches?

-- 
Cheers,
Luca.


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

* Re: [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12
  2010-03-26 13:13   ` Luciano Coelho
@ 2010-03-26 13:26     ` John W. Linville
  2010-03-26 13:37       ` Luciano Coelho
  0 siblings, 1 reply; 29+ messages in thread
From: John W. Linville @ 2010-03-26 13:26 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

On Fri, Mar 26, 2010 at 03:13:15PM +0200, Luciano Coelho wrote:
> On Fri, 2010-03-26 at 14:02 +0100, ext John W. Linville wrote:
> > On Fri, Mar 26, 2010 at 12:53:09PM +0200, Luciano Coelho wrote:
> > 
> > > Here are 25 more patches for wl1271 which are still pending in our internal
> > > tree.  Please apply. :)
> > 
> > Are we catching-up?  Or will these dumps continue indefinitely?
> 
> Now we have finally caught up! Sorry for the mess, but we haven't been
> sending patches for a while and they really got delayed.
> 
> The idea from now on is to send them weekly (still in patch-sets), but
> not so many at once.  We review and test our patches internally before
> sending upstream, that's why we have to send them in batches.

Apparently Nokia, Intel, and maybe Atheros need to form some sort of
support group -- Patch-hoarder's Anonymous... :-)

> I'm currently reconsidering this process and trying to figure out how we
> can do things in a simpler way.  We are already doing all our mac80211
> work upstream, but for the driver we haven't found a good solution yet.
> 
> Would you prefer to pull stuff from a git tree instead of applying the
> patches?

It doesn't make a great deal of difference to me.  I have been pulling
from Intel for a little while now, and that has worked-out fairly
well from my perspective.  But, applying patchbombs is usually easy
so long as there hasn't been lots of other activity in the driver.
So, whatever is convenient for you is probably acceptable to me.

Hth!

John
-- 
John W. Linville                Someday the world will need a hero, and you
linville@tuxdriver.com                  might be all we have.  Be ready.

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

* Re: [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12
  2010-03-26 13:26     ` John W. Linville
@ 2010-03-26 13:37       ` Luciano Coelho
  0 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-03-26 13:37 UTC (permalink / raw)
  To: ext John W. Linville; +Cc: linux-wireless

On Fri, 2010-03-26 at 14:26 +0100, ext John W. Linville wrote:
> On Fri, Mar 26, 2010 at 03:13:15PM +0200, Luciano Coelho wrote:
> > On Fri, 2010-03-26 at 14:02 +0100, ext John W. Linville wrote:
> > > On Fri, Mar 26, 2010 at 12:53:09PM +0200, Luciano Coelho wrote:
> > > 
> > > > Here are 25 more patches for wl1271 which are still pending in our internal
> > > > tree.  Please apply. :)
> > > 
> > > Are we catching-up?  Or will these dumps continue indefinitely?
> > 
> > Now we have finally caught up! Sorry for the mess, but we haven't been
> > sending patches for a while and they really got delayed.
> > 
> > The idea from now on is to send them weekly (still in patch-sets), but
> > not so many at once.  We review and test our patches internally before
> > sending upstream, that's why we have to send them in batches.
> 
> Apparently Nokia, Intel, and maybe Atheros need to form some sort of
> support group -- Patch-hoarder's Anonymous... :-)

LOL!


> > I'm currently reconsidering this process and trying to figure out how we
> > can do things in a simpler way.  We are already doing all our mac80211
> > work upstream, but for the driver we haven't found a good solution yet.
> > 
> > Would you prefer to pull stuff from a git tree instead of applying the
> > patches?
> 
> It doesn't make a great deal of difference to me.  I have been pulling
> from Intel for a little while now, and that has worked-out fairly
> well from my perspective.  But, applying patchbombs is usually easy
> so long as there hasn't been lots of other activity in the driver.
> So, whatever is convenient for you is probably acceptable to me.

Good that this hasn't been causing too much extra work for you.  If you
have any trouble applying the patches I send, just let me know and I'll
fix it.

I think the main drawback of sending patchbombs is that we don't get
good reviews from the community.  Nobody wants to dig into a so many
patches at once, so it would probably be much better to have the patches
sent one-by-one (or in relevant sets).  Unfortunately, we still have
many internal rounds before we're satisfied with the patches.  But I'll
see if we can change that.

Tfyh! :)


-- 
Cheers,
Luca.


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

end of thread, other threads:[~2010-03-26 13:37 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-26 10:53 [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 Luciano Coelho
2010-03-26 10:53 ` [PATCH 01/24] wl1271: fix wl1271_spi driver name Luciano Coelho
2010-03-26 10:53 ` [PATCH 02/24] wl1271: Clean up RX rate reporting Luciano Coelho
2010-03-26 10:53 ` [PATCH 03/24] wl1271: Add TX " Luciano Coelho
2010-03-26 10:53 ` [PATCH 04/24] wl1271: Fix memory leaks in SPI initialization Luciano Coelho
2010-03-26 10:53 ` [PATCH 05/24] wl1271: Fix memory leak in scan command handling Luciano Coelho
2010-03-26 10:53 ` [PATCH 06/24] wl1271: Configure clock-request drive mode to open-drain Luciano Coelho
2010-03-26 10:53 ` [PATCH 07/24] wl1271: Warnings caused by wrong format specifiers fixed Luciano Coelho
2010-03-26 10:53 ` [PATCH 08/24] wl1271: Fix memory leak in cmd_data_path Luciano Coelho
2010-03-26 10:53 ` [PATCH 09/24] wl1271: Update busyword checking mechanism Luciano Coelho
2010-03-26 10:53 ` [PATCH 10/24] wl1271: Remove device MAC-address randomization Luciano Coelho
2010-03-26 10:53 ` [PATCH 11/24] wl1271: wait for join command complete event Luciano Coelho
2010-03-26 10:53 ` [PATCH 12/24] wl1271: wait for disconnect " Luciano Coelho
2010-03-26 10:53 ` [PATCH 13/24] wl1271: remove deprecated usage of RX status noise Luciano Coelho
2010-03-26 10:53 ` [PATCH 14/24] wl1271: Disable connection monitoring while not associated Luciano Coelho
2010-03-26 10:53 ` [PATCH 15/24] wl1271: Fix ad-hoc mode handling Luciano Coelho
2010-03-26 10:53 ` [PATCH 16/24] wl1271: Update beacon interval properly for ad-hoc Luciano Coelho
2010-03-26 10:53 ` [PATCH 17/24] wl1271: Removed checking of PSM from handling BSS_LOST_EVENT Luciano Coelho
2010-03-26 10:53 ` [PATCH 18/24] wl1271: Fix memory leak in firmware crash scenario Luciano Coelho
2010-03-26 10:53 ` [PATCH 19/24] wl1271: Configure probe-request template when associated Luciano Coelho
2010-03-26 10:53 ` [PATCH 20/24] wl1271: Disconnect if PSM entry fails Luciano Coelho
2010-03-26 10:53 ` [PATCH 21/24] wl1271: Configure HW connection monitor Luciano Coelho
2010-03-26 10:53 ` [PATCH 22/24] wl1271: Add keep-alive frame template support Luciano Coelho
2010-03-26 10:53 ` [PATCH 23/24] wl1271: Enable hardware keep alive messages Luciano Coelho
2010-03-26 10:53 ` [PATCH 24/24] wl1271: Fix msleep() delay while waiting for completion Luciano Coelho
2010-03-26 13:02 ` [PATCH 00/24] wl1271: bunch of patches from our internal tree wk12 John W. Linville
2010-03-26 13:13   ` Luciano Coelho
2010-03-26 13:26     ` John W. Linville
2010-03-26 13:37       ` Luciano Coelho

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