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 08FFFA04DD; Tue, 21 Jan 2020 10:13:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D24CA2C23; Tue, 21 Jan 2020 10:13:57 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60040.outbound.protection.outlook.com [40.107.6.40]) by dpdk.org (Postfix) with ESMTP id 0810AF72 for ; Tue, 21 Jan 2020 10:13:57 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bXQwmJAugWqEXQt5TCZQBAqWLnOaHZux2OaMjE/1Bkh/TKJPGijXgsIH4DVlKhOoe/buLtOuQh/73SyDpGXHaLa+kTMubihjDnp3pX6B9hb9td7G7Pr7juN2+CibWWD0y6M9WmqKQZkGQ0x1HAXhNol1aEK5hmSpjwrD7mqtPB/VIhR1IIJBEgqWsF3y5BELyKtCrT+2F0fTQPryuTusMxKXX+txyCdFmxbK+q83o6O8SYwmkHOBvzwirSs7Ko5mWsgQpW47c/PcvkOweu6uxe0MZzP4Ly1C/+yw4IayGBuxoIlqW258gqcPUEYaGWZ3FiZPZUxy+8H9ZEl4nCCncg== 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=roqwBeBAr/daX1AWXhGu2FdTaLS/EBzgKJsCtHRFr8Q=; b=jz9P33pdLK03xMsp31o4m/tB10+UMLsuUiWwxOYYdtBVWiCm0tbEi7tLbSarQy2S/snbZKNM7lao7WXO3lOTUmvKEeDIGinVOhYX4+yotoMKlni/9g4xTepvIPSX/KHly+VnE376a/fhL7h6pL2NIveXMlSDmUwHuta5tVz4r2cPcU7I8leo7DUdXEtUvSY/W0MzrrdiUH1j+PkpJckBxAs9UX1HAAMP7lorkbCA+gn3h4e5MXr+hdqyLUfKnDiK2Znb9RVEtScvuMLbCOTUnH1ue4vnb53/Cz5RaAXA+EEmFoLroRjM+9sn4YCCs3jYScJ05FSZJp47FhSYt4WMRQ== 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=roqwBeBAr/daX1AWXhGu2FdTaLS/EBzgKJsCtHRFr8Q=; b=YU5erhGKhuKYZbk+XQv8gdp15nZUdtiBBNGxLp3LEdyQ6YouSvhQWETswSpFDkiF6KLdBvq+ZyVRio7qeWRt+LzmVC9O73DojBDbhhOEaxjLFV73zSeRymFj2VGf6SIUMzybed8bm8gUNS4Locrc5sR8+IQnkkOuApqYHHKD/XY= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3156.eurprd05.prod.outlook.com (10.171.186.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19; Tue, 21 Jan 2020 09:13:49 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::68eb:ad79:71f4:110f]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::68eb:ad79:71f4:110f%3]) with mapi id 15.20.2644.024; Tue, 21 Jan 2020 09:13:49 +0000 From: Slava Ovsiienko To: Slava Ovsiienko , Olivier Matz CC: Stephen Hemminger , "dev@dpdk.org" , Matan Azrad , Raslan Darawsheh , Ori Kam , Shahaf Shuler , "thomas@mellanox.net" Thread-Topic: [PATCH v5 1/5] mbuf: introduce routine to get private mbuf pool flags Thread-Index: AQHVz9JUQbzanLz0f0WVDugMHenrNaf0wCKggAAFxYCAAAJjwIAADQxA Date: Tue, 21 Jan 2020 09:13:48 +0000 Message-ID: References: <20191118094938.192850-1-shahafs@mellanox.com> <1579541003-2399-1-git-send-email-viacheslavo@mellanox.com> <1579541003-2399-2-git-send-email-viacheslavo@mellanox.com> <20200120124342.6b308e18@hermes.lan> <20200121081417.GO14387@glumotte.dev.6wind.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-originating-ip: [77.75.144.194] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d9350353-26ac-402f-81e2-08d79e5239c8 x-ms-traffictypediagnostic: AM4PR05MB3156:|AM4PR05MB3156: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0289B6431E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(39860400002)(376002)(396003)(346002)(136003)(189003)(199004)(7696005)(5660300002)(186003)(52536014)(54906003)(110136005)(71200400001)(2906002)(478600001)(4326008)(33656002)(6506007)(53546011)(26005)(2940100002)(55016002)(9686003)(66446008)(8676002)(86362001)(316002)(81166006)(64756008)(76116006)(66556008)(66946007)(8936002)(66476007)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3156; H:AM4PR05MB3265.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: EvilBkPXz2iU3/FIzaDcuK3JXCNfbyyQQWbfUxPsomKMXm5tbGAYwRLCC36Y81QlNpOTW+8bU7gicGDTcINSp4JL4WCKQQdZ1syN0l2QbCIo1SS/wUKKMlRI/RD9Q2hFPbT04qE46s04D3U+v84TFfiT4PFEXw9pLnrkQCbknRtTQoNx2/Dkcs4KYr1LDiHW9ZzXA+WC+HJbi0zTFcpYXvz9RKx00dAtD2HWInpuMkkfzTzs64MVD9gWG0mkbjP+C/NRseRrcnDgndy4/4FnLPDGUkwRL09T2OA/QU90TDSTS7qA9gr41Q0NA/1JkXeDzlf7Av6VV17i/7kfWYTo3SdDNOWWyRJ+T+6dmlrtA+Nhuo/DTkJwCdytGPB0iKT8NiuTSQj8zPNErLzkyaBgJl9T9LE/jl17guH+8ko+Pzu8MWUf6ekSOHeTXWAaSJmF Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9350353-26ac-402f-81e2-08d79e5239c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2020 09:13:48.9683 (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: kguyYzV3FoVL+fxcBvp6LIJnZ4UtJ9tVR3GdtPTrcAuBzZApMnNOPYbl7/wcdvXoxPDdW3LA0xc2t2BKcGu9cvoiztUx5Ii1jZglnLA4O8o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3156 Subject: Re: [dpdk-dev] [PATCH v5 1/5] mbuf: introduce routine to get private mbuf pool flags 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" > -----Original Message----- > From: dev On Behalf Of Slava Ovsiienko > Sent: Tuesday, January 21, 2020 10:24 > To: Olivier Matz > Cc: Stephen Hemminger ; dev@dpdk.org; > Matan Azrad ; Raslan Darawsheh > ; Ori Kam ; Shahaf Shuler > ; thomas@mellanox.net > Subject: Re: [dpdk-dev] [PATCH v5 1/5] mbuf: introduce routine to get pri= vate > mbuf pool flags >=20 > > -----Original Message----- > > From: Olivier Matz > > Sent: Tuesday, January 21, 2020 10:14 > > To: Slava Ovsiienko > > Cc: Stephen Hemminger ; dev@dpdk.org; > > Matan Azrad ; Raslan Darawsheh > > ; Ori Kam ; Shahaf Shuler > > ; thomas@mellanox.net > > Subject: Re: [PATCH v5 1/5] mbuf: introduce routine to get private > > mbuf pool flags > > > > On Tue, Jan 21, 2020 at 08:00:17AM +0000, Slava Ovsiienko wrote: > > > > -----Original Message----- > > > > From: Stephen Hemminger > > > > Sent: Monday, January 20, 2020 22:44 > > > > To: Slava Ovsiienko > > > > Cc: dev@dpdk.org; Matan Azrad ; Raslan > > Darawsheh > > > > ; Ori Kam ; Shahaf > > > > Shuler ; olivier.matz@6wind.com; > > thomas@mellanox.net > > > > Subject: Re: [PATCH v5 1/5] mbuf: introduce routine to get private > > > > mbuf pool flags > > > > > > > > On Mon, 20 Jan 2020 17:23:19 +0000 Viacheslav Ovsiienko > > > > wrote: > > > > > > > > > The routine rte_pktmbuf_priv_flags is introduced to fetch the > > > > > flags from the mbuf memory pool private structure in unified fash= ion. > > > > > > > > > > Signed-off-by: Viacheslav Ovsiienko > > > > > Acked-by: Olivier Matz > > > > > --- > > > > > lib/librte_mbuf/rte_mbuf.h | 17 +++++++++++++++++ > > > > > 1 file changed, 17 insertions(+) > > > > > > > > > > diff --git a/lib/librte_mbuf/rte_mbuf.h > > > > > b/lib/librte_mbuf/rte_mbuf.h index 2d4bda2..9b0691d 100644 > > > > > --- a/lib/librte_mbuf/rte_mbuf.h > > > > > +++ b/lib/librte_mbuf/rte_mbuf.h > > > > > @@ -306,6 +306,23 @@ struct rte_pktmbuf_pool_private { > > > > > uint32_t flags; /**< reserved for future use. */ }; > > > > > > > > > > +/** > > > > > + * Return the flags from private data in an mempool structure. > > > > > + * > > > > > + * @param mp > > > > > + * A pointer to the mempool structure. > > > > > + * @return > > > > > + * The flags from the private data structure. > > > > > + */ > > > > > +static inline uint32_t > > > > > +rte_pktmbuf_priv_flags(struct rte_mempool *mp) { > > > > > + struct rte_pktmbuf_pool_private *mbp_priv; > > > > > + > > > > > + mbp_priv =3D (struct rte_pktmbuf_pool_private > > > > *)rte_mempool_get_priv(mp); > > > > > + return mbp_priv->flags; > > > > > +} > > > > > + > > > > > #ifdef RTE_LIBRTE_MBUF_DEBUG > > > > > > > > > > /** check mbuf type in debug mode */ > > > > > > > > Looks fine, but a couple of minor suggestions. > > > > > > > > > > > > Since this doesn't modify the mbuf, the arguments should be const. > > > > Since rte_mempool_get_priv returns void *, the cast is unnecessary. > > > > > > rte_mempool_get_priv() does not expect "const", so adding "const" is > > > a bit problematic, and we should not change the > > > rte_mempool_get_priv() > > prototype. > > > Do you think we should take private structure pointer directly from > > > the pool structure instead of calling rte_mempool_get_priv() ? > > > > I'm not sure it would work. The problem is that to get the priv, we do > > pool_ptr + offset. So if we want to remove the const, we'll have to do > > a cast to "unconst". Not sure it is worth doing it. > > > > Thanks > > Olivier > OK, I'll just remove not necessary (struct rte_pktmbuf_pool_private*) cas= t and > will not introduce const qualifier for the parameter. >=20 > With best regards, Slava I've checked the rte_mempool_get_priv() usage - in all header files there are the type casts. The "rte_mbuf.h" contains the rte_pktmbuf_priv_size() a= nd rte_pktmbuf_data_room_size(), both provide the cast. What is the reason? C++ compatibility? Should we remove the cast in rte_pktmbuf_priv_flags()? With best regards, Slava