From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38A1AA034F for ; Wed, 10 Nov 2021 07:40:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3283D40E28; Wed, 10 Nov 2021 07:40:50 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2073.outbound.protection.outlook.com [40.107.243.73]) by mails.dpdk.org (Postfix) with ESMTP id 232F64068B for ; Wed, 10 Nov 2021 07:40:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VMioVroPlAuseNTGdI4HGJsFn0jfRMkeY36VtNaGOOM+/JWf5oWLHq3AnXfiAYBhXmWxJ29N7POB1dxfDBe2mfVrLFH88AQguK7hvdocYuCfCzqm5coa/RubeWDbfxRu1rBfB4CZeA/ZXT+FY3cEdH8Rv2B35fLABo7Gs/rE1XLgIrlJKgEM5HXHRc0Q84baGUZcsyd9clqpmxtlQyUUOpFaZUTVoVAQljFhzW7viJiS/SQB1zie0DwEZYlGKYXtihGGDg4UdpT+eXbtpJ2xGxpknwrOU6+oP19kQtBt7hv5Er3rITMoo82+kvUtcnetv51LWUnhCXEVzPYIxN7uPA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TpmGRfNlQdbIHWMLlD+RS89AVNxpCTDdvWqAXgwa7/M=; b=a1D0ipjb/JXJDUCfRqD8KgooagTFgtpnMmRdpaPw6QiOQeV/M4iBBMKsXwB8DmSs9ICotWNl0rzJ32iONmnVVrG8bHSFL+oW1EFlZyjt5jjrYTMh2g3W5ZPa+hkjdVyiDtp2R35ENqSlNfP7dK7xXnBS/g+rykePmBac4kd6ZSW5Zeu31ISO5546vhXE/5xn5tXP3eNH/cCsDGqPTAmWAtroieOD4T5TbKlR4XcMUjXRv+0qTCFSOHU4NSZKcmUXogEjGrp1E97BtvNa1I8FUG9pCeEj2BApN4zIj4PTWZuVEiGg4wslMq5gkC+ADmPoPZHXsBLEndmehTdUUoGEwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=cisco.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TpmGRfNlQdbIHWMLlD+RS89AVNxpCTDdvWqAXgwa7/M=; b=A2APtyW6ixfg3m/ENIVpAdPRmfGS77v0VJxH8PSpuUUXP5Bl/kjwp6pcea2bgwYboWvHRFJ4iCfO8nUDoCjAZMjw+KyKoTY7LjJDv+2y2ZQU2pfDrgGR15miS/Vp8kaYBuAGFu5eSIorVqp1/zjiG85mGXkbE8MceqUvuhu8psidEAv28T1fp2xSDCndxTbU2tj7fazs83+oEhQr8RIHGtQ5r+RcqhntcQnq/NYENkvEhx7wV8QnZPqiN0enAtbvV5LH2cW1SoO8nXtCY7jfznJfGyREadi5+pEUdeme6vRzM9Ho7mK4f7WLKWzzudogPksXtE2laEIGLqn2pIUUdg== Received: from DM6PR04CA0026.namprd04.prod.outlook.com (2603:10b6:5:334::31) by DM6PR12MB2665.namprd12.prod.outlook.com (2603:10b6:5:41::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.15; Wed, 10 Nov 2021 06:40:47 +0000 Received: from DM6NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::1e) by DM6PR04CA0026.outlook.office365.com (2603:10b6:5:334::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13 via Frontend Transport; Wed, 10 Nov 2021 06:40:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; cisco.com; dkim=none (message not signed) header.d=none;cisco.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT030.mail.protection.outlook.com (10.13.172.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:40:47 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:40:45 +0000 From: Xueming Li To: Junxiao Shi CC: Luca Boccassi , Jakub Grajciar , dpdk stable Date: Wed, 10 Nov 2021 14:29:21 +0800 Message-ID: <20211110063216.2744012-78-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1cc25772-8908-4565-b3d3-08d9a4150758 X-MS-TrafficTypeDiagnostic: DM6PR12MB2665: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O81bDdqrS/ygNq8jG2EtSxZiuK4hFDyB74aJ7TUS+iNca8dHkSSUFdcgjLHiTIBuoEaAIMNcQqZMpkxa4bB0NjYhhD2ewDaHbNMXtMs6kW1wtkc2k86d5vQmUwmMFtyShqMiRXJ2qCCjeu85+isAh2jWXr2skPMzo0Rwgwitp5roTCSVjYt73Uwj/hiDoJzTF5yIgt2hys77nUc0vMy61HuCmZG+epUPnYqgqYzKf0AMH7faz2KUKqVRzCkZdS9tQM9Ow/l6WX4dhiFaTlT9fqiveWd1JKZMyekTLbwKvM5a2b3FRXFnHszEjnS1xNbA+TAlbhmmiQpyu6atIguxg0k5LhFH8LrZutfO28fOKJ+vTKzODMM/VjFaVkAxNRYqWHNia47evQYt0a7X/mYoGdlCKBBNdBdj5YJYgGMo7Ph4HiNPwTUGA6EvBtoiOypJ1vrrCr79dH9nCC7GXFunpfum4MDhniL78DsZscH+QobT/RC3wyNiJypqcQdDlV0sVPu/JC9sc/JC0cxfaQkMP3q1j1OPXEg0mikNB3Xqt/im5xkEkvCEorqJ10SPjyR+eHbgyziwc4Ycdx3/aJSPTag2bZ0nHYaupH21AqIJ5CTwU/EsLf+ea5JGpo0V3ziHrFSIuz2da1J//6e59cMOzQ1WEzR9Dj6uxumGUHcj+K8Kg7MtCFH00JW9XrXmE5f0FaoNTKXamA489zBEiEWc01HFgYfo0m6VWBNv1zyVYkPvV+dSIE1evirSKnK1X4LGpriRacAGw1KoGR8LdPkHuhEx57vH4lB1bDMB+tRGWXj3psMoFbw1qahEnKkpUqH5ymo8XmZQn8Ltco0n6uCNEQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6916009)(426003)(26005)(356005)(54906003)(5660300002)(1076003)(508600001)(316002)(336012)(2616005)(86362001)(47076005)(82310400003)(70586007)(70206006)(36860700001)(6286002)(966005)(7696005)(53546011)(6666004)(4326008)(16526019)(186003)(83380400001)(8936002)(8676002)(2906002)(36756003)(4001150100001)(55016002)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:40:47.3058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1cc25772-8908-4565-b3d3-08d9a4150758 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2665 Subject: [dpdk-stable] patch 'net/memif: fix chained mbuf determination' has been queued to stable release 20.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/edfd68842c44515e006f83e1e4ee47f8260776b6 Thanks. Xueming Li --- >From edfd68842c44515e006f83e1e4ee47f8260776b6 Mon Sep 17 00:00:00 2001 From: Junxiao Shi Date: Thu, 9 Sep 2021 14:42:06 +0000 Subject: [PATCH] net/memif: fix chained mbuf determination Cc: Xueming Li [ upstream commit 3e3f736e50fba910d1d484b9c763d884dff6688f ] Previously, TX functions call rte_pktmbuf_is_contiguous to determine whether an mbuf is chained. However, rte_pktmbuf_is_contiguous is designed to work on the first mbuf of a packet only. In case a packet contains three or more segment mbufs in a chain, it may cause truncated packets or rte_mbuf_sanity_check panics. This patch updates TX functions to determine chained mbufs using mbuf_head->nb_segs field, which works in all cases. Moreover, it maintains that the second cacheline is only accessed when chained mbuf is actually present. Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD") Fixes: 43b815d88188 ("net/memif: support zero-copy slave") Signed-off-by: Junxiao Shi Reviewed-by: Jakub Grajciar --- drivers/net/memif/rte_eth_memif.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index 15284b3d2c..aded2ac134 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -199,6 +199,7 @@ memif_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *de dev_info->max_rx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS; dev_info->max_tx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS; dev_info->min_rx_bufsize = 0; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS; return 0; } @@ -566,7 +567,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) rte_eth_devices[mq->in_port].process_private; memif_ring_t *ring = memif_get_ring_from_queue(proc_private, mq); uint16_t slot, saved_slot, n_free, ring_size, mask, n_tx_pkts = 0; - uint16_t src_len, src_off, dst_len, dst_off, cp_len; + uint16_t src_len, src_off, dst_len, dst_off, cp_len, nb_segs; memif_ring_type_t type = mq->type; memif_desc_t *d0; struct rte_mbuf *mbuf; @@ -614,6 +615,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) while (n_tx_pkts < nb_pkts && n_free) { mbuf_head = *bufs++; + nb_segs = mbuf_head->nb_segs; mbuf = mbuf_head; saved_slot = slot; @@ -657,7 +659,7 @@ next_in_chain: d0->length = dst_off; } - if (rte_pktmbuf_is_contiguous(mbuf) == 0) { + if (--nb_segs > 0) { mbuf = mbuf->next; goto next_in_chain; } @@ -694,6 +696,7 @@ memif_tx_one_zc(struct pmd_process_private *proc_private, struct memif_queue *mq uint16_t slot, uint16_t n_free) { memif_desc_t *d0; + uint16_t nb_segs = mbuf->nb_segs; int used_slots = 1; next_in_chain: @@ -714,7 +717,7 @@ next_in_chain: d0->flags = 0; /* check if buffer is chained */ - if (rte_pktmbuf_is_contiguous(mbuf) == 0) { + if (--nb_segs > 0) { if (n_free < 2) return 0; /* mark buffer as chained */ -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:05.501718884 +0800 +++ 0077-net-memif-fix-chained-mbuf-determination.patch 2021-11-10 14:17:01.844079642 +0800 @@ -1 +1 @@ -From 3e3f736e50fba910d1d484b9c763d884dff6688f Mon Sep 17 00:00:00 2001 +From edfd68842c44515e006f83e1e4ee47f8260776b6 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 3e3f736e50fba910d1d484b9c763d884dff6688f ] @@ -19 +21,0 @@ -Cc: stable@dpdk.org @@ -28 +30 @@ -index de6becd45e..fd9e877c3d 100644 +index 15284b3d2c..aded2ac134 100644 @@ -39 +41 @@ -@@ -567,7 +568,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +@@ -566,7 +567,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) @@ -48 +50 @@ -@@ -615,6 +616,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +@@ -614,6 +615,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) @@ -56 +58 @@ -@@ -659,7 +661,7 @@ next_in_chain: +@@ -657,7 +659,7 @@ next_in_chain: @@ -65 +67 @@ -@@ -696,6 +698,7 @@ memif_tx_one_zc(struct pmd_process_private *proc_private, struct memif_queue *mq +@@ -694,6 +696,7 @@ memif_tx_one_zc(struct pmd_process_private *proc_private, struct memif_queue *mq @@ -73 +75 @@ -@@ -716,7 +719,7 @@ next_in_chain: +@@ -714,7 +717,7 @@ next_in_chain: