From patchwork Tue Feb 22 10:26:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 107956 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DE5FBA034E; Tue, 22 Feb 2022 11:27:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5ABA24114B; Tue, 22 Feb 2022 11:27:23 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061.outbound.protection.outlook.com [40.107.244.61]) by mails.dpdk.org (Postfix) with ESMTP id 670EA40DF4 for ; Tue, 22 Feb 2022 11:27:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e9jSYUsEnASCuxB6WsG3swSzy5reDx0gOaCH/2UEzM0h2a5kgoOFz585GJPRrKiYZyZuiigtCMev7q4BCuPCJHq24sSaF5det7rhsFFgoKFc3yvL6ts3zFI4cxC5ham7Zml1HPEBRk/SuPTKaBIUeUANAeVAZIKDAKtmrOr4YAgXnWYbxULaEil7/6o8lo0jU4lCLtLUn5kaKOusLsY0wYeuVYDMV8eqVZsP46dlUmZWJCGFgErta4kOi9eXe25/iVBoFEqdcDlr8Tnp+eyHybRg7XvLIYzRFjE+UbN1d5xFqO0A5Mc9tuMYk+LvXbMyi3lgMws9RuWlB+L6gg7I9g== 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=ziBzr65TGxWZ59sb/u2ILO0yC95XedlMyTVJaoK1D0U=; b=PVpEFAMPdOccjcZGAb9Rpxe3nYbp0wuOsmGTwg2tEUWuMRA2PhXetLHHFavBbVcSxZrO2UuA4oGhl8cX/LMA4P6Ft84SktfWkNMzaYn2kAb3ijQIIbaHOqTWdIcHVuWMTDOgxmWIYch6SZX9ia1vyzJDj4Q1yTx4YQ9VFvnXb1TYNR6YxNl125jZFJ4kZjvXcmV5ahuLxgjwOFtzD+5N6AZBa3OHH3CHncvyqR/PjN9bXrmnkTGvJsX54vGGfl/ID1oQsdz+mAK2YrFZdbzM/YtzAWnxZpNL4HlVXkPC0GyNEGP3SMseWloVozgwbczskttrw9esnN/sfzId4FxBZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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 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=ziBzr65TGxWZ59sb/u2ILO0yC95XedlMyTVJaoK1D0U=; b=eTFTOl3FRJz46fbpYtROAMABgsoTSlP6yoQwkkbrYI3LZyhBcgtZnnoSn4MGV8CpzevYYSUuYD/2PzQ4/EA+BzBykINP42LYj2YgNrrMWHXFdqE2yQPTmgOl2Y37O/Olfk3qh7WHKeUMoDwGur2yPV+eidO9roKV2BcrvJV0clVrpSR2dqC5z2dYpD8o3h70kh02/Awgngg7oXfDeMlUkHVOxQWHsSM1kFV/nvoeYubve5euigU8efsptWB3q+4TuHq3a9VhMB1V0gAInKa0sSq96ZXrw9kj3aB3Qm9tlqTAaExmibdVultm1YLvtf5P92Q0qJjyrof6KwBUj044mQ== Received: from DM5PR13CA0052.namprd13.prod.outlook.com (2603:10b6:3:117::14) by DM6PR12MB4828.namprd12.prod.outlook.com (2603:10b6:5:1f8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Tue, 22 Feb 2022 10:27:20 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:3:117:cafe::41) by DM5PR13CA0052.outlook.office365.com (2603:10b6:3:117::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.7 via Frontend Transport; Tue, 22 Feb 2022 10:27:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4995.15 via Frontend Transport; Tue, 22 Feb 2022 10:27:20 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 22 Feb 2022 10:27:13 +0000 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.986.9; Tue, 22 Feb 2022 02:27:11 -0800 From: Viacheslav Ovsiienko To: CC: , Subject: [PATCH v2 3/4] net/mlx5: add wait on time support in Tx datapath Date: Tue, 22 Feb 2022 12:26:47 +0200 Message-ID: <20220222102648.4662-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20220222102648.4662-1-viacheslavo@nvidia.com> References: <20220214085655.22648-2-viacheslavo@nvidia.com> <20220222102648.4662-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.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-Office365-Filtering-Correlation-Id: bc80bd1a-b24f-4a8d-d6ed-08d9f5ede854 X-MS-TrafficTypeDiagnostic: DM6PR12MB4828:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /CquSlUFkujU0ezyIyC1Ifp539h7D6esHsC5RueQzZLNgylJj+TGOwAaLwr+HUYa5629catxoN7VS3AoWj2lgQ8mczetmLTrqXSWP+N7k+CQreL/aSCjIcM2luoUW1hJC9MGZX+h3iIUbDlD4CgIv6WcJDa3t8M7/UVTdDMpYO408th7JzROnaP5WBVBBjEoUP0VlIo2w5wdOxOMD6wnlXZ6L95myqD4x2EMPUVR0oagw5Yi4o7esJp5eHzypCTJi0ZTvDmnKBn2QJeqWaz60ZJhnmCLueykN6HqbUzhDn4P+lnza+ETbI3JaZzO9AJECazU3vse55FVAhMIvEhzZ+k+xumcLY6Broth9gnD23hA4vVYER+AsMtQFUf1boJdENlL5XIcNkj/apeG76bGKnIwVAlH1fjRWeCaJCWEhEQd4oQWLSZsx4Ighu0VpfgfKB4HYdT6lCQjvg8GGw2bgRfovF6VLcfe9rn1aI2Qd1EPn06FiUyrW6uTGosORexOXPI2SIGRsouM5MhEHZ0YBI+zOoF/bsYjuxumDMeAHBS/ABAp8bxK2GgeZce6DwcYo9a61U6pCd7NLco0ty8zPEmvNzmRsMfBdlfk1XDwZoxsc9MiMGpesIc0MzKlt/ldXoWhL64GJ5haNdmqRWEYXH4QjbfKp54LSbuiemRgTpha66wBjQkJVJBH1dsxpB5O9G986Xc5ZDBMMBsctVutBg== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(54906003)(6916009)(8936002)(26005)(1076003)(186003)(16526019)(5660300002)(83380400001)(70586007)(70206006)(4326008)(86362001)(8676002)(6286002)(356005)(316002)(82310400004)(426003)(81166007)(336012)(2616005)(7696005)(40460700003)(36756003)(6666004)(2906002)(36860700001)(508600001)(55016003)(47076005)(107886003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2022 10:27:20.2470 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc80bd1a-b24f-4a8d-d6ed-08d9f5ede854 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4828 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 The hardware since ConnectX-7 supports waiting on specified moment of time with new introduced wait descriptor. A timestamp can be directly placed into descriptor and pushed to sending queue. Once hardware encounter the wait descriptor the queue operation is suspended till specified moment of time. This patch update the Tx datapath to handle this new hardware wait capability. Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_tx.h | 72 +++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index b50deb8b67..0adc3f4839 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -780,7 +780,7 @@ mlx5_tx_cseg_init(struct mlx5_txq_data *__rte_restrict txq, * compile time and may be used for optimization. */ static __rte_always_inline void -mlx5_tx_wseg_init(struct mlx5_txq_data *restrict txq, +mlx5_tx_qseg_init(struct mlx5_txq_data *restrict txq, struct mlx5_txq_local *restrict loc __rte_unused, struct mlx5_wqe *restrict wqe, unsigned int wci, @@ -795,6 +795,43 @@ mlx5_tx_wseg_init(struct mlx5_txq_data *restrict txq, qs->reserved1 = RTE_BE32(0); } +/** + * Build the Wait on Time Segment with specified timestamp value. + * + * @param txq + * Pointer to TX queue structure. + * @param loc + * Pointer to burst routine local context. + * @param wqe + * Pointer to WQE to fill with built Control Segment. + * @param ts + * Timesatmp value to wait. + * @param olx + * Configured Tx offloads mask. It is fully defined at + * compile time and may be used for optimization. + */ +static __rte_always_inline void +mlx5_tx_wseg_init(struct mlx5_txq_data *restrict txq, + struct mlx5_txq_local *restrict loc __rte_unused, + struct mlx5_wqe *restrict wqe, + uint64_t ts, + unsigned int olx __rte_unused) +{ + struct mlx5_wqe_wseg *ws; + + ws = RTE_PTR_ADD(wqe, MLX5_WSEG_SIZE); + ws->operation = rte_cpu_to_be_32(MLX5_WAIT_COND_CYCLIC_BIGGER); + ws->lkey = RTE_BE32(0); + ws->va_high = RTE_BE32(0); + ws->va_low = RTE_BE32(0); + if (txq->rt_timestamp) { + ts = ts % (uint64_t)NS_PER_S + | (ts / (uint64_t)NS_PER_S) << 32; + } + ws->value = rte_cpu_to_be_64(ts); + ws->mask = txq->rt_timemask; +} + /** * Build the Ethernet Segment without inlined data. * Supports Software Parser, Checksums and VLAN insertion Tx offload features. @@ -1626,9 +1663,9 @@ mlx5_tx_schedule_send(struct mlx5_txq_data *restrict txq, { if (MLX5_TXOFF_CONFIG(TXPP) && loc->mbuf->ol_flags & txq->ts_mask) { + struct mlx5_dev_ctx_shared *sh; struct mlx5_wqe *wqe; uint64_t ts; - int32_t wci; /* * Estimate the required space quickly and roughly. @@ -1640,13 +1677,32 @@ mlx5_tx_schedule_send(struct mlx5_txq_data *restrict txq, return MLX5_TXCMP_CODE_EXIT; /* Convert the timestamp into completion to wait. */ ts = *RTE_MBUF_DYNFIELD(loc->mbuf, txq->ts_offset, uint64_t *); - wci = mlx5_txpp_convert_tx_ts(txq->sh, ts); - if (unlikely(wci < 0)) - return MLX5_TXCMP_CODE_SINGLE; - /* Build the WAIT WQE with specified completion. */ wqe = txq->wqes + (txq->wqe_ci & txq->wqe_m); - mlx5_tx_cseg_init(txq, loc, wqe, 2, MLX5_OPCODE_WAIT, olx); - mlx5_tx_wseg_init(txq, loc, wqe, wci, olx); + sh = txq->sh; + if (txq->wait_on_time) { + /* The wait on time capability should be used. */ + ts -= sh->txpp.skew; + mlx5_tx_cseg_init(txq, loc, wqe, + 1 + sizeof(struct mlx5_wqe_wseg) / + MLX5_WSEG_SIZE, + MLX5_OPCODE_WAIT | + MLX5_OPC_MOD_WAIT_TIME << 24, olx); + mlx5_tx_wseg_init(txq, loc, wqe, ts, olx); + } else { + /* Legacy cross-channel operation should be used. */ + int32_t wci; + + wci = mlx5_txpp_convert_tx_ts(sh, ts); + if (unlikely(wci < 0)) + return MLX5_TXCMP_CODE_SINGLE; + /* Build the WAIT WQE with specified completion. */ + mlx5_tx_cseg_init(txq, loc, wqe, + 1 + sizeof(struct mlx5_wqe_qseg) / + MLX5_WSEG_SIZE, + MLX5_OPCODE_WAIT | + MLX5_OPC_MOD_WAIT_CQ_PI << 24, olx); + mlx5_tx_qseg_init(txq, loc, wqe, wci, olx); + } ++txq->wqe_ci; --loc->wqe_free; return MLX5_TXCMP_CODE_MULTI;