[5/8] vdpa/ifc: only configure enabled queue
Checks
Commit Message
when configure the hardware queue, we only configure queues which
have been enabled by vhost.
Signed-off-by: Andy Pei <andy.pei@intel.com>
---
drivers/vdpa/ifc/base/ifcvf.c | 5 ++++-
drivers/vdpa/ifc/ifcvf_vdpa.c | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
@@ -230,6 +230,8 @@
ifcvf_enable_multiqueue(hw, hw->nr_vring);
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);
@@ -264,7 +266,8 @@
notify_off = IFCVF_READ_REG16(&cfg->queue_notify_off);
hw->notify_addr[i] = (void *)((u8 *)hw->notify_base +
notify_off * hw->notify_off_multiplier);
- IFCVF_WRITE_REG16(1, &cfg->queue_enable);
+ if (hw->vring[i].enable)
+ IFCVF_WRITE_REG16(1, &cfg->queue_enable);
}
return 0;
@@ -290,6 +290,8 @@ struct rte_vdpa_dev_info {
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) {
@@ -505,6 +507,8 @@ struct rte_vdpa_dev_info {
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;