Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5458233imm; Tue, 16 Oct 2018 10:31:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV62JcQ20KKdPy+hshB1jSOIDvBtaZJ8AfXimJkYN1mbNQRzS3sojHvjk7E/C+Zh9mihvhEK3 X-Received: by 2002:a62:9951:: with SMTP id d78-v6mr22609355pfe.239.1539711093976; Tue, 16 Oct 2018 10:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711093; cv=none; d=google.com; s=arc-20160816; b=o+jiktT00tx0GFO+d2cCyt7LWTZpcZVIqxF9RDQqxb/7kB7DhR8aP6tHHuX91r5aSw VoS62+9AIc+MiR3Mzwm2NoMjwddUVUfcYNJAOyNmOSxU74/XWxEHyNaYsijYb0+paLF0 fIAEYATUGdrRLo4Z73Da/0vuLu82vH3R7XHWqGgD4J8oz7T4w2QJY9oE+9etz86s+fXY 0jZ60X1sCRSSOKUZDSq0vbn4AIYwEhYRdkXDR16xAvY1WND2Ywy8JmVtPgTnQsBrxZBJ y5ED4K73DlsxJFpsCWwGs2u0b54nd6ZkBwuET2GHSCVfFna8JjNw0TiV7OLaQw+TJVyW 0vDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z0paA9wEwkFaBIDqjawOA2zT8BnvIe8jrNozuWw8Chg=; b=u+l/SSbHqzK3hguBqBegHdVOdJIpBeXpRjHthzveQb4VxFJc9APu1pOveVK2mHSHJ8 lypDrwZ9SOGwc29g3iNdlOre4Vj/74iL4PzPac2j9wsASxdKw943A2ho5WUqtanz8Pmi lJQiKbkdW9Dz8ngMNEpm+TRdjF+tEOGO37l5WP018UBROXBwkxxw/kR6pOs7+49xWWzd mqri9JlE9dy6YfMvHp0Yvxid3KP4RNQtO8ZfVD8bDP4edsHft7aK3i2G0ktWuFQdf3ma B8pc6hFjzJWKjDB/vT+AWSizJ0oZACa0MrhoXlvAPiZ0C3Y3FM1fgcRxbmNUx4mIUqK3 G+wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="XLr//kKO"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c89-v6si15169272pfe.60.2018.10.16.10.31.18; Tue, 16 Oct 2018 10:31:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="XLr//kKO"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731364AbeJQBOo (ORCPT + 99 others); Tue, 16 Oct 2018 21:14:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:33158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730397AbeJQBOm (ORCPT ); Tue, 16 Oct 2018 21:14:42 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E179820866; Tue, 16 Oct 2018 17:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710597; bh=sAmxf/eLuPWk9o+UyD3Z+qcZ9E5DW229I/6wH/dYNzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XLr//kKOCHb96Cl7+WdfehzPmku6wNiHE6knz6c+8b6Lw0YIGEWp5ixg3EyPG6Avz OGcuUpPU1g3qPwu54fYmix5MHW5fHY8X6jZRVIClxILGjNPw7hVwTA/PTyjxRcbEKW Ib0eS1ZbTxgijtbGXtpg/xjv19s1Nm5XHvagCwAU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Michael Chan , "David S. Miller" Subject: [PATCH 4.9 22/71] bnxt_en: Fix TX timeout during netpoll. Date: Tue, 16 Oct 2018 19:09:19 +0200 Message-Id: <20181016170540.504648463@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Chan [ 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 Reported-by: Song Liu Reviewed-by: Song Liu Tested-by: Song Liu Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1666,8 +1666,11 @@ static int bnxt_poll_work(struct bnxt *b 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)) @@ -1685,7 +1688,7 @@ static int bnxt_poll_work(struct bnxt *b } raw_cons = NEXT_RAW_CMP(raw_cons); - if (rx_pkts == budget) + if (rx_pkts && rx_pkts == budget) break; } @@ -1797,8 +1800,12 @@ static int bnxt_poll(struct napi_struct 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);