aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wil6210/netdev.c
diff options
context:
space:
mode:
authorLior David <liord@codeaurora.org>2018-02-26 13:12:15 -0500
committerKalle Valo <kvalo@codeaurora.org>2018-02-27 11:50:33 -0500
commit3ada9314b4ea06e656ebb8f5806ff97596a3d548 (patch)
treece6e920ec37e7be83246f59114cf8a1924cf9918 /drivers/net/wireless/ath/wil6210/netdev.c
parent4aebd3bdbd8a26ebcd2398289e2379472d17825f (diff)
wil6210: multiple VIFs support for start/stop AP
Add support for multiple VIFs in the cfg80211 operations start_ap, stop_ap and change_beacon. This change allows starting multiple APs using virtual interfaces. The data path and most other operations are still working only on the main interface. Signed-off-by: Lior David <liord@codeaurora.org> Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/netdev.c')
-rw-r--r--drivers/net/wireless/ath/wil6210/netdev.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c
index e23a80c235cc..87956c0f7c79 100644
--- a/drivers/net/wireless/ath/wil6210/netdev.c
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -20,8 +20,8 @@
20#include "wil6210.h" 20#include "wil6210.h"
21#include "txrx.h" 21#include "txrx.h"
22 22
23bool wil_has_other_up_ifaces(struct wil6210_priv *wil, 23bool wil_has_other_active_ifaces(struct wil6210_priv *wil,
24 struct net_device *ndev) 24 struct net_device *ndev, bool up, bool ok)
25{ 25{
26 int i; 26 int i;
27 struct wil6210_vif *vif; 27 struct wil6210_vif *vif;
@@ -31,17 +31,19 @@ bool wil_has_other_up_ifaces(struct wil6210_priv *wil,
31 vif = wil->vifs[i]; 31 vif = wil->vifs[i];
32 if (vif) { 32 if (vif) {
33 ndev_i = vif_to_ndev(vif); 33 ndev_i = vif_to_ndev(vif);
34 if (ndev_i != ndev && ndev_i->flags & IFF_UP) 34 if (ndev_i != ndev)
35 return true; 35 if ((up && (ndev_i->flags & IFF_UP)) ||
36 (ok && netif_carrier_ok(ndev_i)))
37 return true;
36 } 38 }
37 } 39 }
38 40
39 return false; 41 return false;
40} 42}
41 43
42bool wil_has_up_ifaces(struct wil6210_priv *wil) 44bool wil_has_active_ifaces(struct wil6210_priv *wil, bool up, bool ok)
43{ 45{
44 return wil_has_other_up_ifaces(wil, NULL); 46 return wil_has_other_active_ifaces(wil, NULL, up, ok);
45} 47}
46 48
47static int wil_open(struct net_device *ndev) 49static int wil_open(struct net_device *ndev)
@@ -57,7 +59,7 @@ static int wil_open(struct net_device *ndev)
57 return -EINVAL; 59 return -EINVAL;
58 } 60 }
59 61
60 if (!wil_has_other_up_ifaces(wil, ndev)) { 62 if (!wil_has_other_active_ifaces(wil, ndev, true, false)) {
61 wil_dbg_misc(wil, "open, first iface\n"); 63 wil_dbg_misc(wil, "open, first iface\n");
62 rc = wil_pm_runtime_get(wil); 64 rc = wil_pm_runtime_get(wil);
63 if (rc < 0) 65 if (rc < 0)
@@ -78,7 +80,7 @@ static int wil_stop(struct net_device *ndev)
78 80
79 wil_dbg_misc(wil, "stop\n"); 81 wil_dbg_misc(wil, "stop\n");
80 82
81 if (!wil_has_other_up_ifaces(wil, ndev)) { 83 if (!wil_has_other_active_ifaces(wil, ndev, true, false)) {
82 wil_dbg_misc(wil, "stop, last iface\n"); 84 wil_dbg_misc(wil, "stop, last iface\n");
83 rc = wil_down(wil); 85 rc = wil_down(wil);
84 if (!rc) 86 if (!rc)
@@ -359,7 +361,7 @@ int wil_vif_add(struct wil6210_priv *wil, struct wil6210_vif *vif)
359{ 361{
360 struct net_device *ndev = vif_to_ndev(vif); 362 struct net_device *ndev = vif_to_ndev(vif);
361 struct wireless_dev *wdev = vif_to_wdev(vif); 363 struct wireless_dev *wdev = vif_to_wdev(vif);
362 bool any_active = wil_has_up_ifaces(wil); 364 bool any_active = wil_has_active_ifaces(wil, true, false);
363 int rc; 365 int rc;
364 366
365 ASSERT_RTNL(); 367 ASSERT_RTNL();
@@ -428,7 +430,7 @@ void wil_vif_remove(struct wil6210_priv *wil, u8 mid)
428{ 430{
429 struct wil6210_vif *vif; 431 struct wil6210_vif *vif;
430 struct net_device *ndev; 432 struct net_device *ndev;
431 bool any_active = wil_has_up_ifaces(wil); 433 bool any_active = wil_has_active_ifaces(wil, true, false);
432 434
433 ASSERT_RTNL(); 435 ASSERT_RTNL();
434 if (mid >= wil->max_vifs) { 436 if (mid >= wil->max_vifs) {