Received: from eggs.gnu.org ([2001:4830:134:3::10]:53593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cC3wp-0005rk-9X for qemu-devel@nongnu.org; Wed, 30 Nov 2016 07:25:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cC3wK-0000t8-FN for qemu-devel@nongnu.org; Wed, 30 Nov 2016 07:25:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33804) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cC3wK-0000ru-61 for qemu-devel@nongnu.org; Wed, 30 Nov 2016 07:24:44 -0500 References: <20161130101017.13382-1-maxime.coquelin@redhat.com> <20161130101017.13382-4-maxime.coquelin@redhat.com> <0204c67d-5f32-a9ac-2f6b-f11fa4af01a3@redhat.com> From: Maxime Coquelin Message-ID: Date: Wed, 30 Nov 2016 13:24:37 +0100 MIME-Version: 1.0 In-Reply-To: <0204c67d-5f32-a9ac-2f6b-f11fa4af01a3@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC v3 3/3] virtio-net: Add MTU feature support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang , mst@redhat.com, aconole@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, fbl@redhat.com, berrange@redhat.com, mlureau@redhat.com, ktraynor@redhat.com Cc: yuanhan.liu@linux.intel.com On 11/30/2016 12:24 PM, Jason Wang wrote: > > > On 2016=E5=B9=B411=E6=9C=8830=E6=97=A5 18:10, Maxime Coquelin wrote: >> This patch allows advising guest with host MTU's by setting >> host_mtu parameter. >> >> If VIRTIO_NET_F_MTU has been successfully negotiated, MTU >> value is passed to the backend. >> >> Cc: Michael S. Tsirkin >> Cc: Aaron Conole > Signed-off-by: Maxime Coquelin >> --- >> hw/net/virtio-net.c | 13 +++++++++++++ >> include/hw/virtio/virtio-net.h | 1 + >> 2 files changed, 14 insertions(+) >> >> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c >> index 5009533..5225e9b 100644 >> --- a/hw/net/virtio-net.c >> +++ b/hw/net/virtio-net.c >> @@ -55,6 +55,8 @@ static VirtIOFeature feature_sizes[] =3D { >> .end =3D endof(struct virtio_net_config, status)}, >> {.flags =3D 1 << VIRTIO_NET_F_MQ, >> .end =3D endof(struct virtio_net_config, max_virtqueue_pairs)}, >> + {.flags =3D 1 << VIRTIO_NET_F_MTU, >> + .end =3D endof(struct virtio_net_config, mtu)}, >> {} >> }; >> @@ -81,6 +83,7 @@ static void virtio_net_get_config(VirtIODevice >> *vdev, uint8_t *config) >> virtio_stw_p(vdev, &netcfg.status, n->status); >> virtio_stw_p(vdev, &netcfg.max_virtqueue_pairs, n->max_queues); >> + virtio_stw_p(vdev, &netcfg.mtu, n->net_conf.mtu); >> memcpy(netcfg.mac, n->mac, ETH_ALEN); >> memcpy(config, &netcfg, n->config_size); >> } >> @@ -152,6 +155,10 @@ static void virtio_net_vhost_status(VirtIONet *n, >> uint8_t status) >> qemu_net_queue_purge(qnc->incoming_queue, qnc->peer); >> } >> + if (virtio_has_feature(vdev->guest_features, >> VIRTIO_NET_F_MTU)) { >> + vhost_net_set_mtu(get_vhost_net(nc->peer), n->net_conf.mt= u); >> + } > > We'd better not ignore errors here and that's why we need management > tool (who can make sure the mtu is set correctly before launching qemu)= . Ok. Currently, errors are reported if it failed to send the request (protocol feature not present), maybe the request should require a reply from the backend whether or not configured MTU is consistent with what management tool set. Make sense? Thanks, Maxime