From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AC9AFA00BE; Tue, 28 Apr 2020 06:13:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 86E391D405; Tue, 28 Apr 2020 06:13:27 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50086.outbound.protection.outlook.com [40.107.5.86]) by dpdk.org (Postfix) with ESMTP id BC6A61C1E1 for ; Tue, 28 Apr 2020 06:13:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEd4iyDTpaZ13Ky5Wm4KPfx7p3fQm3Ync71fJBFd0ns=; b=xBVGMGwIeb0PzCrIFbv6Ul/zxSojnlV7WaCJF2aynECeOQfQstK3kdnm364V/jR1xtj5XZrExnTq6bzl0o42nxHWHl3x2GW2OISlM2iluIVoINSWZJILEZuSXacfRn9Qa1IgcOVLX4xBg5y8+CE2ayQBGX0k4atE1fpT1k8nUSU= Received: from AM6PR0202CA0063.eurprd02.prod.outlook.com (2603:10a6:20b:3a::40) by DB6PR08MB2917.eurprd08.prod.outlook.com (2603:10a6:6:25::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Tue, 28 Apr 2020 04:13:25 +0000 Received: from VE1EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:3a:cafe::32) by AM6PR0202CA0063.outlook.office365.com (2603:10a6:20b:3a::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Tue, 28 Apr 2020 04:13:25 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT049.mail.protection.outlook.com (10.152.19.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.19 via Frontend Transport; Tue, 28 Apr 2020 04:13:25 +0000 Received: ("Tessian outbound fb9de21a7e90:v54"); Tue, 28 Apr 2020 04:13:24 +0000 X-CR-MTA-TID: 64aa7808 Received: from 8445e77dc9de.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7CFFC41D-91D6-46D0-AE9A-41099BAB0DE5.1; Tue, 28 Apr 2020 04:13:19 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8445e77dc9de.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 28 Apr 2020 04:13:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g5Nmnlpa8zTMXixv0wnm2QyKUUAOkcmqYZ+4VuVz8XlYEhoVlzRB1/bcn1/D3GSMYqmQZP5zdqBqZTi0ouU52jD80EnDmcGJ8pPDyp0TD8xHzrVMve/FXMLwvWBTQ7YyfvZKaA0QG4H2xEgJvgknw/OZ6jznsDUzuLIR+DFEJnQpirH12NoJSolHSnSLAgHO/RWNPc8k8SdKdmCDT0r/LvkdEVYRrCrdIZcEHx60AQ9I0eOMMt1TTlTWgHMq6iCPc0+PwW66wW9s3jRjDhfrr23i7HK/zHuiaV6CXk+om1ToqBKMtNX5hs8O3eSpyqGPT5FfXOhaEfxqJgInKS94ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEd4iyDTpaZ13Ky5Wm4KPfx7p3fQm3Ync71fJBFd0ns=; b=bNxfPaqV0bMxDPsKXThAkte4ry7PQ0V/jv0kgiYvpn3w5SuXJ7hCNUlE4pbZLAnsHMlkwzbo9t7nILIY/ciRoD3XpAU2nOGvSp6QfBzCNBLJ/Mcha0D6S7GNf9sMs8Pi+hX7KyGiH2GIQTQgYQ2dKUCOm7pMpAy6+q2AxNepdNTBVqk9RRMf5DgxSyX8ghwnRYlq86o0ZUnr3TNIqrwOeUm/9QoFPNp3sVYgLZ+mDNt6fHdRiCZitobK0fBcIu3y1+qDM7L1rjrJXpZn9iQJeDF0mFxMVLIacse9hO6CgPB+1uxd5m4qUtwWi6PoinzAniudC529zsB7oNtGTkI8bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEd4iyDTpaZ13Ky5Wm4KPfx7p3fQm3Ync71fJBFd0ns=; b=xBVGMGwIeb0PzCrIFbv6Ul/zxSojnlV7WaCJF2aynECeOQfQstK3kdnm364V/jR1xtj5XZrExnTq6bzl0o42nxHWHl3x2GW2OISlM2iluIVoINSWZJILEZuSXacfRn9Qa1IgcOVLX4xBg5y8+CE2ayQBGX0k4atE1fpT1k8nUSU= Received: from DBBPR08MB4646.eurprd08.prod.outlook.com (2603:10a6:10:f5::16) by DBBPR08MB4694.eurprd08.prod.outlook.com (2603:10a6:10:de::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Tue, 28 Apr 2020 04:13:18 +0000 Received: from DBBPR08MB4646.eurprd08.prod.outlook.com ([fe80::1870:afc4:b90f:609d]) by DBBPR08MB4646.eurprd08.prod.outlook.com ([fe80::1870:afc4:b90f:609d%5]) with mapi id 15.20.2937.023; Tue, 28 Apr 2020 04:13:17 +0000 From: Honnappa Nagarahalli To: Stephen Hemminger , "dev@dpdk.org" CC: Konstantin Ananyev , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v3 1/4] ring: future proof flag settings Thread-Index: AQHWHOnnA7xaQo5h80Gbs7tLGJKf1qiN7IQA Date: Tue, 28 Apr 2020 04:12:56 +0000 Message-ID: References: <20200212230810.2837-1-stephen@networkplumber.org> <20200427231625.10135-1-stephen@networkplumber.org> <20200427231625.10135-2-stephen@networkplumber.org> In-Reply-To: <20200427231625.10135-2-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 5424d431-f76b-4a52-9116-c309171296aa.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [70.113.25.165] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2e29163c-2108-4d6c-edb9-08d7eb2a7f42 x-ms-traffictypediagnostic: DBBPR08MB4694:|DBBPR08MB4694:|DB6PR08MB2917: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:2657;OLM:2657; x-forefront-prvs: 0387D64A71 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR08MB4646.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(136003)(396003)(39860400002)(366004)(478600001)(4326008)(6666004)(71200400001)(316002)(86362001)(26005)(186003)(2906002)(9686003)(55016002)(110136005)(54906003)(7696005)(8936002)(8676002)(66446008)(64756008)(66556008)(66476007)(5660300002)(66946007)(81156014)(52536014)(6506007)(33656002)(76116006); DIR:OUT; SFP:1101; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 7UoPGjwCDUW5ZTnNO+fE1XMaOgbB5IKIqSx2yDZa16Fb14tAsEB69b/E/5LtXcVkKYDHN2CffVX8Q4oQr/OkeeWIRnISL2E27Bcn08HisEDO6Hxa09IEaFHz+GfGpcuun0/VTAIuCyJ5L4dRo3SJn3OKfUe5ArohGEyCaC9h4Z503jPZsGnYIsB0UXO1ssv6BcFlCc0VDTMiIT8uawvdSZj0vEEMwNJh/c2GAENSGCFRTsDIKcxblGmcHnUzEOtmJEHngm9LaLWdMPvXbYvQjeGB85t4q0XSm7BlgW/31G9VizSgjkwnpEBtfz4dqf1OtUX8G3CKx7SG9sCT5YhJcIVdfap3JQZImN8fxNCtz7VQFTQ27uzdXZ767wdN8eBGHZkKId+YxD+xd8YonUGSAuPI67Cpk5C1fdZ1hyE5JVSAbFuYnPwXhqY+eX0e4J5Y x-ms-exchange-antispam-messagedata: Z5q+1Uy7GIh79ptahIW4TCYkMLE9gAmztQTEnCAJ3Tul71l9aldt41ABXRG+vZu6YtdCy2OmgPVAuXM9nVsl1/W+28vzHEmzNOoe3s4wSh0Oe62GAMkSfCLxCrVSKSC4OYnkZ5kqUyB5jWP3Zo7XxBnMTqALU71UvHYIPGxd0k8HbZyBhDsNpI2rp7w71+rldrwHRx/cI9xi/VnoB5sJZDjsxiu2LpzTtXqwT7lX4DunMXLCZa/VKGSpas1MNdCBkfGqPPx3JSdvsCFNkXdXMTAFvIIB8u50YgYusPDOKcReHGhtXIqv5THCjJoIjBzAP+WDgJyFTyLEr+2trifPiMY9ef3Utpjbc9GCIKnLyTa95Dhv8buNHhzKy9ScPAgnuSm77/28hKVe0ByBNVJ5z6zUxoEg3+IkSapfeDrbBGPQ7NeMnLC/7Hek41HOqYY73qyN+4FynjUeXjQZkrPTyBXj7XnPF3ro14cZyyJ7o/q9yXAD2Ou0fcTTJr3OjABmcI8yByuUFCcPLB0tS/2XllyDKvo2u9Yu8aB5mYydjfLmtBChmmr6uMyJ0/JYYG3p5qB+ZlkK/87mTCDEPNy/tkqXnWuuK/i1FyTasTyLX58eh3hsRn9RRRu8TFfkDbhY8WeiDF+hja7OPYfe+B4bf1XN4Y/9vC/jReG5l2jt1dlw+J0vvdjvLgoV8g8AsIdNXtfcKb+JwBmw7CJX4M+hrSelzzQxRFAU3zGlAi8JVLJ4sbCD57LawEy/qYOhKIVvyNeXd1xz8TNUxiu8OOmHJ591NwLOuAr18h+IHkD8HMk= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4694 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT049.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(396003)(136003)(39860400002)(46966005)(36906005)(52536014)(2906002)(55016002)(356005)(9686003)(316002)(8676002)(4326008)(33656002)(82310400002)(8936002)(7696005)(81156014)(336012)(6666004)(70206006)(26005)(86362001)(54906003)(110136005)(82740400003)(478600001)(70586007)(186003)(47076004)(81166007)(5660300002)(6506007); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 3b40e2f4-67c7-4e2b-9f7b-08d7eb2a7aec X-Forefront-PRVS: 0387D64A71 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MQN20fH5pGvMskEtQszZnt+pcM1hG92QJHr8KRqMHnyaQrDQ+twi+uf5h8B6Ox9fPC9aKI6w/B/VdepLZg+Imhq9CVx+5wT/Bj9tkwZ2XBykd2n9sHDISDDjnAzp82SQjQ5JBvGs6V6Xa13/uM9Kz3U5gX43NgL3CWX8SXrwMMhbYePv9MNyzKXIHqh5LyR97NG9Mg7khcdyDfgBuaFbWQwOKtfAAHXQ+OAG6CvPwZoG3pxN65RW9Ofazot08Tf4pd4Z7H5U1KSKF8oDqsKuvMRzN0TMSoYKZYlDWs1+1LvH1iwAHlso3dvbYX7O61igdd9ZxVmEY8/28y+LP8J4ETmka+NhqNDuB7kYes3hy9gL0J68XJf8AQAp4WMGWoK/jI7LP/MNRencYog+YU+/L0GmU9UZtcgVs3UjeJjWepDoiEoOoyvqYfPsciPZZ1+bhKuJYyosAJhS7eHeEtBX22MjTHkBuOhRJM+4WhDsdpIsRQH1aqympM3ApwJ4AZD5Y9+orCQHJsbQtTCkrqhNpQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2020 04:13:25.1391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e29163c-2108-4d6c-edb9-08d7eb2a7f42 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2917 Subject: Re: [dpdk-dev] [PATCH v3 1/4] ring: future proof flag settings 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >=20 > All API's should check that they support the flag values passed. > These checks ensure that the extra bits can safely be used without risk o= f ABI > breakage. >=20 > Signed-off-by: Stephen Hemminger Reviewed-by: Honnappa Nagarahalli > --- > lib/librte_ring/rte_ring.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c inde= x > ebe5ccf0de68..e16dd45a82de 100644 > --- a/lib/librte_ring/rte_ring.c > +++ b/lib/librte_ring/rte_ring.c > @@ -42,6 +42,11 @@ static struct rte_tailq_elem rte_ring_tailq =3D { }; > EAL_REGISTER_TAILQ(rte_ring_tailq) >=20 > +/* mask of all valid flag values to ring_create() */ #define > +RING_F_MASK (RING_F_SP_ENQ | RING_F_SC_DEQ | RING_F_EXACT_SZ | \ > + RING_F_MP_RTS_ENQ | RING_F_MC_RTS_DEQ | \ > + RING_F_MP_HTS_ENQ | RING_F_MC_HTS_DEQ ) > + > /* true if x is a power of 2 */ > #define POWEROF2(x) ((((x)-1) & (x)) =3D=3D 0) >=20 > @@ -197,6 +202,13 @@ rte_ring_init(struct rte_ring *r, const char *name, > unsigned count, > RTE_BUILD_BUG_ON(offsetof(struct rte_ring_headtail, tail) !=3D > offsetof(struct rte_ring_rts_headtail, tail.val.pos)); >=20 > + /* future proof flags, only allow supported values */ > + if (flags & ~RING_F_MASK) { > + RTE_LOG(ERR, RING, > + "Unsupported flags requested %#x\n", flags); > + return -EINVAL; > + } > + > /* init the ring structure */ > memset(r, 0, sizeof(*r)); > ret =3D strlcpy(r->name, name, sizeof(r->name)); > -- > 2.20.1