1 From: Arend van Spriel <arend@broadcom.com>
2 Date: Wed, 26 Aug 2015 22:15:00 +0200
3 Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
6 Because the P2P Device interface in firmware uses the same interface
7 index as the primary interface we use the bsscfg index as index in the
8 struct brcmf_pub::iflist. However, in the data path we get the interface
9 index and not the bsscfg index. So we need a mapping of interface index
10 to bsscfg index, which can be determined upon handle adding the interface.
12 Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
13 Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
14 Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
15 Signed-off-by: Arend van Spriel <arend@broadcom.com>
18 --- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
19 +++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
20 @@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
22 struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
24 + struct brcmf_if *ifp;
27 if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
28 brcmf_err("ifidx %d out of range\n", ifidx);
32 - /* The ifidx is the idx to map to matching netdev/ifp. When receiving
33 - * events this is easy because it contains the bssidx which maps
34 - * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
35 - * bssidx 1 is used for p2p0 and no data can be received or
36 - * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
41 + bssidx = drvr->if2bss[ifidx];
43 + ifp = drvr->iflist[bssidx];
45 - return drvr->iflist[ifidx];
49 static void _brcmf_set_multicast_list(struct work_struct *work)
50 @@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
52 ifp = netdev_priv(ndev);
54 + /* store mapping ifidx to bssidx */
55 + drvr->if2bss[ifidx] = bssidx;
59 @@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
62 ifp = drvr->iflist[bssidx];
63 + drvr->if2bss[ifp->ifidx] = -1;
64 drvr->iflist[bssidx] = NULL;
66 brcmf_err("Null interface, idx=%d\n", bssidx);
67 @@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
69 brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
71 + drvr->if2bss[ifp->ifidx] = -1;
73 if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
75 @@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
79 + memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
80 mutex_init(&drvr->proto_block);
82 /* Link to bus module */
83 --- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
84 +++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
85 @@ -122,6 +122,7 @@ struct brcmf_pub {
86 struct mac_address addresses[BRCMF_MAX_IFS];
88 struct brcmf_if *iflist[BRCMF_MAX_IFS];
89 + s32 if2bss[BRCMF_MAX_IFS];
91 struct mutex proto_block;
92 unsigned char proto_buf[BRCMF_DCMD_MAXLEN];