[v2,4/8] vdpa/ifc: write queue count to MQ register
Checks
Commit Message
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 | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
Comments
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Thursday, September 8, 2022 1:54 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; Xu, Rosen <rosen.xu@intel.com>;
> Huang, Wei <wei.huang@intel.com>; Cao, Gang <gang.cao@intel.com>;
> maxime.coquelin@redhat.com; Huang Wei <wei_huang@intel.com>
> Subject: [PATCH v2 4/8] vdpa/ifc: write queue count to MQ register
>
> 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 | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c
> index 34c8226..0444d74 100644
> --- a/drivers/vdpa/ifc/base/ifcvf.c
> +++ b/drivers/vdpa/ifc/base/ifcvf.c
> @@ -198,6 +198,38 @@
> IFCVF_WRITE_REG32(val >> 32, hi);
> }
>
> +STATIC void
> +ifcvf_enable_multiqueue(struct ifcvf_hw *hw)
> +{
> + u8 *mq_cfg;
> + int qid;
> + int nr_queue_pair = 0;
> +
> + if (hw->device_type == IFCVF_NET) {
> + 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;
> + }
> +
> + nr_queue_pair = (nr_queue_pair + 1) / 2;
> + } else if (hw->device_type == IFCVF_BLK) {
> + nr_queue_pair = hw->nr_vring;
> + }
Why above logic will be different for NET/BLK, could you
help me understand it?
Thanks,
Chenbo
> +
> + 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);
> + }
> +}
> +
> STATIC int
> ifcvf_hw_enable(struct ifcvf_hw *hw)
> {
> @@ -215,6 +247,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
Hi Chenbo,
For BLK devices, ifc driver does not have VHOST_USER_SET_VRING_ENABLE msg.
So it does not need to dynamic configuration.
But now I think it is fine to use the same logic.
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Friday, September 9, 2022 3:35 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Huang, Wei <wei.huang@intel.com>; Cao,
> Gang <gang.cao@intel.com>; maxime.coquelin@redhat.com; Huang Wei
> <wei_huang@intel.com>
> Subject: RE: [PATCH v2 4/8] vdpa/ifc: write queue count to MQ register
>
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Thursday, September 8, 2022 1:54 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; Xu, Rosen
> > <rosen.xu@intel.com>; Huang, Wei <wei.huang@intel.com>; Cao, Gang
> > <gang.cao@intel.com>; maxime.coquelin@redhat.com; Huang Wei
> > <wei_huang@intel.com>
> > Subject: [PATCH v2 4/8] vdpa/ifc: write queue count to MQ register
> >
> > 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 | 33 +++++++++++++++++++++++++++++++++
> > 1 file changed, 33 insertions(+)
> >
> > diff --git a/drivers/vdpa/ifc/base/ifcvf.c
> > b/drivers/vdpa/ifc/base/ifcvf.c index 34c8226..0444d74 100644
> > --- a/drivers/vdpa/ifc/base/ifcvf.c
> > +++ b/drivers/vdpa/ifc/base/ifcvf.c
> > @@ -198,6 +198,38 @@
> > IFCVF_WRITE_REG32(val >> 32, hi);
> > }
> >
> > +STATIC void
> > +ifcvf_enable_multiqueue(struct ifcvf_hw *hw) {
> > + u8 *mq_cfg;
> > + int qid;
> > + int nr_queue_pair = 0;
> > +
> > + if (hw->device_type == IFCVF_NET) {
> > + 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;
> > + }
> > +
> > + nr_queue_pair = (nr_queue_pair + 1) / 2;
> > + } else if (hw->device_type == IFCVF_BLK) {
> > + nr_queue_pair = hw->nr_vring;
> > + }
>
> Why above logic will be different for NET/BLK, could you help me understand it?
>
> Thanks,
> Chenbo
>
> > +
> > + 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);
> > + }
> > +}
> > +
> > STATIC int
> > ifcvf_hw_enable(struct ifcvf_hw *hw)
> > {
> > @@ -215,6 +247,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
@@ -198,6 +198,38 @@
IFCVF_WRITE_REG32(val >> 32, hi);
}
+STATIC void
+ifcvf_enable_multiqueue(struct ifcvf_hw *hw)
+{
+ u8 *mq_cfg;
+ int qid;
+ int nr_queue_pair = 0;
+
+ if (hw->device_type == IFCVF_NET) {
+ 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;
+ }
+
+ nr_queue_pair = (nr_queue_pair + 1) / 2;
+ } else if (hw->device_type == IFCVF_BLK) {
+ nr_queue_pair = hw->nr_vring;
+ }
+
+ 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);
+ }
+}
+
STATIC int
ifcvf_hw_enable(struct ifcvf_hw *hw)
{
@@ -215,6 +247,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,