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 698DEA0C4C; Tue, 23 Nov 2021 14:58:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32B5840688; Tue, 23 Nov 2021 14:58:31 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2085.outbound.protection.outlook.com [40.107.93.85]) by mails.dpdk.org (Postfix) with ESMTP id 1417340040; Tue, 23 Nov 2021 14:58:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EfZ8/Nq6WkBc1r7zHHxEVLmu0Z/UfqPZn+dHH5cJuFmzDIlQB1qddAd3v0s0wpAKyIgYO32q4Tl03bLBnIdxzTdDsxarJ0zgbN99Y6wNdlJeUHBMta/qQuoEH2idYm6BIABQByWItpgZ0laT22kVHKPSOjRkNoivvIeZdwnXle1VHvdKM0z3vwjpozh0E11FKo8L0TkzlaG+Yls1vPcGLZM27ccoxB1OiqamVRPQPhfc71NHUAk/bklRPima+4HcNhGysQSEADbcTdhuQxjApwA3OeVEoqwDb+/xdPQq1bOz54QD7JXE5oP3rpJx9dLW6oDUX2GdtXPsRKKPFoPOHg== 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=H/ZTqIZU6dNmgUOO+LqeW9ajuWPAm3Zsm88PPqST5IM=; b=ZvhMTuXbBIgP4C5GcvswDfu2S4pKeRnKuOzLirNvLteqhvTfjedqKUwogehtW4rXQ3z8XPNk76xJGN4S1kmVmayXeWoarvsvBWXl9V64tMneEDFn8w5s48phmFoZir4MZRrFg5epwr6ykPq8CZq96Ef1ZRwQLm1AKLvcAPmdosvuKJ/zzc6wXfDBcYmETgtaZbTyUsxIQfXXgjFPXmtz+7xuWCSxfQx5xounSMdlEpWRVBzZBlAbjpqincNj/qrA2RkUzFDLvb7NDwQS0y5odGgVWFHUSYIHX8Yn+ybMVTRNzOUmztM/KDfAm2IWB0z+WzQVkcz6gs0brEIVz9WcPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none 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=H/ZTqIZU6dNmgUOO+LqeW9ajuWPAm3Zsm88PPqST5IM=; b=acm6baDIU5uIEZ9Rou5t2+4l1QyBw/tc/VmDFazfu6L8C0/BCnbLNlZHYuVsWjUAPPXZfddLJgRbQhsUbdAf6xO6yNG1Dtp8UtXmakgZW5jJj2+UXQg4H4q9Ia9b5H9fQFqwktOq4bCseKz+YxdUJ3UpFeTOo8a3idwQS8875v2sMaoFC5ekFawAcg5OuSSWilHxTLaAoF5DrppaPp1wcgqENqWVuhDG8BbuXmr6V6bwvluTYPXDRDuNCFGkOLYM1nmKSJ8f6SeMnnN8aAgx/znC1h4AM6u/REiGIhrvJp2SNMQvZ9Dbh0dNquS3QMCoqb2BdZUAnZFUbMTLPIjA0w== Received: from MW4PR04CA0119.namprd04.prod.outlook.com (2603:10b6:303:83::34) by SA0PR12MB4592.namprd12.prod.outlook.com (2603:10b6:806:9b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Tue, 23 Nov 2021 13:58:27 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:303:83:cafe::29) by MW4PR04CA0119.outlook.office365.com (2603:10b6:303:83::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Tue, 23 Nov 2021 13:58:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Tue, 23 Nov 2021 13:58:26 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 23 Nov 2021 13:58:22 +0000 From: Dariusz Sosnowski To: Matan Azrad , Viacheslav Ovsiienko CC: , Raslan Darawsheh , Subject: [PATCH v2] net/mlx5: fix multi segment packet wraparound Date: Tue, 23 Nov 2021 15:57:40 +0200 Message-ID: <20211123135741.178491-1-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119181110.232000-1-dsosnowski@nvidia.com> References: <20211119181110.232000-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 190a2d5a-0472-45ed-6a49-08d9ae8952ac X-MS-TrafficTypeDiagnostic: SA0PR12MB4592: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AgUFb4Y7NzMOS6+kEliem0oRI2KFGAhl7dCoOZpMRJuBABUkXZUkyqhY0xfFy0skiR72zxZg+mu7qUeA5Z9bsLV/78E7va6TNVkoqHtfJG9ykIsC+LeTRARkTVL/v2kU2Ksk2fIgCobjuueXQsUNH1xmu/t8vsg1M2AbI0uAZRsHyoOeLQ+oi/Zqdrpn9rZtttmQFDF+tdd9Wr7yqJhWdck8Mc/eR8vYk8L6Mw/ALcSX62PkcBJUOOONbpNmECUoY/1n1jBkgzG0zDiINGfMv5OYqxQ5gniKvPxZxoJJzPcnsrJJk5+ntgGi0HhCAKKGFccC3vexJkz/yCfbqyA55DhxzZNChOVjRc4oxc5ZrjiUqt9cfU0xaaQouZeioHA76RDvmyIdnLcjmw75ehhYr3DNRD1Vn2dx+ypC9+CJp8Pejps3nviVrmSYh1+mxBSP6qFLE3TNI0ilUjEtMN3qNmm26cAn+9GPQqnpQyMuAc+/ILMiLTy8m0k1cRM3RXSKQiqw1OumNQRRmrjpnzASsRo629haMh58qLaEl3ezpGR6eh9UfORGUHGxiRwbOimmxfEyh5qBFM9egkK3xeIPgLUurt4HTyL5N5C6iUGOHBJpX9L94TScR0dJl9GkymGd3u1UYRrA8XODsmvUDaHRcpje08yeIZhcnpgSVsuyF8+q0iSqs7c/dXLH10c3CbPrbhxLhUsXciIfXCBLpxUvhA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(336012)(450100002)(1076003)(426003)(36756003)(5660300002)(82310400004)(70586007)(7696005)(6636002)(316002)(36906005)(508600001)(83380400001)(8676002)(86362001)(6286002)(186003)(47076005)(7636003)(70206006)(36860700001)(16526019)(54906003)(110136005)(8936002)(2906002)(26005)(6666004)(4326008)(356005)(2616005)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2021 13:58:26.9350 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 190a2d5a-0472-45ed-6a49-08d9ae8952ac X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4592 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch fixes the assertion failure triggered when the user configured minimum inline length requirements and the application transmitted multi segment packets. Failure was triggered when space left in TX queue was not enough to cover this requirement. This patch limits the length of data to be copied to the available space in TX queue. Fixes: cacb44a09962 ("net/mlx5: add no-inline Tx flag") Cc: viacheslavo@nvidia.com Cc: stable@dpdk.org Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_tx.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index bc629983fa..099e72935a 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -1071,7 +1071,6 @@ mlx5_tx_mseg_memcpy(uint8_t *pdst, uint8_t *psrc; MLX5_ASSERT(len); - MLX5_ASSERT(must <= len); do { /* Allow zero length packets, must check first. */ dlen = rte_pktmbuf_data_len(loc->mbuf); @@ -1098,9 +1097,11 @@ mlx5_tx_mseg_memcpy(uint8_t *pdst, if (diff <= rte_pktmbuf_data_len(loc->mbuf)) { /* * Copy only the minimal required - * part of the data buffer. + * part of the data buffer. Limit amount + * of data to be copied to the length of + * available space. */ - len = diff; + len = RTE_MIN(len, diff); } } continue; -- 2.25.1