* [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path
@ 2024-02-14 15:12 Paul Barker
2024-02-14 16:44 ` Sergey Shtylyov
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Paul Barker @ 2024-02-14 15:12 UTC (permalink / raw)
To: Sergey Shtylyov, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Paul Barker, Yoshihiro Shimoda, Wolfram Sang, Nikita Yushchenko,
Uwe Kleine-König, Claudiu Beznea, Lad Prabhakar, Biju Das,
netdev, linux-renesas-soc, linux-kernel
The units of "work done" in the RX path should be packets instead of
descriptors, as large packets can be spread over multiple descriptors.
Fixes: 1c59eb678cbd ("ravb: Fillup ravb_rx_gbeth() stub")
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
---
This patch has been broken out from my previous series "Improve GbEth
performance on Renesas RZ/G2L and related SoCs" and submitted as a
bugfix as requested by Sergey. I've labeled it as 'v3' so the ordering
is clear. Remaining patches from the series will follow once we've done
gPTP testing.
drivers/net/ethernet/renesas/ravb_main.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 0e3731f50fc2..f7566cfa45ca 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -772,29 +772,25 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
struct ravb_rx_desc *desc;
struct sk_buff *skb;
dma_addr_t dma_addr;
+ int rx_packets = 0;
u8 desc_status;
- int boguscnt;
u16 pkt_len;
u8 die_dt;
int entry;
int limit;
+ int i;
entry = priv->cur_rx[q] % priv->num_rx_ring[q];
- boguscnt = priv->dirty_rx[q] + priv->num_rx_ring[q] - priv->cur_rx[q];
+ limit = priv->dirty_rx[q] + priv->num_rx_ring[q] - priv->cur_rx[q];
stats = &priv->stats[q];
- boguscnt = min(boguscnt, *quota);
- limit = boguscnt;
desc = &priv->gbeth_rx_ring[entry];
- while (desc->die_dt != DT_FEMPTY) {
+ for (i = 0; i < limit && rx_packets < *quota && desc->die_dt != DT_FEMPTY; i++) {
/* Descriptor type must be checked before all other reads */
dma_rmb();
desc_status = desc->msc;
pkt_len = le16_to_cpu(desc->ds_cc) & RX_DS;
- if (--boguscnt < 0)
- break;
-
/* We use 0-byte descriptors to mark the DMA mapping errors */
if (!pkt_len)
continue;
@@ -820,7 +816,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, ndev);
napi_gro_receive(&priv->napi[q], skb);
- stats->rx_packets++;
+ rx_packets++;
stats->rx_bytes += pkt_len;
break;
case DT_FSTART:
@@ -848,7 +844,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
eth_type_trans(priv->rx_1st_skb, ndev);
napi_gro_receive(&priv->napi[q],
priv->rx_1st_skb);
- stats->rx_packets++;
+ rx_packets++;
stats->rx_bytes += pkt_len;
break;
}
@@ -887,9 +883,9 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)
desc->die_dt = DT_FEMPTY;
}
- *quota -= limit - (++boguscnt);
-
- return boguscnt <= 0;
+ stats->rx_packets += rx_packets;
+ *quota -= rx_packets;
+ return *quota == 0;
}
/* Packet receive function for Ethernet AVB */
--
2.43.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path
2024-02-14 15:12 [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path Paul Barker
@ 2024-02-14 16:44 ` Sergey Shtylyov
2024-02-15 16:03 ` Jakub Kicinski
2024-02-15 16:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2024-02-14 16:44 UTC (permalink / raw)
To: Paul Barker, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Yoshihiro Shimoda, Wolfram Sang, Nikita Yushchenko,
Uwe Kleine-König, Claudiu Beznea, Lad Prabhakar, Biju Das,
netdev, linux-renesas-soc, linux-kernel
On 2/14/24 6:12 PM, Paul Barker wrote:
> The units of "work done" in the RX path should be packets instead of
> descriptors, as large packets can be spread over multiple descriptors.
>
> Fixes: 1c59eb678cbd ("ravb: Fillup ravb_rx_gbeth() stub")
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path
2024-02-14 15:12 [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path Paul Barker
2024-02-14 16:44 ` Sergey Shtylyov
@ 2024-02-15 16:03 ` Jakub Kicinski
2024-02-15 16:10 ` Paul Barker
2024-02-15 16:10 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2024-02-15 16:03 UTC (permalink / raw)
To: Paul Barker
Cc: Sergey Shtylyov, David S . Miller, Eric Dumazet, Paolo Abeni,
Yoshihiro Shimoda, Wolfram Sang, Nikita Yushchenko,
Uwe Kleine-König, Claudiu Beznea, Lad Prabhakar, Biju Das,
netdev, linux-renesas-soc, linux-kernel
On Wed, 14 Feb 2024 15:12:04 +0000 Paul Barker wrote:
> The units of "work done" in the RX path should be packets instead of
> descriptors, as large packets can be spread over multiple descriptors.
FWIW one of y'all may also want to look into processing Tx completions
before Rx. Tx completions can free memory which Rx can then consume.
More efficient. Not to mention netconsole being able to reap Tx with
budget of 0.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path
2024-02-15 16:03 ` Jakub Kicinski
@ 2024-02-15 16:10 ` Paul Barker
0 siblings, 0 replies; 5+ messages in thread
From: Paul Barker @ 2024-02-15 16:10 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Sergey Shtylyov, David S . Miller, Eric Dumazet, Paolo Abeni,
Yoshihiro Shimoda, Wolfram Sang, Nikita Yushchenko,
Uwe Kleine-König, Claudiu Beznea, Lad Prabhakar, Biju Das,
netdev, linux-renesas-soc, linux-kernel
[-- Attachment #1.1.1: Type: text/plain, Size: 786 bytes --]
On 15/02/2024 16:03, Jakub Kicinski wrote:
> On Wed, 14 Feb 2024 15:12:04 +0000 Paul Barker wrote:
>> The units of "work done" in the RX path should be packets instead of
>> descriptors, as large packets can be spread over multiple descriptors.
>
> FWIW one of y'all may also want to look into processing Tx completions
> before Rx. Tx completions can free memory which Rx can then consume.
> More efficient. Not to mention netconsole being able to reap Tx with
> budget of 0.
Thanks for the recommendation - I'll make this change as part of v3 of
the series "Improve GbEth performance on Renesas RZ/G2L and related
SoCs" [1] once we've completed gPTP testing.
[1]: https://lore.kernel.org/netdev/20240206091909.3191-1-paul.barker.ct@bp.renesas.com/
--
Paul Barker
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3577 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path
2024-02-14 15:12 [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path Paul Barker
2024-02-14 16:44 ` Sergey Shtylyov
2024-02-15 16:03 ` Jakub Kicinski
@ 2024-02-15 16:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-15 16:10 UTC (permalink / raw)
To: Paul Barker
Cc: s.shtylyov, davem, edumazet, kuba, pabeni, yoshihiro.shimoda.uh,
wsa+renesas, nikita.yoush, u.kleine-koenig, claudiu.beznea.uj,
prabhakar.mahadev-lad.rj, biju.das.jz, netdev, linux-renesas-soc,
linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 14 Feb 2024 15:12:04 +0000 you wrote:
> The units of "work done" in the RX path should be packets instead of
> descriptors, as large packets can be spread over multiple descriptors.
>
> Fixes: 1c59eb678cbd ("ravb: Fillup ravb_rx_gbeth() stub")
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
> ---
> This patch has been broken out from my previous series "Improve GbEth
> performance on Renesas RZ/G2L and related SoCs" and submitted as a
> bugfix as requested by Sergey. I've labeled it as 'v3' so the ordering
> is clear. Remaining patches from the series will follow once we've done
> gPTP testing.
>
> [...]
Here is the summary with links:
- [net,v3] net: ravb: Count packets instead of descriptors in GbEth RX path
https://git.kernel.org/netdev/net/c/ed4adc07207d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-02-15 16:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-14 15:12 [PATCH net v3] net: ravb: Count packets instead of descriptors in GbEth RX path Paul Barker
2024-02-14 16:44 ` Sergey Shtylyov
2024-02-15 16:03 ` Jakub Kicinski
2024-02-15 16:10 ` Paul Barker
2024-02-15 16:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).