Write queue count to IFCVF_MQ_OFFSET register
to enable multi queue feature.

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

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,
-- 
1.8.3.1

Reply via email to