From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 147DE91B7 for ; Wed, 21 Oct 2015 09:16:18 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 21 Oct 2015 00:16:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,709,1437462000"; d="scan'208";a="798854066" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 21 Oct 2015 00:16:17 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 21 Oct 2015 00:16:17 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 21 Oct 2015 00:16:17 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.96]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.194]) with mapi id 14.03.0248.002; Wed, 21 Oct 2015 15:16:15 +0800 From: "Xie, Huawei" To: Stephen Hemminger , Yuanhan Liu Thread-Topic: [dpdk-dev] [PATCH v7 4/8] vhost: rxtx: use queue id instead of constant ring index Thread-Index: AdEL0F9P6uTHViQ7R1SShjt/6w1iMA== Date: Wed, 21 Oct 2015 07:16:15 +0000 Message-ID: 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> Accept-Language: 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" , "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 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 07:16:19 -0000 On 10/21/2015 12:44 PM, Stephen Hemminger wrote:=0A= > On Wed, 21 Oct 2015 11:48:10 +0800=0A= > Yuanhan Liu wrote:=0A= >=0A= >> =0A= >> +static inline int __attribute__((always_inline))=0A= >> +is_valid_virt_queue_idx(uint32_t virtq_idx, int is_tx, uint32_t max_qp_= idx)=0A= >> +{=0A= >> + if ((is_tx ^ (virtq_idx & 0x1)) ||=0A= >> + (virtq_idx >=3D max_qp_idx * VIRTIO_QNUM))=0A= >> + return 0;=0A= >> +=0A= >> + return 1;=0A= >> +}=0A= > minor nits:=0A= > * this doesn't need to be marked as always inline, =0A= > that is as they say in English "shooting a fly with a bazooka"=0A= Stephen:=0A= always_inline "forces" the compiler to inline this function, like a macro.= =0A= When should it be used or is it not preferred at all?=0A= =0A= > * prefer to just return logical result rather than have conditional:=0A= > * for booleans prefer the type boolean.=0A= >=0A= > static bool=0A= > is_valid_virt_queue_idx(uint32_t virtq_idx, bool is_tx, uint32_t max_qp_i= dx)=0A= > {=0A= > return (is_tx ^ (virtq_idx & 1)) || =0A= > virtq_idx >=3D max_qp_idx * VIRTIO_QNUM;=0A= > }=0A= >=0A= =0A=