diff options
author | Dedy Lansky <qca_dlansky@qca.qualcomm.com> | 2015-01-25 03:52:43 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-01-29 02:53:32 -0500 |
commit | c5e96c91fa8f98ddceac16f410fc741648585401 (patch) | |
tree | b32812cac3c7230aa2700dfb445d2788967b151a | |
parent | 8c6796758f0abd8ee2b4d7e8c6ca5f7adf737ee6 (diff) |
wil6210: fix timing of netif_carrier_on indication
netif_carrier_on indication was too late. In case Rx packet received
before netif_carrier_on indication, upper layers could not send
Tx packet back.
The fix is to indicate netif_carrier_on earlier:
for STA, indicate netif_carrier_on when association starts.
for AP/PCP, indicate netif_carrier_on upon starting AP/PCP.
Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/ath/wil6210/cfg80211.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/main.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/netdev.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wil6210.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wmi.c | 2 |
5 files changed, 12 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index bd013fdb86dc..553aa2e2257a 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c | |||
@@ -454,6 +454,7 @@ static int wil_cfg80211_connect(struct wiphy *wiphy, | |||
454 | 454 | ||
455 | rc = wmi_send(wil, WMI_CONNECT_CMDID, &conn, sizeof(conn)); | 455 | rc = wmi_send(wil, WMI_CONNECT_CMDID, &conn, sizeof(conn)); |
456 | if (rc == 0) { | 456 | if (rc == 0) { |
457 | netif_carrier_on(ndev); | ||
457 | /* Connect can take lots of time */ | 458 | /* Connect can take lots of time */ |
458 | mod_timer(&wil->connect_timer, | 459 | mod_timer(&wil->connect_timer, |
459 | jiffies + msecs_to_jiffies(2000)); | 460 | jiffies + msecs_to_jiffies(2000)); |
@@ -757,12 +758,12 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy, | |||
757 | 758 | ||
758 | wil->secure_pcp = info->privacy; | 759 | wil->secure_pcp = info->privacy; |
759 | 760 | ||
761 | netif_carrier_on(ndev); | ||
762 | |||
760 | rc = wmi_pcp_start(wil, info->beacon_interval, wmi_nettype, | 763 | rc = wmi_pcp_start(wil, info->beacon_interval, wmi_nettype, |
761 | channel->hw_value); | 764 | channel->hw_value); |
762 | if (rc) | 765 | if (rc) |
763 | goto out; | 766 | netif_carrier_off(ndev); |
764 | |||
765 | netif_carrier_on(ndev); | ||
766 | 767 | ||
767 | out: | 768 | out: |
768 | mutex_unlock(&wil->mutex); | 769 | mutex_unlock(&wil->mutex); |
@@ -777,6 +778,7 @@ static int wil_cfg80211_stop_ap(struct wiphy *wiphy, | |||
777 | 778 | ||
778 | wil_dbg_misc(wil, "%s()\n", __func__); | 779 | wil_dbg_misc(wil, "%s()\n", __func__); |
779 | 780 | ||
781 | netif_carrier_off(ndev); | ||
780 | wil_set_recovery_state(wil, fw_recovery_idle); | 782 | wil_set_recovery_state(wil, fw_recovery_idle); |
781 | 783 | ||
782 | mutex_lock(&wil->mutex); | 784 | mutex_lock(&wil->mutex); |
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index 62dc24189bd3..00c9b0f87c9b 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c | |||
@@ -248,7 +248,9 @@ static void _wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid, | |||
248 | switch (wdev->iftype) { | 248 | switch (wdev->iftype) { |
249 | case NL80211_IFTYPE_STATION: | 249 | case NL80211_IFTYPE_STATION: |
250 | case NL80211_IFTYPE_P2P_CLIENT: | 250 | case NL80211_IFTYPE_P2P_CLIENT: |
251 | wil_link_off(wil); | 251 | netif_tx_stop_all_queues(ndev); |
252 | netif_carrier_off(ndev); | ||
253 | |||
252 | if (test_bit(wil_status_fwconnected, wil->status)) { | 254 | if (test_bit(wil_status_fwconnected, wil->status)) { |
253 | clear_bit(wil_status_fwconnected, wil->status); | 255 | clear_bit(wil_status_fwconnected, wil->status); |
254 | cfg80211_disconnected(ndev, reason_code, | 256 | cfg80211_disconnected(ndev, reason_code, |
@@ -395,6 +397,8 @@ static void wil_connect_worker(struct work_struct *work) | |||
395 | int rc; | 397 | int rc; |
396 | struct wil6210_priv *wil = container_of(work, struct wil6210_priv, | 398 | struct wil6210_priv *wil = container_of(work, struct wil6210_priv, |
397 | connect_worker); | 399 | connect_worker); |
400 | struct net_device *ndev = wil_to_ndev(wil); | ||
401 | |||
398 | int cid = wil->pending_connect_cid; | 402 | int cid = wil->pending_connect_cid; |
399 | int ringid = wil_find_free_vring(wil); | 403 | int ringid = wil_find_free_vring(wil); |
400 | 404 | ||
@@ -409,7 +413,7 @@ static void wil_connect_worker(struct work_struct *work) | |||
409 | wil->pending_connect_cid = -1; | 413 | wil->pending_connect_cid = -1; |
410 | if (rc == 0) { | 414 | if (rc == 0) { |
411 | wil->sta[cid].status = wil_sta_connected; | 415 | wil->sta[cid].status = wil_sta_connected; |
412 | wil_link_on(wil); | 416 | netif_tx_wake_all_queues(ndev); |
413 | } else { | 417 | } else { |
414 | wil->sta[cid].status = wil_sta_unused; | 418 | wil->sta[cid].status = wil_sta_unused; |
415 | } | 419 | } |
@@ -741,28 +745,6 @@ void wil_fw_error_recovery(struct wil6210_priv *wil) | |||
741 | schedule_work(&wil->fw_error_worker); | 745 | schedule_work(&wil->fw_error_worker); |
742 | } | 746 | } |
743 | 747 | ||
744 | void wil_link_on(struct wil6210_priv *wil) | ||
745 | { | ||
746 | struct net_device *ndev = wil_to_ndev(wil); | ||
747 | |||
748 | wil_dbg_misc(wil, "%s()\n", __func__); | ||
749 | |||
750 | netif_carrier_on(ndev); | ||
751 | wil_dbg_misc(wil, "netif_tx_wake : link on\n"); | ||
752 | netif_tx_wake_all_queues(ndev); | ||
753 | } | ||
754 | |||
755 | void wil_link_off(struct wil6210_priv *wil) | ||
756 | { | ||
757 | struct net_device *ndev = wil_to_ndev(wil); | ||
758 | |||
759 | wil_dbg_misc(wil, "%s()\n", __func__); | ||
760 | |||
761 | netif_tx_stop_all_queues(ndev); | ||
762 | wil_dbg_misc(wil, "netif_tx_stop : link off\n"); | ||
763 | netif_carrier_off(ndev); | ||
764 | } | ||
765 | |||
766 | int __wil_up(struct wil6210_priv *wil) | 748 | int __wil_up(struct wil6210_priv *wil) |
767 | { | 749 | { |
768 | struct net_device *ndev = wil_to_ndev(wil); | 750 | struct net_device *ndev = wil_to_ndev(wil); |
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c index e81703ca7701..f1f9e510bfe9 100644 --- a/drivers/net/wireless/ath/wil6210/netdev.c +++ b/drivers/net/wireless/ath/wil6210/netdev.c | |||
@@ -174,7 +174,7 @@ void *wil_if_alloc(struct device *dev, void __iomem *csr) | |||
174 | netif_napi_add(ndev, &wil->napi_tx, wil6210_netdev_poll_tx, | 174 | netif_napi_add(ndev, &wil->napi_tx, wil6210_netdev_poll_tx, |
175 | WIL6210_NAPI_BUDGET); | 175 | WIL6210_NAPI_BUDGET); |
176 | 176 | ||
177 | wil_link_off(wil); | 177 | netif_tx_stop_all_queues(ndev); |
178 | 178 | ||
179 | return wil; | 179 | return wil; |
180 | 180 | ||
@@ -217,8 +217,6 @@ int wil_if_add(struct wil6210_priv *wil) | |||
217 | return rc; | 217 | return rc; |
218 | } | 218 | } |
219 | 219 | ||
220 | wil_link_off(wil); | ||
221 | |||
222 | return 0; | 220 | return 0; |
223 | } | 221 | } |
224 | 222 | ||
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index da3fe7853d63..b4404e71cfca 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h | |||
@@ -649,8 +649,6 @@ void wil_priv_deinit(struct wil6210_priv *wil); | |||
649 | int wil_reset(struct wil6210_priv *wil); | 649 | int wil_reset(struct wil6210_priv *wil); |
650 | void wil_fw_error_recovery(struct wil6210_priv *wil); | 650 | void wil_fw_error_recovery(struct wil6210_priv *wil); |
651 | void wil_set_recovery_state(struct wil6210_priv *wil, int state); | 651 | void wil_set_recovery_state(struct wil6210_priv *wil, int state); |
652 | void wil_link_on(struct wil6210_priv *wil); | ||
653 | void wil_link_off(struct wil6210_priv *wil); | ||
654 | int wil_up(struct wil6210_priv *wil); | 652 | int wil_up(struct wil6210_priv *wil); |
655 | int __wil_up(struct wil6210_priv *wil); | 653 | int __wil_up(struct wil6210_priv *wil); |
656 | int wil_down(struct wil6210_priv *wil); | 654 | int wil_down(struct wil6210_priv *wil); |
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 097d78bca2f0..0f3e4334c8e3 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c | |||
@@ -566,7 +566,6 @@ static void wil_addba_tx_cid(struct wil6210_priv *wil, u8 cid, u16 wsize) | |||
566 | 566 | ||
567 | static void wmi_evt_linkup(struct wil6210_priv *wil, int id, void *d, int len) | 567 | static void wmi_evt_linkup(struct wil6210_priv *wil, int id, void *d, int len) |
568 | { | 568 | { |
569 | struct net_device *ndev = wil_to_ndev(wil); | ||
570 | struct wmi_data_port_open_event *evt = d; | 569 | struct wmi_data_port_open_event *evt = d; |
571 | u8 cid = evt->cid; | 570 | u8 cid = evt->cid; |
572 | 571 | ||
@@ -580,7 +579,6 @@ static void wmi_evt_linkup(struct wil6210_priv *wil, int id, void *d, int len) | |||
580 | wil->sta[cid].data_port_open = true; | 579 | wil->sta[cid].data_port_open = true; |
581 | if (agg_wsize >= 0) | 580 | if (agg_wsize >= 0) |
582 | wil_addba_tx_cid(wil, cid, agg_wsize); | 581 | wil_addba_tx_cid(wil, cid, agg_wsize); |
583 | netif_carrier_on(ndev); | ||
584 | } | 582 | } |
585 | 583 | ||
586 | static void wmi_evt_linkdown(struct wil6210_priv *wil, int id, void *d, int len) | 584 | static void wmi_evt_linkdown(struct wil6210_priv *wil, int id, void *d, int len) |