[PATCH v3 4/8] vdpa/ifc: write queue count to MQ register
Xia, Chenbo
chenbo.xia at intel.com
Wed Oct 12 10:08:09 CEST 2022
> -----Original Message-----
> From: Pei, Andy <andy.pei at intel.com>
> Sent: Friday, September 16, 2022 2:16 PM
> To: dev at dpdk.org
> Cc: Xia, Chenbo <chenbo.xia at intel.com>; Xu, Rosen <rosen.xu at intel.com>;
> Huang, Wei <wei.huang at intel.com>; Cao, Gang <gang.cao at intel.com>;
> maxime.coquelin at redhat.com
> Subject: [PATCH v3 4/8] vdpa/ifc: write queue count to MQ register
>
> Write queue count to IFCVF_MQ_OFFSET register
> to enable multi queue feature.
Multi-queue
>
> Signed-off-by: Andy Pei <andy.pei at intel.com>
> Signed-off-by: Huang Wei <wei.huang at intel.com>
> ---
> drivers/vdpa/ifc/base/ifcvf.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c
> index 34c8226..7efb408 100644
> --- a/drivers/vdpa/ifc/base/ifcvf.c
> +++ b/drivers/vdpa/ifc/base/ifcvf.c
> @@ -198,6 +198,35 @@
> IFCVF_WRITE_REG32(val >> 32, hi);
> }
>
> +STATIC void
> +ifcvf_enable_multiqueue(struct ifcvf_hw *hw)
Maybe ifcvf_enable_mq?
> +{
> + u8 *mq_cfg;
> + int qid;
Qid should be the same type as nr_vring, so u8
> + int nr_queue_pair = 0;
> +
> + for (qid = 0; qid < hw->nr_vring; qid++) {
> + if (!hw->vring[qid].enable)
> + continue;
> + nr_queue_pair++;
> + }
> +
> + if (nr_queue_pair == 0) {
> + WARNINGOUT("no enabled vring\n");
> + return;
> + }
> +
> + if (hw->device_type == IFCVF_NET)
> + nr_queue_pair = (nr_queue_pair + 1) / 2;
Why +1?
> +
> + mq_cfg = hw->mq_cfg;
> + if (mq_cfg) {
> + *(u32 *)mq_cfg = nr_queue_pair;
> + RTE_LOG(INFO, PMD, "%d queue pairs are enabled\n",
> + nr_queue_pair);
> + }
As blk does not have queue pair, the log should be different for net/blk.
The variable nr_queue_pair should be nr_queue as it's the number of queues.
When device type is net, you can make *(u32 *)mq_cfg equal to nr_queue / 2
Thanks,
Chenbo
> +}
> +
> STATIC int
> ifcvf_hw_enable(struct ifcvf_hw *hw)
> {
> @@ -215,6 +244,7 @@
> return -1;
> }
>
> + ifcvf_enable_multiqueue(hw);
> 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
More information about the dev
mailing list