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 C82AF8DB3 for ; Wed, 9 Sep 2015 03:51:43 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 08 Sep 2015 18:51:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,493,1437462000"; d="scan'208";a="800507112" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.60]) by orsmga002.jf.intel.com with ESMTP; 08 Sep 2015 18:51:41 -0700 Date: Wed, 9 Sep 2015 09:54:55 +0800 From: Yuanhan Liu To: "Ouyang, Changchun" Message-ID: <20150909015455.GD2925@yliu-dev.sh.intel.com> References: <1440388485-13554-1-git-send-email-yuanhan.liu@linux.intel.com> <1440388485-13554-4-git-send-email-yuanhan.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 4/4] vhost: define callfd and kickfd as int type 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: Wed, 09 Sep 2015 01:51:44 -0000 On Wed, Sep 09, 2015 at 01:43:06AM +0000, Ouyang, Changchun wrote: > > > > -----Original Message----- > > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > > Sent: Monday, August 24, 2015 11:55 AM > > To: dev@dpdk.org > > Cc: Xie, Huawei; Ouyang, Changchun; Yuanhan Liu > > Subject: [PATCH 4/4] vhost: define callfd and kickfd as int type > > > > So that we can remove the redundant (int) cast. > > > > Signed-off-by: Yuanhan Liu > > --- > > > diff --git a/lib/librte_vhost/rte_virtio_net.h > > b/lib/librte_vhost/rte_virtio_net.h > > index b9bf320..a037c15 100644 > > --- a/lib/librte_vhost/rte_virtio_net.h > > +++ b/lib/librte_vhost/rte_virtio_net.h > > @@ -87,8 +87,8 @@ struct vhost_virtqueue { > > uint16_t vhost_hlen; /**< Vhost header > > length (varies depending on RX merge buffers. */ > > volatile uint16_t last_used_idx; /**< Last index used > > on the available ring */ > > volatile uint16_t last_used_idx_res; /**< Used for > > multiple devices reserving buffers. */ > > - eventfd_t callfd; /**< Used to notify > > the guest (trigger interrupt). */ > > - eventfd_t kickfd; /**< Currently > > unused as polling mode is enabled. */ > > + int callfd; /**< Used to notify > > the guest (trigger interrupt). */ > > + int kickfd; /**< Currently > > unused as polling mode is enabled. */ > > I don't think we have to change it from 8B(eventfd_t is defined as uint64_t) to 4B, > Any benefit for this change? As I stated in the commit log, to remove the redundant (int) cast. Casts like following are a bit ugly: if ((int)dev->virtqueue[VIRTIO_RXQ]->callfd >= 0) close((int)dev->virtqueue[VIRTIO_RXQ]->callfd); On the other hand, why it has to be uint64_t? The caller side sends the message(be more precisely, qemu) actually uses int type. --yliu