diff mbox series

[net-next,v4,2/7] net: ravb: Consider busypolling status when re-enabling interrupts

Message ID 20240528150339.6791-3-paul.barker.ct@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Improve GbEth performance on Renesas RZ/G2L and related SoCs | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 902 this patch: 902
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 906 this patch: 906
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 906 this patch: 906
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 34 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-29--21-00 (tests: 1041)

Commit Message

Paul Barker May 28, 2024, 3:03 p.m. UTC
Make use of the busypolling status returned from NAPI complete to decide
if interrupts shall be re-enabled or not. This is useful to reduce the
interrupt overhead.

While at it switch to using napi_complete_done() as it take into account
the work done when providing the busypolling status.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
---
Changes v3->v4:
  * Used Niklas' suggested commit message.

 drivers/net/ethernet/renesas/ravb_main.c | 26 ++++++++++--------------
 1 file changed, 11 insertions(+), 15 deletions(-)

Comments

Sergey Shtylyov May 28, 2024, 4:44 p.m. UTC | #1
On 5/28/24 6:03 PM, Paul Barker wrote:

> Make use of the busypolling status returned from NAPI complete to decide

   My spellchecker/translator trip over "busypolling" -- consider using
"busy-polling"?
   And did you actually mean napi_complete_done()?

> if interrupts shall be re-enabled or not. This is useful to reduce the
> interrupt overhead.
> 
> While at it switch to using napi_complete_done() as it take into account

   Takes.

> the work done when providing the busypolling status.

   Again, "busy-polling"?
 
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>

[...]

MBR, Sergey
Sergey Shtylyov May 28, 2024, 4:47 p.m. UTC | #2
On 5/28/24 7:44 PM, Sergey Shtylyov wrote:

>> Make use of the busypolling status returned from NAPI complete to decide
> 
>    My spellchecker/translator trip over "busypolling" -- consider using
> "busy-polling"?
>    And did you actually mean napi_complete_done()?

   Ah, napi_complete() also returns a result... maybe this should be reworded
as "NAPI completion"?

>> if interrupts shall be re-enabled or not. This is useful to reduce the
>> interrupt overhead.
>>
>> While at it switch to using napi_complete_done() as it take into account
> 
>    Takes.
> 
>> the work done when providing the busypolling status.
> 
>    Again, "busy-polling"?
>  
>> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>

[...]

MBR, Sergey
Paul Barker May 29, 2024, 7:09 p.m. UTC | #3
On 28/05/2024 17:47, Sergey Shtylyov wrote:
> On 5/28/24 7:44 PM, Sergey Shtylyov wrote:
> 
>>> Make use of the busypolling status returned from NAPI complete to decide
>>
>>    My spellchecker/translator trip over "busypolling" -- consider using
>> "busy-polling"?
>>    And did you actually mean napi_complete_done()?
> 
>    Ah, napi_complete() also returns a result... maybe this should be reworded
> as "NAPI completion"?
> 
>>> if interrupts shall be re-enabled or not. This is useful to reduce the
>>> interrupt overhead.
>>>
>>> While at it switch to using napi_complete_done() as it take into account
>>
>>    Takes.
>>
>>> the work done when providing the busypolling status.
>>
>>    Again, "busy-polling"?

Ack to all of the above.

I used the commit message suggested by Niklas here. I'll revise it a
little for v5...

Thanks,
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 193ad05383a8..472aa80002be 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1341,23 +1341,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;
 }