DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] vhost: add config change slave msg support
@ 2019-12-04  5:01 Li Feng
  0 siblings, 0 replies; 7+ messages in thread
From: Li Feng @ 2019-12-04  5:01 UTC (permalink / raw)
  To: Maxime Coquelin, Tiwei Bie, Zhihong Wang; +Cc: dev, Li Feng

This msg is used to notify qemu that should get the config of backend.

For example, vhost-user-blk uses this msg to notify guest os the
compacity of backend has changed.

Signed-off-by: Li Feng <fengli@smartx.com>
---
v2:
* Fix a little log typo.

 lib/librte_vhost/vhost_user.c | 31 +++++++++++++++++++++++++++++++
 lib/librte_vhost/vhost_user.h |  2 ++
 2 files changed, 33 insertions(+)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 0cfb8b792..10f2e47d5 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2840,6 +2840,37 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
 	return 0;
 }
 
+static int
+vhost_user_slave_config_change(struct virtio_net *dev)
+{
+	int ret;
+	struct VhostUserMsg msg = {
+		.request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
+		.flags = VHOST_USER_VERSION,
+		.size = 0,
+	};
+
+	ret = send_vhost_message(dev->slave_req_fd, &msg);
+	if (ret < 0) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+				"Failed to send config change (%d)\n",
+				ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+rte_vhost_user_slave_config_change(int vid)
+{
+	struct virtio_net *dev;
+	dev = get_device(vid);
+	if (!dev)
+		return -ENODEV;
+	return vhost_user_slave_config_change(dev);
+}
+
 static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
 						    int index, int fd,
 						    uint64_t offset,
diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h
index 6563f7315..5c1bb2138 100644
--- a/lib/librte_vhost/vhost_user.h
+++ b/lib/librte_vhost/vhost_user.h
@@ -62,6 +62,7 @@ typedef enum VhostUserRequest {
 typedef enum VhostUserSlaveRequest {
 	VHOST_USER_SLAVE_NONE = 0,
 	VHOST_USER_SLAVE_IOTLB_MSG = 1,
+	VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
 	VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
 	VHOST_USER_SLAVE_MAX
 } VhostUserSlaveRequest;
@@ -158,6 +159,7 @@ typedef struct VhostUserMsg {
 /* vhost_user.c */
 int vhost_user_msg_handler(int vid, int fd);
 int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm);
+int rte_vhost_user_slave_config_change(int vid);
 
 /* socket.c */
 int read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
-- 
2.11.0


-- 
The SmartX email address is only for business purpose. Any sent message 
that is not related to the business is not authorized or permitted by 
SmartX.
本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: add config change slave msg support
  2019-12-05  4:01         ` Li Feng
@ 2019-12-05  4:57           ` Tiwei Bie
  0 siblings, 0 replies; 7+ messages in thread
From: Tiwei Bie @ 2019-12-05  4:57 UTC (permalink / raw)
  To: Li Feng; +Cc: Maxime Coquelin, Zhihong Wang, dev

On Thu, Dec 05, 2019 at 12:01:55PM +0800, Li Feng wrote:
> Tiwei Bie <tiwei.bie@intel.com> 于2019年12月5日周四 上午10:06写道:
> > On Wed, Dec 04, 2019 at 05:43:50PM +0800, Li Feng wrote:
> > > Hi Tiwei,
> > > Thanks for your reply.
> > > Yes, this new API currently is for vhost-user-blk in the SPDK project.
> >
> > I see. Thanks for the clarification.
> > In this case, it should be declared in rte_vhost.h instead
> > of vhost_user.h which is an internal header. And the symbol
> > should be added to rte_vhost_version.map as well.
> >
> OK,  one more question, should I add `__rte_experimental` tag before
> the declare?

Yeah.

> 
> > >
> > > There is a patch in SPDK to use this API.
> >
> > Could you share the link to the SPDK patch?
> >
> The patch is here:
> https://review.gerrithub.io/c/spdk/spdk/+/476704

Thanks for the link. Will take a closer look.

Thanks,
Tiwei

> 
> Thanks.
> Feng Li
> 
> > Thanks,
> > Tiwei
> >
> > >
> > > Thanks,
> > >
> > > Feng Li
> > >
> > > Tiwei Bie <tiwei.bie@intel.com> 于2019年12月4日周三 下午5:30写道:
> > > >
> > > > On Wed, Dec 04, 2019 at 01:13:20PM +0800, Li Feng wrote:
> > > > > This msg is used to notify qemu that should get the config of backend.
> > > > >
> > > > > For example, vhost-user-blk uses this msg to notify guest os the
> > > > > compacity of backend has changed.
> > > > >
> > > > > Signed-off-by: Li Feng <fengli@smartx.com>
> > > > > ---
> > > > > v2:
> > > > > * Fix a little log typo.
> > > > >
> > > > >  lib/librte_vhost/vhost_user.c | 31 +++++++++++++++++++++++++++++++
> > > > >  lib/librte_vhost/vhost_user.h |  2 ++
> > > > >  2 files changed, 33 insertions(+)
> > > > >
> > > > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> > > > > index 0cfb8b792..10f2e47d5 100644
> > > > > --- a/lib/librte_vhost/vhost_user.c
> > > > > +++ b/lib/librte_vhost/vhost_user.c
> > > > > @@ -2840,6 +2840,37 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
> > > > >       return 0;
> > > > >  }
> > > > >
> > > > > +static int
> > > > > +vhost_user_slave_config_change(struct virtio_net *dev)
> > > > > +{
> > > > > +     int ret;
> > > > > +     struct VhostUserMsg msg = {
> > > > > +             .request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
> > > > > +             .flags = VHOST_USER_VERSION,
> > > > > +             .size = 0,
> > > > > +     };
> > > > > +
> > > > > +     ret = send_vhost_message(dev->slave_req_fd, &msg);
> > > > > +     if (ret < 0) {
> > > > > +             RTE_LOG(ERR, VHOST_CONFIG,
> > > > > +                             "Failed to send config change (%d)\n",
> > > > > +                             ret);
> > > > > +             return ret;
> > > > > +     }
> > > > > +
> > > > > +     return 0;
> > > > > +}
> > > > > +
> > > > > +int
> > > > > +rte_vhost_user_slave_config_change(int vid)
> > > > > +{
> > > > > +     struct virtio_net *dev;
> > > > > +     dev = get_device(vid);
> > > > > +     if (!dev)
> > > > > +             return -ENODEV;
> > > > > +     return vhost_user_slave_config_change(dev);
> > > > > +}
> > > > > +
> > > > >  static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
> > > > >                                                   int index, int fd,
> > > > >                                                   uint64_t offset,
> > > > > diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h
> > > > > index 6563f7315..5c1bb2138 100644
> > > > > --- a/lib/librte_vhost/vhost_user.h
> > > > > +++ b/lib/librte_vhost/vhost_user.h
> > > > > @@ -62,6 +62,7 @@ typedef enum VhostUserRequest {
> > > > >  typedef enum VhostUserSlaveRequest {
> > > > >       VHOST_USER_SLAVE_NONE = 0,
> > > > >       VHOST_USER_SLAVE_IOTLB_MSG = 1,
> > > > > +     VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
> > > > >       VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
> > > > >       VHOST_USER_SLAVE_MAX
> > > > >  } VhostUserSlaveRequest;
> > > > > @@ -158,6 +159,7 @@ typedef struct VhostUserMsg {
> > > > >  /* vhost_user.c */
> > > > >  int vhost_user_msg_handler(int vid, int fd);
> > > > >  int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm);
> > > > > +int rte_vhost_user_slave_config_change(int vid);
> > > >
> > > > This is supposed to be an API for external backends?
> > > >
> > > > Thanks,
> > > > Tiwei
> > > >
> > > > >
> > > > >  /* socket.c */
> > > > >  int read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
> > > > > --
> > > > > 2.11.0
> > > > >
> > > > >
> > > > > --
> > > > > The SmartX email address is only for business purpose. Any sent message
> > > > > that is not related to the business is not authorized or permitted by
> > > > > SmartX.
> > > > > 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> > > > >
> > > > >
> > >
> > > --
> > > The SmartX email address is only for business purpose. Any sent message
> > > that is not related to the business is not authorized or permitted by
> > > SmartX.
> > > 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> > >
> > >
> 
> -- 
> The SmartX email address is only for business purpose. Any sent message 
> that is not related to the business is not authorized or permitted by 
> SmartX.
> 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: add config change slave msg support
  2019-12-05  2:07       ` Tiwei Bie
@ 2019-12-05  4:01         ` Li Feng
  2019-12-05  4:57           ` Tiwei Bie
  0 siblings, 1 reply; 7+ messages in thread
From: Li Feng @ 2019-12-05  4:01 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: Maxime Coquelin, Zhihong Wang, dev

Tiwei Bie <tiwei.bie@intel.com> 于2019年12月5日周四 上午10:06写道:
>
> On Wed, Dec 04, 2019 at 05:43:50PM +0800, Li Feng wrote:
> > Hi Tiwei,
> > Thanks for your reply.
> > Yes, this new API currently is for vhost-user-blk in the SPDK project.
>
> I see. Thanks for the clarification.
> In this case, it should be declared in rte_vhost.h instead
> of vhost_user.h which is an internal header. And the symbol
> should be added to rte_vhost_version.map as well.
>
OK,  one more question, should I add `__rte_experimental` tag before
the declare?

> >
> > There is a patch in SPDK to use this API.
>
> Could you share the link to the SPDK patch?
>
The patch is here:
https://review.gerrithub.io/c/spdk/spdk/+/476704

Thanks.
Feng Li

> Thanks,
> Tiwei
>
> >
> > Thanks,
> >
> > Feng Li
> >
> > Tiwei Bie <tiwei.bie@intel.com> 于2019年12月4日周三 下午5:30写道:
> > >
> > > On Wed, Dec 04, 2019 at 01:13:20PM +0800, Li Feng wrote:
> > > > This msg is used to notify qemu that should get the config of backend.
> > > >
> > > > For example, vhost-user-blk uses this msg to notify guest os the
> > > > compacity of backend has changed.
> > > >
> > > > Signed-off-by: Li Feng <fengli@smartx.com>
> > > > ---
> > > > v2:
> > > > * Fix a little log typo.
> > > >
> > > >  lib/librte_vhost/vhost_user.c | 31 +++++++++++++++++++++++++++++++
> > > >  lib/librte_vhost/vhost_user.h |  2 ++
> > > >  2 files changed, 33 insertions(+)
> > > >
> > > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> > > > index 0cfb8b792..10f2e47d5 100644
> > > > --- a/lib/librte_vhost/vhost_user.c
> > > > +++ b/lib/librte_vhost/vhost_user.c
> > > > @@ -2840,6 +2840,37 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
> > > >       return 0;
> > > >  }
> > > >
> > > > +static int
> > > > +vhost_user_slave_config_change(struct virtio_net *dev)
> > > > +{
> > > > +     int ret;
> > > > +     struct VhostUserMsg msg = {
> > > > +             .request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
> > > > +             .flags = VHOST_USER_VERSION,
> > > > +             .size = 0,
> > > > +     };
> > > > +
> > > > +     ret = send_vhost_message(dev->slave_req_fd, &msg);
> > > > +     if (ret < 0) {
> > > > +             RTE_LOG(ERR, VHOST_CONFIG,
> > > > +                             "Failed to send config change (%d)\n",
> > > > +                             ret);
> > > > +             return ret;
> > > > +     }
> > > > +
> > > > +     return 0;
> > > > +}
> > > > +
> > > > +int
> > > > +rte_vhost_user_slave_config_change(int vid)
> > > > +{
> > > > +     struct virtio_net *dev;
> > > > +     dev = get_device(vid);
> > > > +     if (!dev)
> > > > +             return -ENODEV;
> > > > +     return vhost_user_slave_config_change(dev);
> > > > +}
> > > > +
> > > >  static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
> > > >                                                   int index, int fd,
> > > >                                                   uint64_t offset,
> > > > diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h
> > > > index 6563f7315..5c1bb2138 100644
> > > > --- a/lib/librte_vhost/vhost_user.h
> > > > +++ b/lib/librte_vhost/vhost_user.h
> > > > @@ -62,6 +62,7 @@ typedef enum VhostUserRequest {
> > > >  typedef enum VhostUserSlaveRequest {
> > > >       VHOST_USER_SLAVE_NONE = 0,
> > > >       VHOST_USER_SLAVE_IOTLB_MSG = 1,
> > > > +     VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
> > > >       VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
> > > >       VHOST_USER_SLAVE_MAX
> > > >  } VhostUserSlaveRequest;
> > > > @@ -158,6 +159,7 @@ typedef struct VhostUserMsg {
> > > >  /* vhost_user.c */
> > > >  int vhost_user_msg_handler(int vid, int fd);
> > > >  int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm);
> > > > +int rte_vhost_user_slave_config_change(int vid);
> > >
> > > This is supposed to be an API for external backends?
> > >
> > > Thanks,
> > > Tiwei
> > >
> > > >
> > > >  /* socket.c */
> > > >  int read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
> > > > --
> > > > 2.11.0
> > > >
> > > >
> > > > --
> > > > The SmartX email address is only for business purpose. Any sent message
> > > > that is not related to the business is not authorized or permitted by
> > > > SmartX.
> > > > 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> > > >
> > > >
> >
> > --
> > The SmartX email address is only for business purpose. Any sent message
> > that is not related to the business is not authorized or permitted by
> > SmartX.
> > 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> >
> >

-- 
The SmartX email address is only for business purpose. Any sent message 
that is not related to the business is not authorized or permitted by 
SmartX.
本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: add config change slave msg support
  2019-12-04  9:43     ` Li Feng
@ 2019-12-05  2:07       ` Tiwei Bie
  2019-12-05  4:01         ` Li Feng
  0 siblings, 1 reply; 7+ messages in thread
From: Tiwei Bie @ 2019-12-05  2:07 UTC (permalink / raw)
  To: Li Feng; +Cc: Maxime Coquelin, Zhihong Wang, dev

On Wed, Dec 04, 2019 at 05:43:50PM +0800, Li Feng wrote:
> Hi Tiwei,
> Thanks for your reply.
> Yes, this new API currently is for vhost-user-blk in the SPDK project.

I see. Thanks for the clarification.
In this case, it should be declared in rte_vhost.h instead
of vhost_user.h which is an internal header. And the symbol
should be added to rte_vhost_version.map as well.

> 
> There is a patch in SPDK to use this API.

Could you share the link to the SPDK patch?

Thanks,
Tiwei

> 
> Thanks,
> 
> Feng Li
> 
> Tiwei Bie <tiwei.bie@intel.com> 于2019年12月4日周三 下午5:30写道:
> >
> > On Wed, Dec 04, 2019 at 01:13:20PM +0800, Li Feng wrote:
> > > This msg is used to notify qemu that should get the config of backend.
> > >
> > > For example, vhost-user-blk uses this msg to notify guest os the
> > > compacity of backend has changed.
> > >
> > > Signed-off-by: Li Feng <fengli@smartx.com>
> > > ---
> > > v2:
> > > * Fix a little log typo.
> > >
> > >  lib/librte_vhost/vhost_user.c | 31 +++++++++++++++++++++++++++++++
> > >  lib/librte_vhost/vhost_user.h |  2 ++
> > >  2 files changed, 33 insertions(+)
> > >
> > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> > > index 0cfb8b792..10f2e47d5 100644
> > > --- a/lib/librte_vhost/vhost_user.c
> > > +++ b/lib/librte_vhost/vhost_user.c
> > > @@ -2840,6 +2840,37 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
> > >       return 0;
> > >  }
> > >
> > > +static int
> > > +vhost_user_slave_config_change(struct virtio_net *dev)
> > > +{
> > > +     int ret;
> > > +     struct VhostUserMsg msg = {
> > > +             .request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
> > > +             .flags = VHOST_USER_VERSION,
> > > +             .size = 0,
> > > +     };
> > > +
> > > +     ret = send_vhost_message(dev->slave_req_fd, &msg);
> > > +     if (ret < 0) {
> > > +             RTE_LOG(ERR, VHOST_CONFIG,
> > > +                             "Failed to send config change (%d)\n",
> > > +                             ret);
> > > +             return ret;
> > > +     }
> > > +
> > > +     return 0;
> > > +}
> > > +
> > > +int
> > > +rte_vhost_user_slave_config_change(int vid)
> > > +{
> > > +     struct virtio_net *dev;
> > > +     dev = get_device(vid);
> > > +     if (!dev)
> > > +             return -ENODEV;
> > > +     return vhost_user_slave_config_change(dev);
> > > +}
> > > +
> > >  static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
> > >                                                   int index, int fd,
> > >                                                   uint64_t offset,
> > > diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h
> > > index 6563f7315..5c1bb2138 100644
> > > --- a/lib/librte_vhost/vhost_user.h
> > > +++ b/lib/librte_vhost/vhost_user.h
> > > @@ -62,6 +62,7 @@ typedef enum VhostUserRequest {
> > >  typedef enum VhostUserSlaveRequest {
> > >       VHOST_USER_SLAVE_NONE = 0,
> > >       VHOST_USER_SLAVE_IOTLB_MSG = 1,
> > > +     VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
> > >       VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
> > >       VHOST_USER_SLAVE_MAX
> > >  } VhostUserSlaveRequest;
> > > @@ -158,6 +159,7 @@ typedef struct VhostUserMsg {
> > >  /* vhost_user.c */
> > >  int vhost_user_msg_handler(int vid, int fd);
> > >  int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm);
> > > +int rte_vhost_user_slave_config_change(int vid);
> >
> > This is supposed to be an API for external backends?
> >
> > Thanks,
> > Tiwei
> >
> > >
> > >  /* socket.c */
> > >  int read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
> > > --
> > > 2.11.0
> > >
> > >
> > > --
> > > The SmartX email address is only for business purpose. Any sent message
> > > that is not related to the business is not authorized or permitted by
> > > SmartX.
> > > 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> > >
> > >
> 
> -- 
> The SmartX email address is only for business purpose. Any sent message 
> that is not related to the business is not authorized or permitted by 
> SmartX.
> 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: add config change slave msg support
  2019-12-04  9:30   ` Tiwei Bie
@ 2019-12-04  9:43     ` Li Feng
  2019-12-05  2:07       ` Tiwei Bie
  0 siblings, 1 reply; 7+ messages in thread
From: Li Feng @ 2019-12-04  9:43 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: Maxime Coquelin, Zhihong Wang, dev

Hi Tiwei,
Thanks for your reply.
Yes, this new API currently is for vhost-user-blk in the SPDK project.

There is a patch in SPDK to use this API.

Thanks,

Feng Li

Tiwei Bie <tiwei.bie@intel.com> 于2019年12月4日周三 下午5:30写道:
>
> On Wed, Dec 04, 2019 at 01:13:20PM +0800, Li Feng wrote:
> > This msg is used to notify qemu that should get the config of backend.
> >
> > For example, vhost-user-blk uses this msg to notify guest os the
> > compacity of backend has changed.
> >
> > Signed-off-by: Li Feng <fengli@smartx.com>
> > ---
> > v2:
> > * Fix a little log typo.
> >
> >  lib/librte_vhost/vhost_user.c | 31 +++++++++++++++++++++++++++++++
> >  lib/librte_vhost/vhost_user.h |  2 ++
> >  2 files changed, 33 insertions(+)
> >
> > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> > index 0cfb8b792..10f2e47d5 100644
> > --- a/lib/librte_vhost/vhost_user.c
> > +++ b/lib/librte_vhost/vhost_user.c
> > @@ -2840,6 +2840,37 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
> >       return 0;
> >  }
> >
> > +static int
> > +vhost_user_slave_config_change(struct virtio_net *dev)
> > +{
> > +     int ret;
> > +     struct VhostUserMsg msg = {
> > +             .request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
> > +             .flags = VHOST_USER_VERSION,
> > +             .size = 0,
> > +     };
> > +
> > +     ret = send_vhost_message(dev->slave_req_fd, &msg);
> > +     if (ret < 0) {
> > +             RTE_LOG(ERR, VHOST_CONFIG,
> > +                             "Failed to send config change (%d)\n",
> > +                             ret);
> > +             return ret;
> > +     }
> > +
> > +     return 0;
> > +}
> > +
> > +int
> > +rte_vhost_user_slave_config_change(int vid)
> > +{
> > +     struct virtio_net *dev;
> > +     dev = get_device(vid);
> > +     if (!dev)
> > +             return -ENODEV;
> > +     return vhost_user_slave_config_change(dev);
> > +}
> > +
> >  static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
> >                                                   int index, int fd,
> >                                                   uint64_t offset,
> > diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h
> > index 6563f7315..5c1bb2138 100644
> > --- a/lib/librte_vhost/vhost_user.h
> > +++ b/lib/librte_vhost/vhost_user.h
> > @@ -62,6 +62,7 @@ typedef enum VhostUserRequest {
> >  typedef enum VhostUserSlaveRequest {
> >       VHOST_USER_SLAVE_NONE = 0,
> >       VHOST_USER_SLAVE_IOTLB_MSG = 1,
> > +     VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
> >       VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
> >       VHOST_USER_SLAVE_MAX
> >  } VhostUserSlaveRequest;
> > @@ -158,6 +159,7 @@ typedef struct VhostUserMsg {
> >  /* vhost_user.c */
> >  int vhost_user_msg_handler(int vid, int fd);
> >  int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm);
> > +int rte_vhost_user_slave_config_change(int vid);
>
> This is supposed to be an API for external backends?
>
> Thanks,
> Tiwei
>
> >
> >  /* socket.c */
> >  int read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
> > --
> > 2.11.0
> >
> >
> > --
> > The SmartX email address is only for business purpose. Any sent message
> > that is not related to the business is not authorized or permitted by
> > SmartX.
> > 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> >
> >

-- 
The SmartX email address is only for business purpose. Any sent message 
that is not related to the business is not authorized or permitted by 
SmartX.
本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: add config change slave msg support
  2019-12-04  5:13 ` [dpdk-dev] [PATCH v2] " Li Feng
@ 2019-12-04  9:30   ` Tiwei Bie
  2019-12-04  9:43     ` Li Feng
  0 siblings, 1 reply; 7+ messages in thread
From: Tiwei Bie @ 2019-12-04  9:30 UTC (permalink / raw)
  To: Li Feng; +Cc: Maxime Coquelin, Zhihong Wang, dev

On Wed, Dec 04, 2019 at 01:13:20PM +0800, Li Feng wrote:
> This msg is used to notify qemu that should get the config of backend.
> 
> For example, vhost-user-blk uses this msg to notify guest os the
> compacity of backend has changed.
> 
> Signed-off-by: Li Feng <fengli@smartx.com>
> ---
> v2:
> * Fix a little log typo.
> 
>  lib/librte_vhost/vhost_user.c | 31 +++++++++++++++++++++++++++++++
>  lib/librte_vhost/vhost_user.h |  2 ++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 0cfb8b792..10f2e47d5 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -2840,6 +2840,37 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
>  	return 0;
>  }
>  
> +static int
> +vhost_user_slave_config_change(struct virtio_net *dev)
> +{
> +	int ret;
> +	struct VhostUserMsg msg = {
> +		.request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
> +		.flags = VHOST_USER_VERSION,
> +		.size = 0,
> +	};
> +
> +	ret = send_vhost_message(dev->slave_req_fd, &msg);
> +	if (ret < 0) {
> +		RTE_LOG(ERR, VHOST_CONFIG,
> +				"Failed to send config change (%d)\n",
> +				ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +int
> +rte_vhost_user_slave_config_change(int vid)
> +{
> +	struct virtio_net *dev;
> +	dev = get_device(vid);
> +	if (!dev)
> +		return -ENODEV;
> +	return vhost_user_slave_config_change(dev);
> +}
> +
>  static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
>  						    int index, int fd,
>  						    uint64_t offset,
> diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h
> index 6563f7315..5c1bb2138 100644
> --- a/lib/librte_vhost/vhost_user.h
> +++ b/lib/librte_vhost/vhost_user.h
> @@ -62,6 +62,7 @@ typedef enum VhostUserRequest {
>  typedef enum VhostUserSlaveRequest {
>  	VHOST_USER_SLAVE_NONE = 0,
>  	VHOST_USER_SLAVE_IOTLB_MSG = 1,
> +	VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
>  	VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
>  	VHOST_USER_SLAVE_MAX
>  } VhostUserSlaveRequest;
> @@ -158,6 +159,7 @@ typedef struct VhostUserMsg {
>  /* vhost_user.c */
>  int vhost_user_msg_handler(int vid, int fd);
>  int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm);
> +int rte_vhost_user_slave_config_change(int vid);

This is supposed to be an API for external backends?

Thanks,
Tiwei

>  
>  /* socket.c */
>  int read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
> -- 
> 2.11.0
> 
> 
> -- 
> The SmartX email address is only for business purpose. Any sent message 
> that is not related to the business is not authorized or permitted by 
> SmartX.
> 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v2] vhost: add config change slave msg support
  2019-12-02 14:57 [dpdk-dev] [PATCH] " Li Feng
@ 2019-12-04  5:13 ` Li Feng
  2019-12-04  9:30   ` Tiwei Bie
  0 siblings, 1 reply; 7+ messages in thread
From: Li Feng @ 2019-12-04  5:13 UTC (permalink / raw)
  To: Maxime Coquelin, Tiwei Bie, Zhihong Wang; +Cc: dev, Li Feng

This msg is used to notify qemu that should get the config of backend.

For example, vhost-user-blk uses this msg to notify guest os the
compacity of backend has changed.

Signed-off-by: Li Feng <fengli@smartx.com>
---
v2:
* Fix a little log typo.

 lib/librte_vhost/vhost_user.c | 31 +++++++++++++++++++++++++++++++
 lib/librte_vhost/vhost_user.h |  2 ++
 2 files changed, 33 insertions(+)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 0cfb8b792..10f2e47d5 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2840,6 +2840,37 @@ vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
 	return 0;
 }
 
+static int
+vhost_user_slave_config_change(struct virtio_net *dev)
+{
+	int ret;
+	struct VhostUserMsg msg = {
+		.request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
+		.flags = VHOST_USER_VERSION,
+		.size = 0,
+	};
+
+	ret = send_vhost_message(dev->slave_req_fd, &msg);
+	if (ret < 0) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+				"Failed to send config change (%d)\n",
+				ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+rte_vhost_user_slave_config_change(int vid)
+{
+	struct virtio_net *dev;
+	dev = get_device(vid);
+	if (!dev)
+		return -ENODEV;
+	return vhost_user_slave_config_change(dev);
+}
+
 static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
 						    int index, int fd,
 						    uint64_t offset,
diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h
index 6563f7315..5c1bb2138 100644
--- a/lib/librte_vhost/vhost_user.h
+++ b/lib/librte_vhost/vhost_user.h
@@ -62,6 +62,7 @@ typedef enum VhostUserRequest {
 typedef enum VhostUserSlaveRequest {
 	VHOST_USER_SLAVE_NONE = 0,
 	VHOST_USER_SLAVE_IOTLB_MSG = 1,
+	VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
 	VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
 	VHOST_USER_SLAVE_MAX
 } VhostUserSlaveRequest;
@@ -158,6 +159,7 @@ typedef struct VhostUserMsg {
 /* vhost_user.c */
 int vhost_user_msg_handler(int vid, int fd);
 int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm);
+int rte_vhost_user_slave_config_change(int vid);
 
 /* socket.c */
 int read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
-- 
2.11.0


-- 
The SmartX email address is only for business purpose. Any sent message 
that is not related to the business is not authorized or permitted by 
SmartX.
本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-05  4:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04  5:01 [dpdk-dev] [PATCH v2] vhost: add config change slave msg support Li Feng
  -- strict thread matches above, loose matches on Subject: below --
2019-12-02 14:57 [dpdk-dev] [PATCH] " Li Feng
2019-12-04  5:13 ` [dpdk-dev] [PATCH v2] " Li Feng
2019-12-04  9:30   ` Tiwei Bie
2019-12-04  9:43     ` Li Feng
2019-12-05  2:07       ` Tiwei Bie
2019-12-05  4:01         ` Li Feng
2019-12-05  4:57           ` Tiwei Bie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).