diff options
author | Hante Meuleman <meuleman@broadcom.com> | 2013-02-08 09:53:42 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-02-08 14:51:38 -0500 |
commit | 0f8ffe177426e536def8f19f7eca5b895103c62a (patch) | |
tree | 4de9272081784b99505814fd9bce00aa54b3a5c8 /drivers/net/wireless/brcm80211/brcmfmac | |
parent | 5f4f9f114eef4907b6077d19dd5ad7d0a27e0f80 (diff) |
brcmfmac: update escan for multiple bss and simplify.
Add support for scanning on non primary netdev (p2p) and
simplify the p2p scanning preparation.
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 92 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/p2p.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 8 |
3 files changed, 19 insertions, 84 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c index fff5722d4c0b..aef0287f5857 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c | |||
@@ -91,11 +91,6 @@ struct brcmf_p2p_scan_le { | |||
91 | }; | 91 | }; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static struct brcmf_cfg80211_vif *p2p_discover_vif(struct brcmf_p2p_info *p2p) | ||
95 | { | ||
96 | return p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; | ||
97 | } | ||
98 | |||
99 | /** | 94 | /** |
100 | * brcmf_p2p_set_firmware() - prepare firmware for peer-to-peer operation. | 95 | * brcmf_p2p_set_firmware() - prepare firmware for peer-to-peer operation. |
101 | * | 96 | * |
@@ -195,34 +190,6 @@ static s32 brcmf_p2p_set_discover_state(struct brcmf_if *ifp, u8 state, | |||
195 | } | 190 | } |
196 | 191 | ||
197 | /** | 192 | /** |
198 | * brcmf_p2p_discover_disable_search() - reset discover state. | ||
199 | * | ||
200 | * @p2p: P2P specific data. | ||
201 | * | ||
202 | * Reset the discover state to @WL_P2P_DISC_ST_SCAN. Returns 0 on success. | ||
203 | */ | ||
204 | static s32 brcmf_p2p_discover_disable_search(struct brcmf_p2p_info *p2p) | ||
205 | { | ||
206 | struct brcmf_cfg80211_vif *vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; | ||
207 | struct brcmf_p2p_disc_st_le discovery_mode; | ||
208 | int ret; | ||
209 | |||
210 | /* | ||
211 | * vif presence indicates discovery is initialized. | ||
212 | */ | ||
213 | if (!vif) | ||
214 | return -ENODEV; | ||
215 | |||
216 | ret = brcmf_fil_bsscfg_data_get(vif->ifp, "p2p_state", | ||
217 | &discovery_mode, | ||
218 | sizeof(discovery_mode)); | ||
219 | if (!ret && discovery_mode.state != WL_P2P_DISC_ST_SCAN) | ||
220 | ret = brcmf_p2p_set_discover_state(vif->ifp, | ||
221 | WL_P2P_DISC_ST_SCAN, 0, 0); | ||
222 | return ret; | ||
223 | } | ||
224 | |||
225 | /** | ||
226 | * brcmf_p2p_init_discovery() - enable discovery in the firmware. | 193 | * brcmf_p2p_init_discovery() - enable discovery in the firmware. |
227 | * | 194 | * |
228 | * @p2p: P2P specific data. | 195 | * @p2p: P2P specific data. |
@@ -376,32 +343,6 @@ exit: | |||
376 | } | 343 | } |
377 | 344 | ||
378 | /** | 345 | /** |
379 | * brcmf_p2p_configure_probereq() - Configure probe request data. | ||
380 | * | ||
381 | * @p2p: P2P specific data. | ||
382 | * @ie: buffer containing information elements. | ||
383 | * @ie_len: length of @ie buffer. | ||
384 | * | ||
385 | */ | ||
386 | static int brcmf_p2p_configure_probereq(struct brcmf_p2p_info *p2p, | ||
387 | const u8 *ie, u32 ie_len) | ||
388 | { | ||
389 | struct brcmf_cfg80211_vif *vif; | ||
390 | s32 err = 0; | ||
391 | |||
392 | brcmf_dbg(TRACE, "enter\n"); | ||
393 | vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; | ||
394 | |||
395 | err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_PRBREQ_FLAG, | ||
396 | ie, ie_len); | ||
397 | |||
398 | if (err < 0) | ||
399 | brcmf_err("set probreq ie occurs error %d\n", err); | ||
400 | |||
401 | return err; | ||
402 | } | ||
403 | |||
404 | /* | ||
405 | * brcmf_p2p_escan() - initiate a P2P scan. | 346 | * brcmf_p2p_escan() - initiate a P2P scan. |
406 | * | 347 | * |
407 | * @p2p: P2P specific data. | 348 | * @p2p: P2P specific data. |
@@ -621,12 +562,14 @@ exit: | |||
621 | * | 562 | * |
622 | * @wiphy: wiphy device. | 563 | * @wiphy: wiphy device. |
623 | * @request: scan request from cfg80211. | 564 | * @request: scan request from cfg80211. |
565 | * @vif: vif on which scan request is to be executed. | ||
624 | * | 566 | * |
625 | * Prepare the scan appropriately for type of scan requested. Overrides the | 567 | * Prepare the scan appropriately for type of scan requested. Overrides the |
626 | * escan .run() callback for peer-to-peer scanning. | 568 | * escan .run() callback for peer-to-peer scanning. |
627 | */ | 569 | */ |
628 | int brcmf_p2p_scan_prep(struct wiphy *wiphy, | 570 | int brcmf_p2p_scan_prep(struct wiphy *wiphy, |
629 | struct cfg80211_scan_request *request) | 571 | struct cfg80211_scan_request *request, |
572 | struct brcmf_cfg80211_vif *vif) | ||
630 | { | 573 | { |
631 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); | 574 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); |
632 | struct brcmf_p2p_info *p2p = &cfg->p2p; | 575 | struct brcmf_p2p_info *p2p = &cfg->p2p; |
@@ -644,31 +587,16 @@ int brcmf_p2p_scan_prep(struct wiphy *wiphy, | |||
644 | brcmf_dbg(INFO, "P2P: GO_NEG_PHASE status cleared\n"); | 587 | brcmf_dbg(INFO, "P2P: GO_NEG_PHASE status cleared\n"); |
645 | 588 | ||
646 | err = brcmf_p2p_enable_discovery(p2p); | 589 | err = brcmf_p2p_enable_discovery(p2p); |
647 | if (err == 0) | 590 | if (err) |
648 | err = brcmf_p2p_configure_probereq(p2p, request->ie, | 591 | return err; |
649 | request->ie_len); | ||
650 | 592 | ||
651 | /* | 593 | vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; |
652 | * override .run_escan() callback. | ||
653 | */ | ||
654 | cfg->escan_info.run = brcmf_p2p_run_escan; | ||
655 | } else { | ||
656 | /* | ||
657 | * legacy scan trigger | ||
658 | * So, we have to disable p2p discovery if p2p discovery is on | ||
659 | */ | ||
660 | (void)brcmf_p2p_discover_disable_search(p2p); | ||
661 | 594 | ||
662 | /* | 595 | /* override .run_escan() callback. */ |
663 | * clear p2p vendor ies for probe request set by | 596 | cfg->escan_info.run = brcmf_p2p_run_escan; |
664 | * previous p2p related scan(s). | ||
665 | */ | ||
666 | if (p2p_discover_vif(p2p)) | ||
667 | err = brcmf_vif_set_mgmt_ie(p2p_discover_vif(p2p), | ||
668 | BRCMF_VNDR_IE_PRBREQ_FLAG, | ||
669 | request->ie, | ||
670 | request->ie_len); | ||
671 | } | 597 | } |
598 | err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_PRBREQ_FLAG, | ||
599 | request->ie, request->ie_len); | ||
672 | return err; | 600 | return err; |
673 | } | 601 | } |
674 | 602 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h index df93272ad49f..1f97afd8709e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h | |||
@@ -111,7 +111,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev); | |||
111 | int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); | 111 | int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); |
112 | void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); | 112 | void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); |
113 | int brcmf_p2p_scan_prep(struct wiphy *wiphy, | 113 | int brcmf_p2p_scan_prep(struct wiphy *wiphy, |
114 | struct cfg80211_scan_request *request); | 114 | struct cfg80211_scan_request *request, |
115 | struct brcmf_cfg80211_vif *vif); | ||
115 | int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, | 116 | int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, |
116 | struct ieee80211_channel *channel, | 117 | struct ieee80211_channel *channel, |
117 | unsigned int duration, u64 *cookie); | 118 | unsigned int duration, u64 *cookie); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index d792c3b2331a..c57c1dbb0daf 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -805,6 +805,12 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, | |||
805 | return -EAGAIN; | 805 | return -EAGAIN; |
806 | } | 806 | } |
807 | 807 | ||
808 | /* If scan req comes for p2p0, send it over primary I/F */ | ||
809 | if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) { | ||
810 | ifp = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; | ||
811 | ndev = ifp->ndev; | ||
812 | } | ||
813 | |||
808 | /* Arm scan timeout timer */ | 814 | /* Arm scan timeout timer */ |
809 | mod_timer(&cfg->escan_timeout, jiffies + | 815 | mod_timer(&cfg->escan_timeout, jiffies + |
810 | WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000); | 816 | WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000); |
@@ -824,7 +830,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, | |||
824 | set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); | 830 | set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); |
825 | if (escan_req) { | 831 | if (escan_req) { |
826 | cfg->escan_info.run = brcmf_run_escan; | 832 | cfg->escan_info.run = brcmf_run_escan; |
827 | err = brcmf_p2p_scan_prep(wiphy, request); | 833 | err = brcmf_p2p_scan_prep(wiphy, request, ifp->vif); |
828 | if (err) | 834 | if (err) |
829 | goto scan_out; | 835 | goto scan_out; |
830 | 836 | ||