Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wojciech Drewek <wojciech.drewek@intel.com>
To: Ivan Vecera <ivecera@redhat.com>, <netdev@vger.kernel.org>
Cc: dacampbe@redhat.com,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	linux-kernel@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Jacob Keller <jacob.e.keller@intel.com>,
	intel-wired-lan@lists.osuosl.org, Paolo Abeni <pabeni@redhat.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v2 1/3] i40e: Move i40e_is_aq_api_ver_ge helper
Date: Tue, 24 Oct 2023 12:04:39 +0200	[thread overview]
Message-ID: <5a918c17-af73-4d4a-8016-855aa667456f@intel.com> (raw)
In-Reply-To: <20231024081211.677502-2-ivecera@redhat.com>



On 24.10.2023 10:12, Ivan Vecera wrote:
> 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 <ivecera@redhat.com>
> ---

Thanks Ivan,
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/intel/i40e/i40e_common.c | 23 ++++---------------
>  drivers/net/ethernet/intel/i40e/i40e_type.h   | 14 +++++++++++
>  2 files changed, 18 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
> index 7fce881abc93..df7ba349030d 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_common.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
> @@ -1749,21 +1749,6 @@ int i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
>  	return status;
>  }
>  
> -/**
> - * i40e_is_aq_api_ver_ge
> - * @aq: pointer to AdminQ info containing HW API version to compare
> - * @maj: API major value
> - * @min: API minor value
> - *
> - * Assert whether current HW API version is greater/equal than provided.
> - **/
> -static bool i40e_is_aq_api_ver_ge(struct i40e_adminq_info *aq, u16 maj,
> -				  u16 min)
> -{
> -	return (aq->api_maj_ver > maj ||
> -		(aq->api_maj_ver == maj && aq->api_min_ver >= min));
> -}
> -
>  /**
>   * i40e_aq_add_vsi
>   * @hw: pointer to the hw struct
> @@ -1890,14 +1875,14 @@ int i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
>  
>  	if (set) {
>  		flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
> -		if (rx_only_promisc && i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
> +		if (rx_only_promisc && i40e_is_aq_api_ver_ge(hw, 1, 5))
>  			flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
>  	}
>  
>  	cmd->promiscuous_flags = cpu_to_le16(flags);
>  
>  	cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
> -	if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
> +	if (i40e_is_aq_api_ver_ge(hw, 1, 5))
>  		cmd->valid_flags |=
>  			cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
>  
> @@ -2000,13 +1985,13 @@ int i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,
>  
>  	if (enable) {
>  		flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
> -		if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
> +		if (i40e_is_aq_api_ver_ge(hw, 1, 5))
>  			flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
>  	}
>  
>  	cmd->promiscuous_flags = cpu_to_le16(flags);
>  	cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
> -	if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
> +	if (i40e_is_aq_api_ver_ge(hw, 1, 5))
>  		cmd->valid_flags |=
>  			cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
>  	cmd->seid = cpu_to_le16(seid);
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
> index 22150368ba64..a21cc607c844 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_type.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
> @@ -594,6 +594,20 @@ static inline bool i40e_is_vf(struct i40e_hw *hw)
>  		hw->mac.type == I40E_MAC_X722_VF);
>  }
>  
> +/**
> + * i40e_is_aq_api_ver_ge
> + * @hw: pointer to i40e_hw structure
> + * @maj: API major value to compare
> + * @min: API minor value to compare
> + *
> + * Assert whether current HW API version is greater/equal than provided.
> + **/
> +static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
> +{
> +	return (hw->aq.api_maj_ver > maj ||
> +		(hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min));
> +}
> +
>  struct i40e_driver_version {
>  	u8 major_version;
>  	u8 minor_version;
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  reply	other threads:[~2023-10-24 10:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24  8:12 [Intel-wired-lan] [PATCH iwl-next v2 0/3] i40e: Add and use version check helpers Ivan Vecera
2023-10-24  8:12 ` [Intel-wired-lan] [PATCH iwl-next v2 1/3] i40e: Move i40e_is_aq_api_ver_ge helper Ivan Vecera
2023-10-24 10:04   ` Wojciech Drewek [this message]
2023-11-08  5:19   ` Pucha, HimasekharX Reddy
2023-10-24  8:12 ` [Intel-wired-lan] [PATCH iwl-next v2 2/3] i40e: Add other helpers to check version of running firmware and AQ API Ivan Vecera
2023-10-24  8:12 ` [Intel-wired-lan] [PATCH iwl-next v2 3/3] i40e: Use helpers to check running FW and AQ API versions Ivan Vecera
2023-11-08  5:19   ` Pucha, HimasekharX Reddy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a918c17-af73-4d4a-8016-855aa667456f@intel.com \
    --to=wojciech.drewek@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=dacampbe@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ivecera@redhat.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox