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 9CB1BA0548; Tue, 22 Jun 2021 18:41:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A9084003F; Tue, 22 Jun 2021 18:41:11 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2077.outbound.protection.outlook.com [40.107.220.77]) by mails.dpdk.org (Postfix) with ESMTP id 5362A4003C; Tue, 22 Jun 2021 18:41:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V3MAHbqZ3s7HdcDtwgMrL1WOwx8tVF3DR3zB7/xTX7OqWJlbmbygJw4QIW0pD5rz9H4cXgVXlKsl9l+b/lPPgnqZs7TD/39wURC7Lwal4W1I2HRnM+NWJBr7G+RxmcHfdDWsCR3t8NqoKO7/luBlOGvgpbDsn6lsRoKQN3mpRqsSfwSWdEn6qcZikCG/87r//6IL41DshaVLpTbPR8yASmj2FFdt/dzVLe9mC+eWwFZ1Ep3XlMkxTOT8l888cVE22Djte52FwXKPUktNmaCyhLvdiIqc9sqAohMjAddcHa/yj6swmiwmSNYLm7JqDkpeDujon8Gr8iRQi3OeAQbpwA== 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-SenderADCheck; bh=oaZDkanLJRZTGSBK44H/zsZJSEqq/FU4x5u7vWU3nzo=; b=ZPrIQJ98rDrAcIEe4jvssJ429XR6QVKenQwUf0M3waQ9W2JMz9WTC6K8cwCyRQIZcPVfECqoVox6gkm7RHPwCsvrlrMc+lpA3URcK3si65q2b7SXAmftYCnziJedBFkmFYBBq8NdauSGykvJN1r+87lqMrBAP5Mo1yvGyEfZJpSM5zRq4XPKNWvQVmeLZNAhXE22D9mncPqftTB1VxO6NtY6Xv0wuoiw8UORAxVSS4bZAfNBt9dcFWIUtZFF5GiNftA5IGneeBwyoMFJyhxO8sHVvsIhxCatkbPm08jY2ZaE1BKNlomOiA0CCoHhuBjg77npzjWUmZqpog0LW5NJCQ== 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=none sp=none 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=oaZDkanLJRZTGSBK44H/zsZJSEqq/FU4x5u7vWU3nzo=; b=PyeWasjlX7K0/+uyyrV7pXeijXh0tYAd//1wE/Ib5HMQeYAgOUg5kwR7kNnhfDK4SFTSNCfHt0+li7m21NlbJZ/fCJr0mnlj9IRVeD+Y2C37kMWOq6nCcwzYouMIeOm90MVHoQQ56CGhl8igc6RHLRrcs/OTnEn4PJF+Nqqw3wLDTIhbvoOV+DOaP3pD1mBBmMcQ7R+X9CTiHCZogEdWgdkNxktTcxGuKs7GGXAvOPoYYpAMFJT8XanBg2/wBJpi2l1OAsATFmhZq7iQbj9wfMc9vSvlVbnetJHOoT8eHWNVG2UYkLFG/rireWm3janaJratExlzfwFdWFV9l7peZA== Received: from BN9PR03CA0538.namprd03.prod.outlook.com (2603:10b6:408:131::33) by DM8PR12MB5400.namprd12.prod.outlook.com (2603:10b6:8:3b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18; Tue, 22 Jun 2021 16:41:08 +0000 Received: from BN8NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::ff) by BN9PR03CA0538.outlook.office365.com (2603:10b6:408:131::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Tue, 22 Jun 2021 16:41:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BN8NAM11FT068.mail.protection.outlook.com (10.13.177.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4242.16 via Frontend Transport; Tue, 22 Jun 2021 16:41:08 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Jun 2021 16:41:06 +0000 From: Viacheslav Ovsiienko To: CC: , , , Date: Tue, 22 Jun 2021 19:40:49 +0300 Message-ID: <20210622164049.9191-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 282edea8-a492-476f-8c09-08d9359c8953 X-MS-TrafficTypeDiagnostic: DM8PR12MB5400: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ZKuiMvwUAkERmhKCyq5VIuyII/KB41YJVVj8ZEpbo97RUnOt9oNAXGw1XHFtGypXqaL3HQpIe1HLf1+i0GIoonYlCuePbY2mymP6NLITDwibk7BwbWhaG4WO0WRWilA64+QfVeT/EV4q7Y0BHkuriGCM67ZtP96frAgcapuU1lKUJdqBLRE5dPfBRGP10k99r2aK6N79sxoreJHjN2G770DARVLcwrfTZQdgBbk6oFw29lvP5yZMI+NAEUHqpy6yIyxfTDeTTJOIeZ+Nfn4diFrpzZzr8dYoTuud/IoXa+OmH+MU0QkN0dZwXdY9Bp0QmO+q6qxkZV9dQEUNmhKAU0MaRvQ7BXwP3MuZjPuw0tSqyAkFVDtbSpqHmZ3RipmCaLQ8A/BlpSzHytMxbBiai6kVTqAtVlBIJh34SzxNd4EDLSc/153FqrgadFvltGms1l2KVxpLh0Npvxatv+wB+/juJu5GFJnPYqFtXNxaUoBB+CYQlEmI+movtMquFc1x1JAE8ha3CFAvXs8Y879YCBLSy/fY2rp3muHR7wBs8WQUm6JrnDGhQ6S7AN4+u5mlCfWKDcX5rlcBz1pnUk9mG8mY8/wYxGGh9yDJSE+88srTUcuGluOdq9Qlx6Bjkla0cd6YH1qAEKr5RgngHtfYSH/ZPXYMtJwgogtYH9xv2fijPPwW4K3Ygqc4D0JfjFqxbPbD5JFt0+vkETrKVjYMw== 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)(46966006)(36840700001)(82310400003)(16526019)(7696005)(356005)(6666004)(6916009)(1076003)(186003)(2906002)(36756003)(26005)(6286002)(7636003)(5660300002)(426003)(2616005)(70206006)(83380400001)(47076005)(336012)(86362001)(450100002)(8936002)(36906005)(36860700001)(70586007)(8676002)(4326008)(498600001)(54906003)(55016002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2021 16:41:08.2961 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 282edea8-a492-476f-8c09-08d9359c8953 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: BN8NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5400 Subject: [dpdk-dev] [PATCH] net/mlx5: fix multi-segment inline for the first segment 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 Sender: "dev" If the first segment in the multi-segment packet is short and below the inline threshold it should be inline into the WQE to improve the performance. For example, the T-Rex traffic generator might use small leading segments to handle packet headers and performance was affected. Fixes: cacb44a09962 ("net/mlx5: add no-inline Tx flag") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_tx.h | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index e8b1c0f108..1a35919371 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -2041,6 +2041,8 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *__rte_restrict txq, unsigned int nxlen; uintptr_t start; + mbuf = loc->mbuf; + nxlen = rte_pktmbuf_data_len(mbuf); /* * Packet length exceeds the allowed inline data length, * check whether the minimal inlining is required. @@ -2050,28 +2052,23 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *__rte_restrict txq, MLX5_ESEG_MIN_INLINE_SIZE); MLX5_ASSERT(txq->inlen_mode <= txq->inlen_send); inlen = txq->inlen_mode; - } else { - if (loc->mbuf->ol_flags & PKT_TX_DYNF_NOINLINE || - !vlan || txq->vlan_en) { - /* - * VLAN insertion will be done inside by HW. - * It is not utmost effective - VLAN flag is - * checked twice, but we should proceed the - * inlining length correctly and take into - * account the VLAN header being inserted. - */ - return mlx5_tx_packet_multi_send - (txq, loc, olx); - } + } else if (vlan && !txq->vlan_en) { + /* + * VLAN insertion is requested and hardware does not + * support the offload, will do with software inline. + */ inlen = MLX5_ESEG_MIN_INLINE_SIZE; + } else if (mbuf->ol_flags & PKT_TX_DYNF_NOINLINE || + nxlen > txq->inlen_send) { + return mlx5_tx_packet_multi_send(txq, loc, olx); + } else { + goto do_first; } /* * Now we know the minimal amount of data is requested * to inline. Check whether we should inline the buffers * from the chain beginning to eliminate some mbufs. */ - mbuf = loc->mbuf; - nxlen = rte_pktmbuf_data_len(mbuf); if (unlikely(nxlen <= txq->inlen_send)) { /* We can inline first mbuf at least. */ if (nxlen < inlen) { @@ -2093,6 +2090,7 @@ mlx5_tx_packet_multi_inline(struct mlx5_txq_data *__rte_restrict txq, goto do_align; } } +do_first: do { inlen = nxlen; mbuf = NEXT(mbuf); -- 2.18.1