Skip to content

Commit f699a4b

Browse files
Ivan Vecerakuba-moo
Ivan Vecera
authored andcommitted
i40e: Move inline helpers to i40e_prototype.h
Move version check helper functions from i40e_type.h to i40e_prototype.h as per discussion [1]. [1] https://lore.kernel.org/all/cdcd6b97-1138-4cd7-854f-b3faa1f475f8@intel.com/#t Cc: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Link: https://lore.kernel.org/r/20231113231047.548659-15-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent d8c6bee commit f699a4b

File tree

2 files changed

+70
-68
lines changed

2 files changed

+70
-68
lines changed

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

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,4 +501,74 @@ i40e_add_pinfo_to_list(struct i40e_hw *hw,
501501
/* i40e_ddp */
502502
int i40e_ddp_flash(struct net_device *netdev, struct ethtool_flash *flash);
503503

504+
/* Firmware and AdminQ version check helpers */
505+
506+
/**
507+
* i40e_is_aq_api_ver_ge
508+
* @hw: pointer to i40e_hw structure
509+
* @maj: API major value to compare
510+
* @min: API minor value to compare
511+
*
512+
* Assert whether current HW API version is greater/equal than provided.
513+
**/
514+
static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
515+
{
516+
return (hw->aq.api_maj_ver > maj ||
517+
(hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min));
518+
}
519+
520+
/**
521+
* i40e_is_aq_api_ver_lt
522+
* @hw: pointer to i40e_hw structure
523+
* @maj: API major value to compare
524+
* @min: API minor value to compare
525+
*
526+
* Assert whether current HW API version is less than provided.
527+
**/
528+
static inline bool i40e_is_aq_api_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
529+
{
530+
return !i40e_is_aq_api_ver_ge(hw, maj, min);
531+
}
532+
533+
/**
534+
* i40e_is_fw_ver_ge
535+
* @hw: pointer to i40e_hw structure
536+
* @maj: API major value to compare
537+
* @min: API minor value to compare
538+
*
539+
* Assert whether current firmware version is greater/equal than provided.
540+
**/
541+
static inline bool i40e_is_fw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
542+
{
543+
return (hw->aq.fw_maj_ver > maj ||
544+
(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver >= min));
545+
}
546+
547+
/**
548+
* i40e_is_fw_ver_lt
549+
* @hw: pointer to i40e_hw structure
550+
* @maj: API major value to compare
551+
* @min: API minor value to compare
552+
*
553+
* Assert whether current firmware version is less than provided.
554+
**/
555+
static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
556+
{
557+
return !i40e_is_fw_ver_ge(hw, maj, min);
558+
}
559+
560+
/**
561+
* i40e_is_fw_ver_eq
562+
* @hw: pointer to i40e_hw structure
563+
* @maj: API major value to compare
564+
* @min: API minor value to compare
565+
*
566+
* Assert whether current firmware version is equal to provided.
567+
**/
568+
static inline bool i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min)
569+
{
570+
return (hw->aq.fw_maj_ver > maj ||
571+
(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min));
572+
}
573+
504574
#endif /* _I40E_PROTOTYPE_H_ */

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

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -586,74 +586,6 @@ struct i40e_hw {
586586
char err_str[16];
587587
};
588588

589-
/**
590-
* i40e_is_aq_api_ver_ge
591-
* @hw: pointer to i40e_hw structure
592-
* @maj: API major value to compare
593-
* @min: API minor value to compare
594-
*
595-
* Assert whether current HW API version is greater/equal than provided.
596-
**/
597-
static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
598-
{
599-
return (hw->aq.api_maj_ver > maj ||
600-
(hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min));
601-
}
602-
603-
/**
604-
* i40e_is_aq_api_ver_lt
605-
* @hw: pointer to i40e_hw structure
606-
* @maj: API major value to compare
607-
* @min: API minor value to compare
608-
*
609-
* Assert whether current HW API version is less than provided.
610-
**/
611-
static inline bool i40e_is_aq_api_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
612-
{
613-
return !i40e_is_aq_api_ver_ge(hw, maj, min);
614-
}
615-
616-
/**
617-
* i40e_is_fw_ver_ge
618-
* @hw: pointer to i40e_hw structure
619-
* @maj: API major value to compare
620-
* @min: API minor value to compare
621-
*
622-
* Assert whether current firmware version is greater/equal than provided.
623-
**/
624-
static inline bool i40e_is_fw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
625-
{
626-
return (hw->aq.fw_maj_ver > maj ||
627-
(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver >= min));
628-
}
629-
630-
/**
631-
* i40e_is_fw_ver_lt
632-
* @hw: pointer to i40e_hw structure
633-
* @maj: API major value to compare
634-
* @min: API minor value to compare
635-
*
636-
* Assert whether current firmware version is less than provided.
637-
**/
638-
static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
639-
{
640-
return !i40e_is_fw_ver_ge(hw, maj, min);
641-
}
642-
643-
/**
644-
* i40e_is_fw_ver_eq
645-
* @hw: pointer to i40e_hw structure
646-
* @maj: API major value to compare
647-
* @min: API minor value to compare
648-
*
649-
* Assert whether current firmware version is equal to provided.
650-
**/
651-
static inline bool i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min)
652-
{
653-
return (hw->aq.fw_maj_ver > maj ||
654-
(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min));
655-
}
656-
657589
struct i40e_driver_version {
658590
u8 major_version;
659591
u8 minor_version;

0 commit comments

Comments
 (0)