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 EE72545D5D for ; Thu, 21 Nov 2024 01:24:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D6EAF40296; Thu, 21 Nov 2024 01:24:10 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2084.outbound.protection.outlook.com [40.107.243.84]) by mails.dpdk.org (Postfix) with ESMTP id 7978540296 for ; Thu, 21 Nov 2024 01:24:08 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aP+8AQvnxQTVIpJoxb8JX1DvADVPoyi+41ewZeAbeNqxSgSUL7ZjIJzuaQn1l++MsLCecitQsiXUubKgHp6HjIR/xANUayqSa4mjcyAMY9vLuoo2y17YOn986PUQQel9ai5N+rS7Nwwsmp1k/vI/cFv24XYSkzFh6sTl09m01RJxqyBamJ78g5xooQbfksHcZn0qEXa5JjBsYk5SYk8QGh1Ep7GJIYVW4Z9q/Z8jjRzgVyMmwDao98JAQMov6meIRPr9XiEwgWTS57+At2nedGCfLrekizq6IkOnQkJ7hFj5Nk+VM1V/lQQVpdFSu4AhvT9QVwKi8krq866Vr7w3vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=XsmOJQ39q907l5uzzoMqqxo9spUPwJxbgOcZGMJP5qE=; b=i0bBAWs6GtLJSR4ykO7ZLWjWy84PPrvN+HWK/eukwQgahdxKQ3Dls75sb6nyjlDmbixxJQJVpUeIat1GzV1PRP/DZ7fPH2GknMRe1P+ABFgbXwOhCauwCKmjKN3PA/xWLHrrpvsXmKsXmGFELrB1TK8+9VQ1rkgRFe5ZVDzMsuYkCQ/QyVwbniz0hYuhZfoX9lYvVUS+Q8xnRBJ7/8fHTctNkP5zkNFiRLX6iUbxGppziQV7yYJzPv9OQMKE7JsrKTQ1sy0FTMJNuJ/nfDu2f3WhphXlrTQI9Fgja1nhbYD9ZphZz6JNQOZB15XM36ysjr2aWiOL3ljMBZU3qG0SVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=XsmOJQ39q907l5uzzoMqqxo9spUPwJxbgOcZGMJP5qE=; b=W4/MP1/qOh8NwSD3hZ9hOoMUWR3Qg/SUPnEj9lOVi5J3zyw2Z1uNP5qFW9eifW7UIaX4XkBqB3cxu9qfuJtP57Q+XzxlYzVvQd72N9cLb7WttvnKasKMgAfAziaFwi9ZCCGBTXaND/Ws3e5VBgkIQyqjQJH6ILTSCZFM4Y4rleHo1L2DqeTOXfEJ75E58YkEOuCjcdOTWLb4bz7+jFhCmjONrVhocuZCc+fZdPqwAk5qGhlsPAwMu061wADPyWbqnrEneb6XEISuTmgbm5jDaaFsMFoDqmT2hMEukf/m5wltab0K+wsRPHR9WzMrcwKtZFSyXy+vY940VcT2HWFQLA== Received: from SJ0PR03CA0061.namprd03.prod.outlook.com (2603:10b6:a03:331::6) by SJ0PR12MB6968.namprd12.prod.outlook.com (2603:10b6:a03:47b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.18; Thu, 21 Nov 2024 00:24:03 +0000 Received: from SJ1PEPF0000231F.namprd03.prod.outlook.com (2603:10b6:a03:331:cafe::2d) by SJ0PR03CA0061.outlook.office365.com (2603:10b6:a03:331::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.24 via Frontend Transport; Thu, 21 Nov 2024 00:24:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SJ1PEPF0000231F.mail.protection.outlook.com (10.167.242.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.16 via Frontend Transport; Thu, 21 Nov 2024 00:24:02 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 20 Nov 2024 16:23:46 -0800 Received: from pegasus01.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 20 Nov 2024 16:23:44 -0800 From: Alexander Kozyrev To: CC: Subject: [PATCH 22.11] net/mlx5: fix miniCQEs number calculation Date: Thu, 21 Nov 2024 02:23:06 +0200 Message-ID: <20241121002330.862158-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF0000231F:EE_|SJ0PR12MB6968:EE_ X-MS-Office365-Filtering-Correlation-Id: 037720e5-7631-44a4-613f-08dd09c2cd6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?qRs3360OsbLw2Q6crilF4jz07aqbrIUg3trBmX+UKVv1JSy8NsGRtLtx5tU3?= =?us-ascii?Q?fLa4Uoto8Kuxr+g2VeoEnLt1piFVZvVFsowvYSGjo1FhEGO+rstcFjCIBDhY?= =?us-ascii?Q?hTB729jmDNmSlExtj8GnAUKoGXH4Y7EF5je/iXVMnFarSBb3roN2ee7hzcKa?= =?us-ascii?Q?mPT5s62eHvnh5BZbyLx4XrYFpKL+atjQjdTHimpaGeivBG/DyMNR8Ez/JgI5?= =?us-ascii?Q?+mg6BvalNNZZm5SLqneb7vv3oUDfTAvIUnLtQMtV8vzrWPiHYYuudDHV8I6b?= =?us-ascii?Q?bzXBwjUzvvgQ3LaWESoPbS95N6BQ/gO3PD5G6+fdXq1oQpW1FKq89A5xO5ZF?= =?us-ascii?Q?snfh5uCGyGWsJNsYI9iFEafuQk8/lN9q8YwOH9vC88Y8M91mjlhJKLXEFyR9?= =?us-ascii?Q?aE+poDKNUEM+wSH5CBiKt7F47LyLmLh9ZTtH40w1YIelCG9INyqlcGEVYCht?= =?us-ascii?Q?x7o1VQx3djMtLi8OB4B0Yl6URr9L2UnSKpB5RUWv7rN5inYFGVvQgPkS0xad?= =?us-ascii?Q?eu2Kw4W3b3+fBs/K0KxAFY7uyRyjejGG+aysMQMYdeGCv2YuRnOhPLeQIoeB?= =?us-ascii?Q?BQoI+5+/sW0EP+VCCJt9y26rHg0JdVkSeFqAnnPMLigEMXyJpVePciuAa87h?= =?us-ascii?Q?LcUIhdkPJbUTBzZ44XzkHddny3PEZhSomawJhNNLcZStYGyjz93mVKbsamR/?= =?us-ascii?Q?1vgJKpSs7tfohcv7w1mgzXW89XUMkb9PUp9Bl3QmUZ7MrCwDv+p112aK3VKy?= =?us-ascii?Q?kj+eqeVndwT1uFl+r1+Xj6DfPQLFQxgB27H/5n0EXgQ499jDDVadTmZ5VjEP?= =?us-ascii?Q?cYKWnW+2PFjGOffX6DZUdsnV4W+AqJt7/osseHcyM8/rQL7M8Y1cjYG2WUZP?= =?us-ascii?Q?JPu6BSh64PLyT6s3dgeUZRVFbG4cn2obMdij6DBC04AOLbx4UZOnjnut/tfI?= =?us-ascii?Q?DfTflbWHtYrHu1I21+5Ajt9fXpbM9t7DTl5waP6jYMygOooWwZi/1fLEqZ0K?= =?us-ascii?Q?NR98CONYmQ7CVQFy10pQbN19eVWCD2qWKDM6sREwN7WTbmSwaQ5VZYls6nfq?= =?us-ascii?Q?7oN4HhCNu49zUWCEst9puWR83zyOQQ7DSQsa0lj1cgYlZcekcRaM0EiCdCB7?= =?us-ascii?Q?K+H0ILi4kEr8NDKcA0JCUIzOnVkytrVzV7STfe2a4kcI4WEJZw7ZhS35q5hh?= =?us-ascii?Q?ap6tq/fstsvV9mZMCoaF2JNmK0yofnJLyJhbYZY15m+EYaFmRAafSR8qrG2m?= =?us-ascii?Q?EaD4yxuApGaRAhcoaWJjOKwumrKajGUUX4gzoZkvXp+WAjWc8PkaJcTF0ju4?= =?us-ascii?Q?X0uXxcRwHTJJHZ2XEMSxA3uG5Npb3d681LQ5nRjpSK9jHU23TbiP/UszDZr3?= =?us-ascii?Q?fG1AkQ5TN6FckEiy6CDS/wtT7fOomBy0U2D401E1NFp2ElGEfg=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2024 00:24:02.9834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 037720e5-7631-44a4-613f-08dd09c2cd6a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF0000231F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6968 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 Use the information from the CQE, not from the title packet, for getting the number of miniCQEs in the compressed CQEs array. This way we can avoid segfaults in the rxq_cq_decompress_v() in case of mbuf corruption (due to double mbuf free, for example). Fixes: 6cb559d67b ("net/mlx5: add vectorized Rx/Tx burst for x86") Signed-off-by: Alexander Kozyrev --- drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 3 +-- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 3 +-- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h index 204d17a8f2..0d4e1df5e8 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h @@ -93,8 +93,7 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, -1, -1, /* skip vlan_tci */ 11, 10, 9, 8}; /* bswap32, rss */ /* Restore the compressed count. Must be 16 bits. */ - const uint16_t mcqe_n = t_pkt->data_len + - (rxq->crc_present * RTE_ETHER_CRC_LEN); + const uint16_t mcqe_n = rte_be_to_cpu_32(cq->byte_cnt); const __vector unsigned char rearm = (__vector unsigned char)vec_vsx_ld(0, (signed int const *)&t_pkt->rearm_data); diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h index 6d3c594e56..c16cf53c8e 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h @@ -92,8 +92,7 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, 11, 10, 9, 8 /* hash.rss, bswap32 */ }; /* Restore the compressed count. Must be 16 bits. */ - const uint16_t mcqe_n = t_pkt->data_len + - (rxq->crc_present * RTE_ETHER_CRC_LEN); + const uint16_t mcqe_n = rte_be_to_cpu_32(cq->byte_cnt); const uint64x2_t rearm = vld1q_u64((void *)&t_pkt->rearm_data); const uint32x4_t rxdf_mask = { diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h index ab69af0c55..e9c02b4401 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h @@ -92,8 +92,7 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, -1, -1, 14, 15, /* pkt_len, bswap16 */ -1, -1, -1, -1 /* skip packet_type */); /* Restore the compressed count. Must be 16 bits. */ - const uint16_t mcqe_n = t_pkt->data_len + - (rxq->crc_present * RTE_ETHER_CRC_LEN); + const uint16_t mcqe_n = rte_be_to_cpu_32(cq->byte_cnt); const __m128i rearm = _mm_loadu_si128((__m128i *)&t_pkt->rearm_data); const __m128i rxdf = -- 2.43.5