Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5970883iob; Tue, 10 May 2022 07:41:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAbBf7armhD7WciJwD6BKdNNYdSZ3+PMUtPcd3hYg6mRqwncuHCfOs9vIdX1rZ3b+v8OdP X-Received: by 2002:a17:907:da7:b0:6f4:ed59:c4e2 with SMTP id go39-20020a1709070da700b006f4ed59c4e2mr20682655ejc.83.1652193681692; Tue, 10 May 2022 07:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652193681; cv=none; d=google.com; s=arc-20160816; b=W0ieN7HRH+TOrfxNNTIwhJ6GuysnnWEooRTxNxaTqaK7elIqzYlxkA6lYwks9OJOnh 8TSgUE2Bhronx28Z7r2Fv47SqPl4plsQuldsUL+5OEgMZEhgc7m7ZSJ8ZJV+tExoKyn3 iGCf9HX3/pJsfTAjsdJkVPggjZUj0tXprOXiA7BIDSW0iVBnytbawNorwcWp/NjfDbwD wLRcRO57Ccg27z//uOrH7hBm2W3Hj55OWEQQNikQR4sKZ8N6Ywktr2WGOWWtaoxoiC7g jxas1ym9PxS4nrkXej/RpqhvXyMFpbkDkEKpEl1KmVyOVSt+tCto9cVx3cDtflEyK+Zj IR+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=45ovxw11hjdkc5kMkb45QZ9KyViyP6YFv6skuMmbKlo=; b=xJP+TwOlO8EWtkRdSUF7358uHUuBpbt79GFEeQ/mMFdcJlJUQZV7uve3YUo6p2QWO7 vcPPIBqOCNSVsWVCwE3b78PKaCk/GKF5uyK82iAtmVLcJRD7sLMOAByFiFkrV2HfXcul 6wW+a0qQ6QuRQ7GHgyZHZ7JoPFVGGelRE1Xk3ZpZx3u5UiFD/s7mCA/5lpnPDq316lhf JCZ7yNaTTr2PuqIToqCr3PBnqZ4DmCRR3kz4sa1X8geK4dnzVH7hc+dCH6ZwtnL+QgsQ woMFnqYUkgme6mX7dMs52D4GKjz4c9HaWpEw230ubkQig9hbDKMzL/ZuQ6np5118J5F7 ukbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lT8MaNmP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a170906314800b006ee81f1754csi16050481eje.882.2022.05.10.07.40.55; Tue, 10 May 2022 07:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lT8MaNmP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245014AbiEJN5D (ORCPT + 99 others); Tue, 10 May 2022 09:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245122AbiEJNid (ORCPT ); Tue, 10 May 2022 09:38:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31F84245795; Tue, 10 May 2022 06:27:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4304B81DA2; Tue, 10 May 2022 13:27:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05924C385C2; Tue, 10 May 2022 13:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189230; bh=3HnBQ7RhhvY/fdtAei+Bol5vyNmEEQsKf84c57Q1evE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lT8MaNmPRWSqtFr4gX9tfvmriOGqFt4WfFCzW00oPBGfzH2RLRCi9+f66YE2/6xiL YszKSHph94dRNSJyfELV5t1uS8QZJtRVi3BxMFg7aDSGfp3qUxB4raCcwV6VA8sVJ0 oz1qpN02JwBvOuwlq1eFQwZ4o9TrFZNzq20H8oRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Gospodarek , Michael Chan , Jakub Kicinski Subject: [PATCH 5.10 53/70] bnxt_en: Fix unnecessary dropping of RX packets Date: Tue, 10 May 2022 15:08:12 +0200 Message-Id: <20220510130734.414249197@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.861729621@linuxfoundation.org> References: <20220510130732.861729621@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Chan commit 195af57914d15229186658ed26dab24b9ada4122 upstream. 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 Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2575,6 +2575,10 @@ static int bnxt_poll_p5(struct napi_stru 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);