From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 1D423108D for ; Fri, 31 Mar 2017 09:45:15 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24731437F77; Fri, 31 Mar 2017 07:45:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 24731437F77 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=maxime.coquelin@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 24731437F77 Received: from [10.36.112.26] (ovpn-112-26.ams2.redhat.com [10.36.112.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 139C41843A; Fri, 31 Mar 2017 07:45:12 +0000 (UTC) To: Yuanhan Liu , dev@dpdk.org References: <1490253059-28112-1-git-send-email-yuanhan.liu@linux.intel.com> <1490705142-893-1-git-send-email-yuanhan.liu@linux.intel.com> <1490705142-893-7-git-send-email-yuanhan.liu@linux.intel.com> Cc: Harris James R , Liu Changpeng From: Maxime Coquelin Message-ID: Date: Fri, 31 Mar 2017 09:45:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1490705142-893-7-git-send-email-yuanhan.liu@linux.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 31 Mar 2017 07:45:14 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH v3 06/22] vhost: introduce API to fetch negotiated features 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: Fri, 31 Mar 2017 07:45:16 -0000 On 03/28/2017 02:45 PM, Yuanhan Liu wrote: > Signed-off-by: Yuanhan Liu > --- > lib/librte_vhost/rte_vhost_version.map | 1 + > lib/librte_vhost/rte_virtio_net.h | 10 ++++++++++ > lib/librte_vhost/vhost.c | 12 ++++++++++++ > 3 files changed, 23 insertions(+) > > diff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map > index 664a5f3..cec1e9e 100644 > --- a/lib/librte_vhost/rte_vhost_version.map > +++ b/lib/librte_vhost/rte_vhost_version.map > @@ -37,5 +37,6 @@ DPDK_17.05 { > rte_vhost_driver_set_features; > rte_vhost_get_mem_table; > rte_vhost_get_mtu; > + rte_vhost_get_negotiated_features; > > } DPDK_16.07; > diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h > index 5a91f97..57e57e3 100644 > --- a/lib/librte_vhost/rte_virtio_net.h > +++ b/lib/librte_vhost/rte_virtio_net.h > @@ -154,6 +154,16 @@ struct virtio_net_device_ops { > */ > uint64_t rte_vhost_driver_get_features(const char *path); > > +/** > + * Get the feature bits after negotiation > + * > + * @param vid > + * Vhost device ID > + * @return > + * Negotiated feature bits on success, 0 on failure > + */ > +uint64_t rte_vhost_get_negotiated_features(int vid); > + > /* Register callbacks. */ > int rte_vhost_driver_callback_register(const char *path, > struct virtio_net_device_ops const * const ops); > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > index 2b41652..08dccfb 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -359,6 +359,18 @@ struct virtio_net * > return 0; > } > > +uint64_t > +rte_vhost_get_negotiated_features(int vid) > +{ > + struct virtio_net *dev; > + > + dev = get_device(vid); > + if (!dev) > + return 0; It's unlikely to happen with net devices, but as this series is about generalizing the use of this lib, couldn't we have cases where the negotiated features is 0? If so, shouldn't be preferable the caller passes features pointer as argument? > + > + return dev->features; > +} > + > int > rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem) > { > Thanks, Maxime