[PATCH] net/idpf: refine idpf_dev_vport_init() function

Zhang, Qi Z qi.z.zhang at intel.com
Fri Jun 30 10:13:06 CEST 2023



> -----Original Message-----
> From: Mingxia Liu <mingxia.liu at intel.com>
> Sent: Monday, June 26, 2023 10:06 PM
> To: dev at dpdk.org
> Cc: Wu, Jingjing <jingjing.wu at intel.com>; Xing, Beilei <beilei.xing at intel.com>;
> Liu, Mingxia <mingxia.liu at intel.com>
> Subject: [PATCH] net/idpf: refine idpf_dev_vport_init() function
> 
> This patch adds 'cur_vports' and 'cur_vport_nb' updation in error path.
> 
> Signed-off-by: Mingxia Liu <mingxia.liu at intel.com>
> ---
>  drivers/net/idpf/idpf_ethdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
> index 801da57472..3e66898aaf 100644
> --- a/drivers/net/idpf/idpf_ethdev.c
> +++ b/drivers/net/idpf/idpf_ethdev.c
> @@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void
> *init_params)
>  err_mac_addrs:
>  	adapter->vports[param->idx] = NULL;  /* reset */
>  	idpf_vport_deinit(vport);
> +	adapter->cur_vports &= ~RTE_BIT32(param->devarg_id);
> +	adapter->cur_vport_nb--;

Can we move below two lines to the last?

adapter->cur_vports |= RTE_BIT32(param->devarg_id);
adapter->cur_vport_nb++;

so we don't need to revert them in error handle

>  err:
>  	return ret;
>  }
> --
> 2.34.1



More information about the dev mailing list