wil6210: support regular scan on P2P_DEVICE interface
authorLior David <qca_liord@qca.qualcomm.com>
Tue, 26 Apr 2016 11:41:38 +0000 (14:41 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 26 Apr 2016 11:57:45 +0000 (14:57 +0300)
P2P search can only run on the social channel (channel 2).
When issuing a scan request on the P2P_DEVICE interface,
driver ignored the channels argument and always performed a P2P
search.
Fix this by checking the channels argument, if it is
not specified (meaning full scan) or if a non-social channel
was specified, perform a regular scan and not a P2P search.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/wil6210/cfg80211.c
drivers/net/wireless/ath/wil6210/p2p.c
drivers/net/wireless/ath/wil6210/wil6210.h

index 0fb3a7941d84ef26ba48fc5c6043695f11895fa7..5769811291bf4e085afe76dd1cba48f0c7212c35 100644 (file)
@@ -375,8 +375,9 @@ static int wil_cfg80211_scan(struct wiphy *wiphy,
                return -EBUSY;
        }
 
-       /* scan on P2P_DEVICE is handled as p2p search */
-       if (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE) {
+       /* social scan on P2P_DEVICE is handled as p2p search */
+       if (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE &&
+           wil_p2p_is_social_scan(request)) {
                wil->scan_request = request;
                wil->radio_wdev = wdev;
                rc = wil_p2p_search(wil, request);
index 2c1b8958180ef2059aec18fc76f75f98a64f3d1c..1c9153894dcaebdce1ea4949f3000d41f70d0397 100644 (file)
 #define P2P_SEARCH_DURATION_MS 500
 #define P2P_DEFAULT_BI 100
 
+bool wil_p2p_is_social_scan(struct cfg80211_scan_request *request)
+{
+       return (request->n_channels == 1) &&
+              (request->channels[0]->hw_value == P2P_DMG_SOCIAL_CHANNEL);
+}
+
 void wil_p2p_discovery_timer_fn(ulong x)
 {
        struct wil6210_priv *wil = (void *)x;
index 5dee909735bb899114be9bfc17c4a218cce534e8..b6fc256183f0e0222f6ac5644a58f229c4d11091 100644 (file)
@@ -776,6 +776,7 @@ void wil_disable_irq(struct wil6210_priv *wil);
 void wil_enable_irq(struct wil6210_priv *wil);
 
 /* P2P */
+bool wil_p2p_is_social_scan(struct cfg80211_scan_request *request);
 void wil_p2p_discovery_timer_fn(ulong x);
 int wil_p2p_search(struct wil6210_priv *wil,
                   struct cfg80211_scan_request *request);