Re: [PATCH iwl-next 1/2] i40e: Remove VF MAC types

From: Wojciech Drewek
Date: Wed Oct 25 2023 - 08:27:25 EST




On 25.10.2023 14:20, Jiri Pirko wrote:
> Wed, Oct 25, 2023 at 02:16:39PM CEST, jiri@xxxxxxxxxxx wrote:
>> Wed, Oct 25, 2023 at 12:48:37PM CEST, wojciech.drewek@xxxxxxxxx wrote:
>>>
>>>
>>> On 25.10.2023 12:33, Ivan Vecera wrote:
>>>> The i40e_hw.mac.type cannot to be equal to I40E_MAC_VF or
>>>> I40E_MAC_X722_VF so remove helper i40e_is_vf(), simplify
>>>> i40e_adminq_init_regs() and remove enums for these VF MAC types.
>>>>
>>>> Signed-off-by: Ivan Vecera <ivecera@xxxxxxxxxx>
>>>> ---
>>>> drivers/net/ethernet/intel/i40e/i40e_adminq.c | 33 ++++++-------------
>>>> drivers/net/ethernet/intel/i40e/i40e_type.h | 8 -----
>>>> 2 files changed, 10 insertions(+), 31 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
>>>> index 29fc46abf690..896c43905309 100644
>>>> --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
>>>> +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
>>>> @@ -17,29 +17,16 @@ static void i40e_resume_aq(struct i40e_hw *hw);
>>>> static void i40e_adminq_init_regs(struct i40e_hw *hw)
>>>> {
>>>> /* set head and tail registers in our local struct */
>>>> - if (i40e_is_vf(hw)) {
>>>> - hw->aq.asq.tail = I40E_VF_ATQT1;
>>>> - hw->aq.asq.head = I40E_VF_ATQH1;
>>>> - hw->aq.asq.len = I40E_VF_ATQLEN1;
>>>> - hw->aq.asq.bal = I40E_VF_ATQBAL1;
>>>> - hw->aq.asq.bah = I40E_VF_ATQBAH1;
>>>> - hw->aq.arq.tail = I40E_VF_ARQT1;
>>>> - hw->aq.arq.head = I40E_VF_ARQH1;
>>>> - hw->aq.arq.len = I40E_VF_ARQLEN1;
>>>> - hw->aq.arq.bal = I40E_VF_ARQBAL1;
>>>> - hw->aq.arq.bah = I40E_VF_ARQBAH1;
>>>
>>> What about removing those I40E_VF_* defines?
>>> This is their only usage here, right?
>>
>> Wait, do you suggest to use the values directly? That would be
>> wild even for i40e :)
>
> Ah, sec. This is duplicated in
> drivers/net/ethernet/intel/iavf/iavf_register.h. That confused me.

Indeed, in case of i40e they're going be unused after this patch so
there is no point in keeping them, I think.

>
>
>
>>
>>
>>>
>>>> - } else {
>>>> - hw->aq.asq.tail = I40E_PF_ATQT;
>>>> - hw->aq.asq.head = I40E_PF_ATQH;
>>>> - hw->aq.asq.len = I40E_PF_ATQLEN;
>>>> - hw->aq.asq.bal = I40E_PF_ATQBAL;
>>>> - hw->aq.asq.bah = I40E_PF_ATQBAH;
>>>> - hw->aq.arq.tail = I40E_PF_ARQT;
>>>> - hw->aq.arq.head = I40E_PF_ARQH;
>>>> - hw->aq.arq.len = I40E_PF_ARQLEN;
>>>> - hw->aq.arq.bal = I40E_PF_ARQBAL;
>>>> - hw->aq.arq.bah = I40E_PF_ARQBAH;
>>>> - }
>>>> + hw->aq.asq.tail = I40E_PF_ATQT;
>>>> + hw->aq.asq.head = I40E_PF_ATQH;
>>>> + hw->aq.asq.len = I40E_PF_ATQLEN;
>>>> + hw->aq.asq.bal = I40E_PF_ATQBAL;
>>>> + hw->aq.asq.bah = I40E_PF_ATQBAH;
>>>> + hw->aq.arq.tail = I40E_PF_ARQT;
>>>> + hw->aq.arq.head = I40E_PF_ARQH;
>>>> + hw->aq.arq.len = I40E_PF_ARQLEN;
>>>> + hw->aq.arq.bal = I40E_PF_ARQBAL;
>>>> + hw->aq.arq.bah = I40E_PF_ARQBAH;
>>>> }
>>>>
>>>> /**
>>>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
>>>> index 9fda0cb6bdbe..7eaf8b013125 100644
>>>> --- a/drivers/net/ethernet/intel/i40e/i40e_type.h
>>>> +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
>>>> @@ -64,9 +64,7 @@ typedef void (*I40E_ADMINQ_CALLBACK)(struct i40e_hw *, struct i40e_aq_desc *);
>>>> enum i40e_mac_type {
>>>> I40E_MAC_UNKNOWN = 0,
>>>> I40E_MAC_XL710,
>>>> - I40E_MAC_VF,
>>>> I40E_MAC_X722,
>>>> - I40E_MAC_X722_VF,
>>>> I40E_MAC_GENERIC,
>>>> };
>>>>
>>>> @@ -588,12 +586,6 @@ struct i40e_hw {
>>>> char err_str[16];
>>>> };
>>>>
>>>> -static inline bool i40e_is_vf(struct i40e_hw *hw)
>>>> -{
>>>> - return (hw->mac.type == I40E_MAC_VF ||
>>>> - hw->mac.type == I40E_MAC_X722_VF);
>>>> -}
>>>> -
>>>> /**
>>>> * i40e_is_aq_api_ver_ge
>>>> * @hw: pointer to i40e_hw structure
>>>