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 A15F145DBB for ; Wed, 27 Nov 2024 18:49:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 979314029C; Wed, 27 Nov 2024 18:49:22 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2074.outbound.protection.outlook.com [40.107.220.74]) by mails.dpdk.org (Postfix) with ESMTP id A8BB94029C for ; Wed, 27 Nov 2024 18:49:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SGdqf4ZHSP+FoxPwHNCYNzC0odUA8zLODIxVN/wEbRW5XGreTvQE/LkW9QphXbWOIcAFdt6pNQRWgCJCPhiR7iccc4xDgQkHkA+7ELc4olVTXOTJlsW13AzRGljPGIKSvQe6iKr3bD7VV28Mju+n3gKuBmD/MSTiS+VTzSqGusNmNU0GjCJKxfc0u6NkH9kWF0QAAA1ODCsdnd62pDRQZMv+cbWAI3GZl3s+ilgPM4NHEwzImbvxUtGZKaQf77JTufWpEcqbYndyYMQlbmIByVsaseAsSGqaCBlTNiN6gILYW/Tt7RgMJPDmPmnGyDGRD0MWY5ptWK62lj+PbzhKBQ== 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=pMzZNmod1mckX8fj5dkjzIg4jcs/dBuFSMPJI8LIFvc=; b=duhsWI1TMAOlk21dOVvVZEKqQMfhIYym2CZZpLxWYl1CYlz/7L1wlS5mP2TnrXRVKELVnvBSPLcmUPG7QJK+Agnq36fuLxZvG+wIxDe636t8V3ays8rjP6XjNSX+tqwhgNp6mvW6Ewm+WaA7W/A4YNK6e2VJooWA4XBAvbwteud8nixJ3qMWen+g0iTAcNy+Qh5m7InxwyZcoJZktrh6bbVhZPAXmpOq6/5AlyLbU5wKIrADek6m4Gd4S3+mUW7ucA2sdJj7yb70NDyrQwwcWZFdKdDc/l+femY2TV5CG6A/WjsmF4uFBgB9H9rtOpy6TTnw7Mqgp7qdcI4YKsR8hg== 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=pMzZNmod1mckX8fj5dkjzIg4jcs/dBuFSMPJI8LIFvc=; b=W2O17QbtyF8JS1GrorDS6NWs1aiyLVhYqOTG/EYSvimibL87otGAlkkVHyVb/Vw8z0vcs20Y61quiVpV2tU1tDoSqjjse0ZvVHbrGON4CnUhwe6eDostDLgoMpcJUpeOnlToq0oC9efgO4xbQ7S/3jg7RmqQHijx6Md9+EluwwzPoxiFawudHsCW7ZtyYGmQwUbUU07y5LFXmA8yyjJqNqO0csIXnGSmpXS76itj757b0/O5xl15+NJlLuMLkQDcHCQQg2gUmhQQVuIzfIOhDTd0XWk0de1HUXv524qMHfovEUZpdaaKhC+rjf/HR7jE9zOmnj8nqLRdsKHDE+Fmvw== Received: from SJ0PR03CA0061.namprd03.prod.outlook.com (2603:10b6:a03:331::6) by DS0PR12MB7803.namprd12.prod.outlook.com (2603:10b6:8:144::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 17:49:16 +0000 Received: from MWH0EPF000971E8.namprd02.prod.outlook.com (2603:10b6:a03:331:cafe::ca) by SJ0PR03CA0061.outlook.office365.com (2603:10b6:a03:331::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 17:49:15 +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 MWH0EPF000971E8.mail.protection.outlook.com (10.167.243.68) 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:49:15 +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:48:56 -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:48:54 -0800 From: Alexander Kozyrev To: CC: , Viacheslav Ovsiienko Subject: [PATCH 21.11] common/mlx5: fix error CQE handling for 128 bytes CQE Date: Wed, 27 Nov 2024 19:48:23 +0200 Message-ID: <20241127174839.1770671-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: MWH0EPF000971E8:EE_|DS0PR12MB7803:EE_ X-MS-Office365-Filtering-Correlation-Id: 467a47d9-4632-4970-1ec9-08dd0f0bcf69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rVS6cCRXca9ryM6rapRFttwp3BAbZChOE43aFpwcTqYh/KSqLarpOxSIhTa6?= =?us-ascii?Q?RrsN6i6hzrRAkNE8Llxw0+tTAi0BxR1bJ9bxLfm1SJU/kKHM54/ItwoGeH8+?= =?us-ascii?Q?R/lzxhpUJk2XJxpnM7JM4NpC3GmnGFlLQ0Pi7Z14pduJ4PciCVlBDxHqUYKf?= =?us-ascii?Q?qfTPqrX/FPlNJ0mF7LcBFpRqwwFAeaF7wBeuXrleUvGlHd+kKJjyaELTjt3m?= =?us-ascii?Q?SNdLq1SORqI3FHD6nXgQpsrjJhRO7N/97Zs+WfYKgO3Yn1NTiemrnQ7H/QXH?= =?us-ascii?Q?luD5FwxHMd3TPF+kLOYgkbD/UMdceDMWieRaXvDhPGe96MdPzZGZ3jI5uu1z?= =?us-ascii?Q?LF+RawMgWxEWW5QosdHLe0uN84JpUjhWw4+h24X7nPUBNlRDZl+zOXqJPaan?= =?us-ascii?Q?JuQ/i24yQZDJe+suyvaBruXuauuEDTLDA9OxLeMz50jRP3q7wzYchnmx9AqP?= =?us-ascii?Q?h2LiXeZC3dOBbetdgmN7qr6o4ITpxs9CwuFCfWHNaMq7/3FQXhTT9aeIBd9K?= =?us-ascii?Q?K2nniVtlwFa0OrwrjosCHuRpUlrvoB/SgB6V1LerodCWeHiiX/jWbd+u7nNK?= =?us-ascii?Q?8sI7cvNj+Md3Tkmnn2cguvkNvnTZKa5lRqLIHjlEE2kmqAGkPym5DGGfgHvV?= =?us-ascii?Q?V/LWCe8FMxe4bedBWF++s7GmLjdeG6J2288oN2kGBivlXjcVpIY1YH4wXu7C?= =?us-ascii?Q?QMMq3GlMDRAnCY/EZitUR2cuLcqBaRgUwvj6BXW0GZdHUFxyOomth1Ffrnax?= =?us-ascii?Q?otiZ4BH8Q1XRy2IBLpXgrfOSYjTdq9TVzjwRJCEDNKOxWku0P6e+sqWDWqX5?= =?us-ascii?Q?kTLoPGbVxNAXpBwMZ2izvABiK5nVEH0AE7G+4bp4kpk01KGnNxYg0XnEWiUr?= =?us-ascii?Q?LjXd7TtjApXK/ZnlvIIVS08/RX46B9//bRAIb+XIeLdv2kQJcO3ndNeGyQ9P?= =?us-ascii?Q?vkbt5c1ujP+nhHNp5FkOhRRunBb1CirOMB/K4pFljrezgXqAgwp6l6dTIhI/?= =?us-ascii?Q?J3Qw/x6niDORTpBENSF9mlxKUVxfvvddwB7YU1gqbeID4YJzT0M3cqiv7x0c?= =?us-ascii?Q?PtIuaRQ13wsbcQZsRsLbUHTbENg4qIlTJCYeu0jgTY+ew6C2rRgCuuhB8VNx?= =?us-ascii?Q?eGLEfCspWzZe331pAUeae77jvplQwIT/jLAbVtJFW/G/ojmHamt0rAR5dW7Q?= =?us-ascii?Q?OxR/dB3A0kliP1f5K5U1WczOuU6RBE1cj36L7Jvtnmyxrylb9HR2kQtV+nJQ?= =?us-ascii?Q?6Nv+HMfW7qGr72hXri/d0a1xWlUhC5cbL95VumMdOXcPJSX7QuVmsnJUGt++?= =?us-ascii?Q?u9yJFAxEp48+yJB69Ag375ShrFP7bqM7zbswhkZSd/ZuRGWMTGIb0L1vZudQ?= =?us-ascii?Q?Q+OAe57mno72TBbpj7K1QRTTlxT9I8bFMVVDYriIS6mWSbLLk1mrqeH6BFtq?= =?us-ascii?Q?rbLWhi2JJiNw05BZW1pMO74Tk4dj0NFH?= 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)(36860700013)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 17:49:15.3589 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 467a47d9-4632-4970-1ec9-08dd0f0bcf69 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: MWH0EPF000971E8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7803 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 [ upstream commit 3cddeba0ca38b00c7dc646277484d08a4cb2d862 ] The completion queue element size can be independently configured to report either 64 or 128 bytes CQEs by programming cqe_sz parameter at CQ creation. This parameter depends on the cache line size and affects both regular CQEs and error CQEs. But the error handling assumes that an error CQE is 64 bytes and doesn't take the padding into consideration on platforms with 128-byte cache lines. Fix the error CQE size in all error handling routines in mlx5. Fixes: 957e45fb7bcb ("net/mlx5: handle Tx completion with error") Signed-off-by: Alexander Kozyrev Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/mlx5_prm.h | 29 ++++++++++++++++++++- drivers/common/mlx5/windows/mlx5_win_defs.h | 12 --------- drivers/compress/mlx5/mlx5_compress.c | 4 +-- drivers/net/mlx5/mlx5_flow_aso.c | 6 ++--- drivers/net/mlx5/mlx5_rx.c | 2 +- drivers/net/mlx5/mlx5_tx.c | 8 +++--- 6 files changed, 38 insertions(+), 23 deletions(-) diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 58aa72df64..8ce1e66888 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -249,8 +249,12 @@ /* Maximum number of DS in WQE. Limited by 6-bit field. */ #define MLX5_DSEG_MAX 63 -/* The 32 bit syndrome offset in struct mlx5_err_cqe. */ +/* The 32 bit syndrome offset in struct mlx5_error_cqe. */ +#if (RTE_CACHE_LINE_SIZE == 128) +#define MLX5_ERROR_CQE_SYNDROME_OFFSET 116 +#else #define MLX5_ERROR_CQE_SYNDROME_OFFSET 52 +#endif /* The completion mode offset in the WQE control segment line 2. */ #define MLX5_COMP_MODE_OFFSET 2 @@ -379,6 +383,29 @@ struct mlx5_wqe_mprq { #define MLX5_MPRQ_STRIDE_SHIFT_BYTE 2 +struct mlx5_error_cqe { +#if (RTE_CACHE_LINE_SIZE == 128) + uint8_t padding[64]; +#endif + uint8_t rsvd0[2]; + uint16_t eth_wqe_id; + uint8_t rsvd1[16]; + uint16_t ib_stride_index; + uint8_t rsvd2[10]; + uint32_t srqn; + uint8_t rsvd3[8]; + uint32_t byte_cnt; + uint8_t rsvd4[4]; + uint8_t hw_err_synd; + uint8_t hw_synd_type; + uint8_t vendor_err_synd; + uint8_t syndrome; + uint32_t s_wqe_opcode_qpn; + uint16_t wqe_counter; + uint8_t signature; + uint8_t op_own; +}; + /* CQ element structure - should be equal to the cache line size */ struct mlx5_cqe { #if (RTE_CACHE_LINE_SIZE == 128) diff --git a/drivers/common/mlx5/windows/mlx5_win_defs.h b/drivers/common/mlx5/windows/mlx5_win_defs.h index 0c09325444..d79728bcda 100644 --- a/drivers/common/mlx5/windows/mlx5_win_defs.h +++ b/drivers/common/mlx5/windows/mlx5_win_defs.h @@ -223,18 +223,6 @@ struct mlx5_action { } dest_tir; }; -struct mlx5_err_cqe { - uint8_t rsvd0[32]; - uint32_t srqn; - uint8_t rsvd1[18]; - uint8_t vendor_err_synd; - uint8_t syndrome; - uint32_t s_wqe_opcode_qpn; - uint16_t wqe_counter; - uint8_t signature; - uint8_t op_own; -}; - struct mlx5_wqe_srq_next_seg { uint8_t rsvd0[2]; rte_be16_t next_wqe_index; diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index 515b5dfa67..e1ca77795c 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -537,7 +537,7 @@ mlx5_compress_dump_err_objs(volatile uint32_t *cqe, volatile uint32_t *wqe, size_t i; DRV_LOG(ERR, "Error cqe:"); - for (i = 0; i < sizeof(struct mlx5_err_cqe) >> 2; i += 4) + for (i = 0; i < sizeof(struct mlx5_error_cqe) >> 2; i += 4) DRV_LOG(ERR, "%08X %08X %08X %08X", cqe[i], cqe[i + 1], cqe[i + 2], cqe[i + 3]); DRV_LOG(ERR, "\nError wqe:"); @@ -555,7 +555,7 @@ mlx5_compress_cqe_err_handle(struct mlx5_compress_qp *qp, struct rte_comp_op *op) { const uint32_t idx = qp->ci & (qp->entries_n - 1); - volatile struct mlx5_err_cqe *cqe = (volatile struct mlx5_err_cqe *) + volatile struct mlx5_error_cqe *cqe = (volatile struct mlx5_error_cqe *) &qp->cq.cqes[idx]; volatile struct mlx5_gga_wqe *wqes = (volatile struct mlx5_gga_wqe *) qp->qp.wqes; diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index eb7fc43da3..0d01ca1310 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -406,7 +406,7 @@ mlx5_aso_dump_err_objs(volatile uint32_t *cqe, volatile uint32_t *wqe) int i; DRV_LOG(ERR, "Error cqe:"); - for (i = 0; i < 16; i += 4) + for (i = 0; i < (int)sizeof(struct mlx5_error_cqe) / 4; i += 4) DRV_LOG(ERR, "%08X %08X %08X %08X", cqe[i], cqe[i + 1], cqe[i + 2], cqe[i + 3]); DRV_LOG(ERR, "\nError wqe:"); @@ -426,8 +426,8 @@ mlx5_aso_cqe_err_handle(struct mlx5_aso_sq *sq) { struct mlx5_aso_cq *cq = &sq->cq; uint32_t idx = cq->cq_ci & ((1 << cq->log_desc_n) - 1); - volatile struct mlx5_err_cqe *cqe = - (volatile struct mlx5_err_cqe *)&cq->cq_obj.cqes[idx]; + volatile struct mlx5_error_cqe *cqe = + (volatile struct mlx5_error_cqe *)&cq->cq_obj.cqes[idx]; cq->errors++; idx = rte_be_to_cpu_16(cqe->wqe_counter) & (1u << sq->log_desc_n); diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c index eea6a5c6c7..78d3949276 100644 --- a/drivers/net/mlx5/mlx5_rx.c +++ b/drivers/net/mlx5/mlx5_rx.c @@ -433,7 +433,7 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec, container_of(rxq, struct mlx5_rxq_ctrl, rxq); union { volatile struct mlx5_cqe *cqe; - volatile struct mlx5_err_cqe *err_cqe; + volatile struct mlx5_error_cqe *err_cqe; } u = { .cqe = &(*rxq->cqes)[(rxq->cq_ci - vec) & cqe_mask], }; diff --git a/drivers/net/mlx5/mlx5_tx.c b/drivers/net/mlx5/mlx5_tx.c index 8f03743986..edb1e0265f 100644 --- a/drivers/net/mlx5/mlx5_tx.c +++ b/drivers/net/mlx5/mlx5_tx.c @@ -55,7 +55,7 @@ tx_recover_qp(struct mlx5_txq_ctrl *txq_ctrl) /* Return 1 if the error CQE is signed otherwise, sign it and return 0. */ static int -check_err_cqe_seen(volatile struct mlx5_err_cqe *err_cqe) +check_err_cqe_seen(volatile struct mlx5_error_cqe *err_cqe) { static const uint8_t magic[] = "seen"; int ret = 1; @@ -83,7 +83,7 @@ check_err_cqe_seen(volatile struct mlx5_err_cqe *err_cqe) */ static int mlx5_tx_error_cqe_handle(struct mlx5_txq_data *__rte_restrict txq, - volatile struct mlx5_err_cqe *err_cqe) + volatile struct mlx5_error_cqe *err_cqe) { if (err_cqe->syndrome != MLX5_CQE_SYNDROME_WR_FLUSH_ERR) { const uint16_t wqe_m = ((1 << txq->wqe_n) - 1); @@ -107,7 +107,7 @@ mlx5_tx_error_cqe_handle(struct mlx5_txq_data *__rte_restrict txq, mlx5_dump_debug_information(name, "MLX5 Error CQ:", (const void *)((uintptr_t) txq->cqes), - sizeof(struct mlx5_cqe) * + sizeof(struct mlx5_error_cqe) * (1 << txq->cqe_n)); mlx5_dump_debug_information(name, "MLX5 Error SQ:", (const void *)((uintptr_t) @@ -231,7 +231,7 @@ mlx5_tx_handle_completion(struct mlx5_txq_data *__rte_restrict txq, */ rte_wmb(); ret = mlx5_tx_error_cqe_handle - (txq, (volatile struct mlx5_err_cqe *)cqe); + (txq, (volatile struct mlx5_error_cqe *)cqe); if (unlikely(ret < 0)) { /* * Some error occurred on queue error -- 2.43.5