diff mbox series

[v1,06/10] vhsot_net: introduce set_config & get_config function

Message ID 20200622153756.19189-7-lulu@redhat.com (mailing list archive)
State New, archived
Headers show
Series vDPA support in qemu | expand

Commit Message

Cindy Lu June 22, 2020, 3:37 p.m. UTC
This patch introduces set_config & get_config  method which allows
vhost_net set/get the config to backend

Signed-off-by: Cindy Lu <lulu@redhat.com>
---
 hw/net/vhost_net.c      | 11 +++++++++++
 include/net/vhost_net.h |  5 +++++
 2 files changed, 16 insertions(+)

Comments

Jason Wang June 23, 2020, 7:18 a.m. UTC | #1
On 2020/6/22 下午11:37, Cindy Lu wrote:
> This patch introduces set_config & get_config  method which allows


One space is sufficient between get_config and method.


> vhost_net set/get the config to backend


Typo in the subject.


>
> Signed-off-by: Cindy Lu <lulu@redhat.com>
> ---
>   hw/net/vhost_net.c      | 11 +++++++++++
>   include/net/vhost_net.h |  5 +++++
>   2 files changed, 16 insertions(+)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 4096d64aaf..04cc3db264 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c

Is there any reason that making this net specific? I guess it could be 
used by other vhost devices as well.

Thanks


> @@ -111,6 +111,17 @@ uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
>               features);
>   }
>   
> +int vhost_net_get_config(struct vhost_net *net,  uint8_t *config,
> +                         uint32_t config_len)
> +{
> +    return vhost_dev_get_config(&net->dev, config, config_len);
> +}
> +int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
> +                         uint32_t offset, uint32_t size, uint32_t flags)
> +{
> +    return vhost_dev_set_config(&net->dev, data, offset, size, flags);
> +}
> +
>   void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
>   {
>       net->dev.acked_features = net->dev.backend_features;
> diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
> index 77e47398c4..abfb0e8e68 100644
> --- a/include/net/vhost_net.h
> +++ b/include/net/vhost_net.h
> @@ -27,6 +27,11 @@ void vhost_net_cleanup(VHostNetState *net);
>   
>   uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
>   void vhost_net_ack_features(VHostNetState *net, uint64_t features);
> +int vhost_net_get_config(struct vhost_net *net,  uint8_t *config,
> +                         uint32_t config_len);
> +
> +int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
> +                         uint32_t offset, uint32_t size, uint32_t flags);
>   
>   bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
>   void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
Cindy Lu June 23, 2020, 9:22 a.m. UTC | #2
On Tue, Jun 23, 2020 at 3:18 PM Jason Wang <jasowang@redhat.com> wrote:
>
>
> On 2020/6/22 下午11:37, Cindy Lu wrote:
> > This patch introduces set_config & get_config  method which allows
>
>
> One space is sufficient between get_config and method.
>
>
> > vhost_net set/get the config to backend
>
>
> Typo in the subject.
>
>
thanks jason, I will correct this
> >
> > Signed-off-by: Cindy Lu <lulu@redhat.com>
> > ---
> >   hw/net/vhost_net.c      | 11 +++++++++++
> >   include/net/vhost_net.h |  5 +++++
> >   2 files changed, 16 insertions(+)
> >
> > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> > index 4096d64aaf..04cc3db264 100644
> > --- a/hw/net/vhost_net.c
> > +++ b/hw/net/vhost_net.c
>
> Is there any reason that making this net specific? I guess it could be
> used by other vhost devices as well.
>
> Thanks
>
Thanks jason I will correct this
>
> > @@ -111,6 +111,17 @@ uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
> >               features);
> >   }
> >
> > +int vhost_net_get_config(struct vhost_net *net,  uint8_t *config,
> > +                         uint32_t config_len)
> > +{
> > +    return vhost_dev_get_config(&net->dev, config, config_len);
> > +}
> > +int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
> > +                         uint32_t offset, uint32_t size, uint32_t flags)
> > +{
> > +    return vhost_dev_set_config(&net->dev, data, offset, size, flags);
> > +}
> > +
> >   void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
> >   {
> >       net->dev.acked_features = net->dev.backend_features;
> > diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
> > index 77e47398c4..abfb0e8e68 100644
> > --- a/include/net/vhost_net.h
> > +++ b/include/net/vhost_net.h
> > @@ -27,6 +27,11 @@ void vhost_net_cleanup(VHostNetState *net);
> >
> >   uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
> >   void vhost_net_ack_features(VHostNetState *net, uint64_t features);
> > +int vhost_net_get_config(struct vhost_net *net,  uint8_t *config,
> > +                         uint32_t config_len);
> > +
> > +int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
> > +                         uint32_t offset, uint32_t size, uint32_t flags);
> >
> >   bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
> >   void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
>
diff mbox series

Patch

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 4096d64aaf..04cc3db264 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -111,6 +111,17 @@  uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
             features);
 }
 
+int vhost_net_get_config(struct vhost_net *net,  uint8_t *config,
+                         uint32_t config_len)
+{
+    return vhost_dev_get_config(&net->dev, config, config_len);
+}
+int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
+                         uint32_t offset, uint32_t size, uint32_t flags)
+{
+    return vhost_dev_set_config(&net->dev, data, offset, size, flags);
+}
+
 void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
 {
     net->dev.acked_features = net->dev.backend_features;
diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
index 77e47398c4..abfb0e8e68 100644
--- a/include/net/vhost_net.h
+++ b/include/net/vhost_net.h
@@ -27,6 +27,11 @@  void vhost_net_cleanup(VHostNetState *net);
 
 uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
 void vhost_net_ack_features(VHostNetState *net, uint64_t features);
+int vhost_net_get_config(struct vhost_net *net,  uint8_t *config,
+                         uint32_t config_len);
+
+int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
+                         uint32_t offset, uint32_t size, uint32_t flags);
 
 bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
 void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,