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 C0B2E43C8A for ; Mon, 11 Mar 2024 19:14:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A3F5B40687; Mon, 11 Mar 2024 19:14:52 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 5456A4027C for ; Mon, 11 Mar 2024 19:14:51 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k8cnqjWphNR8uNGNHVKSVY41Yzw9f6NxUZMtKC0upOCcI/4yu9mvX8NMu03K1AWzABDZ1eUfD1z5+LglqNEyiXFQSahGkm1n1f7AjPHIYU3HRc3s5UEFeFVlK/e/JWS45HweSRacpfI0ze7rHVhwrpFBJ/wbuE3GvXMMgUmglXrA52Z6lmcwqNKuSQmVqCslImFTdfvBxQxkIumv9plncdK3yzPFAJA771FzJn//n+ITbX7m46Q31sQd7350WgE3S5KOlbhDP0zJ5bFq5DM0XA0c8/Zx396Yt80OABWmsOV8JRwMziX1JxUBJQvtQYKY6aRDx16zgLUhUZiFfjTSFw== 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=C/41to3Uwf5VDu2RLmfXdDt8gE9UMKftdzNEjUubTJk=; b=c+lthiaHoKZfqDN4YFba8sHNhxdRwOwbtxyPohWyQ9rMA/LTr1WFgyVySEqpb7vQONWi6V7dXzOriniDtfGIIKbR6Z+m+b49DaYjSGtjJaoYIvrdhgc3Rd9ucivyzZS0cFrzBkkEMpIkhXwq3XWD4msKMvJI5nBaJyMDo0MW7zJd0wIVnjjGvAMiF2hEY0nS8OKfQUOEDs/nsR2pIGeKHugTfckNWGeReRA+mPqrDkBD5chkJzfDUgkWg9TGzp23NOjUIi0EBHUtwmYXRIdDAm47pF2VtcEVCYYp8NYsFHbtKG+bg2PN5hONEWsxL34s9AmeCqY4ljTlgmjgSXa4sw== 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=C/41to3Uwf5VDu2RLmfXdDt8gE9UMKftdzNEjUubTJk=; b=Kah/JbXrkaoR2O5Bur9wtxKZZ73V7S0qqMeiX4owXUXrEq11PDmZeazjuxJOKOo+4c81k194CGy0HCS4yc1yMyeEw17q2AkE7AIoPq1rvLge5/z7KIL9OsGVxf3FQMOhREGEfmojJyALlBbwgKIs4R8sTkCNyIMPTA3OvVnSFVb5nY9hY3/XKRInW9gSBA1EE3k4tGU9hVWzzSnaMmvKLgg0kr5KMeFujvkH+/k+fglBi6oddj0dOoxqkNc2HvdDZA8fNlgT9nlIjjcUpn5a/4TlviC8S9jdik1d4qAmqqrVwvp/MJo7y1RfvKIXdRgCdGbxk9ib1xLQl0ZZ5vsXbA== Received: from DS7PR05CA0035.namprd05.prod.outlook.com (2603:10b6:8:2f::18) by CH3PR12MB8308.namprd12.prod.outlook.com (2603:10b6:610:131::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Mon, 11 Mar 2024 18:14:46 +0000 Received: from CY4PEPF0000EDD4.namprd03.prod.outlook.com (2603:10b6:8:2f:cafe::3c) by DS7PR05CA0035.outlook.office365.com (2603:10b6:8:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.17 via Frontend Transport; Mon, 11 Mar 2024 18:14:44 +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 CY4PEPF0000EDD4.mail.protection.outlook.com (10.167.241.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.12 via Frontend Transport; Mon, 11 Mar 2024 18:14:43 +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; Mon, 11 Mar 2024 11:14:24 -0700 Received: from nvidia.com (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.1258.12; Mon, 11 Mar 2024 11:14:22 -0700 From: Viacheslav Ovsiienko To: CC: , , , Subject: [PATCH] net/mlx5: fix error packets drop in the regular Rx Date: Mon, 11 Mar 2024 20:14:05 +0200 Message-ID: <20240311181405.51125-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 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: CY4PEPF0000EDD4:EE_|CH3PR12MB8308:EE_ X-MS-Office365-Filtering-Correlation-Id: aceb374c-616a-4998-4a8a-08dc41f7209d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CdXgklngKnWEwyxhRlsiQjEd9/UTWM8afn5aTdElWazWW+SDyzFm5X8iO3+RitN+7UDKWMf6HCreYn6FL/2s/ju8IxXNloSgvuJfdJr9ge5tt31GApLXJp7QMYFJH903q01lYKGdTScO68NlNjuXL4rhcRqhrWIUeWpgC195eEdng4pUPWfst7E3SD7klT1fak0FUTa5o9ytLii94NvE4KY0qONc8w3Xit1oJOxLuDxW4RzE0JibNrzbK4EjjbNIjklUVq/P2GlokWLEWqr0uq/pbvdKBKz28vsrpKppLKJBxo2mL+gBOJh6G6Au2BimnUqgSKKbYQVcCSPNVHYNeg2bYfFDeLDWfwPCVDC1lTz8wyVGHNekjdYzemkgi1U2dT1rU82PchoQJTcsIz5oYsTLz2D7ZVe7jO4CZhQFIyK5ToPjWTpb1oVRdX2K3D0cj3dxsyBUUCvv7mxbOWvhWy8ncL5sM59IlKr9/Lym/wCuTeX4Fai8YGmi90X1c4xoHOp2gumJpaSJuPWfjxwFwK81oJDHQw7maed+Wnv3Lq3w+Jmg3zrrulEVqP+IgfJfohdszE46QufHx1Gkkzcjwh7XjhYUryD8hRmMUo36Pe6Tvw+XCgBY76QZ3RVR0NvHGmOvDSCgj/T59Ba4wwLKStGzfeP2RNwXbtUxAmqytSzPiNB1DWd2216YmcJaXJX6oo0+H+mhkaLX0PJ4yK74lu9+XPreGBC7DF58JhkPCB9be1VZirNoHlK/HgdbWpQ8 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)(376005)(82310400014)(1800799015)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 18:14:43.8580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aceb374c-616a-4998-4a8a-08dc41f7209d 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: CY4PEPF0000EDD4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8308 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 ef296e8f6140ea469b50c7bfe73501b1c9ef86e1 ] 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.34.1