329-v4.17-0004-brcmfmac-allocate-struct-brcmf_pub-instance-using-wi.patch 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. From 856d5a011c86b59f6564be4508912fb1d866adfc Mon Sep 17 00:00:00 2001
  2. From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  3. Date: Thu, 22 Mar 2018 21:28:23 +0100
  4. Subject: [PATCH] brcmfmac: allocate struct brcmf_pub instance using
  5. wiphy_new()
  6. Rework the driver so the wiphy instance holds the main driver information
  7. in its private buffer. Previously it held struct brcmf_cfg80211_info
  8. instance so a bit of reorg was needed. This was done so that the wiphy
  9. name or its parent device can be shown in debug output.
  10. Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  11. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  12. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  13. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  14. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15. ---
  16. .../wireless/broadcom/brcm80211/brcmfmac/btcoex.c | 2 +-
  17. .../broadcom/brcm80211/brcmfmac/cfg80211.c | 86 ++++++++++------------
  18. .../broadcom/brcm80211/brcmfmac/cfg80211.h | 17 +++--
  19. .../wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +
  20. .../wireless/broadcom/brcm80211/brcmfmac/core.c | 27 +++++--
  21. .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 +
  22. .../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 2 +-
  23. 7 files changed, 76 insertions(+), 61 deletions(-)
  24. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c
  25. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c
  26. @@ -464,7 +464,7 @@ static void brcmf_btcoex_dhcp_end(struct
  27. int brcmf_btcoex_set_mode(struct brcmf_cfg80211_vif *vif,
  28. enum brcmf_btcoex_mode mode, u16 duration)
  29. {
  30. - struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  31. + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
  32. struct brcmf_btcoex_info *btci = cfg->btcoex;
  33. struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  34. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  35. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  36. @@ -783,7 +783,7 @@ s32 brcmf_notify_escan_complete(struct b
  37. static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  38. struct wireless_dev *wdev)
  39. {
  40. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  41. + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  42. struct net_device *ndev = wdev->netdev;
  43. struct brcmf_if *ifp = netdev_priv(ndev);
  44. int ret;
  45. @@ -816,7 +816,7 @@ err_unarm:
  46. static
  47. int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  48. {
  49. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  50. + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  51. struct net_device *ndev = wdev->netdev;
  52. if (ndev && ndev == cfg_to_ndev(cfg))
  53. @@ -861,7 +861,7 @@ brcmf_cfg80211_change_iface(struct wiphy
  54. enum nl80211_iftype type, u32 *flags,
  55. struct vif_params *params)
  56. {
  57. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  58. + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  59. struct brcmf_if *ifp = netdev_priv(ndev);
  60. struct brcmf_cfg80211_vif *vif = ifp->vif;
  61. s32 infra = 0;
  62. @@ -2175,17 +2175,15 @@ static s32
  63. brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
  64. s32 *dbm)
  65. {
  66. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  67. - struct net_device *ndev = cfg_to_ndev(cfg);
  68. - struct brcmf_if *ifp = netdev_priv(ndev);
  69. + struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev);
  70. s32 qdbm = 0;
  71. s32 err;
  72. brcmf_dbg(TRACE, "Enter\n");
  73. - if (!check_vif_up(ifp->vif))
  74. + if (!check_vif_up(vif))
  75. return -EIO;
  76. - err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &qdbm);
  77. + err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
  78. if (err) {
  79. brcmf_err("error (%d)\n", err);
  80. goto done;
  81. @@ -3398,7 +3396,7 @@ brcmf_cfg80211_sched_scan_start(struct w
  82. struct cfg80211_sched_scan_request *req)
  83. {
  84. struct brcmf_if *ifp = netdev_priv(ndev);
  85. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  86. + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  87. brcmf_dbg(SCAN, "Enter n_match_sets:%d n_ssids:%d\n",
  88. req->n_match_sets, req->n_ssids);
  89. @@ -5192,6 +5190,12 @@ static struct cfg80211_ops brcmf_cfg8021
  90. .update_connect_params = brcmf_cfg80211_update_conn_params,
  91. };
  92. +struct cfg80211_ops *brcmf_cfg80211_get_ops(void)
  93. +{
  94. + return kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
  95. + GFP_KERNEL);
  96. +}
  97. +
  98. struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
  99. enum nl80211_iftype type)
  100. {
  101. @@ -5866,7 +5870,7 @@ static void brcmf_update_bw40_channel_fl
  102. static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
  103. u32 bw_cap[])
  104. {
  105. - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  106. + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  107. struct ieee80211_supported_band *band;
  108. struct ieee80211_channel *channel;
  109. struct wiphy *wiphy;
  110. @@ -5981,7 +5985,7 @@ fail_pbuf:
  111. static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
  112. {
  113. - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  114. + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  115. struct ieee80211_supported_band *band;
  116. struct brcmf_fil_bwcap_le band_bwcap;
  117. struct brcmf_chanspec_list *list;
  118. @@ -6166,10 +6170,10 @@ static void brcmf_update_vht_cap(struct
  119. }
  120. }
  121. -static int brcmf_setup_wiphybands(struct wiphy *wiphy)
  122. +static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
  123. {
  124. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  125. - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  126. + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  127. + struct wiphy *wiphy;
  128. u32 nmode = 0;
  129. u32 vhtmode = 0;
  130. u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
  131. @@ -6765,8 +6769,8 @@ static s32 brcmf_translate_country_code(
  132. static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
  133. struct regulatory_request *req)
  134. {
  135. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  136. - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  137. + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  138. + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  139. struct brcmf_fil_country_le ccreq;
  140. s32 err;
  141. int i;
  142. @@ -6801,7 +6805,7 @@ static void brcmf_cfg80211_reg_notifier(
  143. brcmf_err("Firmware rejected country setting\n");
  144. return;
  145. }
  146. - brcmf_setup_wiphybands(wiphy);
  147. + brcmf_setup_wiphybands(cfg);
  148. }
  149. static void brcmf_free_wiphy(struct wiphy *wiphy)
  150. @@ -6828,17 +6832,15 @@ static void brcmf_free_wiphy(struct wiph
  151. if (wiphy->wowlan != &brcmf_wowlan_support)
  152. kfree(wiphy->wowlan);
  153. #endif
  154. - wiphy_free(wiphy);
  155. }
  156. struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  157. - struct device *busdev,
  158. + struct cfg80211_ops *ops,
  159. bool p2pdev_forced)
  160. {
  161. + struct wiphy *wiphy = drvr->wiphy;
  162. struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  163. struct brcmf_cfg80211_info *cfg;
  164. - struct wiphy *wiphy;
  165. - struct cfg80211_ops *ops;
  166. struct brcmf_cfg80211_vif *vif;
  167. struct brcmf_if *ifp;
  168. s32 err = 0;
  169. @@ -6850,26 +6852,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  170. return NULL;
  171. }
  172. - ops = kmemdup(&brcmf_cfg80211_ops, sizeof(*ops), GFP_KERNEL);
  173. - if (!ops)
  174. - return NULL;
  175. -
  176. - ifp = netdev_priv(ndev);
  177. -#ifdef CONFIG_PM
  178. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
  179. - ops->set_rekey_data = brcmf_cfg80211_set_rekey_data;
  180. -#endif
  181. - wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
  182. - if (!wiphy) {
  183. + cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
  184. + if (!cfg) {
  185. brcmf_err("Could not allocate wiphy device\n");
  186. - goto ops_out;
  187. + return NULL;
  188. }
  189. - memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
  190. - set_wiphy_dev(wiphy, busdev);
  191. - cfg = wiphy_priv(wiphy);
  192. cfg->wiphy = wiphy;
  193. - cfg->ops = ops;
  194. cfg->pub = drvr;
  195. init_vif_event(&cfg->vif_event);
  196. INIT_LIST_HEAD(&cfg->vif_list);
  197. @@ -6878,6 +6867,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  198. if (IS_ERR(vif))
  199. goto wiphy_out;
  200. + ifp = netdev_priv(ndev);
  201. vif->ifp = ifp;
  202. vif->wdev.netdev = ndev;
  203. ndev->ieee80211_ptr = &vif->wdev;
  204. @@ -6904,6 +6894,11 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  205. if (err < 0)
  206. goto priv_out;
  207. + /* regulatory notifer below needs access to cfg so
  208. + * assign it now.
  209. + */
  210. + drvr->config = cfg;
  211. +
  212. brcmf_dbg(INFO, "Registering custom regulatory\n");
  213. wiphy->reg_notifier = brcmf_cfg80211_reg_notifier;
  214. wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
  215. @@ -6917,13 +6912,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  216. cap = &wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap;
  217. *cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  218. }
  219. +#ifdef CONFIG_PM
  220. + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
  221. + ops->set_rekey_data = brcmf_cfg80211_set_rekey_data;
  222. +#endif
  223. err = wiphy_register(wiphy);
  224. if (err < 0) {
  225. brcmf_err("Could not register wiphy device (%d)\n", err);
  226. goto priv_out;
  227. }
  228. - err = brcmf_setup_wiphybands(wiphy);
  229. + err = brcmf_setup_wiphybands(cfg);
  230. if (err) {
  231. brcmf_err("Setting wiphy bands failed (%d)\n", err);
  232. goto wiphy_unreg_out;
  233. @@ -6940,12 +6939,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  234. else
  235. *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  236. }
  237. - /* p2p might require that "if-events" get processed by fweh. So
  238. - * activate the already registered event handlers now and activate
  239. - * the rest when initialization has completed. drvr->config needs to
  240. - * be assigned before activating events.
  241. - */
  242. - drvr->config = cfg;
  243. +
  244. err = brcmf_fweh_activate_events(ifp);
  245. if (err) {
  246. brcmf_err("FWEH activation failed (%d)\n", err);
  247. @@ -7005,8 +6999,7 @@ priv_out:
  248. ifp->vif = NULL;
  249. wiphy_out:
  250. brcmf_free_wiphy(wiphy);
  251. -ops_out:
  252. - kfree(ops);
  253. + kfree(cfg);
  254. return NULL;
  255. }
  256. @@ -7017,7 +7010,8 @@ void brcmf_cfg80211_detach(struct brcmf_
  257. brcmf_btcoex_detach(cfg);
  258. wiphy_unregister(cfg->wiphy);
  259. - kfree(cfg->ops);
  260. + kfree(cfg->pub->cfg80211_ops);
  261. wl_deinit_priv(cfg);
  262. brcmf_free_wiphy(cfg->wiphy);
  263. + kfree(cfg);
  264. }
  265. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  266. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  267. @@ -290,7 +290,7 @@ struct brcmf_cfg80211_wowl {
  268. */
  269. struct brcmf_cfg80211_info {
  270. struct wiphy *wiphy;
  271. - struct cfg80211_ops *ops;
  272. +// struct cfg80211_ops *ops; /* OpenWrt keeps it in the struct brcmf_pub */
  273. struct brcmf_cfg80211_conf *conf;
  274. struct brcmf_p2p_info p2p;
  275. struct brcmf_btcoex_info *btcoex;
  276. @@ -342,20 +342,24 @@ static inline struct wiphy *cfg_to_wiphy
  277. static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
  278. {
  279. - return (struct brcmf_cfg80211_info *)(wiphy_priv(w));
  280. + struct brcmf_pub *drvr = wiphy_priv(w);
  281. + return drvr->config;
  282. }
  283. static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd)
  284. {
  285. - return (struct brcmf_cfg80211_info *)(wdev_priv(wd));
  286. + return wiphy_to_cfg(wd->wiphy);
  287. +}
  288. +
  289. +static inline struct brcmf_cfg80211_vif *wdev_to_vif(struct wireless_dev *wdev)
  290. +{
  291. + return container_of(wdev, struct brcmf_cfg80211_vif, wdev);
  292. }
  293. static inline
  294. struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg)
  295. {
  296. - struct brcmf_cfg80211_vif *vif;
  297. - vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list);
  298. - return vif->wdev.netdev;
  299. + return brcmf_get_ifp(cfg->pub, 0)->ndev;
  300. }
  301. static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev)
  302. @@ -382,11 +386,12 @@ brcmf_cfg80211_connect_info *cfg_to_conn
  303. }
  304. struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  305. - struct device *busdev,
  306. + struct cfg80211_ops *ops,
  307. bool p2pdev_forced);
  308. void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
  309. s32 brcmf_cfg80211_up(struct net_device *ndev);
  310. s32 brcmf_cfg80211_down(struct net_device *ndev);
  311. +struct cfg80211_ops *brcmf_cfg80211_get_ops(void);
  312. enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
  313. struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
  314. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  315. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  316. @@ -124,6 +124,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  317. brcmf_err("Retreiving cur_etheraddr failed, %d\n", err);
  318. goto done;
  319. }
  320. + memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN);
  321. memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac));
  322. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO,
  323. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  324. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  325. @@ -1008,7 +1008,7 @@ int brcmf_bus_started(struct device *dev
  326. brcmf_proto_add_if(drvr, ifp);
  327. - drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev,
  328. + drvr->config = brcmf_cfg80211_attach(drvr, drvr->cfg80211_ops,
  329. drvr->settings->p2p_enable);
  330. if (drvr->config == NULL) {
  331. ret = -ENOMEM;
  332. @@ -1063,17 +1063,26 @@ fail:
  333. int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
  334. {
  335. + struct wiphy *wiphy;
  336. + struct cfg80211_ops *ops;
  337. struct brcmf_pub *drvr = NULL;
  338. int ret = 0;
  339. int i;
  340. brcmf_dbg(TRACE, "Enter\n");
  341. - /* Allocate primary brcmf_info */
  342. - drvr = kzalloc(sizeof(*drvr), GFP_ATOMIC);
  343. - if (!drvr)
  344. + ops = brcmf_cfg80211_get_ops();
  345. + if (!ops)
  346. return -ENOMEM;
  347. + wiphy = wiphy_new(ops, sizeof(*drvr));
  348. + if (!wiphy)
  349. + return -ENOMEM;
  350. +
  351. + set_wiphy_dev(wiphy, dev);
  352. + drvr = wiphy_priv(wiphy);
  353. + drvr->wiphy = wiphy;
  354. +
  355. for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
  356. drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
  357. @@ -1102,10 +1111,12 @@ int brcmf_attach(struct device *dev, str
  358. /* attach firmware event handler */
  359. brcmf_fweh_attach(drvr);
  360. + drvr->cfg80211_ops = ops;
  361. return ret;
  362. fail:
  363. brcmf_detach(dev);
  364. + kfree(ops);
  365. return ret;
  366. }
  367. @@ -1163,6 +1174,7 @@ void brcmf_detach(struct device *dev)
  368. brcmf_remove_interface(drvr->iflist[i], false);
  369. brcmf_cfg80211_detach(drvr->config);
  370. + drvr->config = NULL;
  371. brcmf_bus_stop(drvr->bus_if);
  372. @@ -1170,7 +1182,7 @@ void brcmf_detach(struct device *dev)
  373. brcmf_debug_detach(drvr);
  374. bus_if->drvr = NULL;
  375. - kfree(drvr);
  376. + wiphy_free(drvr->wiphy);
  377. }
  378. s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len)
  379. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  380. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  381. @@ -108,6 +108,7 @@ struct brcmf_pub {
  382. /* Linkage ponters */
  383. struct brcmf_bus *bus_if;
  384. struct brcmf_proto *proto;
  385. + struct wiphy *wiphy;
  386. struct brcmf_cfg80211_info *config;
  387. /* Internal brcmf items */
  388. @@ -141,6 +142,9 @@ struct brcmf_pub {
  389. struct notifier_block inetaddr_notifier;
  390. struct notifier_block inet6addr_notifier;
  391. struct brcmf_mp_device *settings;
  392. +
  393. + /* Pointer needed by OpenWrt due to backporting some fixes */
  394. + void *cfg80211_ops;
  395. };
  396. /* forward declarations */
  397. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  398. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  399. @@ -2236,7 +2236,7 @@ fail:
  400. */
  401. int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
  402. {
  403. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  404. + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  405. struct brcmf_p2p_info *p2p = &cfg->p2p;
  406. struct brcmf_cfg80211_vif *vif;
  407. enum nl80211_iftype iftype;