diff mbox series

[v7,15/18] vdpa/ifc: add is blk flag to ifcvf HW struct

Message ID 1651048206-282372-16-git-send-email-andy.pei@intel.com (mailing list archive)
State Superseded
Delegated to: Maxime Coquelin
Headers show
Series add virtio_blk device support to vdpa/ifc | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andy Pei April 27, 2022, 8:30 a.m. UTC
Add is_blk flag to ifcvf_hw, and init is_blk during probe.

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/vdpa/ifc/base/ifcvf.h | 1 +
 drivers/vdpa/ifc/ifcvf_vdpa.c | 2 ++
 2 files changed, 3 insertions(+)

Comments

Xia, Chenbo May 13, 2022, 2:55 a.m. UTC | #1
> -----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 15/18] vdpa/ifc: add is blk flag to ifcvf HW struct
> 
> Add is_blk flag to ifcvf_hw, and init is_blk during probe.
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  drivers/vdpa/ifc/base/ifcvf.h | 1 +
>  drivers/vdpa/ifc/ifcvf_vdpa.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.h
> index 769c603..8591ef1 100644
> --- a/drivers/vdpa/ifc/base/ifcvf.h
> +++ b/drivers/vdpa/ifc/base/ifcvf.h
> @@ -149,6 +149,7 @@ struct ifcvf_hw {
>  	u8     *lm_cfg;
>  	struct vring_info vring[IFCVF_MAX_QUEUES * 2];
>  	u8 nr_vring;
> +	u8 is_blk;
>  	struct ifcvf_pci_mem_resource mem_resource[IFCVF_PCI_MAX_RESOURCE];
>  };
> 
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 0e94e1f..4923bc1 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -1536,11 +1536,13 @@ struct rte_vdpa_dev_info dev_info[] = {
> 
>  	if (device_id == VIRTIO_ID_NET) {
>  		internal->device_type = IFCVF_NET;
> +		internal->hw.is_blk = IFCVF_NET;

I believe it's enough to keep only device_type. Device type can be defined in internal
or internal->hw. Choose the way you prefer.

Thanks,
Chenbo

>  		internal->features = features &
>  					~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
>  		internal->features |= dev_info[IFCVF_NET].features;
>  	} else if (device_id == VIRTIO_ID_BLOCK) {
>  		internal->device_type = IFCVF_BLK;
> +		internal->hw.is_blk = IFCVF_BLK;
>  		internal->features = features &
>  					~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
>  		internal->features |= dev_info[IFCVF_BLK].features;
> --
> 1.8.3.1
Andy Pei May 16, 2022, 3:05 a.m. UTC | #2
Hi Chenbo,

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Friday, May 13, 2022 10:55 AM
> 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 15/18] vdpa/ifc: add is blk flag to ifcvf HW struct
> 
> > -----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 15/18] vdpa/ifc: add is blk flag to ifcvf HW struct
> >
> > Add is_blk flag to ifcvf_hw, and init is_blk during probe.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> >  drivers/vdpa/ifc/base/ifcvf.h | 1 +
> >  drivers/vdpa/ifc/ifcvf_vdpa.c | 2 ++
> >  2 files changed, 3 insertions(+)
> >
> > diff --git a/drivers/vdpa/ifc/base/ifcvf.h
> > b/drivers/vdpa/ifc/base/ifcvf.h index 769c603..8591ef1 100644
> > --- a/drivers/vdpa/ifc/base/ifcvf.h
> > +++ b/drivers/vdpa/ifc/base/ifcvf.h
> > @@ -149,6 +149,7 @@ struct ifcvf_hw {
> >  	u8     *lm_cfg;
> >  	struct vring_info vring[IFCVF_MAX_QUEUES * 2];
> >  	u8 nr_vring;
> > +	u8 is_blk;
> >  	struct ifcvf_pci_mem_resource
> mem_resource[IFCVF_PCI_MAX_RESOURCE];
> >  };
> >
> > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 0e94e1f..4923bc1 100644
> > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > @@ -1536,11 +1536,13 @@ struct rte_vdpa_dev_info dev_info[] = {
> >
> >  	if (device_id == VIRTIO_ID_NET) {
> >  		internal->device_type = IFCVF_NET;
> > +		internal->hw.is_blk = IFCVF_NET;
> 
> I believe it's enough to keep only device_type. Device type can be defined in
> internal or internal->hw. Choose the way you prefer.
> 
> Thanks,
> Chenbo
> 
Yes, you are right. To keep API not changed, I think it is better to keep only device_type in internal->hw.
So I have to make some change to other patch in this patch set.

> >  		internal->features = features &
> >  					~(1ULL <<
> VIRTIO_F_IOMMU_PLATFORM);
> >  		internal->features |= dev_info[IFCVF_NET].features;
> >  	} else if (device_id == VIRTIO_ID_BLOCK) {
> >  		internal->device_type = IFCVF_BLK;
> > +		internal->hw.is_blk = IFCVF_BLK;
> >  		internal->features = features &
> >  					~(1ULL <<
> VIRTIO_F_IOMMU_PLATFORM);
> >  		internal->features |= dev_info[IFCVF_BLK].features;
> > --
> > 1.8.3.1
>
diff mbox series

Patch

diff --git a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.h
index 769c603..8591ef1 100644
--- a/drivers/vdpa/ifc/base/ifcvf.h
+++ b/drivers/vdpa/ifc/base/ifcvf.h
@@ -149,6 +149,7 @@  struct ifcvf_hw {
 	u8     *lm_cfg;
 	struct vring_info vring[IFCVF_MAX_QUEUES * 2];
 	u8 nr_vring;
+	u8 is_blk;
 	struct ifcvf_pci_mem_resource mem_resource[IFCVF_PCI_MAX_RESOURCE];
 };
 
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 0e94e1f..4923bc1 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -1536,11 +1536,13 @@  struct rte_vdpa_dev_info dev_info[] = {
 
 	if (device_id == VIRTIO_ID_NET) {
 		internal->device_type = IFCVF_NET;
+		internal->hw.is_blk = IFCVF_NET;
 		internal->features = features &
 					~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
 		internal->features |= dev_info[IFCVF_NET].features;
 	} else if (device_id == VIRTIO_ID_BLOCK) {
 		internal->device_type = IFCVF_BLK;
+		internal->hw.is_blk = IFCVF_BLK;
 		internal->features = features &
 					~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
 		internal->features |= dev_info[IFCVF_BLK].features;