[PATCH v9 09/12] vdpa/ifc: improve internal list logic
Xia, Chenbo
chenbo.xia at intel.com
Thu Oct 20 05:21:32 CEST 2022
> -----Original Message-----
> From: Pei, Andy <andy.pei at intel.com>
> Sent: Wednesday, October 19, 2022 4:41 PM
> To: dev at dpdk.org
> Cc: Xia, Chenbo <chenbo.xia at intel.com>; Xu, Rosen <rosen.xu at intel.com>;
> Huang, Wei <wei.huang at intel.com>; Cao, Gang <gang.cao at intel.com>;
> maxime.coquelin at redhat.com
> Subject: [PATCH v9 09/12] vdpa/ifc: improve internal list logic
>
> Insert internal list element to internal list before
> register vdpa device, in order to call vdpa ops during
> vdpa device registration.
>
> Signed-off-by: Andy Pei <andy.pei at intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
> ---
> drivers/vdpa/ifc/ifcvf_vdpa.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index c16e263..8dfd493 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -1737,17 +1737,20 @@ struct rte_vdpa_dev_info dev_info[] = {
> }
> internal->sw_lm = sw_fallback_lm;
>
> + pthread_mutex_lock(&internal_list_lock);
> + TAILQ_INSERT_TAIL(&internal_list, list, next);
> + pthread_mutex_unlock(&internal_list_lock);
> +
> internal->vdev = rte_vdpa_register_device(&pci_dev->device,
> dev_info[internal->hw.device_type].ops);
> if (internal->vdev == NULL) {
> DRV_LOG(ERR, "failed to register device %s", pci_dev->name);
> + pthread_mutex_lock(&internal_list_lock);
> + TAILQ_REMOVE(&internal_list, list, next);
> + pthread_mutex_unlock(&internal_list_lock);
> goto error;
> }
>
> - pthread_mutex_lock(&internal_list_lock);
> - TAILQ_INSERT_TAIL(&internal_list, list, next);
> - pthread_mutex_unlock(&internal_list_lock);
> -
> rte_atomic32_set(&internal->started, 1);
> update_datapath(internal);
>
> --
> 1.8.3.1
Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>
More information about the dev
mailing list