vdpa/ifc: configure only enabled queue

When configuring the hardware queue, we only configure queues which
have been enabled by vhost.

Signed-off-by: Andy Pei <andy.pei@intel.com>
Signed-off-by: Huang Wei <wei.huang@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
This commit is contained in:
Andy Pei 2022-10-19 16:41:17 +08:00 committed by Chenbo Xia
parent eee3f67ef4
commit 83c7370aca
2 changed files with 17 additions and 2 deletions

View File

@ -252,6 +252,9 @@ ifcvf_hw_enable(struct ifcvf_hw *hw)
ifcvf_enable_mq(hw);
for (i = 0; i < hw->nr_vring; i++) {
if (!hw->vring[i].enable)
continue;
IFCVF_WRITE_REG16(i, &cfg->queue_select);
io_write64_twopart(hw->vring[i].desc, &cfg->queue_desc_lo,
&cfg->queue_desc_hi);

View File

@ -284,6 +284,8 @@ vdpa_ifcvf_start(struct ifcvf_internal *internal)
rte_vhost_get_negotiated_features(vid, &hw->req_features);
for (i = 0; i < nr_vring; i++) {
if (!hw->vring[i].enable)
continue;
rte_vhost_get_vhost_vring(vid, i, &vq);
gpa = hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.desc);
if (gpa == 0) {
@ -499,6 +501,8 @@ notify_relay(void *arg)
vring.kickfd = -1;
for (qid = 0; qid < q_num; qid++) {
if (!hw->vring[qid].enable)
continue;
ev.events = EPOLLIN | EPOLLPRI;
rte_vhost_get_vhost_vring(internal->vid, qid, &vring);
ev.data.u64 = qid | (uint64_t)vring.kickfd << 32;
@ -1058,6 +1062,8 @@ ifcvf_dev_config(int vid)
struct rte_vdpa_device *vdev;
struct internal_list *list;
struct ifcvf_internal *internal;
struct ifcvf_hw *hw;
uint16_t i;
vdev = rte_vhost_get_vdpa_device(vid);
list = find_internal_resource_by_vdev(vdev);
@ -1071,11 +1077,17 @@ ifcvf_dev_config(int vid)
rte_atomic32_set(&internal->dev_attached, 1);
update_datapath(internal);
if (rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, true) != 0)
DRV_LOG(NOTICE, "vDPA (%s): software relay is used.",
hw = &internal->hw;
for (i = 0; i < hw->nr_vring; i++) {
if (!hw->vring[i].enable)
continue;
if (rte_vhost_host_notifier_ctrl(vid, i, true) != 0)
DRV_LOG(NOTICE, "vDPA (%s): software relay is used.",
vdev->device->name);
}
internal->configured = 1;
DRV_LOG(INFO, "vDPA device %s is configured", vdev->device->name);
return 0;
}