diff mbox series

[RFC,net-next,v2,6/7] net: ravb: Enable SW IRQ Coalescing for GbEth

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

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/apply fail Patch does not apply to net-next

Commit Message

Paul Barker Feb. 6, 2024, 9:19 a.m. UTC
Software IRQ Coalescing is required to improve network stack performance
in the RZ/G2L SoC family and the RZ/G3S SoC, i.e. the SoCs which use the
GbEth IP.

For the RZ/G2L, network throughput is comparable before and after this
change. CPU usage during TCP RX testing dropped by 6.5% and during UDP
RX testing dropped by 10%.

For the RZ/G2UL, network throughput is greatly increased by this change
(results obtained with iperf3):
  * TCP TX: 2.9% more throughput
  * TCP RX: 1.1% more throughput
  * UDP TX: similar throughput
  * UDP RX: 41500% more throughput

For the RZ/G3S we see improvements in network throughput similar to the
RZ/G2UL.

The improvement of UDP RX bandwidth for the single core SoCs (RZ/G2UL &
RZ/G3S) is particularly critical.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      | 1 +
 drivers/net/ethernet/renesas/ravb_main.c | 4 ++++
 2 files changed, 5 insertions(+)

Comments

Sergey Shtylyov Feb. 10, 2024, 6:42 p.m. UTC | #1
On 2/6/24 12:19 PM, Paul Barker wrote:

> Software IRQ Coalescing is required to improve network stack performance
> in the RZ/G2L SoC family and the RZ/G3S SoC, i.e. the SoCs which use the
> GbEth IP.
> 
> For the RZ/G2L, network throughput is comparable before and after this
> change. CPU usage during TCP RX testing dropped by 6.5% and during UDP
> RX testing dropped by 10%.
> 
> For the RZ/G2UL, network throughput is greatly increased by this change
> (results obtained with iperf3):
>   * TCP TX: 2.9% more throughput
>   * TCP RX: 1.1% more throughput
>   * UDP TX: similar throughput
>   * UDP RX: 41500% more throughput

   Wow! 8-)

> For the RZ/G3S we see improvements in network throughput similar to the
> RZ/G2UL.
> 
> The improvement of UDP RX bandwidth for the single core SoCs (RZ/G2UL &
> RZ/G3S) is particularly critical.
> 
> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
[...]

> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
> index 55a7a08aabef..ca7a66759e35 100644
> --- a/drivers/net/ethernet/renesas/ravb.h
> +++ b/drivers/net/ethernet/renesas/ravb.h
> @@ -1078,6 +1078,7 @@ struct ravb_hw_info {
>  	unsigned nc_queues:1;		/* AVB-DMAC has RX and TX NC queues */
>  	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
>  	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
> +	unsigned needs_irq_coalesce:1;	/* Requires SW IRQ Coalescing to achieve best performance */

   Is this really a hardware feature?
   Also, s/Requires SW/Needs software/ and s/to achieve best performance//,
please...

[...]

MBR, Sergey
Paul Barker Feb. 12, 2024, 11:45 a.m. UTC | #2
On 10/02/2024 18:42, Sergey Shtylyov wrote:
> On 2/6/24 12:19 PM, Paul Barker wrote:
>> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
>> index 55a7a08aabef..ca7a66759e35 100644
>> --- a/drivers/net/ethernet/renesas/ravb.h
>> +++ b/drivers/net/ethernet/renesas/ravb.h
>> @@ -1078,6 +1078,7 @@ struct ravb_hw_info {
>>  	unsigned nc_queues:1;		/* AVB-DMAC has RX and TX NC queues */
>>  	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
>>  	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
>> +	unsigned needs_irq_coalesce:1;	/* Requires SW IRQ Coalescing to achieve best performance */
> 
>    Is this really a hardware feature?

It's more like a requirement to get the best out of this hardware and the Linux networking stack.

I considered checking the compatible string in the probe function but I decided that storing a configuration bit in the HW info struct was cleaner.

>    Also, s/Requires SW/Needs software/ and s/to achieve best performance//,
> please...

Will do.

> 
> [...]
> 
> MBR, Sergey

Thanks for the review,
Paul
Sergey Shtylyov Feb. 12, 2024, 8:40 p.m. UTC | #3
On 2/12/24 2:45 PM, Paul Barker wrote:
[...]
>>> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
>>> index 55a7a08aabef..ca7a66759e35 100644
>>> --- a/drivers/net/ethernet/renesas/ravb.h
>>> +++ b/drivers/net/ethernet/renesas/ravb.h
>>> @@ -1078,6 +1078,7 @@ struct ravb_hw_info {
>>>  	unsigned nc_queues:1;		/* AVB-DMAC has RX and TX NC queues */
>>>  	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
>>>  	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
>>> +	unsigned needs_irq_coalesce:1;	/* Requires SW IRQ Coalescing to achieve best performance */
>>
>>    Is this really a hardware feature?
> 
> It's more like a requirement to get the best out of this hardware and the Linux networking stack.
> 
> I considered checking the compatible string in the probe function but I decided that storing a configuration bit in the HW info struct was cleaner.

   Yes, but you added the new bit under the "hardware features" commet. :-)

>>    Also, s/Requires SW/Needs software/ and s/to achieve best performance//,
>> please...
> 
> Will do.

   The comment is too long, I think. :-)

[...]

> Thanks for the review,
> Paul

MBR, Sergey
Paul Barker Feb. 14, 2024, 9:29 a.m. UTC | #4
On 12/02/2024 20:40, Sergey Shtylyov wrote:
> On 2/12/24 2:45 PM, Paul Barker wrote:
> [...]
>>>> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
>>>> index 55a7a08aabef..ca7a66759e35 100644
>>>> --- a/drivers/net/ethernet/renesas/ravb.h
>>>> +++ b/drivers/net/ethernet/renesas/ravb.h
>>>> @@ -1078,6 +1078,7 @@ struct ravb_hw_info {
>>>>  	unsigned nc_queues:1;		/* AVB-DMAC has RX and TX NC queues */
>>>>  	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
>>>>  	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
>>>> +	unsigned needs_irq_coalesce:1;	/* Requires SW IRQ Coalescing to achieve best performance */
>>>
>>>    Is this really a hardware feature?
>>
>> It's more like a requirement to get the best out of this hardware and the Linux networking stack.
>>
>> I considered checking the compatible string in the probe function but I decided that storing a configuration bit in the HW info struct was cleaner.
> 
>    Yes, but you added the new bit under the "hardware features" commet. :-)
> 
>>>    Also, s/Requires SW/Needs software/ and s/to achieve best performance//,
>>> please...
>>
>> Will do.
> 
>    The comment is too long, I think. :-)

I'll fix both in the next revision.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 55a7a08aabef..ca7a66759e35 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1078,6 +1078,7 @@  struct ravb_hw_info {
 	unsigned nc_queues:1;		/* AVB-DMAC has RX and TX NC queues */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
 	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
+	unsigned needs_irq_coalesce:1;	/* Requires SW IRQ Coalescing to achieve best performance */
 };
 
 struct ravb_private {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 661fd86899ac..7bb80608f260 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2639,6 +2639,7 @@  static const struct ravb_hw_info gbeth_hw_info = {
 	.tx_counters = 1,
 	.carrier_counters = 1,
 	.half_duplex = 1,
+	.needs_irq_coalesce = 1,
 };
 
 static const struct of_device_id ravb_match_table[] = {
@@ -2983,6 +2984,9 @@  static int ravb_probe(struct platform_device *pdev)
 	if (info->nc_queues)
 		netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll);
 
+	if (info->needs_irq_coalesce)
+		netdev_sw_irq_coalesce_default_on(ndev);
+
 	/* Network device register */
 	error = register_netdev(ndev);
 	if (error)