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 290A57F50 for ; Wed, 25 Apr 2018 20:22:39 +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=TJMyshwW2/tRgZS3NVTTeVj85ujLV6uevIfTpa+37sA=; b=BNwzppCIdtkeDf5EGApMNrsk1zyIMWhbof98YPqOz+7suFe32Fzj18RULLITJtTwoAGtq5eT4g/ZZWBRdV+YjqXrpkRa42SGEmi2Ctgqxwz80hxHeS2XlNgBRR45FlJdxYQlrCZ75wAzq9ZTPc1drJe3TPhyvFbnKngfqmYdl+4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from yongseok-MBP.local (209.116.155.178) by VI1PR0501MB2047.eurprd05.prod.outlook.com (2603:10a6:800:36::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Wed, 25 Apr 2018 18:22:33 +0000 Date: Wed, 25 Apr 2018 11:22:22 -0700 From: Yongseok Koh To: "Ananyev, Konstantin" Cc: "Lu, Wenzhuo" , "Wu, Jingjing" , "olivier.matz@6wind.com" , "dev@dpdk.org" , "arybchenko@solarflare.com" , "stephen@networkplumber.org" , "thomas@monjalon.net" , "adrien.mazarguil@6wind.com" , "nelio.laranjeiro@6wind.com" Message-ID: <20180425182221.GE3268@yongseok-MBP.local> References: <20180310012532.15809-1-yskoh@mellanox.com> <20180425025341.10590-1-yskoh@mellanox.com> <2601191342CEEE43887BDE71AB977258AEBCF98C@IRSMSX102.ger.corp.intel.com> <20180425170638.GB3268@yongseok-MBP.local> <2601191342CEEE43887BDE71AB977258AEBCFD59@IRSMSX102.ger.corp.intel.com> <20180425180235.GD3268@yongseok-MBP.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180425180235.GD3268@yongseok-MBP.local> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: BN6PR1001CA0012.namprd10.prod.outlook.com (2603:10b6:405:28::25) To VI1PR0501MB2047.eurprd05.prod.outlook.com (2603:10a6:800:36::21) X-MS-PublicTrafficType: Email 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:VI1PR0501MB2047; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2047; 3:AjNISWBMNGHbdByw3Ev0pziGBq49ayNbOZY7HOQZ1DF8mBQhLsbmnXk7QbVL71Ok6rVXldDKLCjgUyvfJu3lFmx2jZSq6Is5RYSRVUx6lj97PfzkMtQyKYq4zR7ep3TQBtka1XDhnvN6DJix49kx99dH9XcmPsrsz4zVPlMFfIR85dVGPVWb9B3fLgmevI5y5nVN9rMVFDo+qp4OwHCSIie2P9mRdm1TGewRKhUw4RUn4GM5FVjCBCoz2JT5g01y; 25:1CSTnRmZhKmsXr4kb4FT/b5RVAVsqucanavsrV9acp6+mmUCuQkh6Yb6LibBC+ZCKCfh+ww+Ud07YY/fPL+vHxIzJ8uvGDsmOmBrdJk2kKYVbYD3N1VOqxAezuvS6mJryRBxqwNSo5QJAi9G3WjqkGY8MgKZhIC/V9C+j8/z2nv/HOcA1nyldxBiaj+jFCEVZHRo5mMV3hEq/xDcO+MZyc8KB4ZPujtFpukYpGl5YYmKJlufLyMUdTod/T63+TCCGF8/vXKl0w3bHQ+wWER+k8c2cwe728zJdTBwULd+TRXOtDPn4K7Vo38M6jbVsMkGjd0vPy2NB7kxwnN1S9TGxw==; 31:DgFKfiMe3Ejz7XsME9PqhxeBJPgkjqpeZPTKqBreQri07csTlL1OEflwHc5b1SifYRUqoPdWa2vkwRHUToOZEq9TFUkUjHjTBnIypcpeok+3QJMOl68MKL+2uH4Ng0hLr3k5FOPIYkihY0Tid6E3+g4ZfKNYQFWDLgWybajtxZu35ErMwsa9A51DXzaJDsXjq7p2PxnvF2Tm1PEBnyNV4BHZX7IlElPvAhxLQ7A2mA0= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2047: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2047; 20:z6dcD6KTI/pG/gd9L7cPk2oPXgUc+Qh9rjk/7URNm/BOYnNlJW9CpgPRHs47zkvu8utHn0gjLBwFqqi9XtOugdz64TaT0rJfKB+G8B2WpxLJAjmO6nSb2LjQhOKlb4Ersiw2oZOm4E/mxGUe6hrqgmR3HqMrzyr76DP0oPr6jRPDSmZPZPZEwcVGAXkISENnauNfw7Nf0/1IsD5XISY9ULwG4ln/i9qXlu4ivYrWsetbFJzrnMj9V7RqAJk1VsFjvdtxag4P2pYHoS+qU0C8qzp/pTqoSoMg6O9qoZatsy8ems1G7xXGN8spk6gOSOBLs5RxkPrjddd903s+b/LIAs9qdPdJ4lLW//seIrIMXS2fGI6+MOYETcG6pyS8q5F+R/ngE/fYuFAFh9d98KKwcEgey6s1r22Z4qff1dPc9r97n9J51dIAfLKZtg3717sIOmMfY06BXMpQ8ua3Vy6kZSuPxVwfuDUDetNxOVEMSCAj4z+luKzPADfBPHSfvno0; 4:47yMein7ZbvyPTS/qbgB9e7yC6OxKsSuTsLtKmVciOig3iKSreX6weoKcMgzZ9mHMk1vO5x3mpRxUpXqchbgNRnrwU5tyQ9ghiRy2lxxfo7X3xV8lWhkP2/ARirtden8yVqOgxwxhmLiDP2AbvPCoNBSHGk8d9tZ3krgcEMCwIc6okUDxe6bp92uW6R2HUphMnzSVrDE8j92L0xQslw4HxBwkju4rbms7StY7qr2fbnAgwFwT8amkMIRzj/VdBVXIMl1vC4oZsWUtCKzncxfwVX9laOP05poiCC8CgC1PtHuQhzECW5/IC91ALxkwz9mIaIiSheDE6igGGz1XF6haa4k4w8dN+5dvT7ecmR0Kiw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231232)(944501410)(52105095)(6055026)(6041310)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR0501MB2047; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2047; X-Forefront-PRVS: 06530126A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(39380400002)(346002)(396003)(13464003)(199004)(189003)(446003)(3846002)(2906002)(486006)(97736004)(1076002)(6116002)(23726003)(6666003)(81156014)(105586002)(86362001)(476003)(11346002)(68736007)(8676002)(8936002)(956004)(81166006)(5890100001)(6246003)(478600001)(58126008)(55016002)(33896004)(7696005)(7736002)(26005)(229853002)(93886005)(33656002)(7416002)(76176011)(54906003)(52116002)(16526019)(5660300001)(98436002)(186003)(53546011)(4326008)(16586007)(6916009)(47776003)(386003)(6506007)(316002)(50466002)(59450400001)(9686003)(106356001)(25786009)(66066001)(53936002)(305945005)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2047; H:yongseok-MBP.local; 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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2047; 23:BZ91NJnctrLqjhHl4X0No67gxuqCPxxPaBWPQGt?= =?us-ascii?Q?U7vucPudmslISRehGZxSYF82W90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uhhMw5HEEobi/77Un9xV6rXJ41t8G4Lbom4Ml9tuxPkJDuXV9/POZk/U/9sMBV1+CO3FIkbox7rJCCPP6j9i53/KNsY1IIZjm6nuM6DRRadExekhmCXVM6IHWKG2U2HIZ3WUq8rVQDoLN3hrA6kWUpYiFU1xwa7/59qSBErFzPEMtGTqkVkiJNxEen34bPHCPwQXLS4ruuAYbVlR6iFi7ndEoGpBoJWxBmSdF4sBFRHKFhhrSnDk+jrE7tZFZMsohEujiYAtpzw==; 5:Q15YYya1gqJqS3deqNF+LXWrQD1yBPuzNzroe+xdWDm+Amc7tmUdIhuWtXw+6Ab95F6c4ofQa7728a23LrArpIi1X7/LLKFhYTMogCRWK9BE8tjEkvB0GgH1dgAQDyvLowOYab+FELuQq1yZDXFde4ph3kz37ElsjWIaik5z97Y=; 24:TMZZ4jEk4oMEVy8/NxxT5EGBl0cboQjRLIny1y4rRfOab0MqSqQ5iI3oVvP4AHTEhq8JIg7Cd/LahIgT/9duwMF6AAsHYqu3uiEV4gqulQw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2047; 7:md4NIWtzKpB4DePoijMC5pP6EZRlUbJBJllVngHK5P5C1g/0s5ssz6b47VgJMt0XTuoKf+WZmFxSw39rcfY4lQGHAUR/Pi3+6s8xb5C9yZAkI2fPAqORoEjAOOQDuJJ+ZHhnmSOD8Pzlanw8KVIyJO43uK5H4Sd22ll96akfrYsp9X2QQSUaDqjDIPNUmn7Q9G9ZKJyzvZNEoWXVlUTdNcb01bdr9oMUFCLRbm8pqrpN6Dk5fxiCsM3AvjCzMbgv X-MS-Office365-Filtering-Correlation-Id: 77011482-c5b8-4cd5-d4d3-08d5aad98514 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2018 18:22:33.9684 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77011482-c5b8-4cd5-d4d3-08d5aad98514 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2047 Subject: Re: [dpdk-dev] [PATCH v5 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 18:22:39 -0000 On Wed, Apr 25, 2018 at 11:02:36AM -0700, Yongseok Koh wrote: > On Wed, Apr 25, 2018 at 05:23:20PM +0000, Ananyev, Konstantin wrote: > > > > > > > -----Original Message----- > > > From: Yongseok Koh [mailto:yskoh@mellanox.com] > > > Sent: Wednesday, April 25, 2018 6:07 PM > > > To: Ananyev, Konstantin > > > Cc: Lu, Wenzhuo ; Wu, Jingjing ; olivier.matz@6wind.com; dev@dpdk.org; > > > arybchenko@solarflare.com; stephen@networkplumber.org; thomas@monjalon.net; adrien.mazarguil@6wind.com; > > > nelio.laranjeiro@6wind.com > > > Subject: Re: [PATCH v5 1/2] mbuf: support attaching external buffer to mbuf > > > > > > On Wed, Apr 25, 2018 at 01:31:42PM +0000, Ananyev, Konstantin wrote: > > > [...] > > > > > /** Mbuf prefetch */ > > > > > #define RTE_MBUF_PREFETCH_TO_FREE(m) do { \ > > > > > if ((m) != NULL) \ > > > > > @@ -1213,11 +1306,127 @@ static inline int rte_pktmbuf_alloc_bulk(struct rte_mempool *pool, > > > > > } > > > > > > > > > > /** > > > > > + * Attach an external buffer to a mbuf. > > > > > + * > > > > > + * User-managed anonymous buffer can be attached to an mbuf. When attaching > > > > > + * it, corresponding free callback function and its argument should be > > > > > + * provided. This callback function will be called once all the mbufs are > > > > > + * detached from the buffer. > > > > > + * > > > > > + * The headroom for the attaching mbuf will be set to zero and this can be > > > > > + * properly adjusted after attachment. For example, ``rte_pktmbuf_adj()`` > > > > > + * or ``rte_pktmbuf_reset_headroom()`` can be used. > > > > > + * > > > > > + * More mbufs can be attached to the same external buffer by > > > > > + * ``rte_pktmbuf_attach()`` once the external buffer has been attached by > > > > > + * this API. > > > > > + * > > > > > + * Detachment can be done by either ``rte_pktmbuf_detach_extbuf()`` or > > > > > + * ``rte_pktmbuf_detach()``. > > > > > + * > > > > > + * Attaching an external buffer is quite similar to mbuf indirection in > > > > > + * replacing buffer addresses and length of a mbuf, but a few differences: > > > > > + * - When an indirect mbuf is attached, refcnt of the direct mbuf would be > > > > > + * 2 as long as the direct mbuf itself isn't freed after the attachment. > > > > > + * In such cases, the buffer area of a direct mbuf must be read-only. But > > > > > + * external buffer has its own refcnt and it starts from 1. Unless > > > > > + * multiple mbufs are attached to a mbuf having an external buffer, the > > > > > + * external buffer is writable. > > > > > + * - There's no need to allocate buffer from a mempool. Any buffer can be > > > > > + * attached with appropriate free callback and its IO address. > > > > > + * - Smaller metadata is required to maintain shared data such as refcnt. > > > > > + * > > > > > + * @warning > > > > > + * @b EXPERIMENTAL: This API may change without prior notice. > > > > > + * Once external buffer is enabled by allowing experimental API, > > > > > + * ``RTE_MBUF_DIRECT()`` and ``RTE_MBUF_INDIRECT()`` are no longer > > > > > + * exclusive. A mbuf can be considered direct if it is neither indirect nor > > > > > + * having external buffer. > > > > > + * > > > > > + * @param m > > > > > + * The pointer to the mbuf. > > > > > + * @param buf_addr > > > > > + * The pointer to the external buffer we're attaching to. > > > > > + * @param buf_iova > > > > > + * IO address of the external buffer we're attaching to. > > > > > + * @param buf_len > > > > > + * The size of the external buffer we're attaching to. If memory for > > > > > + * shared data is not provided, buf_len must be larger than the size of > > > > > + * ``struct rte_mbuf_ext_shared_info`` and padding for alignment. If not > > > > > + * enough, this function will return NULL. > > > > > + * @param shinfo > > > > > + * User-provided memory for shared data. If NULL, a few bytes in the > > > > > + * trailer of the provided buffer will be dedicated for shared data and > > > > > + * the shared data will be properly initialized. Otherwise, user must > > > > > + * initialize the content except for free callback and its argument. The > > > > > + * pointer of shared data will be stored in m->shinfo. > > > > > + * @param free_cb > > > > > + * Free callback function to call when the external buffer needs to be > > > > > + * freed. > > > > > + * @param fcb_opaque > > > > > + * Argument for the free callback function. > > > > > + * > > > > > + * @return > > > > > + * A pointer to the new start of the data on success, return NULL > > > > > + * otherwise. > > > > > + */ > > > > > +static inline char * __rte_experimental > > > > > +rte_pktmbuf_attach_extbuf(struct rte_mbuf *m, void *buf_addr, > > > > > + rte_iova_t buf_iova, uint16_t buf_len, > > > > > + struct rte_mbuf_ext_shared_info *shinfo, > > > > > + rte_mbuf_extbuf_free_callback_t free_cb, void *fcb_opaque) > > > > > +{ > > > > > + /* Additional attachment should be done by rte_pktmbuf_attach() */ > > > > > + RTE_ASSERT(!RTE_MBUF_HAS_EXTBUF(m)); > > > > > > > > Shouldn't we have here something like: > > > > RTE_ASSERT(RTE_MBUF_DIRECT(m) && rte_mbuf_refcnt_read(m) == 1); > > > > ? > > > > > > Right. That's better. Attaching mbuf should be direct and writable. > > > > > > > > + > > > > > + m->buf_addr = buf_addr; > > > > > + m->buf_iova = buf_iova; > > > > > + > > > > > + if (shinfo == NULL) { > > > > > > > > Instead of allocating shinfo ourselves - wound's it be better to rely > > > > on caller always allocating afeeling it for us (he can do that at the end/start of buffer, > > > > or whenever he likes to. > > > > > > It is just for convenience. For some users, external attachment could be > > > occasional and casual, e.g. punt control traffic from kernel/hv. For such > > > non-serious cases, it is good to provide this small utility. > > > > For such users that small utility could be a separate function then: > > shinfo_inside_buf() or so. > > I like this idea! As this is an inline function and can be called in a datapath, > shorter code is better if it isn't expected to be used frequently. > > Will take this idea for the new version. Thanks. However, if this API is called with shinfo=NULL (builtin constant), this code block won't get included in compile time because it is an inline function. What is disadvantage to keep this block here? More intuitive? Advantage of keeping it here could be simplicity. No need to call the utility in advance. Or separating this code to another inline function could make the API prototype simpler because free_cb and its arg should be passed via shinfo. static inline char * __rte_experimental rte_pktmbuf_attach_extbuf(struct rte_mbuf *m, void *buf_addr, rte_iova_t buf_iova, uint16_t buf_len, struct rte_mbuf_ext_shared_info *shinfo) I'm still inclined to write the utility function like you suggested. Thoughts? Thanks, Yongseok > > > > Again in that case - caller can provide one shinfo to several mbufs (with different buf_addrs) > > > > and would know for sure that free_cb wouldn't be overwritten by mistake. > > > > I.E. mbuf code will only update refcnt inside shinfo. > > > > > > I think you missed the discussion with other people yesterday. This change is > > > exactly for that purpose. Like I documented above, if this API is called with > > > shinfo being provided, it will use the user-provided shinfo instead of sparing a > > > few byte in the trailer and won't touch the shinfo. > > > > As I can see your current code always update free_cb and fcb_opaque. > > Which is kind of strange these fields shold be the same for all instances of the shinfo.