From patchwork Tue Sep 6 16:11:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 9317445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AC445601C0 for ; Tue, 6 Sep 2016 16:16:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95DA728E1B for ; Tue, 6 Sep 2016 16:16:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A50628E22; Tue, 6 Sep 2016 16:16:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A17228E1B for ; Tue, 6 Sep 2016 16:16:45 +0000 (UTC) Received: from localhost ([::1]:34850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhJ3E-0002ZN-G2 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Sep 2016 12:16:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhIy2-00077F-Aw for qemu-devel@nongnu.org; Tue, 06 Sep 2016 12:11:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhIy0-00077B-6T for qemu-devel@nongnu.org; Tue, 06 Sep 2016 12:11:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhIy0-000775-0x for qemu-devel@nongnu.org; Tue, 06 Sep 2016 12:11:20 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4C1B80F7C for ; Tue, 6 Sep 2016 16:11:19 +0000 (UTC) Received: from max-t460s.redhat.com (vpn1-7-235.ams2.redhat.com [10.36.7.235]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u86GBCoW024070; Tue, 6 Sep 2016 12:11:18 -0400 From: Maxime Coquelin To: mst@redhat.com, qemu-devel@nongnu.org Date: Tue, 6 Sep 2016 18:11:08 +0200 Message-Id: <1473178269-16718-4-git-send-email-maxime.coquelin@redhat.com> In-Reply-To: <1473178269-16718-1-git-send-email-maxime.coquelin@redhat.com> References: <1473178269-16718-1-git-send-email-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 06 Sep 2016 16:11:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 3/4] vhost-net: Add new MTU feature support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jasowang@redhat.com, Aaron Conole , Maxime Coquelin Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Aaron Conole Signed-off-by: Maxime Coquelin --- 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