[v2,2/8] vdpa/ifc: add multi queue support
Checks
Commit Message
Enable VHOST_USER_PROTOCOL_F_MQ feature.
ExposeIFCVF_MQ_OFFSET register to enable multi queue.
Signed-off-by: Andy Pei <andy.pei@intel.com>
Signed-off-by: Huang Wei <wei_huang@intel.com>
---
drivers/vdpa/ifc/base/ifcvf.c | 5 +++++
drivers/vdpa/ifc/base/ifcvf.h | 2 ++
drivers/vdpa/ifc/ifcvf_vdpa.c | 1 +
3 files changed, 8 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 2/8] vdpa/ifc: add multi queue support
multi-queue
>
> Enable VHOST_USER_PROTOCOL_F_MQ feature.
> ExposeIFCVF_MQ_OFFSET register to enable multi queue.
Please rephase it in a better way, at least add a space before
IFCVF_MP_OFFSET...
>
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> Signed-off-by: Huang Wei <wei_huang@intel.com>
> ---
> drivers/vdpa/ifc/base/ifcvf.c | 5 +++++
> drivers/vdpa/ifc/base/ifcvf.h | 2 ++
> drivers/vdpa/ifc/ifcvf_vdpa.c | 1 +
> 3 files changed, 8 insertions(+)
>
> diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c
> index f1e1474..34c8226 100644
> --- a/drivers/vdpa/ifc/base/ifcvf.c
> +++ b/drivers/vdpa/ifc/base/ifcvf.c
> @@ -90,6 +90,11 @@
> if (!hw->lm_cfg)
> WARNINGOUT("HW support live migration not support!\n");
>
> + if (hw->mem_resource[4].addr)
> + hw->mq_cfg = hw->mem_resource[4].addr + IFCVF_MQ_OFFSET;
> + else
> + hw->mq_cfg = NULL;
Could you help me understand the logic here? There are two cases that BAR 4
mmap-able and not mmap-able?
Thanks,
Chenbo
> +
> if (hw->common_cfg == NULL || hw->notify_base == NULL ||
> hw->isr == NULL || hw->dev_cfg == NULL) {
> DEBUGOUT("capability incomplete\n");
> diff --git a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.h
> index 7ede738..ad505f1 100644
> --- a/drivers/vdpa/ifc/base/ifcvf.h
> +++ b/drivers/vdpa/ifc/base/ifcvf.h
> @@ -50,6 +50,7 @@
>
> #define IFCVF_LM_CFG_SIZE 0x40
> #define IFCVF_LM_RING_STATE_OFFSET 0x20
> +#define IFCVF_MQ_OFFSET 0x28
>
> #define IFCVF_LM_LOGGING_CTRL 0x0
>
> @@ -149,6 +150,7 @@ struct ifcvf_hw {
> u16 *notify_base;
> u16 *notify_addr[IFCVF_MAX_QUEUES * 2];
> u8 *lm_cfg;
> + u8 *mq_cfg;
> struct vring_info vring[IFCVF_MAX_QUEUES * 2];
> u8 nr_vring;
> int device_type;
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 61d0250..2d165c0 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -1248,6 +1248,7 @@ struct rte_vdpa_dev_info {
> 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \
> 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | \
> 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | \
> + 1ULL << VHOST_USER_PROTOCOL_F_MQ | \
> 1ULL << VHOST_USER_PROTOCOL_F_STATUS)
>
> #define VDPA_BLK_PROTOCOL_FEATURES \
> --
> 1.8.3.1
Hi Chenbo,
Thanks for your reply.
My reply is inline.
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Friday, September 9, 2022 8:29 AM
> 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 2/8] vdpa/ifc: add multi queue support
>
> > -----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 2/8] vdpa/ifc: add multi queue support
>
> multi-queue
>
Sure.
> >
> > Enable VHOST_USER_PROTOCOL_F_MQ feature.
> > ExposeIFCVF_MQ_OFFSET register to enable multi queue.
>
> Please rephase it in a better way, at least add a space before
> IFCVF_MP_OFFSET...
>
I will make it "Expose IFCVF_MQ_OFFSET register to enable multi queue."
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > Signed-off-by: Huang Wei <wei_huang@intel.com>
> > ---
> > drivers/vdpa/ifc/base/ifcvf.c | 5 +++++
> > drivers/vdpa/ifc/base/ifcvf.h | 2 ++ drivers/vdpa/ifc/ifcvf_vdpa.c |
> > 1 +
> > 3 files changed, 8 insertions(+)
> >
> > diff --git a/drivers/vdpa/ifc/base/ifcvf.c
> > b/drivers/vdpa/ifc/base/ifcvf.c index f1e1474..34c8226 100644
> > --- a/drivers/vdpa/ifc/base/ifcvf.c
> > +++ b/drivers/vdpa/ifc/base/ifcvf.c
> > @@ -90,6 +90,11 @@
> > if (!hw->lm_cfg)
> > WARNINGOUT("HW support live migration not support!\n");
> >
> > + if (hw->mem_resource[4].addr)
> > + hw->mq_cfg = hw->mem_resource[4].addr +
> IFCVF_MQ_OFFSET;
> > + else
> > + hw->mq_cfg = NULL;
>
> Could you help me understand the logic here? There are two cases that BAR 4
> mmap-able and not mmap-able?
>
For some hardware implementation, for example the BAR 4 of PF is NULL, while BAR 4 of VF is not.
This code makes sure hw->mq_cfg is a valid address.
I am planning a optimization to check parameter consistent at init phase.
For example, if hardware does not support HW-assist live migration, we cannot use parameter like "sw-live-migration=0".
> Thanks,
> Chenbo
>
> > +
> > if (hw->common_cfg == NULL || hw->notify_base == NULL ||
> > hw->isr == NULL || hw->dev_cfg == NULL) {
> > DEBUGOUT("capability incomplete\n"); diff --git
> > a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.h index
> > 7ede738..ad505f1 100644
> > --- a/drivers/vdpa/ifc/base/ifcvf.h
> > +++ b/drivers/vdpa/ifc/base/ifcvf.h
> > @@ -50,6 +50,7 @@
> >
> > #define IFCVF_LM_CFG_SIZE 0x40
> > #define IFCVF_LM_RING_STATE_OFFSET 0x20
> > +#define IFCVF_MQ_OFFSET 0x28
> >
> > #define IFCVF_LM_LOGGING_CTRL 0x0
> >
> > @@ -149,6 +150,7 @@ struct ifcvf_hw {
> > u16 *notify_base;
> > u16 *notify_addr[IFCVF_MAX_QUEUES * 2];
> > u8 *lm_cfg;
> > + u8 *mq_cfg;
> > struct vring_info vring[IFCVF_MAX_QUEUES * 2];
> > u8 nr_vring;
> > int device_type;
> > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 61d0250..2d165c0 100644
> > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > @@ -1248,6 +1248,7 @@ struct rte_vdpa_dev_info {
> > 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \
> > 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | \
> > 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | \
> > + 1ULL << VHOST_USER_PROTOCOL_F_MQ | \
> > 1ULL << VHOST_USER_PROTOCOL_F_STATUS)
> >
> > #define VDPA_BLK_PROTOCOL_FEATURES \
> > --
> > 1.8.3.1
@@ -90,6 +90,11 @@
if (!hw->lm_cfg)
WARNINGOUT("HW support live migration not support!\n");
+ if (hw->mem_resource[4].addr)
+ hw->mq_cfg = hw->mem_resource[4].addr + IFCVF_MQ_OFFSET;
+ else
+ hw->mq_cfg = NULL;
+
if (hw->common_cfg == NULL || hw->notify_base == NULL ||
hw->isr == NULL || hw->dev_cfg == NULL) {
DEBUGOUT("capability incomplete\n");
@@ -50,6 +50,7 @@
#define IFCVF_LM_CFG_SIZE 0x40
#define IFCVF_LM_RING_STATE_OFFSET 0x20
+#define IFCVF_MQ_OFFSET 0x28
#define IFCVF_LM_LOGGING_CTRL 0x0
@@ -149,6 +150,7 @@ struct ifcvf_hw {
u16 *notify_base;
u16 *notify_addr[IFCVF_MAX_QUEUES * 2];
u8 *lm_cfg;
+ u8 *mq_cfg;
struct vring_info vring[IFCVF_MAX_QUEUES * 2];
u8 nr_vring;
int device_type;
@@ -1248,6 +1248,7 @@ struct rte_vdpa_dev_info {
1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \
1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | \
1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | \
+ 1ULL << VHOST_USER_PROTOCOL_F_MQ | \
1ULL << VHOST_USER_PROTOCOL_F_STATUS)
#define VDPA_BLK_PROTOCOL_FEATURES \