[v8,02/13] vhost: add vDPA ops for blk device

Message ID 1652876035-70513-3-git-send-email-andy.pei@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series add virtio_blk device support to vdpa/ifc |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pei, Andy May 18, 2022, 12:13 p.m. UTC
  Get_config and set_config are necessary ops for blk device.
Add get_config and set_config ops to vDPA ops.

Signed-off-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/vdpa_driver.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
  

Comments

Chenbo Xia May 23, 2022, 3:46 a.m. UTC | #1
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Wednesday, May 18, 2022 8:14 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>; Xu,
> Rosen <rosen.xu@intel.com>; Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: [PATCH v8 02/13] vhost: add vDPA ops for blk device
> 
> Get_config and set_config are necessary ops for blk device.
> Add get_config and set_config ops to vDPA ops.
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/vhost/vdpa_driver.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h
> index 88138be..e59a834 100644
> --- a/lib/vhost/vdpa_driver.h
> +++ b/lib/vhost/vdpa_driver.h
> @@ -72,8 +72,12 @@ struct rte_vdpa_dev_ops {
>  	/** Reset statistics of the queue */
>  	int (*reset_stats)(struct rte_vdpa_device *dev, int qid);
> 
> -	/** Reserved for future extension */
> -	void *reserved[2];
> +	/** Get the device configuration space */
> +	int (*get_config)(int vid, uint8_t *config, uint32_t len);

One suggestion is renaming 'len' to 'size' to make it aligned to set_config.

With above fixed:

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

> +
> +	/** Set the device configuration space */
> +	int (*set_config)(int vid, uint8_t *config, uint32_t offset,
> +		      uint32_t size, uint32_t flags);
>  };
> 
>  /**
> --
> 1.8.3.1
  
Pei, Andy May 23, 2022, 4:38 a.m. UTC | #2
Hi Chenbo,

Thanks for your reply, I will send out a new version to address this.

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Monday, May 23, 2022 11:46 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>; Xu, Rosen <rosen.xu@intel.com>;
> Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: RE: [PATCH v8 02/13] vhost: add vDPA ops for blk device
> 
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Wednesday, May 18, 2022 8:14 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>; Xu, Rosen <rosen.xu@intel.com>; Xiao,
> > QimaiX <qimaix.xiao@intel.com>
> > Subject: [PATCH v8 02/13] vhost: add vDPA ops for blk device
> >
> > Get_config and set_config are necessary ops for blk device.
> > Add get_config and set_config ops to vDPA ops.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> > ---
> >  lib/vhost/vdpa_driver.h | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h index
> > 88138be..e59a834 100644
> > --- a/lib/vhost/vdpa_driver.h
> > +++ b/lib/vhost/vdpa_driver.h
> > @@ -72,8 +72,12 @@ struct rte_vdpa_dev_ops {
> >  	/** Reset statistics of the queue */
> >  	int (*reset_stats)(struct rte_vdpa_device *dev, int qid);
> >
> > -	/** Reserved for future extension */
> > -	void *reserved[2];
> > +	/** Get the device configuration space */
> > +	int (*get_config)(int vid, uint8_t *config, uint32_t len);
> 
> One suggestion is renaming 'len' to 'size' to make it aligned to set_config.
> 
> With above fixed:
> 
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
> 
> > +
> > +	/** Set the device configuration space */
> > +	int (*set_config)(int vid, uint8_t *config, uint32_t offset,
> > +		      uint32_t size, uint32_t flags);
> >  };
> >
> >  /**
> > --
> > 1.8.3.1
  

Patch

diff --git a/lib/vhost/vdpa_driver.h b/lib/vhost/vdpa_driver.h
index 88138be..e59a834 100644
--- a/lib/vhost/vdpa_driver.h
+++ b/lib/vhost/vdpa_driver.h
@@ -72,8 +72,12 @@  struct rte_vdpa_dev_ops {
 	/** Reset statistics of the queue */
 	int (*reset_stats)(struct rte_vdpa_device *dev, int qid);
 
-	/** Reserved for future extension */
-	void *reserved[2];
+	/** Get the device configuration space */
+	int (*get_config)(int vid, uint8_t *config, uint32_t len);
+
+	/** Set the device configuration space */
+	int (*set_config)(int vid, uint8_t *config, uint32_t offset,
+		      uint32_t size, uint32_t flags);
 };
 
 /**