diff mbox

[v3] brcmfmac: Decrease 8021x_cnt for dropped packets

Message ID 1460494118-2764-1-git-send-email-per.forlin@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

per.forlin@gmail.com April 12, 2016, 8:48 p.m. UTC
From: Per Forlin <per.forlin@gmail.com>

This patch resolves an issue where pend_8021x_cnt was not decreased
on txfinalize. This caused brcmf_netdev_wait_pend8021x to timeout
because the counter indicated pending packets.

WARNING: at .../brcmfmac/core.c:1289 brcmf_netdev_wait_pend8021x
  (warn_slowpath_common)
  (warn_slowpath_null)
  (brcmf_netdev_wait_pend8021x [brcmfmac])
  (send_key_to_dongle [brcmfmac])
  (brcmf_cfg80211_del_key [brcmfmac])
  (nl80211_del_key [cfg80211])
  (genl_rcv_msg)
  (netlink_rcv_skb)
  (genl_rcv)
  (netlink_unicast)
  (netlink_sendmsg)
  (sock_sendmsg)
  (___sys_sendmsg)
  (__sys_sendmsg)
  (SyS_sendmsg)

The solution is to pull back the header offset in case
of an error in txdata(), which may happen in case of
packet overload in brcmf_sdio_bus_txdata.

Overloading an WLAN interface is not an unlikely scenario.
In case of packet overload the error print "out of bus->txq"
is very verbose. To reduce SPAM degrade it to a debug print.

Signed-off-by: Per Forlin <per.forlin@gmail.com>
---
Change log:
 v2 - Add variable to know whether the counter is increased or not
 v3 - txfinalize should decrease the counter. Adjust skb header offset

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 6 +++++-
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

kernel test robot April 12, 2016, 9:14 p.m. UTC | #1
Hi Per,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.6-rc3 next-20160412]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/per-forlin-gmail-com/brcmfmac-Decrease-8021x_cnt-for-dropped-packets/20160413-045216
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: xtensa-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c: In function 'brcmf_proto_bcdc_txdata':
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c:336:3: warning: passing argument 3 of 'brcmf_proto_bcdc_hdrpull' from incompatible pointer type
      brcmf_proto_bcdc_hdrpull(drvr, false, &ifidx, pktbuf);
      ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c:277:1: note: expected 'struct sk_buff *' but argument is of type 'int *'
    brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
    ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c:336:3: warning: passing argument 4 of 'brcmf_proto_bcdc_hdrpull' from incompatible pointer type
      brcmf_proto_bcdc_hdrpull(drvr, false, &ifidx, pktbuf);
      ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c:277:1: note: expected 'struct brcmf_if **' but argument is of type 'struct sk_buff *'
    brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
    ^

vim +/brcmf_proto_bcdc_hdrpull +336 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c

   320	
   321		if (pktbuf->len == 0)
   322			return -ENODATA;
   323	
   324		*ifp = tmp_if;
   325		return 0;
   326	}
   327	
   328	static int
   329	brcmf_proto_bcdc_txdata(struct brcmf_pub *drvr, int ifidx, u8 offset,
   330				struct sk_buff *pktbuf)
   331	{
   332		int res;
   333		brcmf_proto_bcdc_hdrpush(drvr, ifidx, offset, pktbuf);
   334		res = brcmf_bus_txdata(drvr->bus_if, pktbuf);
   335		if (res < 0)
 > 336			brcmf_proto_bcdc_hdrpull(drvr, false, &ifidx, pktbuf);
   337		return res;
   338	}
   339	
   340	static void
   341	brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
   342					     enum proto_addr_mode addr_mode)
   343	{
   344	}

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot April 12, 2016, 9:28 p.m. UTC | #2
Hi Per,

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v4.6-rc3 next-20160412]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/per-forlin-gmail-com/brcmfmac-Decrease-8021x_cnt-for-dropped-packets/20160413-045216
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: mips-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c: In function 'brcmf_proto_bcdc_txdata':
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c:336:41: error: passing argument 3 of 'brcmf_proto_bcdc_hdrpull' from incompatible pointer type [-Werror=incompatible-pointer-types]
      brcmf_proto_bcdc_hdrpull(drvr, false, &ifidx, pktbuf);
                                            ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c:277:1: note: expected 'struct sk_buff *' but argument is of type 'int *'
    brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
    ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c:336:49: error: passing argument 4 of 'brcmf_proto_bcdc_hdrpull' from incompatible pointer type [-Werror=incompatible-pointer-types]
      brcmf_proto_bcdc_hdrpull(drvr, false, &ifidx, pktbuf);
                                                    ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c:277:1: note: expected 'struct brcmf_if **' but argument is of type 'struct sk_buff *'
    brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
    ^
   cc1: some warnings being treated as errors

vim +/brcmf_proto_bcdc_hdrpull +336 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c

   330				struct sk_buff *pktbuf)
   331	{
   332		int res;
   333		brcmf_proto_bcdc_hdrpush(drvr, ifidx, offset, pktbuf);
   334		res = brcmf_bus_txdata(drvr->bus_if, pktbuf);
   335		if (res < 0)
 > 336			brcmf_proto_bcdc_hdrpull(drvr, false, &ifidx, pktbuf);
   337		return res;
   338	}
   339	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
index 6af658e..508b287 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
@@ -329,8 +329,12 @@  static int
 brcmf_proto_bcdc_txdata(struct brcmf_pub *drvr, int ifidx, u8 offset,
 			struct sk_buff *pktbuf)
 {
+	int res;
 	brcmf_proto_bcdc_hdrpush(drvr, ifidx, offset, pktbuf);
-	return brcmf_bus_txdata(drvr->bus_if, pktbuf);
+	res = brcmf_bus_txdata(drvr->bus_if, pktbuf);
+	if (res < 0)
+		brcmf_proto_bcdc_hdrpull(drvr, false, &ifidx, pktbuf);
+	return res;
 }
 
 static void
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index a14d9d9d..485e2ad 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -2721,7 +2721,7 @@  static int brcmf_sdio_bus_txdata(struct device *dev, struct sk_buff *pkt)
 	*(u16 *)(pkt->cb) = 0;
 	if (!brcmf_sdio_prec_enq(&bus->txq, pkt, prec)) {
 		skb_pull(pkt, bus->tx_hdrlen);
-		brcmf_err("out of bus->txq !!!\n");
+		brcmf_dbg(INFO, "out of bus->txq !!!\n");
 		ret = -ENOSR;
 	} else {
 		ret = 0;