brcmfmac: Inform p2p module about p2pon through API
authorHante Meuleman <meuleman@broadcom.com>
Fri, 18 Sep 2015 20:08:08 +0000 (22:08 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 29 Sep 2015 07:55:50 +0000 (10:55 +0300)
When the p2pon module param is used then p2p attach will initialize
p2p device iface in the firmware, but it is doing that by checking
data. It is cleaner to pass the p2pon information to p2p by API.
This information is also needed for other patch.

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: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
drivers/net/wireless/brcm80211/brcmfmac/core.c
drivers/net/wireless/brcm80211/brcmfmac/p2p.c
drivers/net/wireless/brcm80211/brcmfmac/p2p.h

index 0a97e61025fbad3a291a66761259d7a9cc5110a3..3e1c8fcf57cb250979ccf335f8f5115b3f4a2a60 100644 (file)
@@ -6127,7 +6127,8 @@ static void brcmf_free_wiphy(struct wiphy *wiphy)
 }
 
 struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
-                                                 struct device *busdev)
+                                                 struct device *busdev,
+                                                 bool p2pdev_forced)
 {
        struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
        struct brcmf_cfg80211_info *cfg;
@@ -6219,7 +6220,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
                        *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
        }
 
-       err = brcmf_p2p_attach(cfg);
+       err = brcmf_p2p_attach(cfg, p2pdev_forced);
        if (err) {
                brcmf_err("P2P initilisation failed (%d)\n", err);
                goto wiphy_unreg_out;
index d9e6d01b2b69511ebb4139399a81dff9c02f8641..3f5e5505d3291ed87e1cce4081dc691e6ffb8d09 100644 (file)
@@ -469,7 +469,8 @@ brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
 }
 
 struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
-                                                 struct device *busdev);
+                                                 struct device *busdev,
+                                                 bool p2pdev_forced);
 void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
 s32 brcmf_cfg80211_up(struct net_device *ndev);
 s32 brcmf_cfg80211_down(struct net_device *ndev);
index 571c3054da58075430bdf053ea6feab997a167f8..3b169f526a807b99e2c5f2250a5b0e701b114538 100644 (file)
@@ -1044,7 +1044,8 @@ int brcmf_bus_start(struct device *dev)
 
        brcmf_fws_add_interface(ifp);
 
-       drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev);
+       drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev,
+                                            brcmf_p2p_enable);
        if (drvr->config == NULL) {
                ret = -ENOMEM;
                goto fail;
index 6a70c068fbc51edabad81c8b1269b618ec3a38d2..1e09cd2429f3ac62a1691c8172cb63d9ae9e8113 100644 (file)
@@ -2336,7 +2336,7 @@ void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev)
  *
  * @cfg: driver private data for cfg80211 interface.
  */
-s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
 {
        struct brcmf_if *pri_ifp;
        struct brcmf_if *p2p_ifp;
@@ -2351,11 +2351,15 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
 
        drvr = cfg->pub;
 
-       pri_ifp = drvr->iflist[0];
-       p2p_ifp = drvr->iflist[1];
-
+       pri_ifp = brcmf_get_ifp(drvr, 0);
        p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
 
+       if (p2pdev_forced) {
+               p2p_ifp = drvr->iflist[1];
+       } else {
+               p2p_ifp = NULL;
+               p2p->p2pdev_dynamically = true;
+       }
        if (p2p_ifp) {
                p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
                                          false);
index 872f382d9e49b7531e05884d6f6b69e8fc760af0..d82287decf7702cac8dda9f0bfe1652a948cda8f 100644 (file)
@@ -124,6 +124,7 @@ struct afx_hdl {
  * @wait_next_af: thread synchronizing struct.
  * @gon_req_action: about to send go negotiation requets frame.
  * @block_gon_req_tx: drop tx go negotiation requets frame.
+ * @p2pdev_dynamically: is p2p device if created by module param or supplicant.
  */
 struct brcmf_p2p_info {
        struct brcmf_cfg80211_info *cfg;
@@ -144,9 +145,10 @@ struct brcmf_p2p_info {
        struct completion wait_next_af;
        bool gon_req_action;
        bool block_gon_req_tx;
+       bool p2pdev_dynamically;
 };
 
-s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg);
+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);
 void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);
 struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
                                       unsigned char name_assign_type,