diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2016-01-10 00:19:16 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2016-01-10 00:19:16 +0000 |
commit | acad802bceb2d41e003c07a0f17d800151ba7975 (patch) | |
tree | 8abbb86e4c12bf345dcebe199ca195f45557925b /package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch | |
parent | 615ff23d4f635cfefaf2960cd9233e540b1eaab5 (diff) | |
download | upstream-acad802bceb2d41e003c07a0f17d800151ba7975.tar.gz upstream-acad802bceb2d41e003c07a0f17d800151ba7975.tar.bz2 upstream-acad802bceb2d41e003c07a0f17d800151ba7975.zip |
mac80211: brcmfmac: support dumping stations
It allows user-space fetch associated STAs and e.g. iwinfo/luci display
them.
git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@48167 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch')
-rw-r--r-- | package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch | 226 |
1 files changed, 226 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch b/package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch new file mode 100644 index 0000000000..3ffada8d56 --- /dev/null +++ b/package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch @@ -0,0 +1,226 @@ +From: Hante Meuleman <meuleman@broadcom.com> +Date: Thu, 8 Oct 2015 20:33:15 +0200 +Subject: [PATCH] brcmfmac: Rework p2p attach, use single method for p2p dev + creation. + +When module param p2pon is used a p2p device is created at init. +This patch reworks how this is done by using the same method as +for a dynamically (by user space) created p2p device. + +Reviewed-by: Arend Van Spriel <arend@broadcom.com> +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> +Reviewed-by: Franky (Zhenhui) Lin <frankyl@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> +--- + +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +@@ -6237,6 +6237,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + else + *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; + } ++ /* p2p might require that "if-events" get processed by fweh. So ++ * activate the already registered event handlers now and activate ++ * the rest when initialization has completed. drvr->config needs to ++ * be assigned before activating events. ++ */ ++ drvr->config = cfg; ++ err = brcmf_fweh_activate_events(ifp); ++ if (err) { ++ brcmf_err("FWEH activation failed (%d)\n", err); ++ goto wiphy_unreg_out; ++ } + + err = brcmf_p2p_attach(cfg, p2pdev_forced); + if (err) { +@@ -6259,6 +6270,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + brcmf_notify_tdls_peer_event); + } + ++ /* (re-) activate FWEH event handling */ ++ err = brcmf_fweh_activate_events(ifp); ++ if (err) { ++ brcmf_err("FWEH activation failed (%d)\n", err); ++ goto wiphy_unreg_out; ++ } ++ + return cfg; + + wiphy_unreg_out: +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c +@@ -828,8 +828,8 @@ struct brcmf_if *brcmf_add_if(struct brc + } else { + brcmf_dbg(INFO, "allocate netdev interface\n"); + /* Allocate netdev, including space for private structure */ +- ndev = alloc_netdev(sizeof(*ifp), name, NET_NAME_UNKNOWN, +- ether_setup); ++ ndev = alloc_netdev(sizeof(*ifp), is_p2pdev ? "p2p%d" : name, ++ NET_NAME_UNKNOWN, ether_setup); + if (!ndev) + return ERR_PTR(-ENOMEM); + +@@ -1021,12 +1021,7 @@ int brcmf_bus_start(struct device *dev) + if (IS_ERR(ifp)) + return PTR_ERR(ifp); + +- if (brcmf_p2p_enable) +- p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL); +- else +- p2p_ifp = NULL; +- if (IS_ERR(p2p_ifp)) +- p2p_ifp = NULL; ++ p2p_ifp = NULL; + + /* signal bus ready */ + brcmf_bus_change_state(bus_if, BRCMF_BUS_UP); +@@ -1060,11 +1055,13 @@ int brcmf_bus_start(struct device *dev) + goto fail; + } + +- ret = brcmf_fweh_activate_events(ifp); +- if (ret < 0) +- goto fail; +- + ret = brcmf_net_attach(ifp, false); ++ ++ if ((!ret) && (brcmf_p2p_enable)) { ++ p2p_ifp = drvr->iflist[1]; ++ if (p2p_ifp) ++ ret = brcmf_net_p2p_attach(p2p_ifp); ++ } + fail: + if (ret < 0) { + brcmf_err("failed: %d\n", ret); +@@ -1076,20 +1073,12 @@ fail: + brcmf_fws_del_interface(ifp); + brcmf_fws_deinit(drvr); + } +- if (drvr->iflist[0]) { ++ if (ifp) + brcmf_net_detach(ifp->ndev); +- drvr->iflist[0] = NULL; +- } +- if (p2p_ifp) { ++ if (p2p_ifp) + brcmf_net_detach(p2p_ifp->ndev); +- drvr->iflist[1] = NULL; +- } + return ret; + } +- if ((brcmf_p2p_enable) && (p2p_ifp)) +- if (brcmf_net_p2p_attach(p2p_ifp) < 0) +- brcmf_p2p_enable = 0; +- + return 0; + } + +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +@@ -213,7 +213,8 @@ static void brcmf_fweh_handle_if_event(s + is_p2pdev, emsg->ifname, emsg->addr); + if (IS_ERR(ifp)) + return; +- brcmf_fws_add_interface(ifp); ++ if (!is_p2pdev) ++ brcmf_fws_add_interface(ifp); + if (!drvr->fweh.evt_handler[BRCMF_E_IF]) + if (brcmf_net_attach(ifp, false) < 0) + return; +--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +@@ -2350,83 +2350,30 @@ void brcmf_p2p_stop_device(struct wiphy + * brcmf_p2p_attach() - attach for P2P. + * + * @cfg: driver private data for cfg80211 interface. ++ * @p2pdev_forced: create p2p device interface at attach. + */ + s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced) + { +- struct brcmf_if *pri_ifp; +- struct brcmf_if *p2p_ifp; +- struct brcmf_cfg80211_vif *p2p_vif; + struct brcmf_p2p_info *p2p; +- struct brcmf_pub *drvr; +- s32 bssidx; ++ struct brcmf_if *pri_ifp; + s32 err = 0; ++ void *err_ptr; + + p2p = &cfg->p2p; + p2p->cfg = cfg; + +- drvr = cfg->pub; +- +- pri_ifp = brcmf_get_ifp(drvr, 0); ++ pri_ifp = brcmf_get_ifp(cfg->pub, 0); + p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif; + + if (p2pdev_forced) { +- p2p_ifp = drvr->iflist[1]; ++ err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL); ++ if (IS_ERR(err_ptr)) { ++ brcmf_err("P2P device creation failed.\n"); ++ err = PTR_ERR(err_ptr); ++ } + } else { +- p2p_ifp = NULL; + p2p->p2pdev_dynamically = true; + } +- if (p2p_ifp) { +- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE, +- false); +- if (IS_ERR(p2p_vif)) { +- brcmf_err("could not create discovery vif\n"); +- err = -ENOMEM; +- goto exit; +- } +- +- p2p_vif->ifp = p2p_ifp; +- p2p_ifp->vif = p2p_vif; +- p2p_vif->wdev.netdev = p2p_ifp->ndev; +- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev; +- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy)); +- +- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif; +- +- brcmf_p2p_generate_bss_mac(p2p, NULL); +- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN); +- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr); +- +- brcmf_fweh_p2pdev_setup(pri_ifp, true); +- +- /* Initialize P2P Discovery in the firmware */ +- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); +- if (err < 0) { +- brcmf_err("set p2p_disc error\n"); +- brcmf_free_vif(p2p_vif); +- goto exit; +- } +- /* obtain bsscfg index for P2P discovery */ +- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); +- if (err < 0) { +- brcmf_err("retrieving discover bsscfg index failed\n"); +- brcmf_free_vif(p2p_vif); +- goto exit; +- } +- /* Verify that firmware uses same bssidx as driver !! */ +- if (p2p_ifp->bssidx != bssidx) { +- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n", +- bssidx, p2p_ifp->bssidx); +- brcmf_free_vif(p2p_vif); +- goto exit; +- } +- +- init_completion(&p2p->send_af_done); +- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler); +- init_completion(&p2p->afx_hdl.act_frm_scan); +- init_completion(&p2p->wait_next_af); +-exit: +- brcmf_fweh_p2pdev_setup(pri_ifp, false); +- } + return err; + } + |