Skip to content

Commit 28c1726

Browse files
Ivan Vecerakuba-moo
authored andcommitted
i40e: Move i40e_is_aq_api_ver_ge helper
Move i40e_is_aq_api_ver_ge helper function (used to check if AdminQ API version is recent enough) to header so it can be used from other .c files. Signed-off-by: Ivan Vecera <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8cc2956 commit 28c1726

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

drivers/net/ethernet/intel/i40e/i40e_common.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,21 +1749,6 @@ int i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
17491749
return status;
17501750
}
17511751

1752-
/**
1753-
* i40e_is_aq_api_ver_ge
1754-
* @aq: pointer to AdminQ info containing HW API version to compare
1755-
* @maj: API major value
1756-
* @min: API minor value
1757-
*
1758-
* Assert whether current HW API version is greater/equal than provided.
1759-
**/
1760-
static bool i40e_is_aq_api_ver_ge(struct i40e_adminq_info *aq, u16 maj,
1761-
u16 min)
1762-
{
1763-
return (aq->api_maj_ver > maj ||
1764-
(aq->api_maj_ver == maj && aq->api_min_ver >= min));
1765-
}
1766-
17671752
/**
17681753
* i40e_aq_add_vsi
17691754
* @hw: pointer to the hw struct
@@ -1890,14 +1875,14 @@ int i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
18901875

18911876
if (set) {
18921877
flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
1893-
if (rx_only_promisc && i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
1878+
if (rx_only_promisc && i40e_is_aq_api_ver_ge(hw, 1, 5))
18941879
flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
18951880
}
18961881

18971882
cmd->promiscuous_flags = cpu_to_le16(flags);
18981883

18991884
cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
1900-
if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
1885+
if (i40e_is_aq_api_ver_ge(hw, 1, 5))
19011886
cmd->valid_flags |=
19021887
cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
19031888

@@ -2000,13 +1985,13 @@ int i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,
20001985

20011986
if (enable) {
20021987
flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
2003-
if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
1988+
if (i40e_is_aq_api_ver_ge(hw, 1, 5))
20041989
flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
20051990
}
20061991

20071992
cmd->promiscuous_flags = cpu_to_le16(flags);
20081993
cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
2009-
if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
1994+
if (i40e_is_aq_api_ver_ge(hw, 1, 5))
20101995
cmd->valid_flags |=
20111996
cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
20121997
cmd->seid = cpu_to_le16(seid);

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,20 @@ static inline bool i40e_is_vf(struct i40e_hw *hw)
594594
hw->mac.type == I40E_MAC_X722_VF);
595595
}
596596

597+
/**
598+
* i40e_is_aq_api_ver_ge
599+
* @hw: pointer to i40e_hw structure
600+
* @maj: API major value to compare
601+
* @min: API minor value to compare
602+
*
603+
* Assert whether current HW API version is greater/equal than provided.
604+
**/
605+
static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
606+
{
607+
return (hw->aq.api_maj_ver > maj ||
608+
(hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min));
609+
}
610+
597611
struct i40e_driver_version {
598612
u8 major_version;
599613
u8 minor_version;

0 commit comments

Comments
 (0)