[4/8] vdpa/ifc: write queue count to MQ register

Message ID 1661229305-240952-5-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
  Write queue count to IFCVF_MQ_OFFSET register
to enable multi queue feature.

Signed-off-by: Andy Pei <andy.pei@intel.com>
Signed-off-by: Huang Wei <wei_huang@intel.com>
---
 drivers/vdpa/ifc/base/ifcvf.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Patch

diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c
index 34c8226..1b50df6 100644
--- a/drivers/vdpa/ifc/base/ifcvf.c
+++ b/drivers/vdpa/ifc/base/ifcvf.c
@@ -198,6 +198,19 @@ 
 	IFCVF_WRITE_REG32(val >> 32, hi);
 }
 
+STATIC void
+ifcvf_enable_multiqueue(struct ifcvf_hw *hw, u16 nr_queue_pair)
+{
+	u8 *mq_cfg;
+
+	if (hw->device_type == IFCVF_NET)
+		nr_queue_pair = (nr_queue_pair + 1) / 2;
+
+	mq_cfg = hw->mq_cfg;
+	if (mq_cfg)
+		*(u32 *)mq_cfg = nr_queue_pair;
+}
+
 STATIC int
 ifcvf_hw_enable(struct ifcvf_hw *hw)
 {
@@ -215,6 +228,7 @@ 
 		return -1;
 	}
 
+	ifcvf_enable_multiqueue(hw, hw->nr_vring);
 	for (i = 0; i < hw->nr_vring; i++) {
 		IFCVF_WRITE_REG16(i, &cfg->queue_select);
 		io_write64_twopart(hw->vring[i].desc, &cfg->queue_desc_lo,