diff mbox

[RFC,v2,2/3] vhost-net: Add new MTU feature support

Message ID 1479419887-10515-3-git-send-email-maxime.coquelin@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maxime Coquelin Nov. 17, 2016, 9:58 p.m. UTC
If VHOST_USER_F_MTU feature is negociated, vhost-net makes the
advised MTU available to virtio-net through a vhost_net_get_mtu()
call.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Aaron Conole <aconole@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 hw/net/vhost_net.c      | 11 +++++++++++
 include/net/vhost_net.h |  2 ++
 2 files changed, 13 insertions(+)

Comments

Michael S. Tsirkin Nov. 17, 2016, 10:39 p.m. UTC | #1
On Thu, Nov 17, 2016 at 10:58:06PM +0100, Maxime Coquelin wrote:
> If VHOST_USER_F_MTU feature is negociated, vhost-net makes the


negotiated

> advised MTU available to virtio-net through a vhost_net_get_mtu()
> call.
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Aaron Conole <aconole@redhat.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  hw/net/vhost_net.c      | 11 +++++++++++
>  include/net/vhost_net.h |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index f2d49ad..21057d6 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -74,6 +74,7 @@ static const int user_feature_bits[] = {
>      VIRTIO_NET_F_HOST_ECN,
>      VIRTIO_NET_F_HOST_UFO,
>      VIRTIO_NET_F_MRG_RXBUF,
> +    VIRTIO_NET_F_MTU,
>  
>      /* This bit implies RARP isn't sent by QEMU out of band */
>      VIRTIO_NET_F_GUEST_ANNOUNCE,
> @@ -435,6 +436,11 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
>      return 0;
>  }
>  
> +uint64_t vhost_net_get_mtu(struct vhost_net *net)
> +{
> +    return net->dev.mtu;
> +}
> +
>  #else
>  uint64_t vhost_net_get_max_queues(VHostNetState *net)
>  {
> @@ -501,4 +507,9 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
>  {
>      return 0;
>  }
> +
> +uint64_t vhost_net_get_mtu(struct vhost_net *net)
> +{
> +    return 0;
> +}
>  #endif
> diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
> index 5a08eff..37de17b 100644
> --- a/include/net/vhost_net.h
> +++ b/include/net/vhost_net.h
> @@ -35,4 +35,6 @@ int vhost_set_vring_enable(NetClientState * nc, int enable);
>  
>  uint64_t vhost_net_get_acked_features(VHostNetState *net);
>  
> +uint64_t vhost_net_get_mtu(struct vhost_net *net);
> +
>  #endif
> -- 
> 2.7.4
Aaron Conole Nov. 18, 2016, 6:13 p.m. UTC | #2
Maxime Coquelin <maxime.coquelin@redhat.com> writes:

> If VHOST_USER_F_MTU feature is negociated, vhost-net makes the
> advised MTU available to virtio-net through a vhost_net_get_mtu()

s/advised/maximum/

> call.
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Aaron Conole <aconole@redhat.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  hw/net/vhost_net.c      | 11 +++++++++++
>  include/net/vhost_net.h |  2 ++
>  2 files changed, 13 insertions(+)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index f2d49ad..21057d6 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -74,6 +74,7 @@ static const int user_feature_bits[] = {
>      VIRTIO_NET_F_HOST_ECN,
>      VIRTIO_NET_F_HOST_UFO,
>      VIRTIO_NET_F_MRG_RXBUF,
> +    VIRTIO_NET_F_MTU,
>  
>      /* This bit implies RARP isn't sent by QEMU out of band */
>      VIRTIO_NET_F_GUEST_ANNOUNCE,
> @@ -435,6 +436,11 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
>      return 0;
>  }
>  
> +uint64_t vhost_net_get_mtu(struct vhost_net *net)
> +{
> +    return net->dev.mtu;
> +}
> +
>  #else
>  uint64_t vhost_net_get_max_queues(VHostNetState *net)
>  {
> @@ -501,4 +507,9 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
>  {
>      return 0;
>  }
> +
> +uint64_t vhost_net_get_mtu(struct vhost_net *net)
> +{
> +    return 0;
> +}
>  #endif
> diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
> index 5a08eff..37de17b 100644
> --- a/include/net/vhost_net.h
> +++ b/include/net/vhost_net.h
> @@ -35,4 +35,6 @@ int vhost_set_vring_enable(NetClientState * nc, int enable);
>  
>  uint64_t vhost_net_get_acked_features(VHostNetState *net);
>  
> +uint64_t vhost_net_get_mtu(struct vhost_net *net);
> +
>  #endif
Maxime Coquelin Nov. 21, 2016, 12:51 p.m. UTC | #3
On 11/17/2016 11:39 PM, Michael S. Tsirkin wrote:
> On Thu, Nov 17, 2016 at 10:58:06PM +0100, Maxime Coquelin wrote:
>> > If VHOST_USER_F_MTU feature is negociated, vhost-net makes the
>
> negotiated

Excuse my "frenglish"... It will be fixed in next revision.

Thanks,
Maxime
diff mbox

Patch

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index f2d49ad..21057d6 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -74,6 +74,7 @@  static const int user_feature_bits[] = {
     VIRTIO_NET_F_HOST_ECN,
     VIRTIO_NET_F_HOST_UFO,
     VIRTIO_NET_F_MRG_RXBUF,
+    VIRTIO_NET_F_MTU,
 
     /* This bit implies RARP isn't sent by QEMU out of band */
     VIRTIO_NET_F_GUEST_ANNOUNCE,
@@ -435,6 +436,11 @@  int vhost_set_vring_enable(NetClientState *nc, int enable)
     return 0;
 }
 
+uint64_t vhost_net_get_mtu(struct vhost_net *net)
+{
+    return net->dev.mtu;
+}
+
 #else
 uint64_t vhost_net_get_max_queues(VHostNetState *net)
 {
@@ -501,4 +507,9 @@  int vhost_set_vring_enable(NetClientState *nc, int enable)
 {
     return 0;
 }
+
+uint64_t vhost_net_get_mtu(struct vhost_net *net)
+{
+    return 0;
+}
 #endif
diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
index 5a08eff..37de17b 100644
--- a/include/net/vhost_net.h
+++ b/include/net/vhost_net.h
@@ -35,4 +35,6 @@  int vhost_set_vring_enable(NetClientState * nc, int enable);
 
 uint64_t vhost_net_get_acked_features(VHostNetState *net);
 
+uint64_t vhost_net_get_mtu(struct vhost_net *net);
+
 #endif