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 6E2D3A0353; Thu, 24 Feb 2022 11:55:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F359441C26; Thu, 24 Feb 2022 11:55:33 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2069.outbound.protection.outlook.com [40.107.93.69]) by mails.dpdk.org (Postfix) with ESMTP id E313B41C3B for ; Thu, 24 Feb 2022 11:55:32 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N3cLm/drVilL8Ruz6dg7ofPnWQ/S1Rwb4o/hsWf/mJhNuZPPBrFqbg8Brxhu1YItKGp8HcYU3hZJdmQbfm+GJGChw9o5IE1QF8a8+Jjl/zYIwGYCpoYdKMzRBgZBboHKy6QrMSKHAbOhOVT7VmONr1PGsD2gn1QhdVrkYH2CBlRDhDd4SnJlsn+IN8INqcdikVMKJnJSf7mumui3vFfWfN3585aGMy0i+qeHYPypuUt/TLeBMQH2RjWbo9Po28w7FX2AnPGU4BG8yzrzazzoxOFQpK8vMwOgtxr9cH1vfJy2glXKY1mYQeNcnkrAw77vKJUDFI+OffPyizwiD5u5bQ== 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=/YdkB94i2Be63MGTgmP9TSS3lcejIpOsZv7JMTqxiiE=; b=VnnswlXkjGNw8OZi4nElXKeyB1G5u1r78hrOmlEtJftCkVWXcsROFiX90+HVlp7uJuGH1TM2S5Wv5Zyq5Ilh4b67SlWvNEqn6iV+eSzZkviJK2bM3rMfxDcWsXuwScieXECdG18LiMxm1v9MJKANtJLFgUEJ6Dzn2Q9RUX82XLHuLCulWHrCIsRqfNMBjurewWzwUzrbx+ddaTfmAayUxOYMpxGLYMjCP6kDZSoVR4jFGhQ4qv+6WbO3mFQY7PBi8DCtrwEv4TCS/gMTg80LrCuXPm8NuLmRQc7DApa5tYB0m6YGr0YXCET9YO1cWW6m2dhKuLxV9+AX4XcLCzkVQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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=/YdkB94i2Be63MGTgmP9TSS3lcejIpOsZv7JMTqxiiE=; b=iHYqUxkDINFndVOWMrnnNszOXOcUSIyzgeV5F2zHlDJpRRjSnIsjxALsp2xiBc2bmHipWVrqFPzRgJ6ks8WEDNSyOuSlmv2D/ERTDz+xV2gK4+efbWyhWnqyB2CZdJ1lxKquxAUnWQJnkIi9NdRvG+9aIdSQDmFs6dgx81kXllfEJzZpzoDHOZ77x69wlWmezWV2PlbqrSTikiNE0Hj1GdBioV+tJjDGjXxVsLq5/UPMYtqkQigrvH8GWqEfAa2rzXD4m3GnMcka76/ON5OxhiQKM8WTZYQPje0c2rdxgO7idYr2oSwu7P7KoDumqcBVPTEt8Tb5+DbTLDjPhFr0hA== Received: from BN9P220CA0010.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::15) by MN2PR12MB4343.namprd12.prod.outlook.com (2603:10b6:208:26f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Thu, 24 Feb 2022 10:55:31 +0000 Received: from BN8NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13e:cafe::3a) by BN9P220CA0010.outlook.office365.com (2603:10b6:408:13e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21 via Frontend Transport; Thu, 24 Feb 2022 10:55:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT021.mail.protection.outlook.com (10.13.177.114) 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:31 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 10:55:30 +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:28 -0800 From: Viacheslav Ovsiienko To: CC: , Subject: [PATCH v3 2/3] net/mlx5: configure Tx queue with send on time offload Date: Thu, 24 Feb 2022 12:55:00 +0200 Message-ID: <20220224105501.6549-3-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: 87311b75-9320-4ce8-7566-08d9f7842cf9 X-MS-TrafficTypeDiagnostic: MN2PR12MB4343: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: pmDdXVCP2AY/YKnCIdNyBlXlTWyeTEnQ6plbX/6yIBFs3iTojkZOtTY3qN2eu0UvT176kvw2yofA4u8pDXbdMpbE1w3q8rGQHxu3bCnCHWSgjh7wsIKt1GiFAK5p0TlProE6OQ97Vaz/+lxl+4BLNDRDS/cG68RJpfWMplMTwhiUK1L/tSDytHGZJIXPZiIpfspg3T1KTtVSheV3H/C2Qj5AWcU/ZzrO7P+y3vw/wh8qXiTb2sLr75F0oThl1Rs3FyZ83/TTXEOUy0Pu6+wShVy9uSNREoRrpFGI3uWZF23rR7PwBh3h5JVJjGyKIR0zgzGDzz76bvXfWXSd/EhfQ97XwhbIt2eUc0kSUGOx4LUbT/dqsRDTcXePGOihwMBn8Lh3uggwBW1ER5gG0GIYD/4lHwcEG6hl9LVDwOkHFe2nWiCpZ2dm1vdKbE8cLDnwWdANw3LFecdlYcY4wEMPCdftr6qxzcmYR47h94t/KH9xnaAiT/qe472ymmhVKNwsZyqoiMtoTFajTWwvLzpRkRnKL4ZfNUVDj19vbZkQHcEHZMbDDMcgDwJ4L2VLt3+U02HB8cpmTENh/jlpsWW6sLg+2hhuN0o3CGChRdMOVPzALwaVzCUCibqyWD1bOY0MccMOObfrIj6kdUmYDzDsuvODONkiXKRpthydrXSVKOplaLgfoMLpnBkg8HVgpDAXVicxTvS+6ZpAC9dBI64QpQ== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(26005)(55016003)(54906003)(186003)(36860700001)(16526019)(6286002)(5660300002)(316002)(81166007)(356005)(40460700003)(7696005)(6916009)(107886003)(86362001)(1076003)(8936002)(336012)(47076005)(426003)(36756003)(83380400001)(508600001)(6666004)(70206006)(8676002)(70586007)(4326008)(82310400004)(2616005)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2022 10:55:31.0206 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87311b75-9320-4ce8-7566-08d9f7842cf9 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.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4343 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 wait on time configuration flag is copied to the Tx queue structure due to performance considerations. Timestamp mask is preparted and stored in queue structure as well. Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_verbs.c | 4 ++++ drivers/net/mlx5/mlx5.h | 3 +++ drivers/net/mlx5/mlx5_devx.c | 2 ++ drivers/net/mlx5/mlx5_tx.h | 3 +++ drivers/net/mlx5/mlx5_txq.c | 18 ++++++++++++++++-- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c index dfbc5a1e08..b6ba21c216 100644 --- a/drivers/net/mlx5/linux/mlx5_verbs.c +++ b/drivers/net/mlx5/linux/mlx5_verbs.c @@ -1035,6 +1035,10 @@ mlx5_txq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx) txq_data->wqe_pi = 0; txq_data->wqe_comp = 0; txq_data->wqe_thres = txq_data->wqe_s / MLX5_TX_COMP_THRESH_INLINE_DIV; + txq_data->wait_on_time = !!(!priv->sh->config.tx_pp && + priv->sh->cdev->config.hca_attr.wait_on_time && + txq_data->offloads & + RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP); #ifdef HAVE_IBV_FLOW_DV_SUPPORT /* * If using DevX need to query and store TIS transport domain value. diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index e7eaacc76f..0f465d0e9e 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -337,6 +337,9 @@ struct mlx5_lb_ctx { #define MLX5_CNT_ARRAY_IDX(pool, cnt) \ ((int)(((uint8_t *)(cnt) - (uint8_t *)((pool) + 1)) / \ MLX5_CNT_LEN(pool))) +#define MLX5_TS_MASK_SECS 8ull +/* timestamp wrapping in seconds, must be power of 2. */ + /* * The pool index and offset of counter in the pool array makes up the * counter index. In case the counter is from pool 0 and offset 0, it diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c index f18b18b1a2..a9b8c2a1b7 100644 --- a/drivers/net/mlx5/mlx5_devx.c +++ b/drivers/net/mlx5/mlx5_devx.c @@ -1328,6 +1328,8 @@ mlx5_txq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx) txq_data->qp_num_8s = txq_obj->sq_obj.sq->id << 8; txq_data->db_heu = sh->cdev->config.dbnc == MLX5_SQ_DB_HEURISTIC; txq_data->db_nc = sh->tx_uar.dbnc; + txq_data->wait_on_time = !!(!sh->config.tx_pp && + sh->cdev->config.hca_attr.wait_on_time); /* Change Send Queue state to Ready-to-Send. */ ret = mlx5_txq_devx_modify(txq_obj, MLX5_TXQ_MOD_RST2RDY, 0); if (ret) { diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index c4b8271f6f..b50deb8b67 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -138,6 +138,8 @@ struct mlx5_txq_data { uint16_t vlan_en:1; /* VLAN insertion in WQE is supported. */ uint16_t db_nc:1; /* Doorbell mapped to non-cached region. */ uint16_t db_heu:1; /* Doorbell heuristic write barrier. */ + uint16_t rt_timestamp:1; /* Realtime timestamp format. */ + uint16_t wait_on_time:1; /* WQE with timestamp is supported. */ uint16_t fast_free:1; /* mbuf fast free on Tx is enabled. */ uint16_t inlen_send; /* Ordinary send data inline size. */ uint16_t inlen_empw; /* eMPW max packet size to inline. */ @@ -157,6 +159,7 @@ struct mlx5_txq_data { volatile uint32_t *cq_db; /* Completion queue doorbell. */ uint16_t port_id; /* Port ID of device. */ uint16_t idx; /* Queue index. */ + uint64_t rt_timemask; /* Scheduling timestamp mask. */ uint64_t ts_mask; /* Timestamp flag dynamic mask. */ int32_t ts_offset; /* Timestamp field dynamic offset. */ struct mlx5_dev_ctx_shared *sh; /* Shared context. */ diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index edbaa50692..f128c3d1a5 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -109,7 +109,8 @@ mlx5_get_tx_port_offloads(struct rte_eth_dev *dev) RTE_ETH_TX_OFFLOAD_TCP_CKSUM); if (dev_cap->tso) offloads |= RTE_ETH_TX_OFFLOAD_TCP_TSO; - if (priv->sh->config.tx_pp) + if (priv->sh->config.tx_pp || + priv->sh->cdev->config.hca_attr.wait_on_time) offloads |= RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP; if (dev_cap->swp) { if (dev_cap->swp & MLX5_SW_PARSING_CSUM_CAP) @@ -1288,12 +1289,21 @@ mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev) int off, nbit; unsigned int i; uint64_t mask = 0; + uint64_t ts_mask; + if (sh->dev_cap.rt_timestamp || + !sh->cdev->config.hca_attr.dev_freq_khz) + ts_mask = MLX5_TS_MASK_SECS << 32; + else + ts_mask = rte_align64pow2(MLX5_TS_MASK_SECS * 1000ull * + sh->cdev->config.hca_attr.dev_freq_khz); + ts_mask = rte_cpu_to_be_64(ts_mask - 1ull); nbit = rte_mbuf_dynflag_lookup (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL); off = rte_mbuf_dynfield_lookup (RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); - if (nbit >= 0 && off >= 0 && sh->txpp.refcnt) + if (nbit >= 0 && off >= 0 && + (sh->txpp.refcnt || priv->sh->cdev->config.hca_attr.wait_on_time)) mask = 1ULL << nbit; for (i = 0; i != priv->txqs_n; ++i) { data = (*priv->txqs)[i]; @@ -1302,5 +1312,9 @@ mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev) data->sh = sh; data->ts_mask = mask; data->ts_offset = off; + data->rt_timestamp = sh->dev_cap.rt_timestamp; + data->rt_timemask = (data->offloads & + RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP) ? + ts_mask : 0; } } -- 2.18.1