Skip to contentSkip to conversation

i40e: Fix firmware version comparison function

PATCH In review Ivan Vecera 3 participants 3 messages Feb 28, 2024 – Mar 6, 2024

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

PATCH 1/1 i40e: Fix firmware version comparison function

Helper i40e_is_fw_ver_eq() compares incorrectly given firmware version as it returns true when the major version of running firmware is greater than the given major version that is wrong and results in failure during getting of DCB configuration where this helper is used. Fix the check and return true only if the running FW version is exactly equals to the given version.

Reproducer:
1. Load i40e driver
2. Check dmesg output

[root@host ~]# modprobe i40e
[root@host ~]# dmesg | grep 'i40e.*DCB'

[   74.750642] i40e 0000:02:00.0: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL
[   74.759770] i40e 0000:02:00.0: DCB init failed -5, disabled
[   74.966550] i40e 0000:02:00.1: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL
[   74.975683] i40e 0000:02:00.1: DCB init failed -5, disabled
Fixes cf488e13221f ("i40e: Add other helpers to check version of running firmware and AQ API")
---
 drivers/net/ethernet/intel/i40e/i40e_prototype.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_prototype.h +1 -2
index af4269330581..ce1f11b8ad65 100644
@@ -567,8 +567,7 @@ static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
  **/
 static inline bool i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min)
 {
-	return (hw->aq.fw_maj_ver > maj ||
-		(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min));
+	return (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min);
 }
 
 #endif /* _I40E_PROTOTYPE_H_ */
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

Dear Ivan,

Thank you for your patch.

Am 28.02.24 um 18:26 schrieb Ivan Vecera:

Quoted 3 lines

Helper i40e_is_fw_ver_eq() compares incorrectly given firmware version as it returns true when the major version of running firmware is greater than the given major version that is wrong and results in

… version. That …

Quoted 3 lines

failure during getting of DCB configuration where this helper is used. Fix the check and return true only if the running FW version is exactly equals to the given version.

is … equal

Quoted 22 lines

Reproducer:
1. Load i40e driver
2. Check dmesg output

[root@host ~]# modprobe i40e
[root@host ~]# dmesg | grep 'i40e.*DCB'

[   74.750642] i40e 0000:02:00.0: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL
[   74.759770] i40e 0000:02:00.0: DCB init failed -5, disabled
[   74.966550] i40e 0000:02:00.1: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL
[   74.975683] i40e 0000:02:00.1: DCB init failed -5, disabled
Fixes cf488e13221f ("i40e: Add other helpers to check version of running firmware and AQ API")
---
  drivers/net/ethernet/intel/i40e/i40e_prototype.h | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_prototype.h +0 -0
index af4269330581..ce1f11b8ad65 100644

drivers/net/ethernet/intel/i40e/i40e_prototype.h static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) · line 573

Quoted 9 lines
drivers/net/ethernet/intel/i40e/i40e_prototype.h +1 -2
@@ -567,8 +567,7 @@ static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
   **/
  static inline bool i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min)
  {
-	return (hw->aq.fw_maj_ver > maj ||
-		(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min));
+	return (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min);
  }
 
  #endif /* _I40E_PROTOTYPE_H_ */

With the nits in the commit message addressed, this is

Kind regards,

Paul

Tested-by on v1 1/1
#2 lore raw
In reply to Ivan Vecera
Quoted 25 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Ivan Vecera
Sent: Wednesday, February 28, 2024 10:56 PM
To: [email protected]
Cc: moderated list:INTEL ETHERNET DRIVERS <[email protected]>; Brandeburg, Jesse <[email protected]>; open list <[email protected]>; Eric Dumazet <[email protected]>; Nguyen, Anthony L <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; David S. Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH net] i40e: Fix firmware version comparison function

Helper i40e_is_fw_ver_eq() compares incorrectly given firmware version as it returns true when the major version of running firmware is greater than the given major version that is wrong and results in failure during getting of DCB configuration where this helper is used. Fix the check and return true only if the running FW version is exactly equals to the given version.

Reproducer:
1. Load i40e driver
2. Check dmesg output

[root@host ~]# modprobe i40e
[root@host ~]# dmesg | grep 'i40e.*DCB'

[   74.750642] i40e 0000:02:00.0: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL
[   74.759770] i40e 0000:02:00.0: DCB init failed -5, disabled
[   74.966550] i40e 0000:02:00.1: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL
[   74.975683] i40e 0000:02:00.1: DCB init failed -5, disabled
Quoted 6 lines
Fixes cf488e13221f ("i40e: Add other helpers to check version of running firmware and AQ API")
---
 drivers/net/ethernet/intel/i40e/i40e_prototype.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)