From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 6811C5A35 for ; Thu, 18 Aug 2016 10:40:20 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 18 Aug 2016 01:39:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,538,1464678000"; d="scan'208";a="1043336179" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by fmsmga002.fm.intel.com with ESMTP; 18 Aug 2016 01:39:55 -0700 From: Yuanhan Liu To: dev@dpdk.org Cc: Yuanhan Liu Date: Thu, 18 Aug 2016 16:48:43 +0800 Message-Id: <1471510123-4984-8-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1471510123-4984-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1471510123-4984-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH 7/7] vhost: simplify features set/get X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 08:40:21 -0000 No need to use a pointer to store/retrieve features. Signed-off-by: Yuanhan Liu --- lib/librte_vhost/vhost_user.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index ef4a0c1..eee99e9 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -155,23 +155,22 @@ vhost_user_reset_owner(struct virtio_net *dev) /* * The features that we support are requested. */ -static int -vhost_user_get_features(uint64_t *pu) +static uint64_t +vhost_user_get_features(void) { - *pu = VHOST_FEATURES; - return 0; + return VHOST_FEATURES; } /* * We receive the negotiated features supported by us and the virtio device. */ static int -vhost_user_set_features(struct virtio_net *dev, uint64_t *pu) +vhost_user_set_features(struct virtio_net *dev, uint64_t features) { - if (*pu & ~VHOST_FEATURES) + if (features & ~VHOST_FEATURES) return -1; - dev->features = *pu; + dev->features = features; if (dev->features & ((1 << VIRTIO_NET_F_MRG_RXBUF) | (1ULL << VIRTIO_F_VERSION_1))) { dev->vhost_hlen = sizeof(struct virtio_net_hdr_mrg_rxbuf); @@ -802,7 +801,6 @@ vhost_user_msg_handler(int vid, int fd) { struct virtio_net *dev; struct VhostUserMsg msg; - uint64_t features = 0; int ret; dev = get_device(vid); @@ -828,14 +826,12 @@ vhost_user_msg_handler(int vid, int fd) vhost_message_str[msg.request]); switch (msg.request) { case VHOST_USER_GET_FEATURES: - ret = vhost_user_get_features(&features); - msg.payload.u64 = features; + msg.payload.u64 = vhost_user_get_features(); msg.size = sizeof(msg.payload.u64); send_vhost_message(fd, &msg); break; case VHOST_USER_SET_FEATURES: - features = msg.payload.u64; - vhost_user_set_features(dev, &features); + vhost_user_set_features(dev, msg.payload.u64); break; case VHOST_USER_GET_PROTOCOL_FEATURES: -- 1.9.0