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 C73DF8DB4 for ; Wed, 9 Sep 2015 04:40:22 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 08 Sep 2015 19:40:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,493,1437462000"; d="scan'208";a="800528727" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by orsmga002.jf.intel.com with ESMTP; 08 Sep 2015 19:40:18 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by KMSMSX151.gar.corp.intel.com (172.21.73.86) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 9 Sep 2015 10:38:04 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.182]) with mapi id 14.03.0224.002; Wed, 9 Sep 2015 10:37:33 +0800 From: "Ouyang, Changchun" To: Yuanhan Liu Thread-Topic: [PATCH 4/4] vhost: define callfd and kickfd as int type Thread-Index: AQHQ3iCPtDbXKS+To0WkMPcOL/s6yJ4zhJag//9+GICAAJDuoA== Date: Wed, 9 Sep 2015 02:37:33 +0000 Message-ID: References: <1440388485-13554-1-git-send-email-yuanhan.liu@linux.intel.com> <1440388485-13554-4-git-send-email-yuanhan.liu@linux.intel.com> <20150909015455.GD2925@yliu-dev.sh.intel.com> In-Reply-To: <20150909015455.GD2925@yliu-dev.sh.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 02:40:24 -0000 > -----Original Message----- > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] > Sent: Wednesday, September 9, 2015 9:55 AM > To: Ouyang, Changchun > Cc: dev@dpdk.org; Xie, Huawei > Subject: Re: [PATCH 4/4] vhost: define callfd and kickfd as int type >=20 > 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? >=20 > As I stated in the commit log, to remove the redundant (int) cast. Casts = like > following are a bit ugly: >=20 > if ((int)dev->virtqueue[VIRTIO_RXQ]->callfd >=3D 0) > close((int)dev->virtqueue[VIRTIO_RXQ]->callfd); >=20 > 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. >=20 Agree, qemu use 32 bit for the callfd and kickfd. It could use int. Well, there is another comment in other place in this patch, I will send ou= t soon. > --yliu