Search Linux Wireless

[PATCH 17/31] wifi: mwifiex: fix multiple station handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mwifiex_is_send_cmd_allowed() and mwifiex_is_tdls_chan_switching() are
called with the first bss in station mode. There can be multiple bss in
station mode and we have to consider all of them, not only the first
one. Instead of the bss priv pass the adapter to these functions and
iterate over the bss as necessary.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/net/wireless/marvell/mwifiex/main.c | 17 +++++----------
 drivers/net/wireless/marvell/mwifiex/main.h |  4 ++--
 drivers/net/wireless/marvell/mwifiex/util.c | 34 +++++++++++++++++------------
 3 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index f1f6deaa91122..c1f9b483cb5da 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -330,16 +330,12 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
 
 			if ((!adapter->scan_chan_gap_enabled &&
 			     adapter->scan_processing) || adapter->data_sent ||
-			     mwifiex_is_tdls_chan_switching
-			     (mwifiex_get_priv(adapter,
-					       MWIFIEX_BSS_ROLE_STA)) ||
+			     mwifiex_is_tdls_chan_switching(adapter) ||
 			    (mwifiex_wmm_lists_empty(adapter) &&
 			     mwifiex_bypass_txlist_empty(adapter) &&
 			     skb_queue_empty(&adapter->tx_data_q))) {
 				if (adapter->cmd_sent || adapter->curr_cmd ||
-					!mwifiex_is_send_cmd_allowed
-						(mwifiex_get_priv(adapter,
-						MWIFIEX_BSS_ROLE_STA)) ||
+				    !mwifiex_is_send_cmd_allowed(adapter) ||
 				    (!is_command_pending(adapter)))
 					break;
 			}
@@ -387,8 +383,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
 		}
 
 		if (!adapter->cmd_sent && !adapter->curr_cmd &&
-		    mwifiex_is_send_cmd_allowed
-		    (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) {
+		    mwifiex_is_send_cmd_allowed(adapter)) {
 			if (mwifiex_exec_next_cmd(adapter) == -1) {
 				ret = -1;
 				break;
@@ -424,8 +419,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
 		     !adapter->scan_processing) &&
 		    !adapter->data_sent &&
 		    !mwifiex_bypass_txlist_empty(adapter) &&
-		    !mwifiex_is_tdls_chan_switching
-			(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) {
+		    !mwifiex_is_tdls_chan_switching(adapter)) {
 			if (adapter->hs_activated_manually) {
 				mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY),
 						  MWIFIEX_ASYNC_CMD);
@@ -443,8 +437,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
 		if ((adapter->scan_chan_gap_enabled ||
 		     !adapter->scan_processing) &&
 		    !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter) &&
-		    !mwifiex_is_tdls_chan_switching
-			(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) {
+		    !mwifiex_is_tdls_chan_switching(adapter)) {
 			if (adapter->hs_activated_manually) {
 				mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY),
 						  MWIFIEX_ASYNC_CMD);
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index 0f75d69ada924..d3c04402a4f22 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1565,8 +1565,8 @@ struct mwifiex_sta_node *
 mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac);
 struct mwifiex_sta_node *
 mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac);
-u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv);
-u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv);
+u8 mwifiex_is_tdls_chan_switching(struct mwifiex_adapter *adapter);
+u8 mwifiex_is_send_cmd_allowed(struct mwifiex_adapter *adapter);
 int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer,
 				 u8 action_code, u8 dialog_token,
 				 u16 status_code, const u8 *extra_ies,
diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c
index ea28d604ee69c..078877161ab7c 100644
--- a/drivers/net/wireless/marvell/mwifiex/util.c
+++ b/drivers/net/wireless/marvell/mwifiex/util.c
@@ -634,13 +634,19 @@ mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac)
 }
 
 static struct mwifiex_sta_node *
-mwifiex_get_tdls_sta_entry(struct mwifiex_private *priv, u8 status)
+mwifiex_get_tdls_sta_entry(struct mwifiex_adapter *adapter, u8 status)
 {
+	struct mwifiex_private *priv;
 	struct mwifiex_sta_node *node;
+	int i;
 
-	list_for_each_entry(node, &priv->sta_list, list) {
-		if (node->tdls_status == status)
-			return node;
+	for (i = 0; i < adapter->priv_num; i++) {
+                priv = adapter->priv[i];
+
+		list_for_each_entry(node, &priv->sta_list, list) {
+			if (node->tdls_status == status)
+				return node;
+		}
 	}
 
 	return NULL;
@@ -649,28 +655,28 @@ mwifiex_get_tdls_sta_entry(struct mwifiex_private *priv, u8 status)
 /* If tdls channel switching is on-going, tx data traffic should be
  * blocked until the switching stage completed.
  */
-u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv)
+u8 mwifiex_is_tdls_chan_switching(struct mwifiex_adapter *adapter)
 {
 	struct mwifiex_sta_node *sta_ptr;
 
-	if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info))
+	if (!ISSUPP_TDLS_ENABLED(adapter->fw_cap_info))
 		return false;
 
-	sta_ptr = mwifiex_get_tdls_sta_entry(priv, TDLS_CHAN_SWITCHING);
+	sta_ptr = mwifiex_get_tdls_sta_entry(adapter, TDLS_CHAN_SWITCHING);
 	if (sta_ptr)
 		return true;
 
 	return false;
 }
 
-static u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv)
+static u8 mwifiex_is_tdls_off_chan(struct mwifiex_adapter *adapter)
 {
 	struct mwifiex_sta_node *sta_ptr;
 
-	if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info))
+	if (!ISSUPP_TDLS_ENABLED(adapter->fw_cap_info))
 		return false;
 
-	sta_ptr = mwifiex_get_tdls_sta_entry(priv, TDLS_IN_OFF_CHAN);
+	sta_ptr = mwifiex_get_tdls_sta_entry(adapter, TDLS_IN_OFF_CHAN);
 	if (sta_ptr)
 		return true;
 
@@ -680,13 +686,13 @@ static u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv)
 /* If tdls channel switching is on-going or tdls operate on off-channel,
  * cmd path should be blocked until tdls switched to base-channel.
  */
-u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv)
+u8 mwifiex_is_send_cmd_allowed(struct mwifiex_adapter *adapter)
 {
-	if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info))
+	if (!ISSUPP_TDLS_ENABLED(adapter->fw_cap_info))
 		return true;
 
-	if (mwifiex_is_tdls_chan_switching(priv) ||
-	    mwifiex_is_tdls_off_chan(priv))
+	if (mwifiex_is_tdls_chan_switching(adapter) ||
+	    mwifiex_is_tdls_off_chan(adapter))
 		return false;
 
 	return true;

-- 
2.39.2





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux