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 87F8EA0353; Thu, 24 Feb 2022 11:55:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2555841C3B; Thu, 24 Feb 2022 11:55:37 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2085.outbound.protection.outlook.com [40.107.101.85]) by mails.dpdk.org (Postfix) with ESMTP id 408A5426D9 for ; Thu, 24 Feb 2022 11:55:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ISdLl5K2qTxJjX+FDUQs3DB0vRfAPHuHa+oGnyu42yMgZ7Rreq38TVv4UH2QSf6JthtodvVfO1DLwn+9vcP67uYBYGm+2QcRsmQP4DXVOZguUXQ006jWISW7wWCjG0dqqxsBcIwDL9KUcsRh78FEDs4B9NoD96vRFwv0mvCVZnJOE9c2OgtJUdPYwV7oKP9o41b//UOXaeaEhqlf7pcFRCuNH68zlAKQT8ZlROdQN0wJAHV1v3mWjWU61JMeNOF8oyGtm9kpO5beBrioubqHOQ1GFeb34EVjBHT8wKQk5NZDyukuU6Nc8ILYEsKfstgAF1jvUQzRvH4frh8nXPLrAw== 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=We7WHjkUCl70Omybh+IJi73SpLZkwcTt0C0pxkpgf9A=; b=Uji032NEuAXjT9ynbrur5HIeGtdw+DWrycIddB2bSys1+y1RNstwXn1msT293j2d+mJ/K8nL1rN/5ufKADwXy379/47ZBPlMSv+ma+QEFLlsZ25vC90SivmPViISPHJynOZZ4sAiH0e6THvB3/Zh0J+QpI1OBymM3YqdMyIOqmdfGfYm+d7HMkm3mEwBIavV1XYdjboRI30JEVu34QXcy4et39TRpBpfMnVFGUTzpQTH2klIzUzjA5+IvrwdscwjNjJxo+Ia4jUOORHpWqa7U4q3asGd+sokdF6P4/vuNC/ar1MvS4OF4fTqYBz2RtrMWvugscBnMXz3mTYd9dy1Kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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=We7WHjkUCl70Omybh+IJi73SpLZkwcTt0C0pxkpgf9A=; b=YdHupnvDCcy81G8kuhzwT5Wr8ce/2AF0QZv9c/2WpzN6vSfTj9hdqm7+rEpTlEpEeaQqVpmhFyRpszqkL0VNdbpK3e9/iNOe9INDIvdXobiLFFz6tVd86WFt14yuYpOvlP2H7W64G9FRjaAW6L3TWo1ao/1wpRUsHSjymsb8j8B+eEgIlUXhzxSbCFibHAkhSKBW1cbo6U8xcLYjLOdObYjZLx6fEmJwBusH/d/7DTJ33DFIFmQcqiX3f3cOUNaN7vIv8UYXn0kF4yNTGxDncMV7r+TNTxhLpVaNSR2SkMqLj+HB8Vui8JQAcAi8scEgkyL2pDhz+1kIcwD4yGKphA== Received: from DM5PR17CA0053.namprd17.prod.outlook.com (2603:10b6:3:13f::15) by CH2PR12MB5020.namprd12.prod.outlook.com (2603:10b6:610:65::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.24; Thu, 24 Feb 2022 10:55:33 +0000 Received: from DM6NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13f:cafe::b1) by DM5PR17CA0053.outlook.office365.com (2603:10b6:3:13f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.19 via Frontend Transport; Thu, 24 Feb 2022 10:55:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by DM6NAM11FT023.mail.protection.outlook.com (10.13.173.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Thu, 24 Feb 2022 10:55:33 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 10:55:32 +0000 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.986.9; Thu, 24 Feb 2022 02:55:30 -0800 From: Viacheslav Ovsiienko To: CC: , Subject: [PATCH v3 3/3] net/mlx5: add wait on time support in Tx datapath Date: Thu, 24 Feb 2022 12:55:01 +0200 Message-ID: <20220224105501.6549-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20220224105501.6549-1-viacheslavo@nvidia.com> References: <20220214085655.22648-2-viacheslavo@nvidia.com> <20220224105501.6549-1-viacheslavo@nvidia.com> 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-Office365-Filtering-Correlation-Id: 71dc0fa5-ac54-4bbd-f9e8-08d9f7842e51 X-MS-TrafficTypeDiagnostic: CH2PR12MB5020: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: cWmtC73YS547lMXhwUWcGqOv9bGlG0D3x3ejs1ggLu9MrYTO/Z5GLhsHn3prTp2dlHPq/iD0DLQjmlA/wooMRH2MOEaQBdgK4e6cwmAcdOV2bSu0kKUV41FFcjaY9tzK3x85TQtc2GGz3i12aBvWr3OhnOeWV2Wpgtk5sXIkgL7VJON0o0jg7w6FycFcF01Oi+5q2ZFUy6yos3s3EnW3E/fZH9Xw5NTOGCqDZOONFf2m89AnXEXnKmtxo4uL1QZbv7ZHMKBXGqFF18eNRtn1M3RONMID/scrPv/priBPo7mSi3lBCrXZ3LXu1NmfWuhfqy5uFBr8ACFRymKzQXfBqk81QMcv1/VfzRvEbHdX3nzjLR+daExHcUJgwaMZHLyc419w/DlCqAeXgE6R6dyQPNgF+6LmBmKKfsbJiy1DzLENL2w2gdb2e4bfP7hEIVsy7M5eykbh82cZICcsy8pVszSNgrdfILD+d6DEDMPixPT1vMGcaixga7Z4q3FfLwHqCluntL+T33Z729ALJff+Q0ZUD4GfxsqA3zTYQSn/LYDc18VGI6k2/f23CwH6GWPkyZx4jOa/pouJwDLGuTlUbXunFg75kK//d52fQMU2/wJJXj2zCKXMwjC2l5RZwrXF9FkzpKYyB9ZKbaYLtvcT1MfUBT2WNKtOAALAtody91PSz/JAs/Ts1STsbIDEh59oEln6fINq8UoVeZCkdJCfxg== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(5660300002)(8676002)(8936002)(70586007)(316002)(4326008)(36756003)(508600001)(6666004)(7696005)(107886003)(1076003)(70206006)(186003)(16526019)(6286002)(336012)(426003)(2616005)(26005)(47076005)(356005)(83380400001)(55016003)(86362001)(81166007)(36860700001)(82310400004)(54906003)(6916009)(2906002)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 10:55:33.3253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71dc0fa5-ac54-4bbd-f9e8-08d9f7842e51 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.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB5020 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. PMD documentation and release notes updated accordingly. Signed-off-by: Viacheslav Ovsiienko --- doc/guides/nics/mlx5.rst | 5 ++ doc/guides/rel_notes/release_22_03.rst | 6 +++ drivers/net/mlx5/mlx5_tx.h | 72 +++++++++++++++++++++++--- 3 files changed, 75 insertions(+), 8 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 968aac01d2..8956cd1dd8 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -829,6 +829,11 @@ for an additional list of options shared with other mlx5 drivers. By default (if the ``tx_pp`` is not specified) send scheduling on timestamps feature is disabled. + Starting since ConnectX-7 the capability to schedule traffic directly + on timestamp specified in descriptor is provided, no extra objects are + needed anymore and scheduling capability is advertised and handled + regardless tx_pp parameter presence. + - ``tx_skew`` parameter [int] The parameter adjusts the send packet scheduling on timestamps and represents diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst index 74965ebd56..acd56e0a80 100644 --- a/doc/guides/rel_notes/release_22_03.rst +++ b/doc/guides/rel_notes/release_22_03.rst @@ -118,6 +118,12 @@ New Features * Added PPPoL2TPv2oUDP FDIR distribute packets based on inner IP src/dst address and UDP/TCP src/dst port. +* **Updated Mellanox mlx5 driver.** + + Updated the Mellanox mlx5 driver with new features and improvements, including: + + * Support ConnectX-7 capability to schedule traffic sending on timestamp + * **Updated Wangxun ngbe driver.** * Added support for devices of custom PHY interfaces. 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; -- 2.18.1