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 4C2AD45C00 for ; Mon, 28 Oct 2024 18:16:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4310E427B7; Mon, 28 Oct 2024 18:16:00 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2072.outbound.protection.outlook.com [40.107.236.72]) by mails.dpdk.org (Postfix) with ESMTP id 38BE6410D0; Mon, 28 Oct 2024 18:15:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qhJO8+3n+eB/WmatUOTgyhmZFhYH8Ibb/yTg0OhA+bhBjf3L99NG+29RthZeD2ApNk2wFEj4Wjks5gkVXWo3TaDNWGd7QNqXyqG1+aCzGjBsCuK2jitcHkhc/vYnTFOgABN9ETZImpAz7lzKOsCFLN67fboSy67LBuFYOl5YFEVqF7i53N1OlCuYjZVNwJ/LYndCx4/Y8GcavDba1b6wCkvkhahTYf1L5GnLr4Vb2L28YhKd3vJ3lgMXcId0TONBlofs7iWAp7Xaqf+RxhqRy0ju2KV3UbipsF/WasBZpKMNCWsuu0KJG3yzAI5c645gwQGC2AluwvMuQFjw2ooWHg== 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=oL+8xb4vcC4XW3OF1IbcPLUSWePyZ3YIhFp7ftfKgDg=; b=iTuUVWO1mbYiVKt6PALUooJHQt4opkWxZfrzcKh++/S+/oMHTy+16ac/MbRAN+sPVbOCQ98jzvRsyDVKYjMvWZzDwaqZ1P9zp+AtT8IC3JY7/eoTYlzd/M0D2x3OlpHbFUERY+laj7zencOxMYm8TxcD5H35XRlEqTOZtxuTEafhESGURLBm5Eu8JoLsC2CCen6Vp8zI2BIfjrv+lNYpUDZ1YT/bd6X6N8WlT97l0XxwShJss8bNXWE4RzsfGNft5wHqeO8gfm0QYK04RVdPkVd1yRKBP30GSs5jXlswPOqYDYpScOjJCkly+yrRyDSaMzne8PeNYLaHuTOrDfXFQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=oL+8xb4vcC4XW3OF1IbcPLUSWePyZ3YIhFp7ftfKgDg=; b=g7+A7QJUHE++U7X22EKW6QS5lHtpdMXsL4kgjSVJnkFyEDkwpmrLDk82DpZQgX/H8w1PNEUVtBjDcbrg9JIHWF9Kciiy7cBdOTfJWNCd8RRsFije1weMmBnl49/e8sx8C1YJfijehdBIxM00ponfgg2fV03wkVAmOZMwEGagFGRxrQDgohGpzdbUGRAGLZN9cDo6zrMZsjX9g+s33NZhVJQDb/HoNMYIh2K60imMbx91h06STbR4QC6wBTlq1C8T3qgEnnO5BUugpMm+GDYgN8LTbKKUMxESzC1PPpG/MSrL7t8HyV2svaEbI6qfffDs0BCbaPz6xTu3vmnYKX2Ogw== Received: from MN2PR20CA0062.namprd20.prod.outlook.com (2603:10b6:208:235::31) by CH3PR12MB8878.namprd12.prod.outlook.com (2603:10b6:610:17e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 17:15:54 +0000 Received: from BL02EPF00021F68.namprd02.prod.outlook.com (2603:10b6:208:235:cafe::ab) by MN2PR20CA0062.outlook.office365.com (2603:10b6:208:235::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23 via Frontend Transport; Mon, 28 Oct 2024 17:15:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00021F68.mail.protection.outlook.com (10.167.249.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 17:15:54 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 28 Oct 2024 10:15:30 -0700 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; Mon, 28 Oct 2024 10:15:27 -0700 From: Alexander Kozyrev To: CC: , , , , , , Subject: [PATCH v2] net/mlx5: fix miniCQEs number calculation Date: Mon, 28 Oct 2024 19:14:56 +0200 Message-ID: <20241028171458.2264985-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241028164244.2262641-1-akozyrev@nvidia.com> References: <20241028164244.2262641-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F68:EE_|CH3PR12MB8878:EE_ X-MS-Office365-Filtering-Correlation-Id: aff78290-2e2a-4d5b-91ab-08dcf7742e34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?pJUtlK6E8N58cX/84mzlQSwwQe9KeLhTD3ofS2bBvqOOxCUUGE9SQwrkfu3w?= =?us-ascii?Q?+jA5zDvJ8AgKZFmsi3I3QQK5KSeShSUjG1q8+CzeYfYsStwowhhLOCpawBKR?= =?us-ascii?Q?uK+9xD0xGDGXsk55iKqq8i5thDFPnqn0ZA93/n7GzN1n7Ax7Qrx2bvjqUzIY?= =?us-ascii?Q?kYTDkMVBQqv1OMZ42hjjfT/sWPF1PaTkWbxuC2CAEibjnIcCWgC9Z/xFDspV?= =?us-ascii?Q?ksN8JcqrV4jPNgwDEEMS5kS+gt3fPsGO4IgTb5/sToJvVdqaElBjDtTDvrni?= =?us-ascii?Q?wWgexsOKAch7zGP/5FLjov5WOAnf64nlEoqLun+LA7w5Mg4N4vPdYfnFV+gM?= =?us-ascii?Q?vSun2kBPPUz5dvMLS3rC5rxfBp2gwfcSlAiyQ2OpeMiHpWg7AZKU+B3y4H7+?= =?us-ascii?Q?ZgIPdMMtqciUleDbPFLRvbBLbtVoD4QrVV9ytsZOAXjE3H3ottgdH4mzYRDJ?= =?us-ascii?Q?1AeZF5EyQ+mQaYciFV6IVXj8DpRias7mj3vCNCvVJHTUmDJZVqNnHiwO2CVr?= =?us-ascii?Q?ovj/yaIPIjWb5hjzJ5FSywVk4g1VBobZT18wJYD12pNrLwjU2+McRzpyNgto?= =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en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 17:15:54.0888 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aff78290-2e2a-4d5b-91ab-08dcf7742e34 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F68.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8878 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 b2bbc4ba17..265c81d8dc 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h @@ -98,8 +98,7 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, 11, 10, 9, 8}; /* bswap32, rss */ /* Restore the compressed count. Must be 16 bits. */ uint16_t mcqe_n = (rxq->cqe_comp_layout) ? - (MLX5_CQE_NUM_MINIS(cq->op_own) + 1) : - t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN); + (MLX5_CQE_NUM_MINIS(cq->op_own) + 1U) : rte_be_to_cpu_32(cqe->byte_cnt) uint16_t pkts_n = mcqe_n; const __vector unsigned char rearm = (__vector unsigned char)vec_vsx_ld(0, diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h index 510f60b25d..a4d4f3b582 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h @@ -97,8 +97,7 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, }; /* Restore the compressed count. Must be 16 bits. */ uint16_t mcqe_n = (rxq->cqe_comp_layout) ? - (MLX5_CQE_NUM_MINIS(cq->op_own) + 1) : - t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN); + (MLX5_CQE_NUM_MINIS(cq->op_own) + 1U) : rte_be_to_cpu_32(cq->byte_cnt); uint16_t pkts_n = mcqe_n; const uint64x2_t rearm = vld1q_u64((void *)&t_pkt->rearm_data); diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h index e71d6c303f..0273fdb54a 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h @@ -96,8 +96,7 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, -1, -1, -1, -1 /* skip packet_type */); /* Restore the compressed count. Must be 16 bits. */ uint16_t mcqe_n = (rxq->cqe_comp_layout) ? - (MLX5_CQE_NUM_MINIS(cq->op_own) + 1) : - t_pkt->data_len + (rxq->crc_present * RTE_ETHER_CRC_LEN); + (MLX5_CQE_NUM_MINIS(cq->op_own) + 1U) : rte_be_to_cpu_32(cq->byte_cnt); uint16_t pkts_n = mcqe_n; const __m128i rearm = _mm_loadu_si128((__m128i *)&t_pkt->rearm_data); -- 2.43.5