Commit 5c894633 authored by Avinash Patil's avatar Avinash Patil Committed by Kalle Valo

mwifiex: enable traffic only when port is open

This patch adds support to enable data traffic only when port is open.
Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent a1777327
...@@ -77,7 +77,7 @@ int mwifiex_init_priv(struct mwifiex_private *priv) ...@@ -77,7 +77,7 @@ int mwifiex_init_priv(struct mwifiex_private *priv)
priv->media_connected = false; priv->media_connected = false;
eth_broadcast_addr(priv->curr_addr); eth_broadcast_addr(priv->curr_addr);
priv->port_open = false;
priv->pkt_tx_ctrl = 0; priv->pkt_tx_ctrl = 0;
priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
priv->data_rate = 0; /* Initially indicate the rate as auto */ priv->data_rate = 0; /* Initially indicate the rate as auto */
......
...@@ -783,6 +783,8 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, ...@@ -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) if (priv->sec_info.wpa_enabled || priv->sec_info.wpa2_enabled)
priv->scan_block = true; priv->scan_block = true;
else
priv->port_open = true;
done: done:
/* Need to indicate IOCTL complete */ /* Need to indicate IOCTL complete */
......
...@@ -519,6 +519,7 @@ struct mwifiex_private { ...@@ -519,6 +519,7 @@ struct mwifiex_private {
u8 frame_type; u8 frame_type;
u8 curr_addr[ETH_ALEN]; u8 curr_addr[ETH_ALEN];
u8 media_connected; u8 media_connected;
u8 port_open;
u32 num_tx_timeout; u32 num_tx_timeout;
/* track consecutive timeout */ /* track consecutive timeout */
u8 tx_timeout_cnt; u8 tx_timeout_cnt;
......
...@@ -599,6 +599,7 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, ...@@ -599,6 +599,7 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv,
"info: key: GTK is set\n"); "info: key: GTK is set\n");
priv->wpa_is_gtk_set = true; priv->wpa_is_gtk_set = true;
priv->scan_block = false; 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, ...@@ -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"); mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n");
priv->wpa_is_gtk_set = true; priv->wpa_is_gtk_set = true;
priv->scan_block = false; priv->scan_block = false;
priv->port_open = true;
} }
} }
......
...@@ -54,6 +54,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) ...@@ -54,6 +54,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code)
priv->media_connected = false; priv->media_connected = false;
priv->scan_block = false; priv->scan_block = false;
priv->port_open = false;
if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) && if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) { ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) {
...@@ -474,7 +475,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) ...@@ -474,7 +475,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
case EVENT_PS_AWAKE: case EVENT_PS_AWAKE:
mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n"); 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) { priv->media_connected && adapter->sleep_period.period) {
adapter->pps_uapsd_mode = true; adapter->pps_uapsd_mode = true;
mwifiex_dbg(adapter, EVENT, mwifiex_dbg(adapter, EVENT,
...@@ -553,6 +554,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) ...@@ -553,6 +554,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
case EVENT_PORT_RELEASE: case EVENT_PORT_RELEASE:
mwifiex_dbg(adapter, EVENT, "event: PORT RELEASE\n"); mwifiex_dbg(adapter, EVENT, "event: PORT RELEASE\n");
priv->port_open = true;
break; break;
case EVENT_EXT_SCAN_REPORT: case EVENT_EXT_SCAN_REPORT:
......
...@@ -176,6 +176,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv) ...@@ -176,6 +176,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
break; break;
case EVENT_UAP_BSS_IDLE: case EVENT_UAP_BSS_IDLE:
priv->media_connected = false; priv->media_connected = false;
priv->port_open = false;
if (netif_carrier_ok(priv->netdev)) if (netif_carrier_ok(priv->netdev))
netif_carrier_off(priv->netdev); netif_carrier_off(priv->netdev);
mwifiex_stop_net_dev_queue(priv->netdev, adapter); mwifiex_stop_net_dev_queue(priv->netdev, adapter);
...@@ -185,6 +186,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv) ...@@ -185,6 +186,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
break; break;
case EVENT_UAP_BSS_ACTIVE: case EVENT_UAP_BSS_ACTIVE:
priv->media_connected = true; priv->media_connected = true;
priv->port_open = true;
if (!netif_carrier_ok(priv->netdev)) if (!netif_carrier_ok(priv->netdev))
netif_carrier_on(priv->netdev); netif_carrier_on(priv->netdev);
mwifiex_wake_up_net_dev_queue(priv->netdev, adapter); mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
...@@ -192,6 +194,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv) ...@@ -192,6 +194,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
case EVENT_UAP_BSS_START: case EVENT_UAP_BSS_START:
mwifiex_dbg(adapter, EVENT, mwifiex_dbg(adapter, EVENT,
"AP EVENT: event id: %#x\n", eventcause); "AP EVENT: event id: %#x\n", eventcause);
priv->port_open = false;
memcpy(priv->netdev->dev_addr, adapter->event_body + 2, memcpy(priv->netdev->dev_addr, adapter->event_body + 2,
ETH_ALEN); ETH_ALEN);
if (priv->hist_data) if (priv->hist_data)
......
...@@ -465,6 +465,8 @@ mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) ...@@ -465,6 +465,8 @@ mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter)
for (i = 0; i < adapter->priv_num; ++i) { for (i = 0; i < adapter->priv_num; ++i) {
priv = adapter->priv[i]; priv = adapter->priv[i];
if (priv && !priv->port_open)
continue;
if (priv && atomic_read(&priv->wmm.tx_pkts_queued)) if (priv && atomic_read(&priv->wmm.tx_pkts_queued))
return false; return false;
} }
...@@ -1080,7 +1082,8 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, ...@@ -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; 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; continue;
/* iterate over the WMM queues of the BSS */ /* iterate over the WMM queues of the BSS */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment