From patchwork Tue Apr 5 20:01:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: per.forlin@gmail.com X-Patchwork-Id: 8754781 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5F4D19F3D1 for ; Tue, 5 Apr 2016 20:02:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4999D20381 for ; Tue, 5 Apr 2016 20:02:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 44FC520351 for ; Tue, 5 Apr 2016 20:02:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759634AbcDEUCS (ORCPT ); Tue, 5 Apr 2016 16:02:18 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35896 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752392AbcDEUCR (ORCPT ); Tue, 5 Apr 2016 16:02:17 -0400 Received: by mail-lf0-f65.google.com with SMTP id p81so2378403lfb.3 for ; Tue, 05 Apr 2016 13:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=qgH0txbQgJ77rud7M2XSvS2E3IKmsZ+kIAn8odMixWo=; b=Aum694WgCn2ugt09alHZzwoztj3D8ETnv0kVPhUasHAj7XQ9vFpBgShTR1+PeGQS8D ka0pl5QQyerojM581HYwRZFNyGHeFVunJ87v4Rs3oIxJbzGzihOkbjPK3O3PbgYTc8s1 PVyoc0BmTLUaOBTAfax7IY5eadN8JhPK0oMQOGi9c4oTWdAAk0bM65ti7woGMVWNTvcs sOSg+fXJRwtN7gRLRCjm9XSw5CibiA5kazgo1gW1cvETpDcnOeo8hRyI0zu6c1xNTse+ tA7337p/mjqZACowk2fyDAgG8yZzT7vT2EA3vUB6OrXBFSnwt+OiuuXzls8MGZUcwaCd N2iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qgH0txbQgJ77rud7M2XSvS2E3IKmsZ+kIAn8odMixWo=; b=iZ+LUXvGRAiPzoPJeCFPTcm1NX5a+A2/RxiquDVzUvuZ5j+dHoi2z+Uv/RS53ho7sR inrXMZiaVzTCJzpWRivPkGKF4i/+H4bx16rOV8jkEZ1ZhXzQnst9Jp/2Rd9KnMiTGXE3 YksIGeACfgX7hdUTgLwJTLloPUu0sz9kde8W5Px8Bapk1uKr2igRExz8VtU61oRlZWxn Cb8pMEdpkyyEwl0wteoQBK/xJlCA7eJm90mAAF5F0cBQmF/J+G0XsK+iUcb5/BXIP2VL sXs8/TTAXR7MVhNakvcDVYDZOkG7Qf2tzhL/nE4tvGI8mK9stqOwypaZ04scG1yLGVtY WpbA== X-Gm-Message-State: AD7BkJIrbZxC2BUUhIMX7boph6kYJgVO9XjoKMK5CRpZ84OqlGCiYqQrmjEFsKUrqIjj5g== X-Received: by 10.25.155.85 with SMTP id d82mr6413165lfe.74.1459886535884; Tue, 05 Apr 2016 13:02:15 -0700 (PDT) Received: from localhost.localdomain ([109.104.20.244]) by smtp.gmail.com with ESMTPSA id nv8sm5786041lbb.7.2016.04.05.13.02.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Apr 2016 13:02:14 -0700 (PDT) From: per.forlin@gmail.com To: linux-wireless@vger.kernel.org Cc: arend@broadcom.com, brudley@broadcom.com, frankyl@broadcom.com, meuleman@broadcom.com, Per Forlin Subject: [PATCH v2] brcmfmac: Don't increase 8021x_cnt for dropped packets Date: Tue, 5 Apr 2016 22:01:47 +0200 Message-Id: <1459886507-26249-1-git-send-email-per.forlin@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Per Forlin The pend_8021x_cnt gets into a state where it's not being decreased. When the brcmf_netdev_wait_pend8021x is called it will timeout because there are no pending packets to be consumed. There is no easy way of getting out of this state once it has happened. Preventing the counter from being increased in case of dropped packets seem like a reasonable solution. Log showing overflow txq and increased cnt: // Extra debug prints brcmfmac: [brcmf_netdev_wait_pend8021x] pend_8021x_cnt == 0 brcmfmac: [brcmf_netdev_start_xmit] pend_8021x_cnt == 1 brcmfmac: [brcmf_netdev_start_xmit] pend_8021x_cnt == 2 brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!! // Extra debug prints brcmfmac: [brcmf_netdev_start_xmit] pend_8021x_cnt == 3 brcmfmac: [brcmf_netdev_start_xmit] pend_8021x_cnt == 4 brcmfmac: [brcmf_netdev_wait_pend8021x] pend_8021x_cnt == 4 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) Signed-off-by: Per Forlin --- I came across this bug in an older kernel but it seems relevant for the latest kernel as well. I'm not familiar with the code but I can reproduce the issue and verify a fix for it. With this patch I no longer get stuck with a pend8021_cnt > 0. Change log: v2 - Add variable to know whether the counter is increased or not drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index ed9998b..de80ad8 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -196,6 +196,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_pub *drvr = ifp->drvr; struct ethhdr *eh = (struct ethhdr *)(skb->data); + bool pend_8021x_cnt_increased = false; brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); @@ -233,14 +234,18 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, goto done; } - if (eh->h_proto == htons(ETH_P_PAE)) + if (eh->h_proto == htons(ETH_P_PAE)) { atomic_inc(&ifp->pend_8021x_cnt); + pend_8021x_cnt_increased = true; + } ret = brcmf_fws_process_skb(ifp, skb); done: if (ret) { ifp->stats.tx_dropped++; + if (pend_8021x_cnt_increased) + atomic_dec(&ifp->pend_8021x_cnt); } else { ifp->stats.tx_packets++; ifp->stats.tx_bytes += skb->len;