Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 1/3] wl12xx: fix testmode test/interrogate commands
@ 2011-12-06 10:15 Eliad Peller
  2011-12-06 10:15 ` [PATCH 2/3] wl12xx: remove redundant commands from plt init Eliad Peller
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eliad Peller @ 2011-12-06 10:15 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

fix several issues in testmode test/interrogate commands:
1. check the driver state is not OFF.
2. wakeup the chip from elp (if needed)
3. fix memory leak in wl1271_tm_cmd_interrogate()

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 drivers/net/wireless/wl12xx/testmode.c |   72 +++++++++++++++++++++++--------
 1 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c
index 5b3f781..8d970d0 100644
--- a/drivers/net/wireless/wl12xx/testmode.c
+++ b/drivers/net/wireless/wl12xx/testmode.c
@@ -29,6 +29,7 @@
 #include "debug.h"
 #include "acx.h"
 #include "reg.h"
+#include "ps.h"
 
 #define WL1271_TM_MAX_DATA_LENGTH 1024
 
@@ -89,31 +90,47 @@ static int wl1271_tm_cmd_test(struct wl1271 *wl, struct nlattr *tb[])
 		return -EMSGSIZE;
 
 	mutex_lock(&wl->mutex);
-	ret = wl1271_cmd_test(wl, buf, buf_len, answer);
-	mutex_unlock(&wl->mutex);
 
+	if (wl->state == WL1271_STATE_OFF) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = wl1271_ps_elp_wakeup(wl);
+	if (ret < 0)
+		goto out;
+
+	ret = wl1271_cmd_test(wl, buf, buf_len, answer);
 	if (ret < 0) {
 		wl1271_warning("testmode cmd test failed: %d", ret);
-		return ret;
+		goto out_sleep;
 	}
 
 	if (answer) {
 		len = nla_total_size(buf_len);
 		skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, len);
-		if (!skb)
-			return -ENOMEM;
+		if (!skb) {
+			ret = -ENOMEM;
+			goto out_sleep;
+		}
 
 		NLA_PUT(skb, WL1271_TM_ATTR_DATA, buf_len, buf);
 		ret = cfg80211_testmode_reply(skb);
 		if (ret < 0)
-			return ret;
+			goto out_sleep;
 	}
 
-	return 0;
+out_sleep:
+	wl1271_ps_elp_sleep(wl);
+out:
+	mutex_unlock(&wl->mutex);
+
+	return ret;
 
 nla_put_failure:
 	kfree_skb(skb);
-	return -EMSGSIZE;
+	ret = -EMSGSIZE;
+	goto out_sleep;
 }
 
 static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[])
@@ -130,33 +147,50 @@ static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[])
 
 	ie_id = nla_get_u8(tb[WL1271_TM_ATTR_IE_ID]);
 
+	mutex_lock(&wl->mutex);
+
+	if (wl->state == WL1271_STATE_OFF) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = wl1271_ps_elp_wakeup(wl);
+	if (ret < 0)
+		goto out;
+
 	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
-	if (!cmd)
-		return -ENOMEM;
+	if (!cmd) {
+		ret = -ENOMEM;
+		goto out_sleep;
+	}
 
-	mutex_lock(&wl->mutex);
 	ret = wl1271_cmd_interrogate(wl, ie_id, cmd, sizeof(*cmd));
-	mutex_unlock(&wl->mutex);
-
 	if (ret < 0) {
 		wl1271_warning("testmode cmd interrogate failed: %d", ret);
-		kfree(cmd);
-		return ret;
+		goto out_free;
 	}
 
 	skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, sizeof(*cmd));
 	if (!skb) {
-		kfree(cmd);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto out_free;
 	}
 
 	NLA_PUT(skb, WL1271_TM_ATTR_DATA, sizeof(*cmd), cmd);
 
-	return 0;
+out_free:
+	kfree(cmd);
+out_sleep:
+	wl1271_ps_elp_sleep(wl);
+out:
+	mutex_unlock(&wl->mutex);
+
+	return ret;
 
 nla_put_failure:
 	kfree_skb(skb);
-	return -EMSGSIZE;
+	ret = -EMSGSIZE;
+	goto out_free;
 }
 
 static int wl1271_tm_cmd_configure(struct wl1271 *wl, struct nlattr *tb[])
-- 
1.7.6.401.g6a319


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

* [PATCH 2/3] wl12xx: remove redundant commands from plt init
  2011-12-06 10:15 [PATCH 1/3] wl12xx: fix testmode test/interrogate commands Eliad Peller
@ 2011-12-06 10:15 ` Eliad Peller
  2011-12-06 10:15 ` [PATCH 3/3] wl12xx: send testmode reply in wl1271_tm_cmd_interrogate Eliad Peller
  2011-12-13  9:28 ` [PATCH 1/3] wl12xx: fix testmode test/interrogate commands Luciano Coelho
  2 siblings, 0 replies; 4+ messages in thread
From: Eliad Peller @ 2011-12-06 10:15 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

During plt init we configure some redundant commands,
which are not needed for plt (specifically, we shouldn't
configure any role-specific params, as there are no
active roles). remove them.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 drivers/net/wireless/wl12xx/main.c |   61 +-----------------------------------
 1 files changed, 1 insertions(+), 60 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index f4113fe..7e72604 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -641,9 +641,7 @@ static void wl1271_conf_init(struct wl1271 *wl)
 
 static int wl1271_plt_init(struct wl1271 *wl)
 {
-	struct conf_tx_ac_category *conf_ac;
-	struct conf_tx_tid *conf_tid;
-	int ret, i;
+	int ret;
 
 	if (wl->chip.id == CHIP_ID_1283_PG20)
 		ret = wl128x_cmd_general_parms(wl);
@@ -672,10 +670,6 @@ static int wl1271_plt_init(struct wl1271 *wl)
 	if (ret < 0)
 		return ret;
 
-	ret = wl1271_init_templates_config(wl);
-	if (ret < 0)
-		return ret;
-
 	ret = wl1271_acx_init_mem_config(wl);
 	if (ret < 0)
 		return ret;
@@ -685,63 +679,10 @@ static int wl1271_plt_init(struct wl1271 *wl)
 	if (ret < 0)
 		goto out_free_memmap;
 
-	ret = wl1271_acx_dco_itrim_params(wl);
-	if (ret < 0)
-		goto out_free_memmap;
-
-	/* Initialize connection monitoring thresholds */
-	ret = wl1271_acx_conn_monit_params(wl, NULL, false); /* TODO: fix */
-	if (ret < 0)
-		goto out_free_memmap;
-
-	/* Bluetooth WLAN coexistence */
-	ret = wl1271_init_pta(wl);
-	if (ret < 0)
-		goto out_free_memmap;
-
-	/* FM WLAN coexistence */
-	ret = wl1271_acx_fm_coex(wl);
-	if (ret < 0)
-		goto out_free_memmap;
-
-	/* Energy detection */
-	ret = wl1271_init_energy_detection(wl);
-	if (ret < 0)
-		goto out_free_memmap;
-
 	ret = wl12xx_acx_mem_cfg(wl);
 	if (ret < 0)
 		goto out_free_memmap;
 
-	/* Default fragmentation threshold */
-	ret = wl1271_acx_frag_threshold(wl, wl->conf.tx.frag_threshold);
-	if (ret < 0)
-		goto out_free_memmap;
-
-	/* Default TID/AC configuration */
-	BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count);
-	for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
-		conf_ac = &wl->conf.tx.ac_conf[i];
-		/* TODO: fix */
-		ret = wl1271_acx_ac_cfg(wl, NULL, conf_ac->ac, conf_ac->cw_min,
-					conf_ac->cw_max, conf_ac->aifsn,
-					conf_ac->tx_op_limit);
-		if (ret < 0)
-			goto out_free_memmap;
-
-		conf_tid = &wl->conf.tx.tid_conf[i];
-		/* TODO: fix */
-		ret = wl1271_acx_tid_cfg(wl, NULL, conf_tid->queue_id,
-					 conf_tid->channel_type,
-					 conf_tid->tsid,
-					 conf_tid->ps_scheme,
-					 conf_tid->ack_policy,
-					 conf_tid->apsd_conf[0],
-					 conf_tid->apsd_conf[1]);
-		if (ret < 0)
-			goto out_free_memmap;
-	}
-
 	/* Enable data path */
 	ret = wl1271_cmd_data_path(wl, 1);
 	if (ret < 0)
-- 
1.7.6.401.g6a319


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

* [PATCH 3/3] wl12xx: send testmode reply in wl1271_tm_cmd_interrogate
  2011-12-06 10:15 [PATCH 1/3] wl12xx: fix testmode test/interrogate commands Eliad Peller
  2011-12-06 10:15 ` [PATCH 2/3] wl12xx: remove redundant commands from plt init Eliad Peller
@ 2011-12-06 10:15 ` Eliad Peller
  2011-12-13  9:28 ` [PATCH 1/3] wl12xx: fix testmode test/interrogate commands Luciano Coelho
  2 siblings, 0 replies; 4+ messages in thread
From: Eliad Peller @ 2011-12-06 10:15 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

wl1271_tm_cmd_interrogate creates a reply skb, but doesn't
send it (and thus just leaks it).
Add the missing cfg80211_testmode_reply() call.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 drivers/net/wireless/wl12xx/testmode.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c
index 8d970d0..25093c0 100644
--- a/drivers/net/wireless/wl12xx/testmode.c
+++ b/drivers/net/wireless/wl12xx/testmode.c
@@ -177,6 +177,9 @@ static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[])
 	}
 
 	NLA_PUT(skb, WL1271_TM_ATTR_DATA, sizeof(*cmd), cmd);
+	ret = cfg80211_testmode_reply(skb);
+	if (ret < 0)
+		goto out_free;
 
 out_free:
 	kfree(cmd);
-- 
1.7.6.401.g6a319


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

* Re: [PATCH 1/3] wl12xx: fix testmode test/interrogate commands
  2011-12-06 10:15 [PATCH 1/3] wl12xx: fix testmode test/interrogate commands Eliad Peller
  2011-12-06 10:15 ` [PATCH 2/3] wl12xx: remove redundant commands from plt init Eliad Peller
  2011-12-06 10:15 ` [PATCH 3/3] wl12xx: send testmode reply in wl1271_tm_cmd_interrogate Eliad Peller
@ 2011-12-13  9:28 ` Luciano Coelho
  2 siblings, 0 replies; 4+ messages in thread
From: Luciano Coelho @ 2011-12-13  9:28 UTC (permalink / raw)
  To: Eliad Peller; +Cc: linux-wireless

On Tue, 2011-12-06 at 12:15 +0200, Eliad Peller wrote: 
> fix several issues in testmode test/interrogate commands:
> 1. check the driver state is not OFF.
> 2. wakeup the chip from elp (if needed)
> 3. fix memory leak in wl1271_tm_cmd_interrogate()
> 
> Signed-off-by: Eliad Peller <eliad@wizery.com>
> ---

Forgot to reply earlier.  But just for the record and consistency, this
series has been applied and pushed.

-- 
Cheers,
Luca.


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

end of thread, other threads:[~2011-12-13  9:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06 10:15 [PATCH 1/3] wl12xx: fix testmode test/interrogate commands Eliad Peller
2011-12-06 10:15 ` [PATCH 2/3] wl12xx: remove redundant commands from plt init Eliad Peller
2011-12-06 10:15 ` [PATCH 3/3] wl12xx: send testmode reply in wl1271_tm_cmd_interrogate Eliad Peller
2011-12-13  9:28 ` [PATCH 1/3] wl12xx: fix testmode test/interrogate commands Luciano Coelho

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