public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Michael Chan <michael.chan@broadcom.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.4 12/25] bnxt_en: Fix TX timeout during netpoll.
Date: Tue, 16 Oct 2018 00:15:53 -0400	[thread overview]
Message-ID: <20181016041606.135876-12-sashal@kernel.org> (raw)
In-Reply-To: <20181016041606.135876-1-sashal@kernel.org>

From: Michael Chan <michael.chan@broadcom.com>

[ Upstream commit 73f21c653f930f438d53eed29b5e4c65c8a0f906 ]

The current netpoll implementation in the bnxt_en driver has problems
that may miss TX completion events.  bnxt_poll_work() in effect is
only handling at most 1 TX packet before exiting.  In addition,
there may be in flight TX completions that ->poll() may miss even
after we fix bnxt_poll_work() to handle all visible TX completions.
netpoll may not call ->poll() again and HW may not generate IRQ
because the driver does not ARM the IRQ when the budget (0 for netpoll)
is reached.

We fix it by handling all TX completions and to always ARM the IRQ
when we exit ->poll() with 0 budget.

Also, the logic to ACK the completion ring in case it is almost filled
with TX completions need to be adjusted to take care of the 0 budget
case, as discussed with Eric Dumazet <edumazet@google.com>

Reported-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Song Liu <songliubraving@fb.com>
Tested-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 4ffacafddacb..fea8116da06a 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1343,8 +1343,11 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
 		if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
 			tx_pkts++;
 			/* return full budget so NAPI will complete. */
-			if (unlikely(tx_pkts > bp->tx_wake_thresh))
+			if (unlikely(tx_pkts > bp->tx_wake_thresh)) {
 				rx_pkts = budget;
+				raw_cons = NEXT_RAW_CMP(raw_cons);
+				break;
+			}
 		} else if ((TX_CMP_TYPE(txcmp) & 0x30) == 0x10) {
 			rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &agg_event);
 			if (likely(rc >= 0))
@@ -1362,7 +1365,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
 		}
 		raw_cons = NEXT_RAW_CMP(raw_cons);
 
-		if (rx_pkts == budget)
+		if (rx_pkts && rx_pkts == budget)
 			break;
 	}
 
@@ -1404,8 +1407,12 @@ static int bnxt_poll(struct napi_struct *napi, int budget)
 	while (1) {
 		work_done += bnxt_poll_work(bp, bnapi, budget - work_done);
 
-		if (work_done >= budget)
+		if (work_done >= budget) {
+			if (!budget)
+				BNXT_CP_DB_REARM(cpr->cp_doorbell,
+						 cpr->cp_raw_cons);
 			break;
+		}
 
 		if (!bnxt_has_work(bp, cpr)) {
 			napi_complete(napi);
-- 
2.17.1

  parent reply	other threads:[~2018-10-16  4:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16  4:15 [PATCH AUTOSEL 4.4 01/25] xfrm: Validate address prefix lengths in the xfrm selector Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 02/25] xfrm6: call kfree_skb when skb is toobig Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 03/25] mac80211: Always report TX status Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 04/25] cfg80211: reg: Init wiphy_idx in regulatory_hint_core() Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 05/25] cfg80211: Address some corner cases in scan result channel updating Sasha Levin
2018-11-02  9:19   ` Greg KH
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 06/25] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 07/25] xfrm: validate template mode Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 08/25] mac80211_hwsim: do not omit multicast announce of first added radio Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 09/25] Bluetooth: SMP: fix crash in unpairing Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 10/25] pxa168fb: prepare the clock Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 11/25] bonding: avoid possible dead-lock Sasha Levin
2018-10-16  4:15 ` Sasha Levin [this message]
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 13/25] asix: Check for supported Wake-on-LAN modes Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 14/25] ax88179_178a: " Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 15/25] lan78xx: " Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 16/25] sr9800: " Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 17/25] r8152: Check for supported Wake-on-LAN Modes Sasha Levin
2018-10-16  4:15 ` [PATCH AUTOSEL 4.4 18/25] smsc75xx: Check for Wake-on-LAN modes Sasha Levin
2018-10-16  4:16 ` [PATCH AUTOSEL 4.4 19/25] smsc95xx: " Sasha Levin
2018-10-16  4:16 ` [PATCH AUTOSEL 4.4 20/25] qlcnic: fix Tx descriptor corruption on 82xx devices Sasha Levin
2018-10-16  4:16 ` [PATCH AUTOSEL 4.4 21/25] i2c: i2c-scmi: fix for i2c_smbus_write_block_data Sasha Levin
2018-10-16  4:16 ` [PATCH AUTOSEL 4.4 22/25] perf/ring_buffer: Prevent concurent ring buffer access Sasha Levin
2018-10-16  4:16 ` [PATCH AUTOSEL 4.4 23/25] net/usb: cancel pending work when unbinding smsc75xx Sasha Levin
2018-10-16  4:16 ` [PATCH AUTOSEL 4.4 24/25] net: cxgb3_main: fix a missing-check bug Sasha Levin
2018-10-16  4:16 ` [PATCH AUTOSEL 4.4 25/25] mm/vmstat.c: fix outdated vmstat_text Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181016041606.135876-12-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox