mwifiex: abort scan while cancelling pending command
PATCH 5/9 mwifiex: stop AP at shutdown time
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
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.
--- 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(-)
drivers/net/wireless/mwifiex/join.c +14 -1
@@ -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.
drivers/net/wireless/mwifiex/main.h +1 -0
@@ -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,
drivers/net/wireless/mwifiex/pcie.c +1 -6
@@ -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 );
drivers/net/wireless/mwifiex/sdio.c +1 -6
@@ -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);
drivers/net/wireless/mwifiex/usb.c +2 -6
@@ -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),
Signature · 1 line
1.8.2.3
PATCH 3/9 mwifiex: abort scan while cancelling pending command
From: Amitkumar Karwar <[email protected]>
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.
--- drivers/net/wireless/mwifiex/cmdevt.c | 38 ++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-)
drivers/net/wireless/mwifiex/cmdevt.c +31 -7
@@ -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 ; }
Signature · 1 line
1.8.2.3
PATCH 4/9 mwifiex: skipping pending commands after unload
From: Amitkumar Karwar <[email protected]>
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.
--- drivers/net/wireless/mwifiex/cmdevt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mwifiex/cmdevt.c +3 -1
@@ -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 ; }
Signature · 1 line
1.8.2.3
Johannes Berg
maintainerRe: [PATCH 5/9] mwifiex: stop AP at shutdown time
In reply to Bing ZhaoQuoted 6 lines · Bing Zhao
From: Amitkumar Karwar <[email protected]>
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
RE: [PATCH 5/9] mwifiex: stop AP at shutdown time
SGkgSm9oYW5uZXMsDQoNClRoYW5rcyBmb3IgcmV2aWV3aW5nIG91ciBwYXRjaC4NCg0KPiBPbiBU aHUsIDIwMTQtMDItMjcgYXQgMTk6MzUgLTA4MDAsIEJpbmcgWmhhbyB3cm90ZToNCj4gPiBGcm9t OiBBbWl0a3VtYXIgS2Fyd2FyIDxha2Fyd2FyQG1hcnZlbGwuY29tPg0KPiA+DQo+ID4gRGVhdXRo IGlzIHNlbnQgdG8gQVAgd2hlbiB0aGUgZGV2aWNlIGlzIGFjdGluZyBhcyBzdGF0aW9uIGF0IHNo dXRkb3duDQo+ID4gdGltZS4gU2ltaWxhcmx5IHdlIHNob3VsZCBzdG9wIEFQIG9wZXJhdGlvbiBh bHNvLg0KPiA+IG13aWZpZXhfZGVhdXRoZW50aWNhdGUoKSB0YWtlcyBjYXJlIGNsb3NpbmcgdGhl IGNvbm5lY3Rpb24gYmFzZWQgb24NCj4gPiBwcm92aWRlZCBpbnRlcmZhY2UgdHlwZS4NCj4gDQo+ IFdvdWxkbid0IGFsbCB0aGlzIGJlIGhhbmRsZWQgYnkgY2ZnODAyMTEgYW55d2F5Pw0KDQpJdCB3 b3VsZCwgYnV0IGl0J3MgdG9vIGxhdGUuDQpXaGVuIG13aWZpZXggZHJpdmVyIGdldHMgdW5sb2Fk ZWQsIGl0IG5lZWRzIHRvIHNlbmQgQlNTX1NUT1AgY29tbWFuZCB0byBmaXJtd2FyZSBhbmQgdGhl biBzaHV0IGRvd24gdGhlIGZpcm13YXJlLiBQcmlvciB0byB0aGlzIHBhdGNoIHdlIHJlbHkgb24g LnN0b3BfYXAgaGFuZGxlciB0byBzZW5kIHRoZSBCU1NfU1RPUCBjb21tYW5kIHRvIGZpcm13YXJl Lg0KVW5mb3J0dW5hdGVseSwgYnkgdGhlIHRpbWUgd2hlbiAuc3RvcF9hcCBoYW5kbGVyIGlzIGNh bGxlZCwgZHJpdmVyIGhhcyBhbHJlYWR5IHNodXQgZG93biB0aGUgZmlybXdhcmUsIGhlbmNlIHRo ZSBCU1NfU1RPUCBjb21tYW5kIGlzIGlnbm9yZWQsIGxlYXZpbmcgdGhlIGZpcm13YXJlIGluIGEg dW5rbm93biBzdGF0ZS4NClRoaXMgcGF0Y2ggbWFrZXMgc3VyZSB0aGF0IHRoZSBCU1NfU1RPUCBj b21tYW5kIGlzIHNlbnQgdG8gZmlybXdhcmUgZXhwbGljaXRseSBiZWZvcmUgdGhlIHNodXRkb3du Lg0KDQpUaGFua3MsDQpCaW5nDQoNCj4gDQo+IGpvaGFubmVzDQoNCg==