[PATCH net-next v3 14/14] sfc: register the vDPA device
From: Gautam Dawar
Date: Thu Apr 06 2023 - 03:06:29 EST
Register the vDPA device which results in adding the device
to the vDPA bus which will be probed by either of the vDPA
bus drivers: virtio_vdpa or vhost_vdpa.
Signed-off-by: Gautam Dawar <gautam.dawar@xxxxxxx>
---
drivers/net/ethernet/sfc/ef100_vdpa.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
index a04bcae89b7b..472a85c81701 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -242,8 +242,7 @@ static void ef100_vdpa_delete(struct efx_nic *efx)
}
}
- /* replace with _vdpa_unregister_device later */
- put_device(&vdpa_dev->dev);
+ _vdpa_unregister_device(&efx->vdpa_nic->vdpa_dev);
}
efx_mcdi_free_vis(efx);
}
@@ -393,7 +392,14 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
vdpa_nic->mac_configured = true;
}
- /* _vdpa_register_device when its ready */
+ rc = _vdpa_register_device(&vdpa_nic->vdpa_dev,
+ (allocated_vis - 1) * 2);
+ if (rc) {
+ pci_err(efx->pci_dev,
+ "vDPA device registration failed, vf: %u, rc: %d\n",
+ nic_data->vf_index, rc);
+ goto err_put_device;
+ }
return vdpa_nic;
--
2.30.1