brcmfmac: Fix ifidx for rx data by msgbuf.
authorHante Meuleman <meuleman@broadcom.com>
Wed, 3 Dec 2014 20:05:28 +0000 (21:05 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 4 Dec 2014 16:35:02 +0000 (11:35 -0500)
The ifidx provided by FW needs to be offsetted when receiving data
packets.

Cc: stable@vger.kernel.org # v3.17, v3.18
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: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c

index 5b0b70fa1aea845a23f78da891f5ba13b5b9fe36..456944a6a2db8877ff2a73d20d2046b832e468f4 100644 (file)
@@ -1080,8 +1080,17 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf *msgbuf, struct sk_buff *skb,
 {
        struct brcmf_if *ifp;
 
+       /* The ifidx is the idx to map to matching netdev/ifp. When receiving
+        * events this is easy because it contains the bssidx which maps
+        * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
+        * bssidx 1 is used for p2p0 and no data can be received or
+        * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
+        */
+       if (ifidx)
+               (ifidx)++;
        ifp = msgbuf->drvr->iflist[ifidx];
        if (!ifp || !ifp->ndev) {
+               brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
                brcmu_pkt_buf_free_skb(skb);
                return;
        }