mwifiex: enable traffic only when port is open
authorAvinash Patil <patila@marvell.com>
Mon, 22 Jun 2015 13:36:18 +0000 (19:06 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 21 Jul 2015 13:40:31 +0000 (16:40 +0300)
This patch adds support to enable data traffic only when port is open.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mwifiex/init.c
drivers/net/wireless/mwifiex/join.c
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_cmdresp.c
drivers/net/wireless/mwifiex/sta_event.c
drivers/net/wireless/mwifiex/uap_event.c
drivers/net/wireless/mwifiex/wmm.c

index e1b62bf0f7b49da4c3f2025e2932984fa7a58744..8fa363add9706364843207a85d475096f20dbeb7 100644 (file)
@@ -77,7 +77,7 @@ int mwifiex_init_priv(struct mwifiex_private *priv)
 
        priv->media_connected = false;
        eth_broadcast_addr(priv->curr_addr);
-
+       priv->port_open = false;
        priv->pkt_tx_ctrl = 0;
        priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
        priv->data_rate = 0;    /* Initially indicate the rate as auto */
index 56b024a6aaa58d2b89ca25692c37163367eda597..3cda1f956f0b1654ec438291e22f416ada279e17 100644 (file)
@@ -783,6 +783,8 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
 
        if (priv->sec_info.wpa_enabled || priv->sec_info.wpa2_enabled)
                priv->scan_block = true;
+       else
+               priv->port_open = true;
 
 done:
        /* Need to indicate IOCTL complete */
index c59430e906aea8a32a4f0b1f22211ee5a9eda4be..6f98d7ea93382094d7e7e6ff72393a7e37eb05fe 100644 (file)
@@ -519,6 +519,7 @@ struct mwifiex_private {
        u8 frame_type;
        u8 curr_addr[ETH_ALEN];
        u8 media_connected;
+       u8 port_open;
        u32 num_tx_timeout;
        /* track consecutive timeout */
        u8 tx_timeout_cnt;
index 6a85c774587a20b6637ec43c93324903cac6a373..18f269eaed605c1482ac7bcdb6f512ac96605521 100644 (file)
@@ -599,6 +599,7 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv,
                                    "info: key: GTK is set\n");
                        priv->wpa_is_gtk_set = true;
                        priv->scan_block = false;
+                       priv->port_open = true;
                }
        }
 
@@ -629,6 +630,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
                        mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n");
                        priv->wpa_is_gtk_set = true;
                        priv->scan_block = false;
+                       priv->port_open = true;
                }
        }
 
index f1045d41abee8348d5c72124abc7942726052564..72be16eca75843b5ab5b440c5ccf293ec172f94c 100644 (file)
@@ -54,6 +54,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code)
        priv->media_connected = false;
 
        priv->scan_block = false;
+       priv->port_open = false;
 
        if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
            ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) {
@@ -474,7 +475,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
 
        case EVENT_PS_AWAKE:
                mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n");
-               if (!adapter->pps_uapsd_mode &&
+               if (!adapter->pps_uapsd_mode && priv->port_open &&
                    priv->media_connected && adapter->sleep_period.period) {
                                adapter->pps_uapsd_mode = true;
                                mwifiex_dbg(adapter, EVENT,
@@ -553,6 +554,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
 
        case EVENT_PORT_RELEASE:
                mwifiex_dbg(adapter, EVENT, "event: PORT RELEASE\n");
+               priv->port_open = true;
                break;
 
        case EVENT_EXT_SCAN_REPORT:
index 7bc1f850e3b7195302577738ef3c546f4fddd92a..a412c3d4c365296cf534cba0c2b34d486a9ab20e 100644 (file)
@@ -176,6 +176,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
                break;
        case EVENT_UAP_BSS_IDLE:
                priv->media_connected = false;
+               priv->port_open = false;
                if (netif_carrier_ok(priv->netdev))
                        netif_carrier_off(priv->netdev);
                mwifiex_stop_net_dev_queue(priv->netdev, adapter);
@@ -185,6 +186,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
                break;
        case EVENT_UAP_BSS_ACTIVE:
                priv->media_connected = true;
+               priv->port_open = true;
                if (!netif_carrier_ok(priv->netdev))
                        netif_carrier_on(priv->netdev);
                mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
@@ -192,6 +194,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
        case EVENT_UAP_BSS_START:
                mwifiex_dbg(adapter, EVENT,
                            "AP EVENT: event id: %#x\n", eventcause);
+               priv->port_open = false;
                memcpy(priv->netdev->dev_addr, adapter->event_body + 2,
                       ETH_ALEN);
                if (priv->hist_data)
index 7995f92bc2d4178738f5151d43a0d74dc0d0071c..173d3663c2e042bfe44e680e04acf86cf43f7c30 100644 (file)
@@ -465,6 +465,8 @@ mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter)
 
        for (i = 0; i < adapter->priv_num; ++i) {
                priv = adapter->priv[i];
+               if (priv && !priv->port_open)
+                       continue;
                if (priv && atomic_read(&priv->wmm.tx_pkts_queued))
                        return false;
        }
@@ -1080,7 +1082,8 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
 
                        priv_tmp = adapter->bss_prio_tbl[j].bss_prio_cur->priv;
 
-                       if (atomic_read(&priv_tmp->wmm.tx_pkts_queued) == 0)
+                       if (!priv_tmp->port_open ||
+                           (atomic_read(&priv_tmp->wmm.tx_pkts_queued) == 0))
                                continue;
 
                        /* iterate over the WMM queues of the BSS */