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 CD9B643B57 for ; Tue, 20 Feb 2024 12:46:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C73A2406B8; Tue, 20 Feb 2024 12:46:07 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2086.outbound.protection.outlook.com [40.107.102.86]) by mails.dpdk.org (Postfix) with ESMTP id EDD2840289; Tue, 20 Feb 2024 12:46:04 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KjJOzp7f2eWcN5khA3PtVOh0tn/lHfQDsNYPcSg36Vb13T3dk+UtiRwDF64xU7/2ViWSZqNc6pyAGFvSAl2RK5aBngQa0xrhzQvJdDOYoI1w9LIMxEzh7ZxALnzjhyB8maeHVn7Wk1/8+eUzLS00xKPhE9pTvkw7vKN8Hx2AkBNuVOm0E3ovrzF5FHdIOYnjPCPaMl5xRTWJTc5F4j143PEwL/0irqHHJXPsLklQohMbopDJK5H63dEVQCJSIK4PoxHvsu25HbcIBFm1TVjfSUjaiYYxTg1P6lYwV92Y5Ga6YDvIfFphdJllocCsLQUYpDlCmEtwanBaprD3VuFKGQ== 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=e4NxR5zfvOELSTG/z7l74bTinIFujF9KrTdrLhu28X8=; b=JYHOWbYRnzsarOTLRFm/xl5k0Vci1jmanS8rl/gU12ABULz4/ZLGd9PiF43Iz8pXvUtG3yxqi2LAAd0WmYIGN1NJ5j7JcHaSEJ+ih7e9STYUdUtmOMgLr6CduPzxrUjBGA0g+wDneqROOh3eGo5nMUOtgaQrSJ2IMWElo+0HXVsdAkTG/Vy1VtdC3Y50H7tBFGaMxI6CbbsbMix+ZtMQFSLZ25FafgutxApPm5jPM+c8Yq8ckqG5u8grShHAnCPTkYTakUI6OV7Crxix28jZ6kQ+gRwXoQn32WgtnVtlrtHmOsFLxADcp1QTfBRo/bs3AANulVGy3dr7gh6/5MiW1w== 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=e4NxR5zfvOELSTG/z7l74bTinIFujF9KrTdrLhu28X8=; b=DTnthtrZa0RmGIFl/pQdxNJDrWEPugnNZYosLflVhsBBtBDgubrJ2WeRy1NngzHxRSJ32nP0UVKhsORPVv5rD3UVTFBsFVLBG3FbpPrjnPZ2zqWL18hIrMVehQNQZYMqjmECulCxOrXVvOUsRudT4nMrf+OKStfnfcNTF71zYYqFnqSqXTJYfdGrZ0EUKo86YusUrSDKQWvyvcXSXtwrnSipDym6Cngst/ksz6FQZ3Zoz2tJMwQ0AErTQGnDO9jqG/AqmlM0imDtni/j21VVGXEtxAXt45ze9Mrzz2Clg8IDQc8AJq4Ih/QDGYLHfSGho6PLlAm/IKi34HhcNMzGIQ== Received: from SA9PR13CA0101.namprd13.prod.outlook.com (2603:10b6:806:24::16) by SA1PR12MB8842.namprd12.prod.outlook.com (2603:10b6:806:378::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.20; Tue, 20 Feb 2024 11:46:01 +0000 Received: from SN1PEPF0002BA52.namprd03.prod.outlook.com (2603:10b6:806:24::4) by SA9PR13CA0101.outlook.office365.com (2603:10b6:806:24::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.28 via Frontend Transport; Tue, 20 Feb 2024 11:46:01 +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 SN1PEPF0002BA52.mail.protection.outlook.com (10.167.242.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Tue, 20 Feb 2024 11:46:01 +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.986.41; Tue, 20 Feb 2024 03:45:42 -0800 Received: from nvidia.com (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.1258.12; Tue, 20 Feb 2024 03:45:39 -0800 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH] net/mlx5: fix error packets drop in the regular Rx Date: Tue, 20 Feb 2024 13:45:20 +0200 Message-ID: <20240220114520.14531-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 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: SN1PEPF0002BA52:EE_|SA1PR12MB8842:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e4ffe33-3ec5-4bcb-550a-08dc32098320 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: td3ODTEf7OPrltdqN18mhc4ehZFOsgls5JJMJBhGKeGe+OCc9zRFmM/slw/dHRF8ZtxJuXX1mbQ+3FLIW49V2BZHMBF11GL+ZqPCfQbNQoO7F1pVkIUxMryrd0ioseXOXs0RdMz6NOi0sNn6IGkRN3ooB4kagWkFngz3sqJzzIRR7p+RHN0hRncoo0NeSIMfcIlqpEEONnFBkTnRj/4cJnFOrarwB5tyJDlLbkfyyQMS3ksiIrWnqkhnlz3FKn0DkobZ7nEDC+INgoZqf80i9BJ3Fl+38rixLk5r8cG6+NnglYGNjaGb7dC4BrdOk/CSBOX+R5PpN1fBiCc0xISZIp5MGXp33lPxpFbtsczrZhskv5Y8x9fv7VW6ASUZtSQSk478tbCxWIO4T8y5j7LH/N6vNd5mpkxDSqfLoPskN9O/DSwltsieftQKcvZxJYKEvSaQXgdZjcNpPCRD7ZJBtQ0U307IC/QwnLX3tY870e2govYK5tFq1h5cZsP5YlUa467Hdo5/G489x9DGWsF5YMCecQANYf+jgBy6W9uuKNHcPVf45pcmmVnR2GmHiuBZyKdeKLl6+ctzHBkbACQDgszooqADckuGdBSWKXKCrUqm7/ofNfGFaB5M29BdzDuVRtlLKACwfFMt1wDs202d8Xj/jd8fuVG3QROH+nJIKbI= 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:(13230031)(36860700004)(46966006)(40470700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 11:46:01.2983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e4ffe33-3ec5-4bcb-550a-08dc32098320 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: SN1PEPF0002BA52.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8842 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 When packet gets received with error it is reported in CQE structure and PMD analyzes the error syndrome and provides two options - either reset the entire queue for the critical errors, or just ignore the packet. The non-vectorized rx_burst did not ignore the non-critical error packets, and in case of packet length exceeding the mbuf data buffer length it took the next element in the queue WQE ring, resulting in CQE/WQE consume indices synchronization lost. Fixes: aa67ed308458 ("net/mlx5: ignore non-critical syndromes for Rx queue") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_rx.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c index 5bf1a679b2..cc087348a4 100644 --- a/drivers/net/mlx5/mlx5_rx.c +++ b/drivers/net/mlx5/mlx5_rx.c @@ -613,7 +613,8 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec, * @param mprq * Indication if it is called from MPRQ. * @return - * 0 in case of empty CQE, MLX5_REGULAR_ERROR_CQE_RET in case of error CQE, + * 0 in case of empty CQE, + * MLX5_REGULAR_ERROR_CQE_RET in case of error CQE, * MLX5_CRITICAL_ERROR_CQE_RET in case of error CQE lead to Rx queue reset, * otherwise the packet size in regular RxQ, * and striding byte count format in mprq case. @@ -697,6 +698,11 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe, if (ret == MLX5_RECOVERY_ERROR_RET || ret == MLX5_RECOVERY_COMPLETED_RET) return MLX5_CRITICAL_ERROR_CQE_RET; + if (!mprq && ret == MLX5_RECOVERY_IGNORE_RET) { + *skip_cnt = 1; + ++rxq->cq_ci; + return MLX5_ERROR_CQE_MASK; + } } else { return 0; } @@ -971,19 +977,18 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) cqe = &(*rxq->cqes)[rxq->cq_ci & cqe_mask]; len = mlx5_rx_poll_len(rxq, cqe, cqe_n, cqe_mask, &mcqe, &skip_cnt, false); if (unlikely(len & MLX5_ERROR_CQE_MASK)) { + /* We drop packets with non-critical errors */ + rte_mbuf_raw_free(rep); if (len == MLX5_CRITICAL_ERROR_CQE_RET) { - rte_mbuf_raw_free(rep); rq_ci = rxq->rq_ci << sges_n; break; } + /* Skip specified amount of error CQEs packets */ rq_ci >>= sges_n; rq_ci += skip_cnt; rq_ci <<= sges_n; - idx = rq_ci & wqe_mask; - wqe = &((volatile struct mlx5_wqe_data_seg *)rxq->wqes)[idx]; - seg = (*rxq->elts)[idx]; - cqe = &(*rxq->cqes)[rxq->cq_ci & cqe_mask]; - len = len & ~MLX5_ERROR_CQE_MASK; + MLX5_ASSERT(!pkt); + continue; } if (len == 0) { rte_mbuf_raw_free(rep); -- 2.18.1