All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mwifiex: scan command preparation failure handling
@ 2014-03-20 23:23 Bing Zhao
  2014-03-20 23:23 ` [PATCH] mwifiex: cancel pending commands for signal Bing Zhao
  2014-03-20 23:23 ` [PATCH] mwifiex: use timeout variant for wait_event_interruptible Bing Zhao
  0 siblings, 2 replies; 3+ messages in thread
From: Bing Zhao @ 2014-03-20 23:23 UTC (permalink / raw)
  To: linux-wireless
  Cc: John W. Linville, Amitkumar Karwar, Avinash Patil,
	Maithili Hinge, Xinming Hu, Bing Zhao

From: Amitkumar Karwar <akarwar@marvell.com>

When scan request is received, scan commands are prepared and
queued into scan pending queue. There is a corner case when
command nodes are full. So we stop queueing further scan
commands and return an error. This patch makes sure that
currently queued commands in scan pending queue are also freed
in this case.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
 drivers/net/wireless/mwifiex/scan.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index f139244..a5ecd83 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -591,9 +591,12 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
 			  *chan_tlv_out,
 			  struct mwifiex_chan_scan_param_set *scan_chan_list)
 {
+	struct mwifiex_adapter *adapter = priv->adapter;
 	int ret = 0;
 	struct mwifiex_chan_scan_param_set *tmp_chan_list;
 	struct mwifiex_chan_scan_param_set *start_chan;
+	struct cmd_ctrl_node *cmd_node, *tmp_node;
+	unsigned long flags;
 
 	u32 tlv_idx, rates_size, cmd_no;
 	u32 total_scan_time;
@@ -748,8 +751,19 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
 		scan_cfg_out->tlv_buf_len -=
 			    sizeof(struct mwifiex_ie_types_header) + rates_size;
 
-		if (ret)
+		if (ret) {
+			spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
+			list_for_each_entry_safe(cmd_node, tmp_node,
+						 &adapter->scan_pending_q,
+						 list) {
+				list_del(&cmd_node->list);
+				cmd_node->wait_q_enabled = false;
+				mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
+			}
+			spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
+					       flags);
 			break;
+		}
 	}
 
 	if (ret)
-- 
1.8.2.3


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

* [PATCH] mwifiex: cancel pending commands for signal
  2014-03-20 23:23 [PATCH] mwifiex: scan command preparation failure handling Bing Zhao
@ 2014-03-20 23:23 ` Bing Zhao
  2014-03-20 23:23 ` [PATCH] mwifiex: use timeout variant for wait_event_interruptible Bing Zhao
  1 sibling, 0 replies; 3+ messages in thread
From: Bing Zhao @ 2014-03-20 23:23 UTC (permalink / raw)
  To: linux-wireless
  Cc: John W. Linville, Amitkumar Karwar, Avinash Patil,
	Maithili Hinge, Xinming Hu, Bing Zhao

From: Amitkumar Karwar <akarwar@marvell.com>

When a thread is interrupted by signal, all
wait_event_interruptible calls after queueing commands return
an error. Numbers of commands in pending queue are increased
in this case. Sometimes all commands nodes in pool are filled.

We will cancel pending commands when signal is received.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
 drivers/net/wireless/mwifiex/sta_ioctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 33170af..95abaf4 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -64,6 +64,7 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
 					  *(cmd_queued->condition));
 	if (status) {
 		dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status);
+		mwifiex_cancel_all_pending_cmd(adapter);
 		return status;
 	}
 
-- 
1.8.2.3


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

* [PATCH] mwifiex: use timeout variant for wait_event_interruptible
  2014-03-20 23:23 [PATCH] mwifiex: scan command preparation failure handling Bing Zhao
  2014-03-20 23:23 ` [PATCH] mwifiex: cancel pending commands for signal Bing Zhao
@ 2014-03-20 23:23 ` Bing Zhao
  1 sibling, 0 replies; 3+ messages in thread
From: Bing Zhao @ 2014-03-20 23:23 UTC (permalink / raw)
  To: linux-wireless
  Cc: John W. Linville, Amitkumar Karwar, Avinash Patil,
	Maithili Hinge, Xinming Hu, Bing Zhao

From: Amitkumar Karwar <akarwar@marvell.com>

It has been observed that system hangs during suspend, if host
sleep activation fails due to a missing interrupt from firmware.
Use timeout variant, so that the thread will be woken up when
timer expires.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
 drivers/net/wireless/mwifiex/sta_ioctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 95abaf4..fcb791c 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -517,8 +517,9 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 		return false;
 	}
 
-	if (wait_event_interruptible(adapter->hs_activate_wait_q,
-				     adapter->hs_activate_wait_q_woken)) {
+	if (wait_event_interruptible_timeout(adapter->hs_activate_wait_q,
+					     adapter->hs_activate_wait_q_woken,
+					     (10 * HZ)) <= 0) {
 		dev_err(adapter->dev, "hs_activate_wait_q terminated\n");
 		return false;
 	}
-- 
1.8.2.3


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

end of thread, other threads:[~2014-03-20 23:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-20 23:23 [PATCH] mwifiex: scan command preparation failure handling Bing Zhao
2014-03-20 23:23 ` [PATCH] mwifiex: cancel pending commands for signal Bing Zhao
2014-03-20 23:23 ` [PATCH] mwifiex: use timeout variant for wait_event_interruptible Bing Zhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.