[PATCH v4 02/10] net/cpfl: introduce interface structure

Wu, Jingjing jingjing.wu at intel.com
Sat Sep 9 04:08:05 CEST 2023


> -----Original Message-----
> From: Xing, Beilei <beilei.xing at intel.com>
> Sent: Friday, September 8, 2023 7:17 PM
> To: Wu, Jingjing <jingjing.wu at intel.com>
> Cc: dev at dpdk.org; Liu, Mingxia <mingxia.liu at intel.com>; Xing, Beilei
> <beilei.xing at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>
> Subject: [PATCH v4 02/10] net/cpfl: introduce interface structure
> 
> From: Beilei Xing <beilei.xing at intel.com>
> 
> Introduce cplf interface structure to distinguish vport and port
> representor.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang at intel.com>
> Signed-off-by: Beilei Xing <beilei.xing at intel.com>
> ---
>  drivers/net/cpfl/cpfl_ethdev.c |  3 +++
>  drivers/net/cpfl/cpfl_ethdev.h | 16 ++++++++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
> index 46b3a52e49..92fe92c00f 100644
> --- a/drivers/net/cpfl/cpfl_ethdev.c
> +++ b/drivers/net/cpfl/cpfl_ethdev.c
> @@ -1803,6 +1803,9 @@ cpfl_dev_vport_init(struct rte_eth_dev *dev, void
> *init_params)
>  		goto err;
>  	}
> 
> +	cpfl_vport->itf.type = CPFL_ITF_TYPE_VPORT;
> +	cpfl_vport->itf.adapter = adapter;
> +	cpfl_vport->itf.data = dev->data;
>  	adapter->vports[param->idx] = cpfl_vport;
>  	adapter->cur_vports |= RTE_BIT32(param->devarg_id);
>  	adapter->cur_vport_nb++;
> diff --git a/drivers/net/cpfl/cpfl_ethdev.h b/drivers/net/cpfl/cpfl_ethdev.h
> index b637bf2e45..53e45035e8 100644
> --- a/drivers/net/cpfl/cpfl_ethdev.h
> +++ b/drivers/net/cpfl/cpfl_ethdev.h
> @@ -86,7 +86,19 @@ struct p2p_queue_chunks_info {
>  	uint32_t rx_buf_qtail_spacing;
>  };
> 
> +enum cpfl_itf_type {
> +	CPFL_ITF_TYPE_VPORT,
> +	CPFL_ITF_TYPE_REPRESENTOR
Defined but not used in this patch, how about move CPFL_ITF_TYPE_REPRESENTOR to the patch that uses it?
> +};
> +
> +struct cpfl_itf {
> +	enum cpfl_itf_type type;
> +	struct cpfl_adapter_ext *adapter;
> +	void *data;
> +};
> +
>  struct cpfl_vport {
> +	struct cpfl_itf itf;
>  	struct idpf_vport base;
>  	struct p2p_queue_chunks_info *p2p_q_chunks_info;
> 
> @@ -124,5 +136,9 @@ TAILQ_HEAD(cpfl_adapter_list, cpfl_adapter_ext);
>  	RTE_DEV_TO_PCI((eth_dev)->device)
>  #define CPFL_ADAPTER_TO_EXT(p)					\
>  	container_of((p), struct cpfl_adapter_ext, base)
> +#define CPFL_DEV_TO_VPORT(dev)					\
> +	((struct cpfl_vport *)((dev)->data->dev_private))
> +#define CPFL_DEV_TO_ITF(dev)				\
> +	((struct cpfl_itf *)((dev)->data->dev_private))
> 
>  #endif /* _CPFL_ETHDEV_H_ */
> --
> 2.34.1



More information about the dev mailing list