Skip to contentSkip to conversation

ice: fix setting RSS VSI hash for E830

PATCH In review Marcin Szycik 2 participants 5 messages Jan 9 – Jan 29

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: fix setting RSS VSI hash for E830

ice_set_rss_hfunc() performs a VSI update, in which it sets hashing function, leaving other VSI options unchanged. However, ::q_opt_flags is mistakenly set to the value of another field, instead of its original value, probably due to a typo. What happens next is hardware-dependent:

On E810, only the first bit is meaningful (see ICE_AQ_VSI_Q_OPT_PE_FLTR_EN) and can potentially end up in a different state than before VSI update.

On E830, some of the remaining bits are not reserved. Setting them to some unrelated values can cause the firmware to reject the update because of invalid settings, or worse - succeed.

Reproducer:
sudo ethtool -X $PF1 equal 8

Output in dmesg:
Failed to configure RSS hash for VSI 6, error -5

Fixes 352e9bf23813 ("ice: enable symmetric-xor RSS for Toeplitz hash function")
---
 drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
index cf8ba5a85384..08268f1a03da 100644
@@ -8038,7 +8038,7 @@ int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc)
 	ctx->info.q_opt_rss |=
 		FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hfunc);
 	ctx->info.q_opt_tc = vsi->info.q_opt_tc;
-	ctx->info.q_opt_flags = vsi->info.q_opt_rss;
+	ctx->info.q_opt_flags = vsi->info.q_opt_flags;
 
 	err = ice_update_vsi(hw, vsi->idx, ctx, NULL);
 	if (err) {
Signature · 1 line
2.49.0
#1 lore raw
Quoted 32 lines · Marcin Szycik

ice_set_rss_hfunc() performs a VSI update, in which it sets hashing function, leaving other VSI options unchanged. However, ::q_opt_flags is mistakenly set to the value of another field, instead of its original value, probably due to a typo. What happens next is hardware-dependent:

On E810, only the first bit is meaningful (see ICE_AQ_VSI_Q_OPT_PE_FLTR_EN) and can potentially end up in a different state than before VSI update.

On E830, some of the remaining bits are not reserved. Setting them to some unrelated values can cause the firmware to reject the update because of invalid settings, or worse - succeed.

Reproducer:
sudo ethtool -X $PF1 equal 8

Output in dmesg:
Failed to configure RSS hash for VSI 6, error -5

Fixes 352e9bf23813 ("ice: enable symmetric-xor RSS for Toeplitz hash function")
---
  drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +0 -0
index cf8ba5a85384..08268f1a03da 100644

drivers/net/ethernet/intel/ice/ice_main.c int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc) · line 8041

Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
@@ -8038,7 +8038,7 @@ int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc)
  	ctx->info.q_opt_rss |=
  		FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hfunc);
  	ctx->info.q_opt_tc = vsi->info.q_opt_tc;
-	ctx->info.q_opt_flags = vsi->info.q_opt_rss;
+	ctx->info.q_opt_flags = vsi->info.q_opt_flags;

The very same typo pattern is in ice_vc_handle_rss_cfg() in ice/virt/rss.c

I believe both places have to be fixed.

Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_main.c +0 -0
  	err = ice_update_vsi(hw, vsi->idx, ctx, NULL);
  	if (err) {
#2 lore raw
Quoted 42 lines · Vadim Fedorenko
Quoted 32 lines · Marcin Szycik

ice_set_rss_hfunc() performs a VSI update, in which it sets hashing function, leaving other VSI options unchanged. However, ::q_opt_flags is mistakenly set to the value of another field, instead of its original value, probably due to a typo. What happens next is hardware-dependent:

On E810, only the first bit is meaningful (see ICE_AQ_VSI_Q_OPT_PE_FLTR_EN) and can potentially end up in a different state than before VSI update.

On E830, some of the remaining bits are not reserved. Setting them to some unrelated values can cause the firmware to reject the update because of invalid settings, or worse - succeed.

Reproducer:
   sudo ethtool -X $PF1 equal 8

Output in dmesg:
   Failed to configure RSS hash for VSI 6, error -5

Fixes 352e9bf23813 ("ice: enable symmetric-xor RSS for Toeplitz hash function")

---
  drivers/net/ethernet/intel/ice/ice_main.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +0 -0
index cf8ba5a85384..08268f1a03da 100644
@@ -8038,7 +8038,7 @@ int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc)
Quoted 5 lines

      ctx->info.q_opt_rss |= FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hfunc); ctx->info.q_opt_tc = vsi->info.q_opt_tc;
-    ctx->info.q_opt_flags = vsi->info.q_opt_rss; +    ctx->info.q_opt_flags = vsi->info.q_opt_flags;

The very same typo pattern is in ice_vc_handle_rss_cfg() in ice/virt/rss.c

Quoted 1 line

I believe both places have to be fixed.

Hmm... where exactly? ice_vc_rss_hash_update() (called from ice_vc_handle_rss_cfg()) looks correct.

Thanks for reviewing,
Marcin

Quoted 4 lines
Quoted 3 lines

        err = ice_update_vsi(hw, vsi->idx, ctx, NULL); if (err) {

#3 lore raw
Quoted 45 lines · Marcin Szycik
Quoted 42 lines · Vadim Fedorenko
Quoted 32 lines · Marcin Szycik

ice_set_rss_hfunc() performs a VSI update, in which it sets hashing function, leaving other VSI options unchanged. However, ::q_opt_flags is mistakenly set to the value of another field, instead of its original value, probably due to a typo. What happens next is hardware-dependent:

On E810, only the first bit is meaningful (see ICE_AQ_VSI_Q_OPT_PE_FLTR_EN) and can potentially end up in a different state than before VSI update.

On E830, some of the remaining bits are not reserved. Setting them to some unrelated values can cause the firmware to reject the update because of invalid settings, or worse - succeed.

Reproducer:
   sudo ethtool -X $PF1 equal 8

Output in dmesg:
   Failed to configure RSS hash for VSI 6, error -5

Fixes 352e9bf23813 ("ice: enable symmetric-xor RSS for Toeplitz hash function")
---
   drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +0 -0
index cf8ba5a85384..08268f1a03da 100644

drivers/net/ethernet/intel/ice/ice_main.c int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc) · line 8041

Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
@@ -8038,7 +8038,7 @@ int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc)
       ctx->info.q_opt_rss |=
           FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hfunc);
       ctx->info.q_opt_tc = vsi->info.q_opt_tc;
-    ctx->info.q_opt_flags = vsi->info.q_opt_rss;
+    ctx->info.q_opt_flags = vsi->info.q_opt_flags;

The very same typo pattern is in ice_vc_handle_rss_cfg() in ice/virt/rss.c

Quoted 3 lines
Quoted 1 line

I believe both places have to be fixed.

Hmm... where exactly? ice_vc_rss_hash_update() (called from ice_vc_handle_rss_cfg()) looks correct.

Sorry, it was fixed in 3a6d87e2eaac ("ice: implement GTP RSS context tracking and configuration") when the logic was moved to ice_vc_rss_hash_update(), but this code was never backported, the problem exists in 6.18...

Quoted 9 lines

Thanks for reviewing,
Marcin

Quoted 4 lines
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_main.c +0 -0
         err = ice_update_vsi(hw, vsi->idx, ctx, NULL);
       if (err) {
#4 lore raw
Quoted 46 lines · Vadim Fedorenko
Quoted 45 lines · Marcin Szycik
Quoted 42 lines · Vadim Fedorenko
Quoted 32 lines · Marcin Szycik

ice_set_rss_hfunc() performs a VSI update, in which it sets hashing function, leaving other VSI options unchanged. However, ::q_opt_flags is mistakenly set to the value of another field, instead of its original value, probably due to a typo. What happens next is hardware-dependent:

On E810, only the first bit is meaningful (see ICE_AQ_VSI_Q_OPT_PE_FLTR_EN) and can potentially end up in a different state than before VSI update.

On E830, some of the remaining bits are not reserved. Setting them to some unrelated values can cause the firmware to reject the update because of invalid settings, or worse - succeed.

Reproducer:
    sudo ethtool -X $PF1 equal 8

Output in dmesg:
    Failed to configure RSS hash for VSI 6, error -5

Fixes 352e9bf23813 ("ice: enable symmetric-xor RSS for Toeplitz hash function")

---
   drivers/net/ethernet/intel/ice/ice_main.c | 2 +-

   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +0 -0
index cf8ba5a85384..08268f1a03da 100644
@@ -8038,7 +8038,7 @@ int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc)
Quoted 5 lines

       ctx->info.q_opt_rss |= FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hfunc); ctx->info.q_opt_tc = vsi->info.q_opt_tc;
-    ctx->info.q_opt_flags = vsi->info.q_opt_rss; +    ctx->info.q_opt_flags = vsi->info.q_opt_flags;

The very same typo pattern is in ice_vc_handle_rss_cfg() in ice/virt/rss.c

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I believe both places have to be fixed.

Hmm... where exactly? ice_vc_rss_hash_update() (called from ice_vc_handle_rss_cfg()) looks correct.

Sorry, it was fixed in 3a6d87e2eaac ("ice: implement GTP RSS context tracking and configuration") when the logic was moved to ice_vc_rss_hash_update(), but this code was never backported, the problem exists in 6.18...

Sorry for late reply, I don't know why, but I assumed the patch you mention would be independently picked up to stable. Now that I've looked into it, I see it's a feature implementation that accidentally (?) also fixed that one line in ice_vc_handle_rss_cfg(), so it won't be backported.

Do we know if the mistake in ice_vc_handle_rss_cfg() is an actual issue? So far I wasn't even able to enter that branch (rss_cfg->rss_algorithm is never VIRTCHNL_RSS_ALG_R_ASYMMETRIC, in fact this is the only usage of VIRTCHNL_RSS_ALG_R_ASYMMETRIC - dead code?). If I understand correctly, "theoretical" fixes are not welcome in stable.

Thanks,
Marcin

Quoted 11 lines
Quoted 10 lines

Thanks for reviewing,
Marcin

Quoted 4 lines
Quoted 3 lines

         err = ice_update_vsi(hw, vsi->idx, ctx, NULL); if (err) {