diff mbox series

[iwl-net,v2] i40e: Fix handling changed priv flags

Message ID 20241030172224.30548-1-pegro@friiks.de (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [iwl-net,v2] i40e: Fix handling changed priv flags | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5 this patch: 5
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 3 blamed authors not CCed: kuba@kernel.org ivecera@redhat.com jacob.e.keller@intel.com; 6 maintainers not CCed: andrew+netdev@lunn.ch pabeni@redhat.com kuba@kernel.org ivecera@redhat.com jacob.e.keller@intel.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 3 this patch: 3
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 Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 44 this patch: 44
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-31--09-00 (tests: 779)

Commit Message

Peter Große Oct. 30, 2024, 5:22 p.m. UTC
From: Peter Große <pegro@friiks.de>

After assembling the new private flags on a PF, the operation to determine
the changed flags uses the wrong bitmaps. Instead of xor-ing orig_flags
with new_flags, it uses the still unchanged pf->flags, thus changed_flags
is always 0.

Fix it by using the correct bitmaps.

The issue was discovered while debugging why disabling source pruning
stopped working with release 6.7. Although the new flags will be copied to
pf->flags later on in that function, disabling source pruning requires
a reset of the PF, which was skipped due to this bug.

Disabling source pruning:
$ sudo ethtool --set-priv-flags eno1 disable-source-pruning on
$ sudo ethtool --show-priv-flags eno1
Private flags for eno1:
MFP                   : off
total-port-shutdown   : off
LinkPolling           : off
flow-director-atr     : on
veb-stats             : off
hw-atr-eviction       : off
link-down-on-close    : off
legacy-rx             : off
disable-source-pruning: on
disable-fw-lldp       : off
rs-fec                : off
base-r-fec            : off
vf-vlan-pruning       : off

Regarding reproducing:

I observed the issue with a rather complicated lab setup, where
 * two VLAN interfaces are created on eno1
 * each with a different MAC address assigned
 * each moved into a separate namespace
 * both VLANs are bridged externally, so they form a single layer 2 network

The external bridge is done via a channel emulator adding packet loss and
delay and the application in the namespaces tries to send/receive traffic
and measure the performance. Sender and receiver are separated by
namespaces, yet the network card "sees its own traffic" send back to it.
To make that work, source pruning has to be disabled.

Fixes: 70756d0a4727 ("i40e: Use DECLARE_BITMAP for flags and hw_features fields in i40e_pf")
Signed-off-by: Peter Große <pegro@friiks.de>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul Menzel Oct. 30, 2024, 5:35 p.m. UTC | #1
Dear Peter,


Am 30.10.24 um 18:22 schrieb pegro@friiks.de:
> From: Peter Große <pegro@friiks.de>
> 
> After assembling the new private flags on a PF, the operation to determine
> the changed flags uses the wrong bitmaps. Instead of xor-ing orig_flags
> with new_flags, it uses the still unchanged pf->flags, thus changed_flags
> is always 0.
> 
> Fix it by using the correct bitmaps.
> 
> The issue was discovered while debugging why disabling source pruning
> stopped working with release 6.7. Although the new flags will be copied to
> pf->flags later on in that function, disabling source pruning requires
> a reset of the PF, which was skipped due to this bug.
> 
> Disabling source pruning:
> $ sudo ethtool --set-priv-flags eno1 disable-source-pruning on
> $ sudo ethtool --show-priv-flags eno1
> Private flags for eno1:
> MFP                   : off
> total-port-shutdown   : off
> LinkPolling           : off
> flow-director-atr     : on
> veb-stats             : off
> hw-atr-eviction       : off
> link-down-on-close    : off
> legacy-rx             : off
> disable-source-pruning: on
> disable-fw-lldp       : off
> rs-fec                : off
> base-r-fec            : off
> vf-vlan-pruning       : off
> 
> Regarding reproducing:
> 
> I observed the issue with a rather complicated lab setup, where
>   * two VLAN interfaces are created on eno1
>   * each with a different MAC address assigned
>   * each moved into a separate namespace
>   * both VLANs are bridged externally, so they form a single layer 2 network
> 
> The external bridge is done via a channel emulator adding packet loss and
> delay and the application in the namespaces tries to send/receive traffic
> and measure the performance. Sender and receiver are separated by
> namespaces, yet the network card "sees its own traffic" send back to it.
> To make that work, source pruning has to be disabled.

Thank you for taking the time to write this up.

> Fixes: 70756d0a4727 ("i40e: Use DECLARE_BITMAP for flags and hw_features fields in i40e_pf")
> Signed-off-by: Peter Große <pegro@friiks.de>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index c841779713f6..016c0ae6b36f 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -5306,7 +5306,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
>   	}
>   
>   flags_complete:
> -	bitmap_xor(changed_flags, pf->flags, orig_flags, I40E_PF_FLAGS_NBITS);
> +	bitmap_xor(changed_flags, new_flags, orig_flags, I40E_PF_FLAGS_NBITS);
>   
>   	if (test_bit(I40E_FLAG_FW_LLDP_DIS, changed_flags))
>   		reset_needed = I40E_PF_RESET_AND_REBUILD_FLAG;

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul
Przemek Kitszel Oct. 31, 2024, 7:34 a.m. UTC | #2
On 10/30/24 18:35, Paul Menzel wrote:
> Dear Peter,
> 
> 
> Am 30.10.24 um 18:22 schrieb pegro@friiks.de:
>> From: Peter Große <pegro@friiks.de>
>>
>> After assembling the new private flags on a PF, the operation to 
>> determine
>> the changed flags uses the wrong bitmaps. Instead of xor-ing orig_flags
>> with new_flags, it uses the still unchanged pf->flags, thus changed_flags
>> is always 0.
>>
>> Fix it by using the correct bitmaps.
>>
>> The issue was discovered while debugging why disabling source pruning
>> stopped working with release 6.7. Although the new flags will be 
>> copied to
>> pf->flags later on in that function, disabling source pruning requires
>> a reset of the PF, which was skipped due to this bug.
>>
>> Disabling source pruning:
>> $ sudo ethtool --set-priv-flags eno1 disable-source-pruning on
>> $ sudo ethtool --show-priv-flags eno1
>> Private flags for eno1:
>> MFP                   : off
>> total-port-shutdown   : off
>> LinkPolling           : off
>> flow-director-atr     : on
>> veb-stats             : off
>> hw-atr-eviction       : off
>> link-down-on-close    : off
>> legacy-rx             : off
>> disable-source-pruning: on
>> disable-fw-lldp       : off
>> rs-fec                : off
>> base-r-fec            : off
>> vf-vlan-pruning       : off
>>
>> Regarding reproducing:
>>
>> I observed the issue with a rather complicated lab setup, where
>>   * two VLAN interfaces are created on eno1
>>   * each with a different MAC address assigned
>>   * each moved into a separate namespace
>>   * both VLANs are bridged externally, so they form a single layer 2 
>> network
>>
>> The external bridge is done via a channel emulator adding packet loss and
>> delay and the application in the namespaces tries to send/receive traffic
>> and measure the performance. Sender and receiver are separated by
>> namespaces, yet the network card "sees its own traffic" send back to it.
>> To make that work, source pruning has to be disabled.
> 
> Thank you for taking the time to write this up.
> 
>> Fixes: 70756d0a4727 ("i40e: Use DECLARE_BITMAP for flags and 
>> hw_features fields in i40e_pf")
>> Signed-off-by: Peter Große <pegro@friiks.de>

Both the code change and the Fixes: tag are correct, thank you!
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

BTW, we obey netdev rules on IWL ML - next revision only after 24-48h
and send as standalone series (instead of In-reply-to) - no need to
repost this time of course

>> ---
>>   drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/ 
>> net/ethernet/intel/i40e/i40e_ethtool.c
>> index c841779713f6..016c0ae6b36f 100644
>> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
>> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
>> @@ -5306,7 +5306,7 @@ static int i40e_set_priv_flags(struct net_device 
>> *dev, u32 flags)
>>       }
>>   flags_complete:
>> -    bitmap_xor(changed_flags, pf->flags, orig_flags, 
>> I40E_PF_FLAGS_NBITS);
>> +    bitmap_xor(changed_flags, new_flags, orig_flags, 
>> I40E_PF_FLAGS_NBITS);
>>       if (test_bit(I40E_FLAG_FW_LLDP_DIS, changed_flags))
>>           reset_needed = I40E_PF_RESET_AND_REBUILD_FLAG;
> 
> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
> 
> 
> Kind regards,
> 
> Paul
Peter Große Oct. 31, 2024, 4:11 p.m. UTC | #3
Am Thu, 31 Oct 2024 08:34:36 +0100
schrieb Przemek Kitszel <przemyslaw.kitszel@intel.com>:

> >> Fixes: 70756d0a4727 ("i40e: Use DECLARE_BITMAP for flags and 
> >> hw_features fields in i40e_pf")
> >> Signed-off-by: Peter Große <pegro@friiks.de>  
> 
> Both the code change and the Fixes: tag are correct, thank you!
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

Great to hear :)

Would this be material for stable?

I hope to avoid building my own kernel and just use a hwe kernel of Ubuntu.


> BTW, we obey netdev rules on IWL ML - next revision only after 24-48h
> and send as standalone series (instead of In-reply-to) - no need to
> repost this time of course

Sorry, I'm new to submitting patches here.

Is there anything else I need to do?

Kind regards
Peter
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index c841779713f6..016c0ae6b36f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -5306,7 +5306,7 @@  static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 	}
 
 flags_complete:
-	bitmap_xor(changed_flags, pf->flags, orig_flags, I40E_PF_FLAGS_NBITS);
+	bitmap_xor(changed_flags, new_flags, orig_flags, I40E_PF_FLAGS_NBITS);
 
 	if (test_bit(I40E_FLAG_FW_LLDP_DIS, changed_flags))
 		reset_needed = I40E_PF_RESET_AND_REBUILD_FLAG;