From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 216832C27 for ; Sat, 1 Apr 2017 09:25:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491031553; x=1522567553; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=4k0xInNzj7iO66D1wGTNZB2PP40RiTNg8eJdD5W5xNA=; b=wT2OaVmVfdc+vTmBK/zMfLDfLai+hzQ6UAFwc2RV4och088ltiRWQGQ4 Z4oRF74AJ85OP/zFDZrgH4VA/JmL5Q==; Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2017 00:25:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,256,1486454400"; d="scan'208";a="67700673" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 01 Apr 2017 00:25:30 -0700 From: Yuanhan Liu To: dev@dpdk.org Cc: Maxime Coquelin , Harris James R , Liu Changpeng , Yuanhan Liu Date: Sat, 1 Apr 2017 15:22:44 +0800 Message-Id: <1491031380-1499-7-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1491031380-1499-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1490705142-893-1-git-send-email-yuanhan.liu@linux.intel.com> <1491031380-1499-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH v4 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: Sat, 01 Apr 2017 07:25:54 -0000 Signed-off-by: Yuanhan Liu --- v4: use parameter to store the returned features and return -1 on error --- lib/librte_vhost/rte_vhost_version.map | 1 + lib/librte_vhost/rte_virtio_net.h | 12 ++++++++++++ lib/librte_vhost/vhost.c | 13 +++++++++++++ 3 files changed, 26 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 8c1c172..c6fba0b 100644 --- a/lib/librte_vhost/rte_virtio_net.h +++ b/lib/librte_vhost/rte_virtio_net.h @@ -156,6 +156,18 @@ struct virtio_net_device_ops { */ int rte_vhost_driver_get_features(const char *path, uint64_t *features); +/** + * Get the feature bits after negotiation + * + * @param vid + * Vhost device ID + * @param features + * A pointer to store the queried feature bits + * @return + * 0 on success, -1 on failure + */ +int rte_vhost_get_negotiated_features(int vid, uint64_t *features); + /* 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..90b0f67 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -360,6 +360,19 @@ struct virtio_net * } int +rte_vhost_get_negotiated_features(int vid, uint64_t *features) +{ + struct virtio_net *dev; + + dev = get_device(vid); + if (!dev) + return -1; + + *features = dev->features; + return 0; +} + +int rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem) { struct virtio_net *dev; -- 1.9.0