Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2233219imm; Thu, 18 Oct 2018 11:06:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV61sfozeUkIFgM7BAeXW2N90gROjo1m+YTL/83WUO9ijko9feV/B4kfkEGwmSdjlgfesbtWK X-Received: by 2002:a65:4103:: with SMTP id w3-v6mr29930621pgp.284.1539886018445; Thu, 18 Oct 2018 11:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539886018; cv=none; d=google.com; s=arc-20160816; b=sVZvQpNWMmCVh3yb81EaZMl3JpgGhy157985Lm94BeSfAGhb7OFGBKw1HhRb69iCRs GqgIq4LJiQMdpT4R6EaTDmRXlSH9hKdilCWk/jxzRN79zgdvLIa9yDdIL2cJhnXFuUV7 ZT+G12ob5QHrhH4H8wKi3wDmFl9WNGCARAQmNXeSipGwuTuzgvvoFQpRxF/ydDpxa8IG ounMo6YZkSWYSjufsKw93Mekva3SlqzXti5HBEUlWN3UKu0M2k21n08abzYNmTVI+yws yheehrJsP2bBLCCPpan+FaY37lka6C53xO3A8ICovwK+KeXKtkiYnG8ALRGouQPEes11 ACBw== 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=mvgmioYBpB9rmZsUWr+IgBYOC3kt0SJAjR+n5ha45VI=; b=Id9hp0t224biI4k7MXVuTazEfesS1itHpMEVs5hajRuWt5oItVt7nYps15VyXPq9nS FcVSrpz+sdrxjzpV/nxFs75FW6AwprPrjr8uY1PNeA+xGUik7ywYcTPxL+paSiM0lcMU R5RQtJG7UQmU7LwALoh3sgTHh0ikBkO7hJm3DNW3ej+ZcMBZsHnJRGzt/J4OY99JS0vi xjq5XvVLRnRzC9soEF+jLIHZSKZgrPbAhyRhvFmBQVozY8o3+ixMVL458njFori+Rvt9 pI7yHWNwwP8v+IEPC7uaOKR8XZ0287XTUMCMUai/FV1nglN27dtvHdFQK9n4KbTvHfrR zu4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kkeb9vr7; 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 t6-v6si20843730pgk.306.2018.10.18.11.06.43; Thu, 18 Oct 2018 11:06:58 -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=Kkeb9vr7; 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 S1730246AbeJSCHX (ORCPT + 99 others); Thu, 18 Oct 2018 22:07:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:56020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729245AbeJSCHX (ORCPT ); Thu, 18 Oct 2018 22:07:23 -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 A95CC2148D; Thu, 18 Oct 2018 18:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885916; bh=eH4amy02+wX7xmbZrak7ouu7Dx1G6xyn/1YJA5Pb1Cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kkeb9vr7wSLnsLm4nOmwydlnPdvYhd6Dr2OOGUu3LIDrdJ6WL/FMsGqfKrS3SnJXr 4KpHJPELVYbCN1NKLf0wEEYcQLFL/sC2bfskNPEY3Us2rLoC0yxC3Ab7w2d7fJB89A BZom1wrkWPmviKc1SGUDmMKdkmG4+0wW2EUeKr6Q= 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.4 17/48] bnxt_en: Fix TX timeout during netpoll. Date: Thu, 18 Oct 2018 19:54:52 +0200 Message-Id: <20181018175428.945537350@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175427.133690306@linuxfoundation.org> References: <20181018175427.133690306@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.4-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 @@ -1343,8 +1343,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)) @@ -1362,7 +1365,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; } @@ -1404,8 +1407,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);