From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0049.outbound.protection.outlook.com [104.47.0.49]) by dpdk.org (Postfix) with ESMTP id 818FACF3 for ; Wed, 25 Apr 2018 11:19:33 +0200 (CEST) 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; bh=1wRDQn8zEhGAreZLT2Be5Rc/7l5nf2xTnbxpO8Nivkg=; b=QVT8Cj9HMq3Vys+5fq+qcSdkad0mBgEL2OoNOdI//jVAcUfpWeOpBbA9pbnVoIfzXfoHfiGRG/MdxOpguyKdLVnqWIanLZrgCBlDQDN8yrq011drVWu9G3fTDUho/xTEfy8U9TzdMA8bHcVVKPSJv0fiDiow/Jq68/xBFIUvAs0= Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com (10.167.195.147) by VI1PR0501MB2464.eurprd05.prod.outlook.com (10.168.136.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Wed, 25 Apr 2018 09:19:32 +0000 Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::5453:e317:6563:11b3]) by VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::5453:e317:6563:11b3%13]) with mapi id 15.20.0696.019; Wed, 25 Apr 2018 09:19:32 +0000 From: Yongseok Koh To: Olivier Matz CC: Andrew Rybchenko , Wenzhuo Lu , Jingjing Wu , "dev@dpdk.org" , Konstantin Ananyev , "Adrien Mazarguil" , =?iso-8859-1?Q?N=E9lio_Laranjeiro?= Thread-Topic: [dpdk-dev] [PATCH v4 1/2] mbuf: support attaching external buffer to mbuf Thread-Index: AQHT220LyCCpNI7frk+eJHPBYtp6AaQP2KqAgAA72ACAARNhgIAACzMAgAADMQA= Date: Wed, 25 Apr 2018 09:19:32 +0000 Message-ID: <22EF1A3B-ECFF-4A4F-955D-43F992B4F135@mellanox.com> References: <20180310012532.15809-1-yskoh@mellanox.com> <20180424013854.33749-1-yskoh@mellanox.com> <934e714e-3cba-7f5d-9fcf-4f96611d758f@solarflare.com> <20180424160244.bggifhilvadxcjb2@neon> <20180425082821.ktbzjrnxbo4nhqgg@neon> <915EB643-1009-4016-9E18-7DAB43FFDC9F@mellanox.com> In-Reply-To: <915EB643-1009-4016-9E18-7DAB43FFDC9F@mellanox.com> 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=yskoh@mellanox.com; x-originating-ip: [73.222.116.174] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0501MB2464; 7:dKjyBxM765ZmG39MuPIF+saaCeaoHKluB9tST3sHxa5PxYGx2dg+ceiXWZYBM0nVJWarLZU8+c3x03E4CJa7a6X2xHnPD5Sp7l1b2gLy2bRZKULDscxf4yNIzBGp7SBvqxDHKHTVAo3dwF99gCZwNJ5yfAdtG0ls3y6QluSfrz6qhNpA30qy000ueTvgO9JsnT315m7QBeBRVQIFcVt0FhEVK7DenUF6AVOdhPYFtij205xr/5WqWt8Ox9EvXXpH x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2464; x-ms-traffictypediagnostic: VI1PR0501MB2464: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231232)(944501410)(52105095)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR0501MB2464; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2464; x-forefront-prvs: 06530126A4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(366004)(396003)(39380400002)(189003)(199004)(5250100002)(5660300001)(7736002)(305945005)(8936002)(53546011)(14454004)(5890100001)(3280700002)(66066001)(3660700001)(106356001)(6486002)(3846002)(6116002)(6512007)(53936002)(6916009)(229853002)(86362001)(81166006)(81156014)(83716003)(8676002)(6506007)(6436002)(6246003)(68736007)(105586002)(186003)(478600001)(11346002)(82746002)(446003)(2616005)(2900100001)(26005)(102836004)(486006)(476003)(2906002)(97736004)(54906003)(33656002)(25786009)(76176011)(99286004)(4326008)(59450400001)(316002)(93886005)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2464; H:VI1PR0501MB2045.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-microsoft-antispam-message-info: YrbMBl87OO7bXq3cIBUq/hD/iayTVw4SJzhvU81yHGwPjteJipk4C9BtdAyWsLGhlounJPQxShPdfIbQppdFzIGKwxLZLcEPYYln4i7JhuYQ8WgvOwj52jA1VRVju8ekFU4rUWzd3wrB0UVRwub2zqU7Xtu3iY27sTPMUMuFNNS6UbTrT+oEWg0FbinZ6GXi spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-ID: <60CEA32DB6B5A14F96CDA3EF34794866@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: cf45b431-5c20-4c9e-b559-08d5aa8da794 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf45b431-5c20-4c9e-b559-08d5aa8da794 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2018 09:19:32.0663 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2464 Subject: Re: [dpdk-dev] [PATCH v4 1/2] mbuf: support attaching external buffer to mbuf 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: , X-List-Received-Date: Wed, 25 Apr 2018 09:19:33 -0000 > On Apr 25, 2018, at 2:08 AM, Yongseok Koh wrote: >> On Apr 25, 2018, at 1:28 AM, Olivier Matz wrote= : >>=20 >> Hi Yongseok, >>=20 >> On Tue, Apr 24, 2018 at 06:02:44PM +0200, Olivier Matz wrote: >>>>> @@ -688,14 +704,33 @@ rte_mbuf_to_baddr(struct rte_mbuf *md) >>>>> } >>>>> /** >>>>> + * Returns TRUE if given mbuf is cloned by mbuf indirection, or FALS= E >>>>> + * otherwise. >>>>> + * >>>>> + * If a mbuf has its data in another mbuf and references it by mbuf >>>>> + * indirection, this mbuf can be defined as a cloned mbuf. >>>>> + */ >>>>> +#define RTE_MBUF_CLONED(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF) >>>>> + >>>>> +/** >>>>> * Returns TRUE if given mbuf is indirect, or FALSE otherwise. >>>>> */ >>>>> -#define RTE_MBUF_INDIRECT(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF) >>>>> +#define RTE_MBUF_INDIRECT(mb) RTE_MBUF_CLONED(mb) >>>>=20 >>>> It is still confusing that INDIRECT !=3D !DIRECT. >>>> May be we have no good options right now, but I'd suggest to at least >>>> deprecate >>>> RTE_MBUF_INDIRECT() and completely remove it in the next release. >>>=20 >>> Agree. I may have missed something, but is my previous suggestion >>> not doable? >>>=20 >>> - direct =3D embeds its own data (and indirect =3D !direct) >>> - clone (or another name) =3D data is another mbuf >>> - extbuf =3D data is in an external buffer >>=20 >> Any comment about this option? >=20 > I liked your idea, so I defined RTE_MBUF_CLONED() and wanted to deprecate > RTE_MBUF_INDIRECT() in the coming release. But RTE_MBUF_DIRECT() can't be > (!RTE_MBUF_INDIRECT()) because it will logically include RTE_MBUF_HAS_EXT= BUF(). > I'm not sure I understand you correctly. >=20 > Can you please give me more guidelines so that I can take you idea? Maybe, did you mean the following? Looks like doable but RTE_MBUF_DIRECT() can't logically mean 'mbuf embeds its own data', right? #define RTE_MBUF_INDIRECT(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF) #define RTE_MBUF_DIRECT(mb) (!RTE_MBUF_INDIRECT(mb)) #define RTE_MBUF_HAS_EXTBUF(mb) ((mb)->ol_flags & EXT_ATTACHED_MBUF) #define RTE_MBUF_CLONED(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF) [...] @@ -1327,7 +1572,7 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m) =20 if (likely(rte_mbuf_refcnt_read(m) =3D=3D 1)) { =20 - if (RTE_MBUF_INDIRECT(m)) + if (RTE_MBUF_INDIRECT(m) || RTE_MBUF_HAS_EXTBUF(m)) rte_pktmbuf_detach(m); =20 if (m->next !=3D NULL) { @@ -1339,7 +1584,7 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m) =20 } else if (__rte_mbuf_refcnt_update(m, -1) =3D=3D 0) { =20 - if (RTE_MBUF_INDIRECT(m)) + if (RTE_MBUF_INDIRECT(m) || RTE_MBUF_HAS_EXTBUF(m)) rte_pktmbuf_detach(m); =20 if (m->next !=3D NULL) { Thanks, Yongseok