From patchwork Fri Feb 22 10:20:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nivedita Singhvi X-Patchwork-Id: 1046719 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 445S6359Blz9s71; Fri, 22 Feb 2019 21:20:43 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gx7wc-0006p1-El; Fri, 22 Feb 2019 10:20:38 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gx7wa-0006on-UF for kernel-team@lists.ubuntu.com; Fri, 22 Feb 2019 10:20:36 +0000 Received: from mail-wr1-f72.google.com ([209.85.221.72]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gx7wa-00049E-Ms for kernel-team@lists.ubuntu.com; Fri, 22 Feb 2019 10:20:36 +0000 Received: by mail-wr1-f72.google.com with SMTP id j16so822139wrp.4 for ; Fri, 22 Feb 2019 02:20:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:from:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=sH/JMXeaNyI1Ai8Eaxma9HtIfXa8LXIHo/SZdt+aiP8=; b=Khi5DUg/HPTHOkKEdviV/UumhYhAFFENAKB13w1J01HiZxnXKNEwni6MA1b5MXehXk Rlw1B4e76bZfAaAbqT2xSwuTP81dLTEBubVVhbvSWFMe/RHUq8J1qvl2BNtmkT8nO8wF 63uAsbDtxIbQx60s8Mdqd2/GgJlhqT28QyrMpVDLdeuyF55E9u4+XLtr0iFhn4iPt0pQ DdRbTFMpLfzoHVMXYZRkeq3XWO7dvdyO2QS+mtXLeSIezwbw3iSEmlPbxgV0nwIYvCdP +1AwVTJB5FHzuBbbGw4rJkOVTvNzeo5jG4aoPNaE1z7vlYd400NF51pJdN30jDf6VNSO lLNg== X-Gm-Message-State: AHQUAubIGvhum2iR3MTd0lSp7eAC5lWWrO027GHZcBpzyI0kfYALlfNj wBWVmQSni0y50bIzOxhPZRA2B6vUmD5P9lOuWg3DbgR2vbRpXFhZgzHjxGYE204DjbavFiHNS7f /VYVzdDpMbeFXnfZqKNJ3CpR8aksvz3hH1KhXdG423g== X-Received: by 2002:a1c:2d4:: with SMTP id 203mr1944301wmc.20.1550830836129; Fri, 22 Feb 2019 02:20:36 -0800 (PST) X-Google-Smtp-Source: AHgI3IZcujGFaqHTJB2kqgBM+4SjKrI8knRsMmW+h5EPfUgulOH5tQwtTUDu7hGprMBWq4oYRpkrTQ== X-Received: by 2002:a1c:2d4:: with SMTP id 203mr1944286wmc.20.1550830835851; Fri, 22 Feb 2019 02:20:35 -0800 (PST) Received: from ?IPv6:2001:67c:1562:8007::aac:414d? ([2001:67c:1562:8007::aac:414d]) by smtp.gmail.com with ESMTPSA id h17sm681614wrq.17.2019.02.22.02.20.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 02:20:35 -0800 (PST) To: kernel-team@lists.ubuntu.com Subject: [SRU X] [PATCH 1/1] UBUNTU: SAUCE: bnxt_en_bpo: Fix TX timeout during netpoll From: Nivedita Singhvi Message-ID: Date: Fri, 22 Feb 2019 11:20:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 Content-Language: en-US X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Michael Chan BugLink: http://bugs.launchpad.net/bugs/1814095 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 (backported from commit 73f21c653f930f438d53eed29b5e4c65c8a0f906 upstream) Signed-off-by: Nivedita Singhvi rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &event); @@ -2028,7 +2031,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; } @@ -2156,8 +2159,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)) { #ifdef HAVE_NEW_NAPI_COMPLETE_DONE Acked-by: Stefan Bader Signed-off-by: Nivedita Singhvi diff --git a/ubuntu/bnxt/bnxt.c b/ubuntu/bnxt/bnxt.c index f04db69..9b51120 100644 --- a/ubuntu/bnxt/bnxt.c +++ b/ubuntu/bnxt/bnxt.c @@ -2006,8 +2006,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) { if (likely(budget))