qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: mst@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org,
	jasowang@redhat.com, yuanhan.liu@linux.intel.com
Subject: Re: [Qemu-devel] [RFC v2 1/3] vhost-user: Add new protocol feature MTU
Date: Fri, 18 Nov 2016 09:26:47 -0500	[thread overview]
Message-ID: <f7teg28ood4.fsf@redhat.com> (raw)
In-Reply-To: <1479419887-10515-2-git-send-email-maxime.coquelin@redhat.com> (Maxime Coquelin's message of "Thu, 17 Nov 2016 22:58:05 +0100")

Maxime Coquelin <maxime.coquelin@redhat.com> writes:

> This patch adds VHOST_USER_PROTOCOL_F_MTU protocol feature.
>
> If supported, QEMU sends VHOST_USER_GET_MTU request to the client,
> and expects a u64 reply containing the MTU advised for the guest.
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Aaron Conole <aconole@redhat.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  hw/virtio/vhost-user.c    | 11 +++++++++++
>  include/hw/virtio/vhost.h |  1 +
>  2 files changed, 12 insertions(+)
>
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 7ee92b3..eaf007d 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -32,6 +32,7 @@ enum VhostUserProtocolFeature {
>      VHOST_USER_PROTOCOL_F_LOG_SHMFD = 1,
>      VHOST_USER_PROTOCOL_F_RARP = 2,
>      VHOST_USER_PROTOCOL_F_REPLY_ACK = 3,
> +    VHOST_USER_PROTOCOL_F_MTU = 4,
>  
>      VHOST_USER_PROTOCOL_F_MAX
>  };
> @@ -59,6 +60,7 @@ typedef enum VhostUserRequest {
>      VHOST_USER_GET_QUEUE_NUM = 17,
>      VHOST_USER_SET_VRING_ENABLE = 18,
>      VHOST_USER_SEND_RARP = 19,
> +    VHOST_USER_GET_MTU = 20,
>      VHOST_USER_MAX
>  } VhostUserRequest;
>  
> @@ -186,6 +188,7 @@ static bool vhost_user_one_time_request(VhostUserRequest request)
>      case VHOST_USER_RESET_OWNER:
>      case VHOST_USER_SET_MEM_TABLE:
>      case VHOST_USER_GET_QUEUE_NUM:
> +    case VHOST_USER_GET_MTU:
>          return true;
>      default:
>          return false;
> @@ -602,6 +605,14 @@ static int vhost_user_init(struct vhost_dev *dev, void *opaque)
>                  return err;
>              }
>          }
> +
> +        /* query the MTU we support if backend supports MTU feature */
> +        if (dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_MTU)) {
> +            err = vhost_user_get_u64(dev, VHOST_USER_GET_MTU, &dev->mtu);
> +            if (err < 0) {
> +                return err;
> +            }
> +        }
>      }
>  
>      if (dev->migration_blocker == NULL &&
> diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
> index 1fe5aad..c674a05 100644
> --- a/include/hw/virtio/vhost.h
> +++ b/include/hw/virtio/vhost.h
> @@ -51,6 +51,7 @@ struct vhost_dev {
>      uint64_t backend_features;
>      uint64_t protocol_features;
>      uint64_t max_queues;
> +    uint64_t mtu;

Just a question why the MTU is stored as a u64?  would uint16_t make
more sense - then we can be sure we never have an excessively large mtu
value.

What do you think?

>      bool started;
>      bool log_enabled;
>      uint64_t log_size;

  reply	other threads:[~2016-11-18 14:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 21:58 [Qemu-devel] [RFC v2 0/3] virtio-net: Add support to MTU feature Maxime Coquelin
2016-11-17 21:58 ` [Qemu-devel] [RFC v2 1/3] vhost-user: Add new protocol feature MTU Maxime Coquelin
2016-11-18 14:26   ` Aaron Conole [this message]
2016-11-21 12:50     ` Maxime Coquelin
2016-11-17 21:58 ` [Qemu-devel] [RFC v2 2/3] vhost-net: Add new MTU feature support Maxime Coquelin
2016-11-17 22:39   ` Michael S. Tsirkin
2016-11-21 12:51     ` Maxime Coquelin
2016-11-18 18:13   ` Aaron Conole
2016-11-17 21:58 ` [Qemu-devel] [RFC v2 3/3] virtio-net: Add " Maxime Coquelin
2016-11-17 22:38   ` Michael S. Tsirkin
2016-11-21 12:34     ` Maxime Coquelin
2016-11-21 16:48       ` Michael S. Tsirkin
2016-11-22 12:11         ` Maxime Coquelin
2016-11-22 14:18           ` Michael S. Tsirkin
2016-11-22 15:33             ` Maxime Coquelin
2016-11-17 22:34 ` [Qemu-devel] [RFC v2 0/3] virtio-net: Add support to MTU feature Michael S. Tsirkin
2016-11-18  6:42   ` John Fastabend
2016-11-18 18:15 ` Aaron Conole
2016-11-18 18:52   ` Maxime Coquelin
2016-11-18 19:21     ` Aaron Conole
2016-11-21 16:23       ` Michael S. Tsirkin
2016-11-22  4:07         ` Jason Wang
2016-11-22  7:40           ` Maxime Coquelin
2016-11-22 14:32             ` Aaron Conole
2016-11-22 14:41               ` Michael S. Tsirkin
2016-11-22 17:56                 ` Maxime Coquelin
2016-11-22 20:38                   ` Michael S. Tsirkin
2016-11-23  3:42                     ` Jason Wang
2016-11-23  4:26                       ` Michael S. Tsirkin
2016-11-23 14:02                         ` Aaron Conole
2016-11-23 17:42                           ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7teg28ood4.fsf@redhat.com \
    --to=aconole@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yuanhan.liu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).