From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <maxime.coquelin@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id A0AF1567F
 for <dev@dpdk.org>; Mon,  6 Mar 2017 09:28:08 +0100 (CET)
Received: from int-mx13.intmail.prod.int.phx2.redhat.com
 (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26])
 (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 1226B80F7C;
 Mon,  6 Mar 2017 08:28:09 +0000 (UTC)
Received: from max-t460s.redhat.com (ovpn-116-235.ams2.redhat.com
 [10.36.116.235])
 by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 v268RmvF006934; Mon, 6 Mar 2017 03:28:06 -0500
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: aconole@redhat.com, sodey@sonusnet.com, yuanhan.liu@linux.intel.com,
 jianfeng.tan@intel.com, dev@dpdk.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Date: Mon,  6 Mar 2017 09:27:38 +0100
Message-Id: <20170306082740.5675-6-maxime.coquelin@redhat.com>
In-Reply-To: <20170306082740.5675-1-maxime.coquelin@redhat.com>
References: <20170213142820.8964-1-maxime.coquelin@redhat.com>
 <20170306082740.5675-1-maxime.coquelin@redhat.com>
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.27]); Mon, 06 Mar 2017 08:28:09 +0000 (UTC)
Subject: [dpdk-dev] [PATCH v2 5/7] net/vhost: Fill rte_eth_dev's MTU property
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 06 Mar 2017 08:28:08 -0000

This patch adds a call to rte_vhost_mtu_get() at device creation
time to fill device's MTU property when available.

This makes the MTU value defined in QEMU cmdline accessible to the
application by calling rte_eth_dev_get_mtu().

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index e98cffd..344c328 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -575,6 +575,8 @@ new_device(int vid)
 	for (i = 0; i < rte_vhost_get_queue_num(vid) * VIRTIO_QNUM; i++)
 		rte_vhost_enable_guest_notification(vid, i, 0);
 
+	rte_vhost_mtu_get(vid, &eth_dev->data->mtu);
+
 	eth_dev->data->dev_link.link_status = ETH_LINK_UP;
 
 	rte_atomic32_set(&internal->dev_attached, 1);
-- 
2.9.3