[v7,08/18] vdpa/ifc: add get device type ops to ifc driver
Checks
Commit Message
Add get device type ops to ifc driver.
Signed-off-by: Andy Pei <andy.pei@intel.com>
---
drivers/vdpa/ifc/ifcvf_vdpa.c | 10 ++++++++++
1 file changed, 10 insertions(+)
Comments
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Wednesday, April 27, 2022 4:30 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Cao,
> Gang <gang.cao@intel.com>; Liu, Changpeng <changpeng.liu@intel.com>
> Subject: [PATCH v7 08/18] vdpa/ifc: add get device type ops to ifc driver
>
> Add get device type ops to ifc driver.
>
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
> drivers/vdpa/ifc/ifcvf_vdpa.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 8a260b7..99a6ab0 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -1300,6 +1300,15 @@ struct rte_vdpa_dev_info {
> return 0;
> }
>
> +static int
> +ifcvf_blk_get_device_type(struct rte_vdpa_device *vdev,
> + uint32_t *type)
> +{
> + RTE_SET_USED(vdev);
> + *type = VDPA_DEVICE_TYPE_BLK;
> + return 0;
This is not right. Remember net and blk are both using the driver?
This will lead to using net also returns BLK.
And I suggest the patch-set validated with both blk and net...
Besides, ifcvf_blk_get_device_type should be ifcvf_get_device_type
Thanks,
Chenbo
> +}
> +
> static struct rte_vdpa_dev_ops ifcvf_blk_ops = {
> .get_queue_num = ifcvf_get_queue_num,
> .get_features = ifcvf_get_vdpa_features,
> @@ -1313,6 +1322,7 @@ struct rte_vdpa_dev_info {
> .get_vfio_device_fd = ifcvf_get_vfio_device_fd,
> .get_notify_area = ifcvf_get_notify_area,
> .get_config = ifcvf_blk_get_config,
> + .get_dev_type = ifcvf_blk_get_device_type,
> };
>
> struct rte_vdpa_dev_info dev_info[] = {
> --
> 1.8.3.1
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Thursday, May 12, 2022 9:22 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>
> Subject: RE: [PATCH v7 08/18] vdpa/ifc: add get device type ops to ifc
> driver
>
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Wednesday, April 27, 2022 4:30 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Cao,
> > Gang <gang.cao@intel.com>; Liu, Changpeng <changpeng.liu@intel.com>
> > Subject: [PATCH v7 08/18] vdpa/ifc: add get device type ops to ifc
> driver
> >
> > Add get device type ops to ifc driver.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> > drivers/vdpa/ifc/ifcvf_vdpa.c | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > index 8a260b7..99a6ab0 100644
> > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > @@ -1300,6 +1300,15 @@ struct rte_vdpa_dev_info {
> > return 0;
> > }
> >
> > +static int
> > +ifcvf_blk_get_device_type(struct rte_vdpa_device *vdev,
> > + uint32_t *type)
> > +{
> > + RTE_SET_USED(vdev);
> > + *type = VDPA_DEVICE_TYPE_BLK;
> > + return 0;
>
> This is not right. Remember net and blk are both using the driver?
> This will lead to using net also returns BLK.
Correct a bit for above: will lead to net not working. So implement
callback for both (although in the API, NULL callback can return NET type)
Thanks,
Chenbo
>
> And I suggest the patch-set validated with both blk and net...
>
> Besides, ifcvf_blk_get_device_type should be ifcvf_get_device_type
>
> Thanks,
> Chenbo
>
> > +}
> > +
> > static struct rte_vdpa_dev_ops ifcvf_blk_ops = {
> > .get_queue_num = ifcvf_get_queue_num,
> > .get_features = ifcvf_get_vdpa_features,
> > @@ -1313,6 +1322,7 @@ struct rte_vdpa_dev_info {
> > .get_vfio_device_fd = ifcvf_get_vfio_device_fd,
> > .get_notify_area = ifcvf_get_notify_area,
> > .get_config = ifcvf_blk_get_config,
> > + .get_dev_type = ifcvf_blk_get_device_type,
> > };
> >
> > struct rte_vdpa_dev_info dev_info[] = {
> > --
> > 1.8.3.1
HI Chenbo,
Thanks for your reply.
I will implement a function "ifcvf_get_device_type" for both ifc net and blk ops.
"ifcvf_get_device_type" will return device type according to internal->device_type.
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Thursday, May 12, 2022 9:41 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>; Pei, Andy <andy.pei@intel.com>;
> dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>
> Subject: RE: [PATCH v7 08/18] vdpa/ifc: add get device type ops to ifc driver
>
> > -----Original Message-----
> > From: Xia, Chenbo <chenbo.xia@intel.com>
> > Sent: Thursday, May 12, 2022 9:22 PM
> > To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> > Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> > Changpeng <changpeng.liu@intel.com>
> > Subject: RE: [PATCH v7 08/18] vdpa/ifc: add get device type ops to ifc
> > driver
> >
> > > -----Original Message-----
> > > From: Pei, Andy <andy.pei@intel.com>
> > > Sent: Wednesday, April 27, 2022 4:30 PM
> > > To: dev@dpdk.org
> > > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > > Cao, Gang <gang.cao@intel.com>; Liu, Changpeng
> > > <changpeng.liu@intel.com>
> > > Subject: [PATCH v7 08/18] vdpa/ifc: add get device type ops to ifc
> > driver
> > >
> > > Add get device type ops to ifc driver.
> > >
> > > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > > ---
> > > drivers/vdpa/ifc/ifcvf_vdpa.c | 10 ++++++++++
> > > 1 file changed, 10 insertions(+)
> > >
> > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > index 8a260b7..99a6ab0 100644
> > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > @@ -1300,6 +1300,15 @@ struct rte_vdpa_dev_info {
> > > return 0;
> > > }
> > >
> > > +static int
> > > +ifcvf_blk_get_device_type(struct rte_vdpa_device *vdev,
> > > + uint32_t *type)
> > > +{
> > > + RTE_SET_USED(vdev);
> > > + *type = VDPA_DEVICE_TYPE_BLK;
> > > + return 0;
> >
> > This is not right. Remember net and blk are both using the driver?
> > This will lead to using net also returns BLK.
>
> Correct a bit for above: will lead to net not working. So implement callback
> for both (although in the API, NULL callback can return NET type)
>
> Thanks,
> Chenbo
>
> >
> > And I suggest the patch-set validated with both blk and net...
> >
> > Besides, ifcvf_blk_get_device_type should be ifcvf_get_device_type
> >
> > Thanks,
> > Chenbo
> >
> > > +}
> > > +
> > > static struct rte_vdpa_dev_ops ifcvf_blk_ops = {
> > > .get_queue_num = ifcvf_get_queue_num,
> > > .get_features = ifcvf_get_vdpa_features, @@ -1313,6 +1322,7 @@
> > > struct rte_vdpa_dev_info {
> > > .get_vfio_device_fd = ifcvf_get_vfio_device_fd,
> > > .get_notify_area = ifcvf_get_notify_area,
> > > .get_config = ifcvf_blk_get_config,
> > > + .get_dev_type = ifcvf_blk_get_device_type,
> > > };
> > >
> > > struct rte_vdpa_dev_info dev_info[] = {
> > > --
> > > 1.8.3.1
>
@@ -1300,6 +1300,15 @@ struct rte_vdpa_dev_info {
return 0;
}
+static int
+ifcvf_blk_get_device_type(struct rte_vdpa_device *vdev,
+ uint32_t *type)
+{
+ RTE_SET_USED(vdev);
+ *type = VDPA_DEVICE_TYPE_BLK;
+ return 0;
+}
+
static struct rte_vdpa_dev_ops ifcvf_blk_ops = {
.get_queue_num = ifcvf_get_queue_num,
.get_features = ifcvf_get_vdpa_features,
@@ -1313,6 +1322,7 @@ struct rte_vdpa_dev_info {
.get_vfio_device_fd = ifcvf_get_vfio_device_fd,
.get_notify_area = ifcvf_get_notify_area,
.get_config = ifcvf_blk_get_config,
+ .get_dev_type = ifcvf_blk_get_device_type,
};
struct rte_vdpa_dev_info dev_info[] = {