From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD1D1C282DD for ; Fri, 10 Jan 2020 17:57:21 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 592D82080D for ; Fri, 10 Jan 2020 17:57:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 592D82080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D94241EB32; Fri, 10 Jan 2020 18:57:19 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 788BD1DD37 for ; Fri, 10 Jan 2020 18:57:17 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from viacheslavo@mellanox.com) with ESMTPS (AES256-SHA encrypted); 10 Jan 2020 19:57:14 +0200 Received: from pegasus11.mtr.labs.mlnx (pegasus11.mtr.labs.mlnx [10.210.16.104]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00AHvEjM002242; Fri, 10 Jan 2020 19:57:14 +0200 Received: from pegasus11.mtr.labs.mlnx (localhost [127.0.0.1]) by pegasus11.mtr.labs.mlnx (8.14.7/8.14.7) with ESMTP id 00AHvEZK025427; Fri, 10 Jan 2020 17:57:14 GMT Received: (from viacheslavo@localhost) by pegasus11.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id 00AHvD7m025426; Fri, 10 Jan 2020 17:57:13 GMT X-Authentication-Warning: pegasus11.mtr.labs.mlnx: viacheslavo set sender to viacheslavo@mellanox.com using -f From: Viacheslav Ovsiienko To: dev@dpdk.org Cc: matan@mellanox.com, rasland@mellanox.com, orika@mellanox.com, Shahaf Shuler Date: Fri, 10 Jan 2020 17:56:58 +0000 Message-Id: <1578679022-25344-1-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <20191118094938.192850-1-shahafs@mellanox.com> References: <20191118094938.192850-1-shahafs@mellanox.com> Subject: [dpdk-dev] [PATCH 0/4] mbuf: introduce pktmbuf pool with pinned external buffers 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" Today's pktmbuf pool contains only mbufs with no external buffers. This means data buffer for the mbuf should be placed right after the mbuf structure (+ the private data when enabled). On some cases, the application would want to have the buffers allocated from a different device in the platform. This is in order to do zero copy for the packet directly to the device memory. Examples for such devices can be GPU or storage device. For such cases the native pktmbuf pool does not fit since each mbuf would need to point to external buffer. To support above, the pktmbuf pool will be populated with mbuf pointing to the device buffers using the mbuf external buffer feature. The PMD will populate its receive queues with those buffer, so that every packet received will be scattered directly to the device memory. on the other direction, embedding the buffer pointer to the transmit queues of the NIC, will make the DMA to fetch device memory using peer to peer communication. Such mbuf with external buffer should be handled with care when mbuf is freed. Mainly The external buffer should not be detached, so that it can be reused for the next packet receive. This patch introduce a new flag on the rte_pktmbuf_pool_private structure to specify this mempool is for mbuf with pinned external buffer. Upon detach this flag is validated and buffer is not detached. A new mempool create wrapper is also introduced to help application to create and populate such mempool. Signed-off-by: Shahaf Shuler Signed-off-by: Viacheslav Ovsiienko RFC: http://patches.dpdk.org/patch/63077/ Viacheslav Ovsiienko (4): mbuf: detach mbuf with pinned external buffer mbuf: create packet pool with external memory buffers app/testpmd: add mempool with external data buffers net/mlx5: allow use allocated mbuf with external buffer app/test-pmd/config.c | 2 + app/test-pmd/flowgen.c | 3 +- app/test-pmd/parameters.c | 2 + app/test-pmd/testpmd.c | 81 +++++++++++++++++ app/test-pmd/testpmd.h | 4 +- app/test-pmd/txonly.c | 3 +- drivers/net/mlx5/mlx5_rxq.c | 7 +- drivers/net/mlx5/mlx5_rxtx.c | 2 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_rxtx_vec.h | 14 +-- drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 5 +- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 29 ++++--- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 2 +- lib/librte_mbuf/rte_mbuf.c | 145 ++++++++++++++++++++++++++++++- lib/librte_mbuf/rte_mbuf.h | 145 +++++++++++++++++++++++++++++-- lib/librte_mbuf/rte_mbuf_version.map | 1 + 16 files changed, 406 insertions(+), 41 deletions(-) -- 1.8.3.1