* [PATCH 3/9] mwifiex: abort scan while cancelling pending command
@ 2014-02-28 3:35 Bing Zhao
2014-02-28 3:35 ` [PATCH 4/9] mwifiex: skipping pending commands after unload Bing Zhao
2014-02-28 3:35 ` [PATCH 5/9] mwifiex: stop AP at shutdown time Bing Zhao
0 siblings, 2 replies; 5+ messages in thread
From: Bing Zhao @ 2014-02-28 3:35 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Tim Shepard, Avery Pennarun, Amitkumar Karwar,
Avinash Patil, Maithili Hinge, Xinming Hu, Bing Zhao
From: Amitkumar Karwar <akarwar@marvell.com>
mwifiex_cancel_pending_ioctl() and
mwifiex_cancel_all_pending_cmd() are called in command timeout
and driver unload paths respectively.
If scan operation is in progress, we should abort it smoothly.
Reported-by: Tim Shepard <shep@alum.mit.edu>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
drivers/net/wireless/mwifiex/cmdevt.c | 38 ++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 64e708b..58cf3a9 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -966,7 +966,9 @@ void
mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
{
struct cmd_ctrl_node *cmd_node = NULL, *tmp_node;
- unsigned long flags;
+ unsigned long flags, cmd_flags;
+ struct mwifiex_private *priv;
+ int i;
/* Cancel current cmd */
if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) {
@@ -1006,9 +1008,21 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
}
spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
- spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
- adapter->scan_processing = false;
- spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
+ if (adapter->scan_processing) {
+ spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
+ adapter->scan_processing = false;
+ spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags);
+ for (i = 0; i < adapter->priv_num; i++) {
+ priv = adapter->priv[i];
+ if (!priv)
+ continue;
+ if (priv->scan_request) {
+ dev_dbg(adapter->dev, "info: aborting scan\n");
+ cfg80211_scan_done(priv->scan_request, 1);
+ priv->scan_request = NULL;
+ }
+ }
+ }
}
/*
@@ -1027,7 +1041,8 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL;
unsigned long cmd_flags;
unsigned long scan_pending_q_flags;
- bool cancel_scan_cmd = false;
+ struct mwifiex_private *priv;
+ int i;
if ((adapter->curr_cmd) &&
(adapter->curr_cmd->wait_q_enabled)) {
@@ -1053,15 +1068,24 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
spin_lock_irqsave(&adapter->scan_pending_q_lock,
scan_pending_q_flags);
- cancel_scan_cmd = true;
}
spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
scan_pending_q_flags);
- if (cancel_scan_cmd) {
+ if (adapter->scan_processing) {
spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
adapter->scan_processing = false;
spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags);
+ for (i = 0; i < adapter->priv_num; i++) {
+ priv = adapter->priv[i];
+ if (!priv)
+ continue;
+ if (priv->scan_request) {
+ dev_dbg(adapter->dev, "info: aborting scan\n");
+ cfg80211_scan_done(priv->scan_request, 1);
+ priv->scan_request = NULL;
+ }
+ }
}
adapter->cmd_wait_q.status = -1;
}
--
1.8.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/9] mwifiex: skipping pending commands after unload
2014-02-28 3:35 [PATCH 3/9] mwifiex: abort scan while cancelling pending command Bing Zhao
@ 2014-02-28 3:35 ` Bing Zhao
2014-02-28 3:35 ` [PATCH 5/9] mwifiex: stop AP at shutdown time Bing Zhao
1 sibling, 0 replies; 5+ messages in thread
From: Bing Zhao @ 2014-02-28 3:35 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Tim Shepard, Avery Pennarun, Amitkumar Karwar,
Avinash Patil, Maithili Hinge, Xinming Hu, Bing Zhao
From: Amitkumar Karwar <akarwar@marvell.com>
We skip downloading other commands after FUNC_SHUTDOWN is queued
during driver unload. Main thread should be woken up each time
after freeing skipped command so that FUNC_SHUTDOWN gets served
in case if there are other pending commands before FUNC_SHUTDOWN.
Also, call mwifiex_complete_cmd() only for synchronous commands.
Reported-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Maithili Hinge <maithili@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
drivers/net/wireless/mwifiex/cmdevt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 58cf3a9..0958764 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -165,8 +165,10 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
dev_err(adapter->dev,
"DNLD_CMD: FW in reset state, ignore cmd %#x\n",
cmd_code);
- mwifiex_complete_cmd(adapter, cmd_node);
+ if (cmd_node->wait_q_enabled)
+ mwifiex_complete_cmd(adapter, cmd_node);
mwifiex_recycle_cmd_node(adapter, cmd_node);
+ queue_work(adapter->workqueue, &adapter->main_work);
return -1;
}
--
1.8.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/9] mwifiex: stop AP at shutdown time
2014-02-28 3:35 [PATCH 3/9] mwifiex: abort scan while cancelling pending command Bing Zhao
2014-02-28 3:35 ` [PATCH 4/9] mwifiex: skipping pending commands after unload Bing Zhao
@ 2014-02-28 3:35 ` Bing Zhao
2014-02-28 7:56 ` Johannes Berg
1 sibling, 1 reply; 5+ messages in thread
From: Bing Zhao @ 2014-02-28 3:35 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Tim Shepard, Avery Pennarun, Amitkumar Karwar,
Avinash Patil, Maithili Hinge, Xinming Hu, Bing Zhao
From: Amitkumar Karwar <akarwar@marvell.com>
Deauth is sent to AP when the device is acting as station at
shutdown time. Similarly we should stop AP operation also.
mwifiex_deauthenticate() takes care closing the connection
based on provided interface type.
Add a new function to simplify the code.
Reported-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
drivers/net/wireless/mwifiex/join.c | 15 ++++++++++++++-
drivers/net/wireless/mwifiex/main.h | 1 +
drivers/net/wireless/mwifiex/pcie.c | 7 +------
drivers/net/wireless/mwifiex/sdio.c | 7 +------
drivers/net/wireless/mwifiex/usb.c | 8 ++------
5 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index e9bd435..89dc62a 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -1443,7 +1443,20 @@ int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac)
return ret;
}
-EXPORT_SYMBOL_GPL(mwifiex_deauthenticate);
+
+/* This function deauthenticates/disconnects from all BSS. */
+void mwifiex_deauthenticate_all(struct mwifiex_adapter *adapter)
+{
+ struct mwifiex_private *priv;
+ int i;
+
+ for (i = 0; i < adapter->priv_num; i++) {
+ priv = adapter->priv[i];
+ if (priv)
+ mwifiex_deauthenticate(priv, NULL);
+ }
+}
+EXPORT_SYMBOL_GPL(mwifiex_deauthenticate_all);
/*
* This function converts band to radio type used in channel TLV.
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 6747405..85ce29c 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -926,6 +926,7 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason);
u8 mwifiex_band_to_radio_type(u8 band);
int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
+void mwifiex_deauthenticate_all(struct mwifiex_adapter *adapter);
int mwifiex_adhoc_start(struct mwifiex_private *priv,
struct cfg80211_ssid *adhoc_ssid);
int mwifiex_adhoc_join(struct mwifiex_private *priv,
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index f56595c..9f1683b 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -211,7 +211,6 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)
struct pcie_service_card *card;
struct mwifiex_adapter *adapter;
struct mwifiex_private *priv;
- int i;
card = pci_get_drvdata(pdev);
if (!card)
@@ -230,11 +229,7 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)
mwifiex_pcie_resume(&pdev->dev);
#endif
- for (i = 0; i < adapter->priv_num; i++)
- if ((GET_BSS_ROLE(adapter->priv[i]) ==
- MWIFIEX_BSS_ROLE_STA) &&
- adapter->priv[i]->media_connected)
- mwifiex_deauthenticate(adapter->priv[i], NULL);
+ mwifiex_deauthenticate_all(adapter);
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index d5661a6..e0dcd3e 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -166,7 +166,6 @@ mwifiex_sdio_remove(struct sdio_func *func)
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
struct mwifiex_private *priv;
- int i;
pr_debug("info: SDIO func num=%d\n", func->num);
@@ -185,11 +184,7 @@ mwifiex_sdio_remove(struct sdio_func *func)
if (adapter->is_suspended)
mwifiex_sdio_resume(adapter->dev);
- for (i = 0; i < adapter->priv_num; i++)
- if ((GET_BSS_ROLE(adapter->priv[i]) ==
- MWIFIEX_BSS_ROLE_STA) &&
- adapter->priv[i]->media_connected)
- mwifiex_deauthenticate(adapter->priv[i], NULL);
+ mwifiex_deauthenticate_all(adapter);
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
mwifiex_disable_auto_ds(priv);
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
index f47a793..ae30c39 100644
--- a/drivers/net/wireless/mwifiex/usb.c
+++ b/drivers/net/wireless/mwifiex/usb.c
@@ -1026,7 +1026,6 @@ static void mwifiex_usb_cleanup_module(void)
if (usb_card && usb_card->adapter) {
struct mwifiex_adapter *adapter = usb_card->adapter;
- int i;
/* In case driver is removed when asynchronous FW downloading is
* in progress
@@ -1037,11 +1036,8 @@ static void mwifiex_usb_cleanup_module(void)
if (adapter->is_suspended)
mwifiex_usb_resume(usb_card->intf);
#endif
- for (i = 0; i < adapter->priv_num; i++)
- if ((GET_BSS_ROLE(adapter->priv[i]) ==
- MWIFIEX_BSS_ROLE_STA) &&
- adapter->priv[i]->media_connected)
- mwifiex_deauthenticate(adapter->priv[i], NULL);
+
+ mwifiex_deauthenticate_all(adapter);
mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter,
MWIFIEX_BSS_ROLE_ANY),
--
1.8.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 5/9] mwifiex: stop AP at shutdown time
2014-02-28 3:35 ` [PATCH 5/9] mwifiex: stop AP at shutdown time Bing Zhao
@ 2014-02-28 7:56 ` Johannes Berg
2014-02-28 8:26 ` Bing Zhao
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2014-02-28 7:56 UTC (permalink / raw)
To: Bing Zhao
Cc: linux-wireless, John W. Linville, Tim Shepard, Avery Pennarun,
Amitkumar Karwar, Avinash Patil, Maithili Hinge, Xinming Hu
On Thu, 2014-02-27 at 19:35 -0800, Bing Zhao wrote:
> From: Amitkumar Karwar <akarwar@marvell.com>
>
> Deauth is sent to AP when the device is acting as station at
> shutdown time. Similarly we should stop AP operation also.
> mwifiex_deauthenticate() takes care closing the connection
> based on provided interface type.
Wouldn't all this be handled by cfg80211 anyway?
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 5/9] mwifiex: stop AP at shutdown time
2014-02-28 7:56 ` Johannes Berg
@ 2014-02-28 8:26 ` Bing Zhao
0 siblings, 0 replies; 5+ messages in thread
From: Bing Zhao @ 2014-02-28 8:26 UTC (permalink / raw)
To: Johannes Berg
Cc: linux-wireless, John W. Linville, Tim Shepard, Avery Pennarun,
Amitkumar Karwar, Avinash Patil, Maithili Hinge, Xinming Hu
SGkgSm9oYW5uZXMsDQoNClRoYW5rcyBmb3IgcmV2aWV3aW5nIG91ciBwYXRjaC4NCg0KPiBPbiBU
aHUsIDIwMTQtMDItMjcgYXQgMTk6MzUgLTA4MDAsIEJpbmcgWmhhbyB3cm90ZToNCj4gPiBGcm9t
OiBBbWl0a3VtYXIgS2Fyd2FyIDxha2Fyd2FyQG1hcnZlbGwuY29tPg0KPiA+DQo+ID4gRGVhdXRo
IGlzIHNlbnQgdG8gQVAgd2hlbiB0aGUgZGV2aWNlIGlzIGFjdGluZyBhcyBzdGF0aW9uIGF0IHNo
dXRkb3duDQo+ID4gdGltZS4gU2ltaWxhcmx5IHdlIHNob3VsZCBzdG9wIEFQIG9wZXJhdGlvbiBh
bHNvLg0KPiA+IG13aWZpZXhfZGVhdXRoZW50aWNhdGUoKSB0YWtlcyBjYXJlIGNsb3NpbmcgdGhl
IGNvbm5lY3Rpb24gYmFzZWQgb24NCj4gPiBwcm92aWRlZCBpbnRlcmZhY2UgdHlwZS4NCj4gDQo+
IFdvdWxkbid0IGFsbCB0aGlzIGJlIGhhbmRsZWQgYnkgY2ZnODAyMTEgYW55d2F5Pw0KDQpJdCB3
b3VsZCwgYnV0IGl0J3MgdG9vIGxhdGUuDQpXaGVuIG13aWZpZXggZHJpdmVyIGdldHMgdW5sb2Fk
ZWQsIGl0IG5lZWRzIHRvIHNlbmQgQlNTX1NUT1AgY29tbWFuZCB0byBmaXJtd2FyZSBhbmQgdGhl
biBzaHV0IGRvd24gdGhlIGZpcm13YXJlLiBQcmlvciB0byB0aGlzIHBhdGNoIHdlIHJlbHkgb24g
LnN0b3BfYXAgaGFuZGxlciB0byBzZW5kIHRoZSBCU1NfU1RPUCBjb21tYW5kIHRvIGZpcm13YXJl
Lg0KVW5mb3J0dW5hdGVseSwgYnkgdGhlIHRpbWUgd2hlbiAuc3RvcF9hcCBoYW5kbGVyIGlzIGNh
bGxlZCwgZHJpdmVyIGhhcyBhbHJlYWR5IHNodXQgZG93biB0aGUgZmlybXdhcmUsIGhlbmNlIHRo
ZSBCU1NfU1RPUCBjb21tYW5kIGlzIGlnbm9yZWQsIGxlYXZpbmcgdGhlIGZpcm13YXJlIGluIGEg
dW5rbm93biBzdGF0ZS4NClRoaXMgcGF0Y2ggbWFrZXMgc3VyZSB0aGF0IHRoZSBCU1NfU1RPUCBj
b21tYW5kIGlzIHNlbnQgdG8gZmlybXdhcmUgZXhwbGljaXRseSBiZWZvcmUgdGhlIHNodXRkb3du
Lg0KDQpUaGFua3MsDQpCaW5nDQoNCj4gDQo+IGpvaGFubmVzDQoNCg==
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-28 8:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-28 3:35 [PATCH 3/9] mwifiex: abort scan while cancelling pending command Bing Zhao
2014-02-28 3:35 ` [PATCH 4/9] mwifiex: skipping pending commands after unload Bing Zhao
2014-02-28 3:35 ` [PATCH 5/9] mwifiex: stop AP at shutdown time Bing Zhao
2014-02-28 7:56 ` Johannes Berg
2014-02-28 8:26 ` 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.