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 35918A00C2; Fri, 24 Apr 2020 20:07:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EBADA1D506; Fri, 24 Apr 2020 20:07:26 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150085.outbound.protection.outlook.com [40.107.15.85]) by dpdk.org (Postfix) with ESMTP id CE6701D441 for ; Fri, 24 Apr 2020 20:07:24 +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=FNIY96zvPxOMp4MWKpfD09QSs0STYlyUbVEaNk18Czo=; b=b9jvWtmeXYFbf1S1+as5wAEx+fveiZIy1hDetW6jGRyjrJSEn6yRvnk8yG6JWIkiTaOS/O1PAqj6a06gKKDxuqd9saRzIUN8g3QmA0SGwvpsg3USkoB5ZonwLoVv9KSygqln5w6M95z2dgDWZy7uafbcZRG0GA7pW7XHVJ0wIvk= Received: from DB6P195CA0018.EURP195.PROD.OUTLOOK.COM (2603:10a6:4:cb::28) by AM5PR0802MB2532.eurprd08.prod.outlook.com (2603:10a6:203:a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Fri, 24 Apr 2020 18:07:23 +0000 Received: from DB5EUR03FT028.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:cb:cafe::7c) by DB6P195CA0018.outlook.office365.com (2603:10a6:4:cb::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Fri, 24 Apr 2020 18:07:23 +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 DB5EUR03FT028.mail.protection.outlook.com (10.152.20.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.19 via Frontend Transport; Fri, 24 Apr 2020 18:07:23 +0000 Received: ("Tessian outbound b3a67fbfbb1f:v54"); Fri, 24 Apr 2020 18:07:23 +0000 X-CR-MTA-TID: 64aa7808 Received: from bd2c5a5a52bb.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 887B57E0-F240-4E70-AB23-E14D60952ED4.1; Fri, 24 Apr 2020 18:07:18 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bd2c5a5a52bb.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 24 Apr 2020 18:07:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iBbNeaYuxjXYALQHSNstxej3R/c35jZKNZoN6obwWeQrxqt6VkHul+BT/yVrCGRdeiHljq9lBQMeF+m/GvUGv0KF6mlWX5kp31XlIkP93N0JePeQcxMLXdk69NQmj0voW0wdncgs0UsltpWvxDXYF3WmGDnWhKcvwyG1/Btmu7aHED8EFqwjn7Jiu9t1usFNa5uObp3X0vrXFEvMX5YVck2SJz2juykr5BfnmlAvkD2v5mELVUzaX8QZ0nZImQdmy4k4ihwCu9+kS4ar7iSmaZy1ToHzCTaPwXcHhCO1g9IuUaPmKeH6yEo7kj76FXKfxvloJj0jIT7N//Bm1L6BDA== 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=FNIY96zvPxOMp4MWKpfD09QSs0STYlyUbVEaNk18Czo=; b=A77fyP37uos5zOUT4vkZMDWbvWG9BB1R5jA4Xu7WJ/g42TBLidZlEgmpJsn19PxTtzMaJT6o2N1cvf6ViBYUgALy5ZB9jStnvXfXXR4d8UIRqUEPp9QwhmQsXn7NVE38wYaTdy/VHZsU8UBfTtm3pQR9plhd7foUcnVy7suv3uQDaK02GqRuwA7clSl0IuE082eIqRox63BbERFHxxihs2BBH3mH55b6sbXWts5L4kKUjrE11lWqnm+NyWGQMub1FUV6Iw9ICljJP4fdLQ1CphpIHAkQMXYJ6P2XsoLJuurVKCPkrmSMxLTDeqS1u4NrSQMq79C9P7ZziaBdK0bahA== 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=FNIY96zvPxOMp4MWKpfD09QSs0STYlyUbVEaNk18Czo=; b=b9jvWtmeXYFbf1S1+as5wAEx+fveiZIy1hDetW6jGRyjrJSEn6yRvnk8yG6JWIkiTaOS/O1PAqj6a06gKKDxuqd9saRzIUN8g3QmA0SGwvpsg3USkoB5ZonwLoVv9KSygqln5w6M95z2dgDWZy7uafbcZRG0GA7pW7XHVJ0wIvk= Received: from DBBPR08MB4646.eurprd08.prod.outlook.com (2603:10a6:10:f5::16) by DBBPR08MB4886.eurprd08.prod.outlook.com (2603:10a6:10:f4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Fri, 24 Apr 2020 18:07:16 +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.2921.030; Fri, 24 Apr 2020 18:07:16 +0000 From: Honnappa Nagarahalli To: Stephen Hemminger , "dev@dpdk.org" CC: nd , Honnappa Nagarahalli , nd Thread-Topic: [dpdk-dev] [PATCH v2 1/4] ring: future proof flag settings Thread-Index: AQHWGlwEpc9DrFIOf0WR1B42WftnX6iIkUUw Date: Fri, 24 Apr 2020 18:07:15 +0000 Message-ID: References: <20200212230810.2837-1-stephen@networkplumber.org> <20200424171536.11535-1-stephen@networkplumber.org> <20200424171536.11535-2-stephen@networkplumber.org> In-Reply-To: <20200424171536.11535-2-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 06fbf423-a331-446c-a25d-72f93bbf8947.0 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 323d47d1-2d0c-4570-490d-08d7e87a56a6 x-ms-traffictypediagnostic: DBBPR08MB4886:|DBBPR08MB4886:|AM5PR0802MB2532: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:3383;OLM:3383; x-forefront-prvs: 03838E948C 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)(396003)(39860400002)(376002)(136003)(346002)(366004)(8936002)(52536014)(2906002)(76116006)(5660300002)(54906003)(33656002)(86362001)(186003)(81156014)(9686003)(66446008)(66946007)(66476007)(66556008)(64756008)(4326008)(55016002)(8676002)(110136005)(26005)(6506007)(71200400001)(478600001)(316002)(7696005); 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: 2nOl8/o+/l7CbZWj5AYF/XXczz5mIaW1jl3NHsfRKRalAgsQyb8Joyn8bvN/2NIFgvOIEJ/soSMCEhmZ1mAM+td721SIO0rgbBsde1ioZupBFGPa98YM3YYeEU/bnott96z3Q2ZCBH+Lgi+8O8Rx4sTClEvJQbL2BR6T+hY7g35nmR8EDmKfoFckNgUU54UfsCxqUaKLBic5pnZIpR1PZajcwQIRmGNGFPzK0UjziaxuwSBEeuX5NEhKhcmfce48TuCBMDYVcp0XRwD1BvT9CqksJRAAj3XNdZQanHm2ulLWldv8URQVl7QlEcLjprp9PpMsNUpcYM5D3hUlif8r5cljvszCJSDnqmlqqsQ+ty217rtuG2sIt9lKjS67NU9GJudlXv8gPh3uXoYZvQ2uIElGeXvTSZ+REf1oHXZlSRYiNOGqV5BnizKVVyHeIZP0 x-ms-exchange-antispam-messagedata: lcIrcE9D0ANG7AjtajyLftgsLwPOMDkWJ3rmlcSdgDcZzRcF5/8q6cJNmt8lb8u0UlbXrPiwUZ/D7NNCq8fmAMhPen0B7KRGO8LKTXGyFSJDnXDZUWKTW5Wq0Ud4HeIG1WE4s1SIOTnt9df86wVytA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4886 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT028.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)(39860400002)(376002)(346002)(396003)(136003)(46966005)(81156014)(8676002)(82310400002)(26005)(356005)(47076004)(54906003)(8936002)(110136005)(336012)(186003)(82740400003)(7696005)(5660300002)(81166007)(316002)(2906002)(52536014)(70206006)(9686003)(70586007)(4326008)(86362001)(55016002)(6506007)(33656002)(478600001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 89d1c7ba-e783-4e72-de34-08d7e87a5256 X-Forefront-PRVS: 03838E948C X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OeiAQ+0HprcRk9akGKOvK4AxfdObLZy2jlL8o12rBAHKljKaVKS1FevD58VvNXN2uPU4CBz3DXYXnMceIMZQXptbdLHuU4muNUV090Mmgxb2/lRSyWIeipI05jTekRUBHnNWFIDf6GBTmtb9fBCiux1+ujRAKLMaAE0yJxBV14UoQJ1IMVPheiN/28MbjK5eNe4GitHuCa8bRLTurwFrjK37VZklo2+YlOHs2uJBF+0oYBL2g1yR2IwXmZPQ8oYHXtmp6OVtNTdbO2dTRRhSqO7vLPB+JmnNnfUXHleB+w1SDumEVsYcZLfw8WOqbcqKEu5LQk4ABBm59dYNOoxwRf7BnFdHTklH0UIz3mpgIJVzXIaKqnrjD+S7sHqOyFLpKvlESIczY4rg5f1fsWh4iaCqSIcDUo5qZSUbDzo0ri1Q1H5OxSWCnQinuGc7P3oH6eqsNxYk+zvWz4qb1SWgmNOxR0RuzJbVM4sAp96C3yMTGjW7DrDJ4itld4mOOM/+l4C4F+Wb4qC59GU6e+XdYw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2020 18:07:23.3537 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 323d47d1-2d0c-4570-490d-08d7e87a56a6 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: AM5PR0802MB2532 Subject: Re: [dpdk-dev] [PATCH v2 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 > --- > lib/librte_ring/rte_ring.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c inde= x > ebe5ccf0de68..70685121581f 100644 > --- a/lib/librte_ring/rte_ring.c > +++ b/lib/librte_ring/rte_ring.c > @@ -42,6 +42,9 @@ 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 0x007F Is it better to construct this using the actual flag #defines? > + > /* true if x is a power of 2 */ > #define POWEROF2(x) ((((x)-1) & (x)) =3D=3D 0) >=20 > @@ -197,6 +200,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