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 <[email protected]>
> Sent: Thursday, May 12, 2022 9:41 PM
> To: Xia, Chenbo <[email protected]>; Pei, Andy <[email protected]>;
> [email protected]
> Cc: [email protected]; Cao, Gang <[email protected]>; Liu,
> Changpeng <[email protected]>
> Subject: RE: [PATCH v7 08/18] vdpa/ifc: add get device type ops to ifc driver
> 
> > -----Original Message-----
> > From: Xia, Chenbo <[email protected]>
> > Sent: Thursday, May 12, 2022 9:22 PM
> > To: Pei, Andy <[email protected]>; [email protected]
> > Cc: [email protected]; Cao, Gang <[email protected]>; Liu,
> > Changpeng <[email protected]>
> > Subject: RE: [PATCH v7 08/18] vdpa/ifc: add get device type ops to ifc
> > driver
> >
> > > -----Original Message-----
> > > From: Pei, Andy <[email protected]>
> > > Sent: Wednesday, April 27, 2022 4:30 PM
> > > To: [email protected]
> > > Cc: Xia, Chenbo <[email protected]>; [email protected];
> > > Cao, Gang <[email protected]>; Liu, Changpeng
> > > <[email protected]>
> > > 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 <[email protected]>
> > > ---
> > >  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
> 

Reply via email to