Subject: [PATCH iwl-net] igc: Fix hicredit calculation

From: Rodrigo Cataldo <[email protected]>

According to the Intel Software Manual for I225, Section 7.5.2.7,
hicredit should be multiplied by the constant link-rate value, 0x7736.

Currently, the old constant link-rate value, 0x7735, from the boards
supported on igb are being used, most likely due to a copy'n'paste, as
the rest of the logic is the same for both drivers.

Update hicredit accordingly.

Fixes: 1ab011b0bf07 ("igc: Add support for CBS offloading")
Reviewed-by: Kurt Kanzenbach <[email protected]>
Signed-off-by: Rodrigo Cataldo <[email protected]>
---
This is a simple fix for the credit calculation on igc devices
(i225/i226) to match the Intel software manual.

This is my first contribution to the Linux Kernel. Apologies for any
mistakes and let me know if I improve anything.
---
drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
index a9c08321aca9..22cefb1eeedf 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -227,7 +227,7 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
wr32(IGC_TQAVCC(i), tqavcc);

wr32(IGC_TQAVHC(i),
- 0x80000000 + ring->hicredit * 0x7735);
+ 0x80000000 + ring->hicredit * 0x7736);
} else {
/* Disable any CBS for the queue */
txqctl &= ~(IGC_TXQCTL_QAV_SEL_MASK);

---
base-commit: 2078a341f5f609d55667c2dc6337f90d8f322b8f
change-id: 20231206-igc-fix-hicredit-calc-028bf73c50a8

Best regards,
--
Rodrigo Cataldo <[email protected]>


2023-12-09 00:54:39

by Vinicius Costa Gomes

[permalink] [raw]
Subject: Re: [PATCH iwl-net] igc: Fix hicredit calculation

Rodrigo Cataldo via B4 Relay
<[email protected]> writes:

> From: Rodrigo Cataldo <[email protected]>
>
> According to the Intel Software Manual for I225, Section 7.5.2.7,
> hicredit should be multiplied by the constant link-rate value, 0x7736.
>
> Currently, the old constant link-rate value, 0x7735, from the boards
> supported on igb are being used, most likely due to a copy'n'paste, as
> the rest of the logic is the same for both drivers.
>
> Update hicredit accordingly.
>
> Fixes: 1ab011b0bf07 ("igc: Add support for CBS offloading")
> Reviewed-by: Kurt Kanzenbach <[email protected]>
> Signed-off-by: Rodrigo Cataldo <[email protected]>
> ---

Very good catch.

Acked-by: Vinicius Costa Gomes <[email protected]>

Just for curiosity, my test machines are busy right now, what kind of
difference are you seeing?

> This is a simple fix for the credit calculation on igc devices
> (i225/i226) to match the Intel software manual.
>
> This is my first contribution to the Linux Kernel. Apologies for any
> mistakes and let me know if I improve anything.
> ---
> drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
> index a9c08321aca9..22cefb1eeedf 100644
> --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
> +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
> @@ -227,7 +227,7 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
> wr32(IGC_TQAVCC(i), tqavcc);
>
> wr32(IGC_TQAVHC(i),
> - 0x80000000 + ring->hicredit * 0x7735);
> + 0x80000000 + ring->hicredit * 0x7736);
> } else {
> /* Disable any CBS for the queue */
> txqctl &= ~(IGC_TXQCTL_QAV_SEL_MASK);
>
> ---
> base-commit: 2078a341f5f609d55667c2dc6337f90d8f322b8f
> change-id: 20231206-igc-fix-hicredit-calc-028bf73c50a8
>
> Best regards,
> --
> Rodrigo Cataldo <[email protected]>
>

Cheers,
--
Vinicius

2023-12-09 17:22:33

by Chilakala, Mallikarjuna

[permalink] [raw]
Subject: RE: [PATCH iwl-net] igc: Fix hicredit calculation

Rodrigo Cataldo via B4 Relay
<[email protected]> writes:

> From: Rodrigo Cataldo <[email protected]>
>
> According to the Intel Software Manual for I225, Section 7.5.2.7,
> hicredit should be multiplied by the constant link-rate value, 0x7736.
>
> Currently, the old constant link-rate value, 0x7735, from the boards
> supported on igb are being used, most likely due to a copy'n'paste, as
> the rest of the logic is the same for both drivers.
>
> Update hicredit accordingly.
>
> Fixes: 1ab011b0bf07 ("igc: Add support for CBS offloading")
> Reviewed-by: Kurt Kanzenbach <[email protected]>
> Signed-off-by: Rodrigo Cataldo <[email protected]>
> ---

Looks good to me!
Acked-by: Malli Chilakala <[email protected]>

> This is a simple fix for the credit calculation on igc devices
> (i225/i226) to match the Intel software manual.
>
> This is my first contribution to the Linux Kernel. Apologies for any
> mistakes and let me know if I improve anything.
> ---
> drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c
> b/drivers/net/ethernet/intel/igc/igc_tsn.c
> index a9c08321aca9..22cefb1eeedf 100644
> --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
> +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
> @@ -227,7 +227,7 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
> wr32(IGC_TQAVCC(i), tqavcc);
>
> wr32(IGC_TQAVHC(i),
> - 0x80000000 + ring->hicredit * 0x7735);
> + 0x80000000 + ring->hicredit * 0x7736);
> } else {
> /* Disable any CBS for the queue */
> txqctl &= ~(IGC_TXQCTL_QAV_SEL_MASK);
>
> ---
> base-commit: 2078a341f5f609d55667c2dc6337f90d8f322b8f
> change-id: 20231206-igc-fix-hicredit-calc-028bf73c50a8
>
> Best regards,
> --
> Rodrigo Cataldo <[email protected]>
>

2023-12-11 09:21:25

by Rodrigo CADORE CATALDO

[permalink] [raw]
Subject: RE: [PATCH iwl-net] igc: Fix hicredit calculation

> -----Original Message-----
> From: Vinicius Costa Gomes <[email protected]>
>
> Rodrigo Cataldo via B4 Relay
> <[email protected]> writes:
>
> > From: Rodrigo Cataldo <[email protected]>
> >
> > According to the Intel Software Manual for I225, Section 7.5.2.7,
> > hicredit should be multiplied by the constant link-rate value, 0x7736.
> >
> > Currently, the old constant link-rate value, 0x7735, from the boards
> > supported on igb are being used, most likely due to a copy'n'paste, as
> > the rest of the logic is the same for both drivers.
> >
> > Update hicredit accordingly.
> >
> > Fixes: 1ab011b0bf07 ("igc: Add support for CBS offloading")
> > Reviewed-by: Kurt Kanzenbach <[email protected]>
> > Signed-off-by: Rodrigo Cataldo <[email protected]>
> > ---
>
> Very good catch.
>
> Acked-by: Vinicius Costa Gomes <[email protected]>
>
> Just for curiosity, my test machines are busy right now, what kind of
> difference are you seeing?
>

Hello Vinicius, thank you for the ACK.

For our internal setup, this does not make a difference. My understanding is
that hicredit is used for non-SR traffic mixed with SR traffic (i.e., hicredit is
directly related to the max non-SR frame size). But our setup does not mix
them (q0 is used only for milan audio/clock SR class A).

Let me know if you think we need a testcase for this.

> > This is a simple fix for the credit calculation on igc devices
> > (i225/i226) to match the Intel software manual.
> >
> > This is my first contribution to the Linux Kernel. Apologies for any
> > mistakes and let me know if I improve anything.
> > ---
> > drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c
> b/drivers/net/ethernet/intel/igc/igc_tsn.c
> > index a9c08321aca9..22cefb1eeedf 100644
> > --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
> > +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
> > @@ -227,7 +227,7 @@ static int igc_tsn_enable_offload(struct igc_adapter
> *adapter)
> > wr32(IGC_TQAVCC(i), tqavcc);
> >
> > wr32(IGC_TQAVHC(i),
> > - 0x80000000 + ring->hicredit * 0x7735);
> > + 0x80000000 + ring->hicredit * 0x7736);
> > } else {
> > /* Disable any CBS for the queue */
> > txqctl &= ~(IGC_TXQCTL_QAV_SEL_MASK);
> >
> > ---
> > base-commit: 2078a341f5f609d55667c2dc6337f90d8f322b8f
> > change-id: 20231206-igc-fix-hicredit-calc-028bf73c50a8
> >
> > Best regards,
> > --
> > Rodrigo Cataldo <[email protected]>
> >
>
> Cheers,
> --
> Vinicius

Best Regards,
Rodrigo Cataldo

2023-12-11 18:08:55

by Vinicius Costa Gomes

[permalink] [raw]
Subject: RE: [PATCH iwl-net] igc: Fix hicredit calculation

Rodrigo CADORE CATALDO <[email protected]> writes:

>> -----Original Message-----
>> From: Vinicius Costa Gomes <[email protected]>
>>
>> Rodrigo Cataldo via B4 Relay
>> <[email protected]> writes:
>>
>> > From: Rodrigo Cataldo <[email protected]>
>> >
>> > According to the Intel Software Manual for I225, Section 7.5.2.7,
>> > hicredit should be multiplied by the constant link-rate value, 0x7736.
>> >
>> > Currently, the old constant link-rate value, 0x7735, from the boards
>> > supported on igb are being used, most likely due to a copy'n'paste, as
>> > the rest of the logic is the same for both drivers.
>> >
>> > Update hicredit accordingly.
>> >
>> > Fixes: 1ab011b0bf07 ("igc: Add support for CBS offloading")
>> > Reviewed-by: Kurt Kanzenbach <[email protected]>
>> > Signed-off-by: Rodrigo Cataldo <[email protected]>
>> > ---
>>
>> Very good catch.
>>
>> Acked-by: Vinicius Costa Gomes <[email protected]>
>>
>> Just for curiosity, my test machines are busy right now, what kind of
>> difference are you seeing?
>>
>
> Hello Vinicius, thank you for the ACK.
>
> For our internal setup, this does not make a difference. My understanding is
> that hicredit is used for non-SR traffic mixed with SR traffic (i.e., hicredit is
> directly related to the max non-SR frame size). But our setup does not mix
> them (q0 is used only for milan audio/clock SR class A).

I see.

>
> Let me know if you think we need a testcase for this.
>

It was just curiority. No need. Thanks.

>> > This is a simple fix for the credit calculation on igc devices
>> > (i225/i226) to match the Intel software manual.
>> >
>> > This is my first contribution to the Linux Kernel. Apologies for any
>> > mistakes and let me know if I improve anything.
>> > ---
>> > drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c
>> b/drivers/net/ethernet/intel/igc/igc_tsn.c
>> > index a9c08321aca9..22cefb1eeedf 100644
>> > --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
>> > +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
>> > @@ -227,7 +227,7 @@ static int igc_tsn_enable_offload(struct igc_adapter
>> *adapter)
>> > wr32(IGC_TQAVCC(i), tqavcc);
>> >
>> > wr32(IGC_TQAVHC(i),
>> > - 0x80000000 + ring->hicredit * 0x7735);
>> > + 0x80000000 + ring->hicredit * 0x7736);
>> > } else {
>> > /* Disable any CBS for the queue */
>> > txqctl &= ~(IGC_TXQCTL_QAV_SEL_MASK);
>> >
>> > ---
>> > base-commit: 2078a341f5f609d55667c2dc6337f90d8f322b8f
>> > change-id: 20231206-igc-fix-hicredit-calc-028bf73c50a8
>> >
>> > Best regards,
>> > --
>> > Rodrigo Cataldo <[email protected]>
>> >
>>
>> Cheers,
>> --
>> Vinicius
>
> Best Regards,
> Rodrigo Cataldo


Cheers,
--
Vinicius

2023-12-28 09:24:41

by naamax.meir

[permalink] [raw]
Subject: Re: [Intel-wired-lan] [PATCH iwl-net] igc: Fix hicredit calculation

On 12/8/2023 16:58, Rodrigo Cataldo via B4 Relay wrote:
> From: Rodrigo Cataldo <[email protected]>
>
> According to the Intel Software Manual for I225, Section 7.5.2.7,
> hicredit should be multiplied by the constant link-rate value, 0x7736.
>
> Currently, the old constant link-rate value, 0x7735, from the boards
> supported on igb are being used, most likely due to a copy'n'paste, as
> the rest of the logic is the same for both drivers.
>
> Update hicredit accordingly.
>
> Fixes: 1ab011b0bf07 ("igc: Add support for CBS offloading")
> Reviewed-by: Kurt Kanzenbach <[email protected]>
> Signed-off-by: Rodrigo Cataldo <[email protected]>
> ---
> This is a simple fix for the credit calculation on igc devices
> (i225/i226) to match the Intel software manual.
>
> This is my first contribution to the Linux Kernel. Apologies for any
> mistakes and let me know if I improve anything.
> ---
> drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Tested-by: Naama Meir <[email protected]>