Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1319528lqp; Mon, 15 Apr 2024 02:49:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUj1Iyl3H9cCmMIVzycTpPOGWZXFMnC8hFIBhJgnSaDvXYkXkjJF2VdOCzvwFOy9Ea6y2OPv+fq2qIFA/1/NR0fZx1tN8KQR2HbMGQSlg== X-Google-Smtp-Source: AGHT+IH9Bn5qVooACwr6gCG2LwCO8aETpAbpp/B9MoIB6Y71+0xdyhgOYjk8gmkEUDqZdn2TZXgb X-Received: by 2002:a05:622a:14c6:b0:436:8e39:9c6a with SMTP id u6-20020a05622a14c600b004368e399c6amr11349123qtx.34.1713174541875; Mon, 15 Apr 2024 02:49:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713174541; cv=pass; d=google.com; s=arc-20160816; b=fEJU5S4+JzIqAnQJitzYFA+HxEWq+zkisGebRUnPUR/UUwdQiPHhV8R8a3hPkljzZ7 2gQ2zJ//zPwHKnVSF6dSwUCabPUhjd+Wbto31fP0WXbCU3+apbh6T7YysQpCucLmG77N z0p2oQPmiQ+vmEfccml6VxGzw29pOhNSXmA0FUHRZioIpLiEzE6znnJuI5SG9GfDqaGI goldmL0bwyJW7fYVn7u/oSberqYF+FQYg0I2s1LAK8ozeyxWHpiA9hxI68YoYRAoGy6Q jzFGFtGWl7htbDhYUjqG2lgCL29iGzzStBIOjHbvrDjtngpd63B54sQRnWHzNhehNAtd E/Xw== 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=OgJ282FF9JiH2uzir5QnJESX/bbYbtjlgIkqUDqTu6c=; fh=4QG8JldDsSGgNvIBKkpjxUq7EoGw0Kp2cqehO+01mDo=; b=1GqFVraGgilPpp+j9aAJNjoWhy7mZByr0KxbGo+7wL8F1460bKGzowQ86OWXivdztE WXo2ateyHPXSwj35fTJnG73J54GO7KbCRyYuRKzhbXqC6x1lO+Hz0BE+dZBZmiJb1mVc aXIj2BjUDAU+2cIuYBEbDWrfZUn8rKGSaKvrRlzTw2ajDdDsXHoCNKZ13WgWV+GuUcN4 Kfju2ptNkdNnLP6oDKt71UJxmnS/PS50AIOGjFINx8DrBESvh6g7/xoSaAcDidsqVGXe VdYjUa+5uk1Hdl6jUajRVvmQjI57EJW2LS4ZO3d6KGklEorOrZ+wDO4v3xjq6ueyP6aT a2MQ==; 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-144857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f3-20020a05622a1a0300b0043461c89793si9743989qtb.116.2024.04.15.02.49.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 02:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-144857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144857-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 986CD1C21DFD for ; Mon, 15 Apr 2024 09:49:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 41B3E4F5F8; Mon, 15 Apr 2024 09:48:29 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 799D34E1B5; Mon, 15 Apr 2024 09:48:26 +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=1713174508; cv=none; b=Wp+TQNlDo9HX3TR7V51YjhTwXtc1smt5NrOBbgQom61ioRNEggblA2vgHgBiyo9GaNrNfzIOIgduLwFhl4vaaaCk848ZWJCfy9mPiTMZ3tp9LoxdX/9crSyTHJFN+4XvPjAKqFCxs4DP6KgeJURiWIC4AlP7Vsi/R+JHm/yU5+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713174508; c=relaxed/simple; bh=x4Zsub4YbolyN1YLVPle9lSA5gqkeulVwY0tAnBiE5E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=O98jA5AybIW5IBaZ8hlQXafOGhacI4N8W3/yDeuGyPGMmNbneGv562ZtsmHSJV6xzg6z2jNqo1urSxWwIpQxJGveJFk28e0002bgdrAxu189I4rXBRWy3IvAy3Rio68wt+RtONPXk63K5/nY8h5+hcWgm94GzscIKdEe/pWL5Qs= 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.07,202,1708354800"; d="scan'208";a="205432156" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 15 Apr 2024 18:48:26 +0900 Received: from renesas-deb12.cephei.uk (unknown [10.226.93.74]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 5D6D94006DE8; Mon, 15 Apr 2024 18:48:22 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Geert Uytterhoeven , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next RFC v3 2/7] net: ravb: Align poll function with NAPI docs Date: Mon, 15 Apr 2024 10:47:59 +0100 Message-Id: <20240415094804.8016-3-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240415094804.8016-1-paul.barker.ct@bp.renesas.com> References: <20240415094804.8016-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 Content-Transfer-Encoding: 8bit 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 33f8043143c1..1ac599a044b2 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1340,23 +1340,19 @@ static int ravb_poll(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; } -- 2.39.2