From patchwork Tue Feb 6 09:19:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 13546917 X-Patchwork-Delegate: kuba@kernel.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3230512EBDD; Tue, 6 Feb 2024 09:19:39 +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=1707211182; cv=none; b=SvfVQc/resLy15z19jnw4nu9eULsiFC630c1vHwdUSGjUcUjOnmmC5Ha+XJ+P+nasgoJrC4zHICHQ2oSVJdRM/Wdz4hGYHHRNhMkvkvaCCh/TTBc8vH5J52pn6de1k4/lNHZjSAA/YwMDF77WOlHHbrG0mob4CfxfJz12ZqysKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707211182; c=relaxed/simple; bh=87blQj+GxmDYGplMV4xdgn6LYv3+QSfpU7NtXCzDNME=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UqL+34O8ClfAV16DhDFAt+Y31bNLdPIrX8Nz56QXvkTruZn1LX95lVTjW/JB/Q3yX3gnwcKg+YgvcLY0YR9ovWg+t8Deb/vTo2N0KUO7JSTGaxqtBlSToXUsMDuPSSK8Rg6LSKoWk0mEQBLCpX/NlyOOcazhYUWD9q4IZPF5Ax4= 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,246,1701097200"; d="scan'208";a="196934650" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 06 Feb 2024 18:19:39 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.93.63]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 834D941B86C7; Tue, 6 Feb 2024 18:19:35 +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: [RFC PATCH net-next v2 5/7] net: ravb: Align poll function with NAPI docs Date: Tue, 6 Feb 2024 09:19:07 +0000 Message-Id: <20240206091909.3191-6-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240206091909.3191-1-paul.barker.ct@bp.renesas.com> References: <20240206091909.3191-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Call napi_complete_done() in accordance with the documentation in `Documentation/networking/napi.rst`. Signed-off-by: Paul Barker Reviewed-by: Sergey Shtylyov --- 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 2136600d60dd..661fd86899ac 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1367,23 +1367,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; }