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 8624FA04C7; Mon, 25 Nov 2019 11:21:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 64BC52952; Mon, 25 Nov 2019 11:21:36 +0100 (CET) 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 2DC6B28EE for ; Mon, 25 Nov 2019 11:21:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KhDa6TSMTRjYi4J/5BDhy22lKHcB9pJvqrcLzIlAFERe/Bq0Z4tCKASLPflhnHa7VXU/voMHzLVcVDcjlx1G0v2jf1HJeyj3c0m4+cunyrqtxHAXd+qa+Eb5EyazjTK6/SD/OLmJ4w08v84icoq11OvJZbxXj2swD0T0VkbNdOny0epiczCVW6R9FPSsBVwSQjIy+HsCrEwhRRfkXk4Wb5jDbo/zR0Q6JDX7ozya5cqCmQjvrxF0EViBiGS/TdMfqT4dVSNQ0jwpny7MP3godh+vFBzDALTNfcVeqcTvIiVFER5a15R1EkqPmB6w+ytNybg0AIshm8Jad5o9GWE16w== 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=NHoV+mMh7iqAsL1qd2O/ivH9CSgV8Yt5n2XTh+ErieY=; b=JaHKzbFB+RlJY2xu9JCW+Tivlcb+opLq/ZW+PTJm4d/XAm6G3dmjeCTOkAQisn3n4Qej2efHa5g/wxNe1nVsoVHF5gFwv3A625ik2TAnX+URunqx3tpYlHtSWbgVieBkqc2fTiWzfdbS/Lr6MaA5hKqBP9q0eSf76Vnizoi55ko2c5P8s+npBVx2xU14nradPVVn5Zn22CaIjZJ76kB52Uoq438hGPz4ojNLB3RlspWDAtY74BCzwOkJHj/5yyABeVBxUgkANaiCyLbiMYbKcw+OkHjraf73GYqVOSSev1fCvb39zbYm7C7/ltNypaCd3IY0SDe3jrP4BTDc1lAf3A== 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=NHoV+mMh7iqAsL1qd2O/ivH9CSgV8Yt5n2XTh+ErieY=; b=kqyGOsGmuQcAU4guZNKDl8i1BTf74cg2KlSDI8Rwxbnt9kLb/YAAlWjy03OG5TnA4asLdYFiwlhZthKLPp3zk/5kFm2DlG/CugD5OwRXQSUeYWs6RormgHuOdEOzpv4te29Ifit9Q2hrZ772J6kCfY/uvxap1T1IxdRoOaRFni4= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB3828.eurprd05.prod.outlook.com (52.133.47.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Mon, 25 Nov 2019 10:21:32 +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; Mon, 25 Nov 2019 10:21:32 +0000 From: Shahaf Shuler To: "dev@dpdk.org" , Thomas Monjalon , "olivier.matz@6wind.com" Thread-Topic: [PATCH v4] mbuf: extend pktmbuf pool private structure Thread-Index: AQHVo3oblZIjPtUxoE6T50Bs+MFaCA== Date: Mon, 25 Nov 2019 10:21:32 +0000 Message-ID: <20191125102125.176945-1-shahafs@mellanox.com> References: <20191124055336.129527-1-shahafs@mellanox.com> In-Reply-To: <20191124055336.129527-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: AM0PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:208:ac::27) 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: 8ba39088-c3e3-4cca-3a78-08d771913e45 x-ms-traffictypediagnostic: AM0PR0502MB3828: x-ms-exchange-purlcount: 1 x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0232B30BBC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(136003)(39860400002)(346002)(366004)(396003)(199004)(189003)(186003)(6306002)(6512007)(3846002)(6436002)(6486002)(1076003)(6116002)(2906002)(50226002)(71200400001)(8676002)(71190400001)(81156014)(81166006)(66446008)(8936002)(66946007)(66476007)(64756008)(66556008)(5660300002)(256004)(446003)(11346002)(14444005)(25786009)(36756003)(66066001)(2501003)(316002)(478600001)(386003)(6506007)(102836004)(76176011)(86362001)(52116002)(305945005)(966005)(99286004)(110136005)(26005)(7736002)(2616005)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3828; H:AM0PR0502MB3795.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: Ks2l19SIKxzEwfx8HIwGITdebI+BZxfmA0j/wD5x+3ytxmqTSkyQJ/iC6NES9grRfoz5lgQA8jaK2OaIxKOjUobP5Ro0CqqgmKk0+k5ZXJQ7O6gTO2KEF5XuEpwJM/1SZOIRwudUwhwhYcfHzhMRDWVcz3JqQw4pXOIvjGMR90oh0gEfm/XMcaxZFSSgLew+7BjpFzVWDS8OJcC2Uztzw9sV+lFoDZ3Q0147be6M1koQWAoOwB+BdvnjHkiXR2e6oHMwFkajWawd1obgLJs1jsomjEOs8qusgTCNtVXEVLSEY9tJyVBbQDawlX88xK5ubJu2gDbvfXvUSBVrQEZhhFCh0M0t3Od5reyxPrgiV5e6XQfSiBqQpLt8PWLzIwt7PZgcSt5cpJLr5Oez4xC6gAVSZqIPwHvXUtOj3VlyJM5FmOfaT1Sh5u/GRd4tT9VIAVZdswqOX9sx5HW3J9mAwZHodSUze3+FA1+jYtL8Clc= 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: 8ba39088-c3e3-4cca-3a78-08d771913e45 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2019 10:21:32.7474 (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: TGWLvqMjDRihOREiLZAh1iRdhf5NAR1aWfYJsvordJ84evP8DEYbLWEIStGCfowSSbqsm321YjFjY0cjgHpWsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3828 Subject: [dpdk-dev] [PATCH v4] 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 v4: - added note to release notes 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 --- doc/guides/rel_notes/release_19_11.rst | 7 +++++++ examples/ntb/ntb_fwd.c | 1 + lib/librte_mbuf/rte_mbuf.c | 4 +++- lib/librte_mbuf/rte_mbuf.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/= release_19_11.rst index c0045a91ff..b8c4d35b4d 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -65,6 +65,13 @@ New Features =20 The lock-free stack implementation is enabled for aarch64 platforms. =20 +* **Extended pktmbuf mempool private structure.** + + rte_pktmbuf_pool_private structure was extended to include flags field + for future compatibility. + As per 19.11 release this field is reserved and should be set to 0 + by the user. + * **Changed mempool allocation behaviour.** =20 Objects are no longer across pages by default. 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