From patchwork Wed Jan 31 17:05:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2030998dyb; Wed, 31 Jan 2024 09:08:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4jQteOMfNFh8A8d0KiqdOprXtj3+NzyWn4bpk/9eR0FcYZbrnIYCoG27OF/uaJSWD6poF X-Received: by 2002:a17:906:4f0a:b0:a35:de06:23f1 with SMTP id t10-20020a1709064f0a00b00a35de0623f1mr1516824eju.0.1706720939471; Wed, 31 Jan 2024 09:08:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706720939; cv=pass; d=google.com; s=arc-20160816; b=bfGghb/HqQdtXOETW2j1cqREQG9yHDAxYPartWTV7mP9qbtY0OwnP3a6/NFLNqLoME B4jiTPagCICxMSebvdVqD7q1FY3dTftxUeQbi8SEnQiYsSJ1eEF99CMzC3Lfxh5KXb/g uI18/d4Pk0yJgJ5E8PFdSvDEJWGpN28eklUm55gxmkbnWiKaM4iV5NavFdLEbv0IKhME eE1AdXbFJGO3BfZAh0Vopzz9NoNiAH1Y0L5MOskWpt5TdzR9V2BLSFOksdl1C5wZXOZ7 xVYUzM1LdRqx6+cVvCf36pMChFK3vnWHTXZM/zdgFrNiuOr9JwaLrZ8SdJ7+vkFABYkf gv8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=f5TyMU74VJHcMlxN6wPFUQAAvDmFWv443Th+PifQ9nM=; fh=nwi+t7QQfTtXe4vzvfV2yvk2qlH+37kE6rjzauuINDU=; b=vuwzLCFCio8A+NkFHv3wEflwf12WRuQ49IETO4YJs/bIfA3htQA5m8BrHj5xeN1cTU q3i4fbimQzv9kf0f1hDQEGLKvlCDCzBZk0CetN9PSVno9F2APMwo2wEj8B3zCmf0amU/ AHn4EjZpSXGUmlNN2wRS+KFjlCuGg5p38kyZkdgkr6Co8QvWiP9wU3ui7WXlD8BwDOVM Y9PLk7yG24DiLL+LajcDIvmDQl++ot2NWfEw1DtYuG1leE/xHkfOuXEjsRyzCQyGlExM xutHucmMJlW4oSqYOdY9uMxdjgPFgIVaJXtDCPpFNIMlQj7nLO0J00Ffi/C9Fxnws/P7 fVCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCVjzIXHY1M98NP84lX4Msxl0+kNfIMDlCscCA+vdEYpf86KWPcFMftJ/EZBxsGP37y5MsC2vHSncHXZ9B1hJEUloig/Zw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gf14-20020a170906e20e00b00a352afb106bsi4972113ejb.239.2024.01.31.09.08.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:08:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 195191F22B06 for ; Wed, 31 Jan 2024 17:08:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C972013AA53; Wed, 31 Jan 2024 17:06:15 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69F33137C5B; Wed, 31 Jan 2024 17:06:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720774; cv=none; b=uoX33JkQQyLKUQTcfBuKYfAT/wC3gr1Npf+gly5z+9CHkxQ7/txQDPPKcBjYFnYCtj2dvw6UtoSyuKp7X47fVsIJme6Ec9C8HgO2eYg0cLyiwVu302fN4McgV0XahjMSUgawLlEzU3ZxsJTJkoDmcIYWYKdDrSOyT+g1tgEWDc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720774; c=relaxed/simple; bh=Xmw9KV3Egdvfg0TUeQfDphSDxUXsZykmY75UH/aGsXc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zg7AKqvopXKiqghYFlym6RmRWJDczcXfvCZHTUb6lelnxKIGamCl9kGhWxml7+UKIriyi0X/9vhBcSxUHRCKfknNfyP9a+2vFWrPm3IA4hm5U4rpvSzXUOgUViumKoY5tFzwFZNtJApmYYZ7uUOIflRBEYMNRU7WssDzHyAr2j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="196315544" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Feb 2024 02:06:11 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D134440344FE; Thu, 1 Feb 2024 02:06:07 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/8] net: ravb: Align GbEth poll function with NAPI docs Date: Wed, 31 Jan 2024 17:05:20 +0000 Message-Id: <20240131170523.30048-7-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789626615395886930 X-GMAIL-MSGID: 1789626615395886930 Call napi_complete_done() in accordance with the documentation in `Documentation/networking/napi.rst`. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 26 ++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index a90e70b25875..c3a5e4bb61f9 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1363,23 +1363,19 @@ static int ravb_poll_gbeth(struct napi_struct *napi, int budget) if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; - if (work_done == budget) - goto out; - - napi_complete(napi); - - /* Re-enable RX/TX interrupts */ - spin_lock_irqsave(&priv->lock, flags); - if (!info->irq_en_dis) { - ravb_modify(ndev, RIC0, mask, mask); - ravb_modify(ndev, TIC, mask, mask); - } else { - ravb_write(ndev, mask, RIE0); - ravb_write(ndev, mask, TIE); + if (work_done < budget && napi_complete_done(napi, work_done)) { + /* Re-enable RX/TX interrupts */ + spin_lock_irqsave(&priv->lock, flags); + if (!info->irq_en_dis) { + ravb_modify(ndev, RIC0, mask, mask); + ravb_modify(ndev, TIC, mask, mask); + } else { + ravb_write(ndev, mask, RIE0); + ravb_write(ndev, mask, TIE); + } + spin_unlock_irqrestore(&priv->lock, flags); } - spin_unlock_irqrestore(&priv->lock, flags); -out: return work_done; }