From patchwork Tue May 3 01:13:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12834955 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A36FC433EF for ; Tue, 3 May 2022 01:13:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230002AbiECBRX (ORCPT ); Mon, 2 May 2022 21:17:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiECBRF (ORCPT ); Mon, 2 May 2022 21:17:05 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EBF4506C7 for ; Mon, 2 May 2022 18:13:32 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id n18so13812285plg.5 for ; Mon, 02 May 2022 18:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JV8HZH/RPwztFz8GsBRUtlTHu110VIJsgQCQJI8UpIw=; b=JiFCRWn3cJ1sB06VBquVzKwcJgxuUxYydgI33z61EK2iojfj1sRxDN/WzkLFGtHeRn wzLfsYA1/6A/gxTcKaxdwCrfBd/nkyy+kUc+wQW27WzB16ASxJ5/M5FEb5+JNpFy4uZM d667zxjrMJ+Y1UfpLPZ5xD02M+WHtn+NeRoNA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JV8HZH/RPwztFz8GsBRUtlTHu110VIJsgQCQJI8UpIw=; b=DopX5da53YkkddrzrNmqJadctifwtbOLuSciXBeZKKLBHoqc9PtUpiQm4mGwvhWOx5 KMpXsHOCwLuxjL6Mk3zJCaagtYRWONL69uIJrECAo6qlGiqnTGkoHHY2lywTIQZwlKdV AnggR30K7ySaVwUNACqI3+5EMev1irHZtezD0mbDcU3iuAOHwmtvjo9ziBn6hldjSewu HGjMnimRucPBBd8vKMGNZLrNe1GvoODE05+IhRedhbG2PkwyE1RVH7ULwioDmIJ2630f J2CffBumTFDRgzk0o+bujN6Mk4P5Z5OUGEMyc5lMgVFKNYQAln8LiYXn9K31J5d/UZL5 ACJQ== X-Gm-Message-State: AOAM531qji5pt2RZGaKgXJwIY9VNzYsRC4ZvU3q38rOS6x68qdOTVsWd haQ7bnV/W04PtVyIs6JPGWbFTw== X-Google-Smtp-Source: ABdhPJyCh0KNFy/iizL+WV+y0HyJ6FCZyGMJ4aVWrx/GX5KNSc3upch7rXvBwJbdVYJ70GUYOa84uQ== X-Received: by 2002:a17:903:2306:b0:15e:b7be:dafd with SMTP id d6-20020a170903230600b0015eb7bedafdmr456797plh.29.1651540411519; Mon, 02 May 2022 18:13:31 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id k23-20020a170902ba9700b0015e8d4eb1fesm5272169pls.72.2022.05.02.18.13.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 May 2022 18:13:31 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 3/3] bnxt_en: Fix unnecessary dropping of RX packets Date: Mon, 2 May 2022 21:13:12 -0400 Message-Id: <1651540392-2260-4-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1651540392-2260-1-git-send-email-michael.chan@broadcom.com> References: <1651540392-2260-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In bnxt_poll_p5(), we first check cpr->has_more_work. If it is true, we are in NAPI polling mode and we will call __bnxt_poll_cqs() to continue polling. It is possible to exhanust the budget again when __bnxt_poll_cqs() returns. We then enter the main while loop to check for new entries in the NQ. If we had previously exhausted the NAPI budget, we may call __bnxt_poll_work() to process an RX entry with zero budget. This will cause packets to be dropped unnecessarily, thinking that we are in the netpoll path. Fix it by breaking out of the while loop if we need to process an RX NQ entry with no budget left. We will then exit NAPI and stay in polling mode. Fixes: 389a877a3b20 ("bnxt_en: Process the NQ under NAPI continuous polling.") Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 2818cfef42f8..1d69fe0737a1 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2707,6 +2707,10 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget) u32 idx = le32_to_cpu(nqcmp->cq_handle_low); struct bnxt_cp_ring_info *cpr2; + /* No more budget for RX work */ + if (budget && work_done >= budget && idx == BNXT_RX_HDL) + break; + cpr2 = cpr->cp_ring_arr[idx]; work_done += __bnxt_poll_work(bp, cpr2, budget - work_done);