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 BEFDCA034F; Sun, 24 Nov 2019 06:53:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8B2A32C6A; Sun, 24 Nov 2019 06:53:48 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150071.outbound.protection.outlook.com [40.107.15.71]) by dpdk.org (Postfix) with ESMTP id 0B561235 for ; Sun, 24 Nov 2019 06:53:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MOHsbNdZd1WGKlU9InqxXtAEnv5bEOKkXjIfejtq//a0KRZ0sjxjnWrLe8FMgx4PfKSGwGvVUzf1jNnZg2dtT3Pb/bOJJqin+wQ31JdwUSbPz41OvSV12OFu8ARiHAXWGYznXmkqYBk2s2VW5/h7ISB5yT3vDb1NsQr2le413wprvlY03uNsMJvWlaZefRG0QB9rHOSgD6yCeeYnPQYaTWZwVQF1uwLLSJFjV1UmsOv1KmO5rSLrfVFKVBJWTttaMOt6TyDnU5l9dM04XbPiu+UKky8uxHRzqBr7cZvtd9hO1k47t4A3SKP1zxa6PI6aVvnnXWyRrBrAHurnKdCELg== 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=+j0vPV4KkFliXcgdXrYz3zJHRcPi3TvXs+oNxKZxMdo=; b=BTRvn2yYmmVZ1FfRLK+vcEaM4p4oIUwLcBEONLIbROkHVT4zS1hQzvlgmvletDLQSPR8ggALfMdOhQtSwq+qijz56nYCFpxa3uNolqxUQP399a50BPvyuDYbfyglQbiAiCy+9TQS4GGNy+xPEibWEGR6wlI1Irahl3PMXoEJyVGPnInLp4lkJvMrQYik9YmYYDgQlW4oXVqO66OFNDmly2YOaTA2gBwjl0kd/IMBY8G7md6Fr2JUEA6n8J42Oeq6CBhZo1tCx0Vl23bSDOdGSJ3b4NmafxdP2Owe2dcLMyPNil9Z5lrdY/pA9DSZZCo9FS7qOIp2i+mlN6N3yd+0Hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+j0vPV4KkFliXcgdXrYz3zJHRcPi3TvXs+oNxKZxMdo=; b=VyHcF1shtP+sPJfae4cKLAjdiALuq2LBR1jGxDWjUymhHquNjpwH3DH3rXwB1RQrw9ZprtR/RMJIORZ+RdIEt7/hThuZlu1WwquOU7VKsoWt0f+0u5C5KmL96W7HgnVBxFSHeyRq5kvqVMDDG41QzqYr/0I0JlVGmuk4N7d+FFg= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB4002.eurprd05.prod.outlook.com (52.133.40.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Sun, 24 Nov 2019 05:53:46 +0000 Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::2441:6a62:ee55:bf6f]) by AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::2441:6a62:ee55:bf6f%7]) with mapi id 15.20.2474.023; Sun, 24 Nov 2019 05:53:46 +0000 From: Shahaf Shuler To: "dev@dpdk.org" , Thomas Monjalon , "olivier.matz@6wind.com" Thread-Topic: [PATCH v3] mbuf: extend pktmbuf pool private structure Thread-Index: AQHVoouJlMPgBAyq2EylyMCDrrk7ew== Date: Sun, 24 Nov 2019 05:53:46 +0000 Message-ID: <20191124055336.129527-1-shahafs@mellanox.com> References: <20191121122810.147351-1-shahafs@mellanox.com> In-Reply-To: <20191121122810.147351-1-shahafs@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.12.0 x-clientproxiedby: AM0PR02CA0015.eurprd02.prod.outlook.com (2603:10a6:208:3e::28) To AM0PR0502MB3795.eurprd05.prod.outlook.com (2603:10a6:208:1b::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.188.199.18] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d912129b-3f72-43fb-e964-08d770a2ab6c x-ms-traffictypediagnostic: AM0PR0502MB4002: x-ms-exchange-purlcount: 1 x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 02318D10FB x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(136003)(346002)(39850400004)(366004)(189003)(199004)(5660300002)(14444005)(52116002)(256004)(26005)(76176011)(66066001)(99286004)(6486002)(1076003)(305945005)(102836004)(66946007)(64756008)(66446008)(66476007)(7736002)(66556008)(386003)(6506007)(2501003)(86362001)(316002)(186003)(14454004)(6436002)(2906002)(966005)(3846002)(25786009)(446003)(6512007)(478600001)(6116002)(8676002)(50226002)(36756003)(8936002)(2616005)(6306002)(71190400001)(81166006)(71200400001)(11346002)(81156014)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB4002; H:AM0PR0502MB3795.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M271/peULgwCzWfpqPpH+cxQ7I2jaaMkPc14ipOphWGFxCfhG4InVfehR6djdGrXn6ILyI3xBhsvhgvq3gHJk8N1pMh8/uYti6Ti8l9YDH1rR6BtHWndnIX+WEgGXaM8lWjzAJUCBVUmE6w/Y80EbZm1qqWtFvZx2qYG2vbD/5PiEgLt/xHqrLZe7CBxASSmsUsKemnS3UzrqdEMNpvuVYchxcj5fCAk1NIUZ80HQlzfeHIks6AdepYJjNdIUr4AlLaEk7m5NnoX8jZjwZ4kaD6HwzfaD4DDDbn0/gONMEKxl6GeqnhbUH7CqlGpZeOWPWgkpNxwmcf9kWaaKXpyIh3ziGBl9KDCXCgW8Wb1ywVPLI6/zA/oJaNRwik4j7JP/vpwXVUXgiP50chUuSoXGKakAxhIocMt8PGgP0zy1v5sEfqpdtdlMtyvo3hPXlQR5gKAX+XD5qfCDXT6+NSGgmhqTA4zUBX49X+XNahFtLw= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d912129b-3f72-43fb-e964-08d770a2ab6c X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Nov 2019 05:53:46.0928 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: dsOafcJfzfgVXdUrbkTkhvWleEL5mP7dFTYCevX7u8JkBEsoYBO1NDvlrlLbvn3kwr87FwuD7oLQ1QMKQgul8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB4002 Subject: [dpdk-dev] [PATCH v3] mbuf: extend pktmbuf pool private structure 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" With the API and ABI freeze ahead, it will be good to reserve some bits on the private structure for future use. Otherwise we will potentially need to maintain two different private structure during 2020 period. There is already one use case for those reserved bits[1] The reserved field should be set to 0 by the user. [1] https://patches.dpdk.org/patch/63077/ Signed-off-by: Shahaf Shuler --- On v3: - use memset to zero the entire private struct - validate flags is set to 0 also on ntb example On v2: - rename new field to flags - add extra validation in code that flags =3D 0 --- examples/ntb/ntb_fwd.c | 1 + lib/librte_mbuf/rte_mbuf.c | 4 +++- lib/librte_mbuf/rte_mbuf.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index edce77ecdc..c914256dd4 100644 --- a/examples/ntb/ntb_fwd.c +++ b/examples/ntb/ntb_fwd.c @@ -1256,6 +1256,7 @@ ntb_mbuf_pool_create(uint16_t mbuf_seg_size, uint32_t= nb_mbuf, if (mp =3D=3D NULL) return NULL; =20 + memset(&mbp_priv, 0, sizeof(mbp_priv)); mbp_priv.mbuf_data_room_size =3D mbuf_seg_size; mbp_priv.mbuf_priv_size =3D 0; rte_pktmbuf_pool_init(mp, &mbp_priv); diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 35df1c4c38..8fa7f49645 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -49,7 +49,7 @@ rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaqu= e_arg) /* if no structure is provided, assume no mbuf private area */ user_mbp_priv =3D opaque_arg; if (user_mbp_priv =3D=3D NULL) { - default_mbp_priv.mbuf_priv_size =3D 0; + memset(&default_mbp_priv, 0, sizeof(default_mbp_priv)); if (mp->elt_size > sizeof(struct rte_mbuf)) roomsz =3D mp->elt_size - sizeof(struct rte_mbuf); else @@ -61,6 +61,7 @@ rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaqu= e_arg) RTE_ASSERT(mp->elt_size >=3D sizeof(struct rte_mbuf) + user_mbp_priv->mbuf_data_room_size + user_mbp_priv->mbuf_priv_size); + RTE_ASSERT(user_mbp_priv->flags =3D=3D 0); =20 mbp_priv =3D rte_mempool_get_priv(mp); memcpy(mbp_priv, user_mbp_priv, sizeof(*mbp_priv)); @@ -126,6 +127,7 @@ rte_pktmbuf_pool_create_by_ops(const char *name, unsign= ed int n, } elt_size =3D sizeof(struct rte_mbuf) + (unsigned)priv_size + (unsigned)data_room_size; + memset(&mbp_priv, 0, sizeof(mbp_priv)); mbp_priv.mbuf_data_room_size =3D data_room_size; mbp_priv.mbuf_priv_size =3D priv_size; =20 diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 92d81972ab..219b110b76 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -303,6 +303,7 @@ rte_mbuf_to_priv(struct rte_mbuf *m) struct rte_pktmbuf_pool_private { uint16_t mbuf_data_room_size; /**< Size of data space in each mbuf. */ uint16_t mbuf_priv_size; /**< Size of private area in each mbuf. */ + uint32_t flags; /**< reserved for future use. */ }; =20 #ifdef RTE_LIBRTE_MBUF_DEBUG --=20 2.12.0