[PATCH v4 1/2] common/idpf: move PF specific functions from common init

Wu, Jingjing jingjing.wu at intel.com
Sun Apr 23 10:25:43 CEST 2023



> -----Original Message-----
> From: Xing, Beilei <beilei.xing at intel.com>
> Sent: Thursday, April 6, 2023 3:43 PM
> To: Wu, Jingjing <jingjing.wu at intel.com>
> Cc: dev at dpdk.org; Xing, Beilei <beilei.xing at intel.com>
> Subject: [PATCH v4 1/2] common/idpf: move PF specific functions from common init
> 
> From: Beilei Xing <beilei.xing at intel.com>
> 
> Move PF reset and PF mailbox initialization functions from
> idpf_adapter_init function to xxxx_adapter_ext_init function,
> since they're different between PF and VF support.
> 
> Signed-off-by: Beilei Xing <beilei.xing at intel.com>
> ---
>  drivers/common/idpf/idpf_common_device.c | 72 +++++-------------------
>  drivers/common/idpf/idpf_common_device.h | 11 ++++
>  drivers/common/idpf/version.map          |  5 ++
>  drivers/net/cpfl/cpfl_ethdev.c           | 51 +++++++++++++++++
>  drivers/net/idpf/idpf_ethdev.c           | 51 +++++++++++++++++
>  5 files changed, 131 insertions(+), 59 deletions(-)
> 
> diff --git a/drivers/common/idpf/idpf_common_device.c
> b/drivers/common/idpf/idpf_common_device.c
> index c5e7bbf66c..3b58bdd41e 100644
> --- a/drivers/common/idpf/idpf_common_device.c
> +++ b/drivers/common/idpf/idpf_common_device.c
> @@ -6,8 +6,8 @@
>  #include <idpf_common_device.h>
>  #include <idpf_common_virtchnl.h>
> 
> -static void
> -idpf_reset_pf(struct idpf_hw *hw)
> +void
> +idpf_hw_pf_reset(struct idpf_hw *hw)
>  {
>  	uint32_t reg;
> 
> @@ -15,9 +15,8 @@ idpf_reset_pf(struct idpf_hw *hw)
>  	IDPF_WRITE_REG(hw, PFGEN_CTRL, (reg | PFGEN_CTRL_PFSWR));
>  }
> 
> -#define IDPF_RESET_WAIT_CNT 100
> -static int
> -idpf_check_pf_reset_done(struct idpf_hw *hw)
> +int
> +idpf_hw_pf_reset_check(struct idpf_hw *hw)
>  {
>  	uint32_t reg;
>  	int i;
> @@ -33,48 +32,13 @@ idpf_check_pf_reset_done(struct idpf_hw *hw)
>  	return -EBUSY;
>  }
> 
> -#define CTLQ_NUM 2
> -static int
> -idpf_init_mbx(struct idpf_hw *hw)
> +int
> +idpf_hw_mbx_init(struct idpf_hw *hw, struct idpf_ctlq_create_info *ctlq_info)
>  {
> -	struct idpf_ctlq_create_info ctlq_info[CTLQ_NUM] = {
> -		{
> -			.type = IDPF_CTLQ_TYPE_MAILBOX_TX,
> -			.id = IDPF_CTLQ_ID,
> -			.len = IDPF_CTLQ_LEN,
> -			.buf_size = IDPF_DFLT_MBX_BUF_SIZE,
> -			.reg = {
> -				.head = PF_FW_ATQH,
> -				.tail = PF_FW_ATQT,
> -				.len = PF_FW_ATQLEN,
> -				.bah = PF_FW_ATQBAH,
> -				.bal = PF_FW_ATQBAL,
> -				.len_mask = PF_FW_ATQLEN_ATQLEN_M,
> -				.len_ena_mask = PF_FW_ATQLEN_ATQENABLE_M,
> -				.head_mask = PF_FW_ATQH_ATQH_M,
> -			}
> -		},
> -		{
> -			.type = IDPF_CTLQ_TYPE_MAILBOX_RX,
> -			.id = IDPF_CTLQ_ID,
> -			.len = IDPF_CTLQ_LEN,
> -			.buf_size = IDPF_DFLT_MBX_BUF_SIZE,
> -			.reg = {
> -				.head = PF_FW_ARQH,
> -				.tail = PF_FW_ARQT,
> -				.len = PF_FW_ARQLEN,
> -				.bah = PF_FW_ARQBAH,
> -				.bal = PF_FW_ARQBAL,
> -				.len_mask = PF_FW_ARQLEN_ARQLEN_M,
> -				.len_ena_mask = PF_FW_ARQLEN_ARQENABLE_M,
> -				.head_mask = PF_FW_ARQH_ARQH_M,
> -			}
> -		}
> -	};
>  	struct idpf_ctlq_info *ctlq;
>  	int ret;
> 
> -	ret = idpf_ctlq_init(hw, CTLQ_NUM, ctlq_info);
> +	ret = idpf_ctlq_init(hw, IDPF_CTLQ_NUM, ctlq_info);
>  	if (ret != 0)
>  		return ret;
> 
> @@ -96,6 +60,12 @@ idpf_init_mbx(struct idpf_hw *hw)
>  	return ret;
>  }

You can check the device id if idpf_hw, and then decide how to init ctlq and then this function can also be consumed by VF driver. No need to move them out from common. The same as other functions.
> 



More information about the dev mailing list