[6/8] vdpa/ifc: set vring state callback update data path
Checks
Commit Message
To support multi queue, in the case that first queue is ready
and device is configured, when more queues need to be configured,
we just close and restart data path.
This also fix the situation that using set_vring_state callback
to disable one queue will cause all vfio interrupts being disabled.
Signed-off-by: Andy Pei <andy.pei@intel.com>
---
drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
@@ -1286,8 +1286,6 @@ struct rte_vdpa_dev_info {
struct internal_list *list;
struct ifcvf_internal *internal;
struct ifcvf_hw *hw;
- struct ifcvf_pci_common_cfg *cfg;
- int ret = 0;
vdev = rte_vhost_get_vdpa_device(vid);
list = find_internal_resource_by_vdev(vdev);
@@ -1303,27 +1301,20 @@ struct rte_vdpa_dev_info {
}
hw = &internal->hw;
- if (!internal->configured)
- goto exit;
- cfg = hw->common_cfg;
- IFCVF_WRITE_REG16(vring, &cfg->queue_select);
- IFCVF_WRITE_REG16(!!state, &cfg->queue_enable);
+ hw->vring[vring].enable = !!state;
- if (!state && hw->vring[vring].enable) {
- ret = vdpa_disable_vfio_intr(internal);
- if (ret)
- return ret;
- }
+ if (!internal->configured)
+ goto exit;
- if (state && !hw->vring[vring].enable) {
- ret = vdpa_enable_vfio_intr(internal, false);
- if (ret)
- return ret;
- }
+ /* close data path */
+ rte_atomic32_set(&internal->dev_attached, 0);
+ update_datapath(internal);
+ /* restart data path */
+ rte_atomic32_set(&internal->dev_attached, 1);
+ update_datapath(internal);
exit:
- hw->vring[vring].enable = !!state;
return 0;
}