From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A1E2C91B8 for ; Wed, 21 Oct 2015 11:38:41 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 21 Oct 2015 02:38:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,711,1437462000"; d="scan'208";a="585203873" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by FMSMGA003.fm.intel.com with ESMTP; 21 Oct 2015 02:38:39 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.75]) by IRSMSX107.ger.corp.intel.com ([169.254.10.49]) with mapi id 14.03.0248.002; Wed, 21 Oct 2015 10:38:37 +0100 From: "Ananyev, Konstantin" To: "Xie, Huawei" , Stephen Hemminger , Yuanhan Liu Thread-Topic: [dpdk-dev] [PATCH v7 4/8] vhost: rxtx: use queue id instead of constant ring index Thread-Index: AQHRC7s2zRuhYWkQ8UKlXUTcM4WQSp51sDIg Date: Wed, 21 Oct 2015 09:38:37 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836AB321F@irsmsx105.ger.corp.intel.com> References: <1445399294-18826-1-git-send-email-yuanhan.liu@linux.intel.com> <1445399294-18826-5-git-send-email-yuanhan.liu@linux.intel.com> <20151020214354.12ac5ce1@xeon-e3> In-Reply-To: Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" , "marcel@redhat.com" , Changchun Ouyang , "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH v7 4/8] vhost: rxtx: use queue id instead of constant ring index 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, 21 Oct 2015 09:38:42 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xie, Huawei > Sent: Wednesday, October 21, 2015 8:16 AM > To: Stephen Hemminger; Yuanhan Liu > Cc: dev@dpdk.org; marcel@redhat.com; Michael S. Tsirkin; Changchun Ouyang > Subject: Re: [dpdk-dev] [PATCH v7 4/8] vhost: rxtx: use queue id instead = of constant ring index >=20 > On 10/21/2015 12:44 PM, Stephen Hemminger wrote: > > On Wed, 21 Oct 2015 11:48:10 +0800 > > Yuanhan Liu wrote: > > > >> > >> +static inline int __attribute__((always_inline)) > >> +is_valid_virt_queue_idx(uint32_t virtq_idx, int is_tx, uint32_t max_q= p_idx) > >> +{ > >> + if ((is_tx ^ (virtq_idx & 0x1)) || > >> + (virtq_idx >=3D max_qp_idx * VIRTIO_QNUM)) > >> + return 0; > >> + > >> + return 1; > >> +} > > minor nits: > > * this doesn't need to be marked as always inline, > > that is as they say in English "shooting a fly with a bazooka" > Stephen: > always_inline "forces" the compiler to inline this function, like a macro= . > When should it be used or is it not preferred at all? I also don't understand what's wrong with using 'always_inline' here. As I understand the author wants compiler to *always inline* that function. So seems perfectly ok to use it here. As I remember just 'inline' is sort of recommendation that compiler is free= to ignore. Konstantin=20 >=20 > > * prefer to just return logical result rather than have conditional: > > * for booleans prefer the type boolean. > > > > static bool > > is_valid_virt_queue_idx(uint32_t virtq_idx, bool is_tx, uint32_t max_qp= _idx) > > { > > return (is_tx ^ (virtq_idx & 1)) || > > virtq_idx >=3D max_qp_idx * VIRTIO_QNUM; > > } > >