From patchwork Fri Sep 8 07:01:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hayes Wang X-Patchwork-Id: 137710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp416265vqo; Fri, 8 Sep 2023 02:16:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFhAfkOeJi5nM1HIGBW4aQJ3x0+V2JxoDtNXst10vdXQlX5SwlKAaG9DjdO76/QUGwKcC+ X-Received: by 2002:a19:675b:0:b0:500:977d:a4e1 with SMTP id e27-20020a19675b000000b00500977da4e1mr1307004lfj.40.1694164614985; Fri, 08 Sep 2023 02:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694164614; cv=none; d=google.com; s=arc-20160816; b=QpgjOPifqCQ0izpPEY3hO+NevioKyul11UpVtRt5rym9ygfA5nwISyqmVszUwiQ+VY 2yXkZmKy3A4FbAsMjWi7sFuSu5jQ+Xrf05EdCvbjq6Gx4qDviVGZEHGjYvZKAyb2nUEX kGI3hu66mUJXwzCtSZZxpjYjvitIEcFZ6rNI4xd4J8MVpnpjJtarz9cfuUNQXQjKFJYR udkJcD/xWMBcGybmgzgTsBhzM3IZYMzqEQ3WfLCIeGGrR/nrLXc0T7CdpUJZuzf58HEZ fo+rbq7sAgYS0TM3ddB/RZre1auS97JRNExT0IKP35FnKOv5JGxaYG5JHpy+mxyUtkb7 FKpw== 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 :message-id:date:subject:cc:to:from; bh=DOCKJioHcRxSC89hg3GLNOGebylfMor0ae/WKHrDqTs=; fh=asqeH3O/QnyRb7t/jKhooxi2j9EYs9s/QOPv512F3oU=; b=PSkpXo4py08EZRNj8mfa4vgz2Vw2AIoyvBrrecQ4mytEwYVVEjsLUGIVbaq55hnXmq 8hudy4OUSnmYsjBsTLwj1TzL+BsAcLute6vNGbq9+olxvlD55LI98zKPaz3goBUZkNwc S+yK+9lU/rbtmPXsK51WZ1vZ4YHTqUEbm+V0ziNljzl9pxMiFtbTAUsPITUPI5NAIdOC tEbcg90XTWc8vj8Em8ScticJedoqdlvr6TtDwOKimfVRYQ7q8ZkBlADh54pct/hqIVW+ 72EjI4aCCP0IMkMjHjwunMPF1jEu6h4lhU8xRQ8sxw1lblMfRpaWcO8wW3XmDt+k4R6J jGHg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a056402068b00b0052557cc5db0si1089520edy.217.2023.09.08.02.16.36; Fri, 08 Sep 2023 02:16:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229665AbjIHHCh (ORCPT + 47 others); Fri, 8 Sep 2023 03:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232354AbjIHHCf (ORCPT ); Fri, 8 Sep 2023 03:02:35 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B9A419B6; Fri, 8 Sep 2023 00:02:30 -0700 (PDT) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 38872FPA01588277, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.92/5.92) with ESMTPS id 38872FPA01588277 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Sep 2023 15:02:15 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Fri, 8 Sep 2023 15:02:13 +0800 Received: from fc38.localdomain (172.22.228.98) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 8 Sep 2023 15:02:12 +0800 From: Hayes Wang To: , CC: , , , , Hayes Wang Subject: [PATCH net] r8152: check budget for r8152_poll() Date: Fri, 8 Sep 2023 15:01:52 +0800 Message-ID: <20230908070152.26484-422-nic_swsd@realtek.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Originating-IP: [172.22.228.98] X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776460355495800491 X-GMAIL-MSGID: 1776460355495800491 According to the document of napi, there is no rx process when the budget is 0. Therefore, r8152_poll() has to return 0 directly when the budget is equal to 0. Fixes: d2187f8e4454 ("r8152: divide the tx and rx bottom functions") Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 332c853ca99b..0c13d9950cd8 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2636,6 +2636,9 @@ static int r8152_poll(struct napi_struct *napi, int budget) struct r8152 *tp = container_of(napi, struct r8152, napi); int work_done; + if (!budget) + return 0; + work_done = rx_bottom(tp, budget); if (work_done < budget) {