Commit ddddfed2 authored by Arend van Spriel's avatar Arend van Spriel Committed by Kalle Valo

brcmfmac: correct detection of p2pdev interface event

The p2pdev interface is setup in firmware resulting in a interface
event. This event has role and no-if flag. When role is p2p client
and no-if flag is set it indicates that this is the p2pdev interface.
This info is used in handling the event and adding interface in the
driver.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 1c626cf4
...@@ -795,7 +795,7 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp) ...@@ -795,7 +795,7 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
} }
struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx, struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
char *name, u8 *mac_addr) bool is_p2pdev, char *name, u8 *mac_addr)
{ {
struct brcmf_if *ifp; struct brcmf_if *ifp;
struct net_device *ndev; struct net_device *ndev;
...@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx, ...@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
} }
} }
if (!brcmf_p2p_enable && bssidx == 1) { if (!brcmf_p2p_enable && is_p2pdev) {
/* this is P2P_DEVICE interface */ /* this is P2P_DEVICE interface */
brcmf_dbg(INFO, "allocate non-netdev interface\n"); brcmf_dbg(INFO, "allocate non-netdev interface\n");
ifp = kzalloc(sizeof(*ifp), GFP_KERNEL); ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
...@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev) ...@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
brcmf_dbg(TRACE, "\n"); brcmf_dbg(TRACE, "\n");
/* add primary networking interface */ /* add primary networking interface */
ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL); ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
if (IS_ERR(ifp)) if (IS_ERR(ifp))
return PTR_ERR(ifp); return PTR_ERR(ifp);
if (brcmf_p2p_enable) if (brcmf_p2p_enable)
p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL); p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
else else
p2p_ifp = NULL; p2p_ifp = NULL;
if (IS_ERR(p2p_ifp)) if (IS_ERR(p2p_ifp))
......
...@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drvr, int idx); ...@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx, struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
char *name, u8 *mac_addr); bool is_p2pdev, char *name, u8 *mac_addr);
void brcmf_remove_interface(struct brcmf_if *ifp); void brcmf_remove_interface(struct brcmf_if *ifp);
int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr); int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
void brcmf_txflowblock_if(struct brcmf_if *ifp, void brcmf_txflowblock_if(struct brcmf_if *ifp,
......
...@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, ...@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
{ {
struct brcmf_if_event *ifevent = data; struct brcmf_if_event *ifevent = data;
struct brcmf_if *ifp; struct brcmf_if *ifp;
bool is_p2pdev;
int err = 0; int err = 0;
brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n", brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
...@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, ...@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
ifevent->flags, ifevent->role); ifevent->flags, ifevent->role);
/* The P2P Device interface event must not be ignored /* The P2P Device interface event must not be ignored
* contrary to what firmware tells us. The only way to * contrary to what firmware tells us.
* distinguish the P2P Device is by looking at the ifidx
* and bssidx received.
*/ */
if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) && is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
(ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) { ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
brcmf_dbg(EVENT, "event can be ignored\n"); brcmf_dbg(EVENT, "event can be ignored\n");
return; return;
} }
if (ifevent->ifidx >= BRCMF_MAX_IFS) { if (ifevent->ifidx >= BRCMF_MAX_IFS) {
brcmf_err("invalid interface index: %u\n", brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
ifevent->ifidx);
return; return;
} }
...@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, ...@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname, brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
emsg->addr); emsg->addr);
ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx, ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
emsg->ifname, emsg->addr); is_p2pdev, emsg->ifname, emsg->addr);
if (IS_ERR(ifp)) if (IS_ERR(ifp))
return; return;
brcmf_fws_add_interface(ifp); brcmf_fws_add_interface(ifp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment