From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 6A77C324D; Wed, 31 Oct 2018 04:39:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 20:39:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,447,1534834800"; d="scan'208";a="96445850" Received: from kmsmsx155.gar.corp.intel.com ([172.21.73.106]) by orsmga003.jf.intel.com with ESMTP; 30 Oct 2018 20:39:27 -0700 Received: from pgsmsx103.gar.corp.intel.com ([169.254.2.114]) by KMSMSX155.gar.corp.intel.com ([169.254.15.19]) with mapi id 14.03.0415.000; Wed, 31 Oct 2018 11:34:29 +0800 From: "Zhao1, Wei" To: "Yigit, Ferruh" , "Wu, Jingjing" , "Lu, Wenzhuo" CC: "dev@dpdk.org" , "Yigit, Ferruh" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/avf/base: fix shifting 32 bits signed variable 31 times Thread-Index: AQHUbms0XiFruXAoC0Ke3DFmX9qfFKU4tunQ Date: Wed, 31 Oct 2018 03:34:28 +0000 Message-ID: References: <20181028035133.67106-1-ferruh.yigit@intel.com> In-Reply-To: <20181028035133.67106-1-ferruh.yigit@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [172.30.20.205] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/avf/base: fix shifting 32 bits signed variable 31 times X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 03:39:30 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit > Sent: Sunday, October 28, 2018 11:52 AM > To: Wu, Jingjing ; Lu, Wenzhuo > > Cc: dev@dpdk.org; Yigit, Ferruh ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH] net/avf/base: fix shifting 32 bits signed var= iable > 31 times >=20 > Fixes: e5b2a9e957e7 ("net/avf/base: add base code for avf PMD") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ferruh Yigit > --- > drivers/net/avf/base/avf_register.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/avf/base/avf_register.h > b/drivers/net/avf/base/avf_register.h > index ba5a9f3fa..adb989583 100644 > --- a/drivers/net/avf/base/avf_register.h > +++ b/drivers/net/avf/base/avf_register.h > @@ -76,7 +76,7 @@ POSSIBILITY OF SUCH DAMAGE. > #define AVF_ARQLEN1_ARQCRIT_SHIFT 30 > #define AVF_ARQLEN1_ARQCRIT_MASK AVF_MASK(0x1, > AVF_ARQLEN1_ARQCRIT_SHIFT) > #define AVF_ARQLEN1_ARQENABLE_SHIFT 31 > -#define AVF_ARQLEN1_ARQENABLE_MASK AVF_MASK(0x1, > AVF_ARQLEN1_ARQENABLE_SHIFT) > +#define AVF_ARQLEN1_ARQENABLE_MASK AVF_MASK(0x1U, > +AVF_ARQLEN1_ARQENABLE_SHIFT) > #define AVF_ARQT1 0x00007000 /* Reset: EMPR */ > #define AVF_ARQT1_ARQT_SHIFT 0 > #define AVF_ARQT1_ARQT_MASK AVF_MASK(0x3FF, > AVF_ARQT1_ARQT_SHIFT) @@ -99,7 +99,7 @@ POSSIBILITY OF SUCH > DAMAGE. > #define AVF_ATQLEN1_ATQCRIT_SHIFT 30 > #define AVF_ATQLEN1_ATQCRIT_MASK AVF_MASK(0x1, > AVF_ATQLEN1_ATQCRIT_SHIFT) > #define AVF_ATQLEN1_ATQENABLE_SHIFT 31 > -#define AVF_ATQLEN1_ATQENABLE_MASK AVF_MASK(0x1, > AVF_ATQLEN1_ATQENABLE_SHIFT) > +#define AVF_ATQLEN1_ATQENABLE_MASK AVF_MASK(0x1U, > +AVF_ATQLEN1_ATQENABLE_SHIFT) > #define AVF_ATQT1 0x00008400 /* Reset: EMPR */ > #define AVF_ATQT1_ATQT_SHIFT 0 > #define AVF_ATQT1_ATQT_MASK AVF_MASK(0x3FF, > AVF_ATQT1_ATQT_SHIFT) > -- > 2.17.2 I have test this code change with a small function to observe the differenc= e. Reviewed-by: Wei Zhao #define AVF_ARQLEN1_ARQENABLE_SHIFT 31 #define AVF_MASK(mask, shift) (mask << shift) #define AVF_ARQLEN1_ARQENABLE_MASK1 AVF_MASK(0x1, AVF_ARQLEN1_ARQENABLE_SH= IFT) #define AVF_ARQLEN1_ARQENABLE_MASK2 AVF_MASK(0x1U, AVF_ARQLEN1_ARQENABLE_S= HIFT) void main(int argc,char **argv) { signed int a=3D1; printf("Hello Linux\n"); printf("%x,=3D%x\n",AVF_ARQLEN1_ARQENABLE_MASK1,AVF_ARQLEN1_ARQENAB= LE_MASK2); printf("a=3D%x\n",a<<31); }