Skip to content

Commit cf488e1

Browse files
Ivan Vecerakuba-moo
authored andcommitted
i40e: Add other helpers to check version of running firmware and AQ API
Add another helper functions that will be used by subsequent patch to refactor existing open-coded checks whether the version of running firmware and AdminQ API is recent enough to provide certain capabilities. Signed-off-by: Ivan Vecera <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 28c1726 commit cf488e1

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

drivers/net/ethernet/intel/i40e/i40e_type.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,60 @@ static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
608608
(hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min));
609609
}
610610

611+
/**
612+
* i40e_is_aq_api_ver_lt
613+
* @hw: pointer to i40e_hw structure
614+
* @maj: API major value to compare
615+
* @min: API minor value to compare
616+
*
617+
* Assert whether current HW API version is less than provided.
618+
**/
619+
static inline bool i40e_is_aq_api_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
620+
{
621+
return !i40e_is_aq_api_ver_ge(hw, maj, min);
622+
}
623+
624+
/**
625+
* i40e_is_fw_ver_ge
626+
* @hw: pointer to i40e_hw structure
627+
* @maj: API major value to compare
628+
* @min: API minor value to compare
629+
*
630+
* Assert whether current firmware version is greater/equal than provided.
631+
**/
632+
static inline bool i40e_is_fw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
633+
{
634+
return (hw->aq.fw_maj_ver > maj ||
635+
(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver >= min));
636+
}
637+
638+
/**
639+
* i40e_is_fw_ver_lt
640+
* @hw: pointer to i40e_hw structure
641+
* @maj: API major value to compare
642+
* @min: API minor value to compare
643+
*
644+
* Assert whether current firmware version is less than provided.
645+
**/
646+
static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
647+
{
648+
return !i40e_is_fw_ver_ge(hw, maj, min);
649+
}
650+
651+
/**
652+
* i40e_is_fw_ver_eq
653+
* @hw: pointer to i40e_hw structure
654+
* @maj: API major value to compare
655+
* @min: API minor value to compare
656+
*
657+
* Assert whether current firmware version is equal to provided.
658+
**/
659+
static inline bool i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min)
660+
{
661+
return (hw->aq.fw_maj_ver > maj ||
662+
(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min));
663+
}
664+
611665
struct i40e_driver_version {
612666
u8 major_version;
613667
u8 minor_version;

0 commit comments

Comments
 (0)