[5/8] vdpa/ifc: only configure enabled queue

Message ID 1661229305-240952-6-git-send-email-andy.pei@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series add multi queue support to vDPA ifc driver |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pei, Andy Aug. 23, 2022, 4:35 a.m. UTC
  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(-)
  

Patch

diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c
index 1b50df6..ca5f677 100644
--- a/drivers/vdpa/ifc/base/ifcvf.c
+++ b/drivers/vdpa/ifc/base/ifcvf.c
@@ -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;
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 34aea6c..a62bcec 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -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;