From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 91778379B for ; Wed, 8 Mar 2017 03:46:28 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Mar 2017 18:46:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,261,1486454400"; d="scan'208";a="65313193" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga004.jf.intel.com with ESMTP; 07 Mar 2017 18:46:26 -0800 Date: Wed, 8 Mar 2017 10:45:01 +0800 From: Yuanhan Liu To: Maxime Coquelin Cc: aconole@redhat.com, sodey@sonusnet.com, jianfeng.tan@intel.com, dev@dpdk.org Message-ID: <20170308024501.GY18844@yliu-dev.sh.intel.com> References: <20170306082740.5675-1-maxime.coquelin@redhat.com> <20170306082740.5675-5-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170306082740.5675-5-maxime.coquelin@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2 4/7] vhost: Add API to get MTU value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Mar 2017 02:46:29 -0000 On Mon, Mar 06, 2017 at 09:27:37AM +0100, Maxime Coquelin wrote: > This patch implements the function for the application to > get the MTU value. > > rte_vhost_mtu_get() fills the mtu parameter with the MTU value > set in QEMU if VIRTIO_NET_F_MTU has been negotiated and returns 0, > -ENOTSUP otherwise. > > The function returns -EAGAIN if Virtio feature negotiation > didn't happened yet. > > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/rte_virtio_net.h | 15 +++++++++++++++ > lib/librte_vhost/vhost.c | 19 +++++++++++++++++++ > 2 files changed, 34 insertions(+) > > diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h > index 926039c..ff02e9b 100644 > --- a/lib/librte_vhost/rte_virtio_net.h > +++ b/lib/librte_vhost/rte_virtio_net.h > @@ -100,6 +100,21 @@ int rte_vhost_driver_callback_register(struct virtio_net_device_ops const * cons > int rte_vhost_driver_session_start(void); > > /** > + * Get the MTU value of the device if set in QEMU. > + * > + * @param vid > + * virtio-net device ID > + * @param mtu > + * The variable to store the MTU value > + * > + * @return > + * 0: success > + * -EAGAIN: device not yet started > + * -ENOTSUP: device does not support MTU feature > + */ > +int rte_vhost_mtu_get(int vid, uint16_t *mtu); I'd suggest to name it "_get_mtu", to align with the current naming style: _get_ifname _get_numa_node ... Besides that, you should add an entry to the rte_vhost_version.map. --yliu