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 D5E3345DB9 for ; Wed, 27 Nov 2024 18:43:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D04FE4029C; Wed, 27 Nov 2024 18:43:03 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2045.outbound.protection.outlook.com [40.107.95.45]) by mails.dpdk.org (Postfix) with ESMTP id BC8F74029C for ; Wed, 27 Nov 2024 18:43:01 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k28TytFW4AUsBUFVbE+fmj0FiWpiT6tpJwSEQyoW+WzLZFhqlCv0So2u7eEstvHI2MFF1Hkct1cPFIF/mwQ0S8JBICpmETqdnZ154iRB0PtFeUZpcj6OPi5/4GHYgLIW3ZewpflNZXAtoiTyfWXDPzjjJLIoKZnNJESP25GLhzND3KwGp3gsBE1qnnuWBjad0e49CuwxudK89TLaGENsRLqiDmGiZ3/HRdsWk/fJZMD9DandvvvJqS5NDz1+E3QIyOG9kJNDQc0hOvmYfcNN2e1xyXK/F8iLEXDhqWqx7755blkpKxe3AjYyEmaTDYF2RY7ylup9XPBwiBjxdVZ6Fw== 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=Mn2+CLgXvtefjnHJMZxdMfAHZrIVDc16mnbMGqeyaH1r3UD02eD2VcDGcHIbD1RKkFmbA02UI997Mci7uf70vbGcxCkZPrIkxdlIiVbd80l33ZAz6tbPqnllzaqj/pEp1+CSGcTMZaCk1XkthYnY6HOVe0rKWPIbUp1/lhaf6XbD9niPD25pimyTHm2RG6CbtFd+7AuHuARrtYdMyd70tPu+zyy9t3TLqptMaamL9YkJvUeJPewZy/jKP5a5Qivhz4HiPwWMDy6nN0IO5IH0KRD621dXv7Eil17oesBvGDH0nij384Y+I+zKUYxc8KIjgpjlUpXeeLk/iUNbAfMpDA== 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=ZsKXBaf6bT5053Xrlv7m3fO46TwWDKBthsgau5dsJmXQwmLCFWWTPOPsOyFtP1cAePoabJ5ThTlsnEhf82nJ0YPyNTjJK2N4gOqcTwnO5WlNqkp6i5Lx3j3SRLtyKVAHocibsNGhesm1ftiqEdf7vU93KW2s7MkF/Z3K3zLvVBGmhCA2hbHoaFF0Yhv4t3yACDObOIZPg8JHSISeuFPZ7M0oL0woWT1G1XXSqH8L4ZpTipSzBI6+bktEeIOVmaP4jVz0yaymCQ7QqsXVzwedfxDMvkIoqXXCcPRBW7qRdak1Gr5ckXlff0/c031phTz1L1G8TcB1qPCyhFUUc4IcZw== Received: from CH2PR04CA0011.namprd04.prod.outlook.com (2603:10b6:610:52::21) by PH7PR12MB6933.namprd12.prod.outlook.com (2603:10b6:510:1b7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Wed, 27 Nov 2024 17:42:56 +0000 Received: from DS3PEPF0000C37C.namprd04.prod.outlook.com (2603:10b6:610:52:cafe::a5) by CH2PR04CA0011.outlook.office365.com (2603:10b6:610:52::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.21 via Frontend Transport; Wed, 27 Nov 2024 17:42:56 +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 DS3PEPF0000C37C.mail.protection.outlook.com (10.167.23.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 17:42:55 +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, 27 Nov 2024 09:42:42 -0800 Received: from pegasus01.mtr.labs.mlnx (10.126.231.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, 27 Nov 2024 09:42:40 -0800 From: Alexander Kozyrev To: CC: Subject: [PATCH 21.11] net/mlx5: fix miniCQEs number calculation Date: Wed, 27 Nov 2024 19:42:14 +0200 Message-ID: <20241127174226.1717781-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.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37C:EE_|PH7PR12MB6933:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e87a13e-6ce2-494e-d36e-08dd0f0aed48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GhpjX3BNfpsr79BXeMAOXqqFfuCIXiQd/cjSDueO7W/w1Jl6d3xzZB0TGYj8?= =?us-ascii?Q?mAf/S2UmQlgya9OFMHxBmt6AdJwxk9W/b6mAsZCE/uO+REvhvVxpT0Z7c6fR?= =?us-ascii?Q?KVDSbvAuMWT8XSdOON2SzkjCuG++LSdSgJyZzvkknhXocCxTdMWQ+WLJvUbP?= =?us-ascii?Q?C2m95GYTfltTONfFdecJfdOo0Yfrq9BWbP2wyRtwPM2GMNRnT4qo01AyKPCA?= =?us-ascii?Q?Hi22bayGmrsLUa+9EkTFoYjKuaWZSfx1eEmbtGx5ejB6+6RFYRV0kueAu9bd?= =?us-ascii?Q?x1wlcnZnGcKtk1WPXThHW1bM9fWGWY9SOzjynDyi8f2AW0hdwRN4xl+1ZSgj?= =?us-ascii?Q?iHLK2J/ISI95DxpI7PbLpzXwn8+bOArn8sqU53tdonWmsCxZGlYhaZ40PjQ+?= =?us-ascii?Q?OmNPoUtVwlZO5zm0eP8hFsC33CGaoXrYIH+VhEs1JEP78AgL2SXeeQkgAgRp?= =?us-ascii?Q?VtPWCRlT2naqlhERHpyd3wKktWUBfvVY75ZClWMF47ENTxb9Oo+WRgNWrOAg?= =?us-ascii?Q?V1HOlv5HkN+ILi74O2/fxWlFvGlVasjbckeB49jdz3pOdQo6e7xGAx6Aah7o?= =?us-ascii?Q?o7nZvpRJ0xxfVmGGWWISGYKh04Yw7QgBYtBqDDGZMUzEmOmHoP1vl8JdpBjF?= =?us-ascii?Q?+BH33SykCeoPwrEidX1xkuU7yMcekHR2KeyLtdvdsbLRLWtJ7HNkpH9mcycM?= =?us-ascii?Q?nCVFBf10sK+waLFKyj9zLN9wxE9+Qs7dtoLJZ2C2+4oHdaWpf7f8CHWp8cX6?= =?us-ascii?Q?0H2xu41fBxZ1peOfj6wtjkIXOznoEtijvPp78lvHLhSkGx/trD6gNKDTDMw+?= =?us-ascii?Q?1yg0iWvFwZwpRgW6GyggPhOWF1WGHb1Tsx8cBijdkkbeF9ZhW571aH/nsK0Q?= =?us-ascii?Q?cOcN5OOZENak6yq+oCMOuGVr35rVraOxN1+fWelNhlTIfFwWMqSEp8WLwT28?= =?us-ascii?Q?o4B+8TJCnGa2/3iipAnM90cNFS+JZMPpGu+syuWK8Uhes/3sDtpTux/mm+gz?= =?us-ascii?Q?n+jTMUdf96a6+XUvGzDYHgxu+JZX92NIn3BP5oS2iIdfuKARJ69rV0QLe5L4?= =?us-ascii?Q?DRG5z97tkaipLKKzMtaMjJbRm/KbZhsbpTrU/91SIGfo9Jt+7YjpTujG00Ko?= =?us-ascii?Q?wRYYN46BpDxmXGt2oNiFxpX5JAftoPGumUiCeYUFVUJDpXbZkZATH9U7UClI?= =?us-ascii?Q?ENXd2hdQuhMgd2fHrsLe/+Hq8/Ixrm9PYzixKpNGm9RMmI0NHxRkixGMyfD5?= =?us-ascii?Q?RtPl1TNlLkWGgTXcJI1tqjYTewDA68C9/guA13LAeTXJ3S1o4z5Dvy71DlO9?= =?us-ascii?Q?ftjof3svqH4MvCzs0y618ONbBHV7LlPvQ2Cd3/hcVRQKpZZF/VSqdUDxEGLb?= =?us-ascii?Q?HX0V53oWwPJYk+yK12iGxMKIO1ZW3/xPKM2mxzvKvQa4JhmOpYvGH5EjFjs1?= =?us-ascii?Q?wITqXBR4sl4w25eEPOloHz60zNf3etvw?= 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)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 17:42:55.9978 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e87a13e-6ce2-494e-d36e-08dd0f0aed48 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: DS3PEPF0000C37C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6933 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