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 349A5A04A6; Thu, 27 Jan 2022 16:41:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73CE4428BA; Thu, 27 Jan 2022 16:40:21 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2054.outbound.protection.outlook.com [40.107.92.54]) by mails.dpdk.org (Postfix) with ESMTP id 359D64067C for ; Thu, 27 Jan 2022 16:40:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RtOtIRKJHtKPzzNp2JhckqazzsTgZi7IFAMLkK+WETwW5mrNRN0SzLet6YSMNz5rL12DE4HNla3sqDcsMfgOkqU0NjfUT8MZXiZute7fEi0msTwDkoWkH8Ha0m7ktBFqi/yKRc4DviqvbKOLIRw2+vAHK/Fxp+XWZiJhpRfr4e431RJUkWvyT/n64ESdac4gnTEzJG3HjKCDz8a9B2IxDPPc5G/nt34OxdchCCvJpBMphgxkUmhNEjrsn25/3sPVoTwPT9ZaUUVBvEqeoXiOSl2UGpfk1VBhU0tbI4A73S6LF0BYFxq80g5DZpXNEWbfz+h/V/rpT4setyhmyWkShw== 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=PFtiVM8X/ByFz8fYQZniYMH1w8A9cPliJBMG/XyXm84=; b=b8+3X+7Fs7X8tTRi324o8L87ietbrT1erpu/QWyglZyyy0t/GP4tH5OA5UtqBia+jnVo9uzkHoKtiCUTaviPSxkwW03hP9pcrux7F1SZX7qGutglgQ80AdVcYJb5EGIKYTX4BKE1gB1vDnGNoJWw18K1t8WZKrTdQBYo/Dl/H9c8zI9TtP7lW2YZq+TTiSun8xq+rd3AsCUW8Bvsd65g130+nFPBPUcYibbpd+GjiCZk9Oh5hRyuwm6pakC0B8uyCZmMfpnhNQIfYDJp8D+ceSQY+E91S8pJI6X4rQCjTPqllhB9lsMF/AH+FsNaNoFREz6iDNRskt1rW9FHzAj+Jg== 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=PFtiVM8X/ByFz8fYQZniYMH1w8A9cPliJBMG/XyXm84=; b=rQEml/KhVB9+2X4kQaOSI6hPTgwhO9h6zUVLslouo9U8cW1zNrL4lJexBzyJEWPb8jxCkDazGsNfw2P6y9ft6Re8gQaJHPnaanm2qW5WSvGEAvPr4L8fIngpuFtvb1L9mwXF5gMWfzPa/yC1xYs6ZAKDzYdw24golC3dSYwPIT7wX8xfO2EkTLTrvXKaxpKQXEFwLzLaDmxj0Jesd71iMHJBtDU9xEAt9kXO+Rtg8zQdmTEAeP1p33faliVzVNhHgJ/U29sYNlNzc6M8rS4ST+Sn1rX3tb41s43QPIRQVqQcmEIuzEde1W1zUktIL/bOnrI+d+mKL1fI4MLZTXflcQ== Received: from BN9PR03CA0229.namprd03.prod.outlook.com (2603:10b6:408:f8::24) by CH0PR12MB5171.namprd12.prod.outlook.com (2603:10b6:610:ba::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Thu, 27 Jan 2022 15:40:18 +0000 Received: from BN8NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f8:cafe::3e) by BN9PR03CA0229.outlook.office365.com (2603:10b6:408:f8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Thu, 27 Jan 2022 15:40:18 +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 BN8NAM11FT064.mail.protection.outlook.com (10.13.176.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4930.15 via Frontend Transport; Thu, 27 Jan 2022 15:40:18 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 27 Jan 2022 15:40:17 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Thu, 27 Jan 2022 07:40:16 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9 via Frontend Transport; Thu, 27 Jan 2022 07:40:15 -0800 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko Subject: [PATCH 11/20] net/mlx5: share realtime timestamp configure Date: Thu, 27 Jan 2022 17:39:41 +0200 Message-ID: <20220127153950.812953-12-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127153950.812953-1-michaelba@nvidia.com> References: <20220127153950.812953-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 193df303-4c9d-4cd3-af4e-08d9e1ab5222 X-MS-TrafficTypeDiagnostic: CH0PR12MB5171:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z6FG+k6awoYhkWBvmiMnAcHkOFz5SMh6GaTZ9sS4Yx2V5IW+rnUaeAylxTxvZUyjZeUnOA5aR0SSEnfXOBJVMru5LgMeOCVssHekmfab5grykqmuy7BQemlr7vM3f2gyokK2czZyZksIlIrzQXaf757S/QgKVn+/0UGJjFAwu/+4GI62THJUesDDa9BtpkKokkhs0U8X7jkTzOerMt7tfbOrCg53T+ekklvXITp06Flt1Qsp0pDA5lcYB0Y9KfC9LkLHEfJJT20M+TG+cZ1A3RkYynKQ3x/ZdLohLuH70v280EFJ/pdtVfl9vhVeqfObivTPL66HRcpxX727/P7pVBEZvvvxxC6Dqp4WhaAAcMTHiJIZAGj8Bm6erEg2HZp2HAaUggA75xgROwJlePvw9dQYFYKiK7zoJDxjIo4SYcykz2xdKUx4BncH6HFwhMbAaz9oHs0C5PXHsnq6KZBKRiD7skbx2c0mU+LubukkMsYmsGhVp7hjDeNjFkHi5zBo3wdNnT/MUfD1xy+AXekGHlrcX/Csx7rIIIP3psIran5iaZLO25bAuNC/vgbLfKvCmU9iG2jNs9xNI2bLHSlZ0w7IeLfIDLazZZz6z7DhN+rqHBYmcqHYnezuBOeGhclAKtim4GssvfRkQifGa5qan4C2T6pcDKCyDUxCOgMQeF+VxiLxmlXmcjcFsIbRm+Qtzbi2+05h0PSZAzT9vpSakw== 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)(36840700001)(46966006)(86362001)(82310400004)(2906002)(508600001)(6666004)(7696005)(47076005)(40460700003)(316002)(54906003)(6916009)(5660300002)(8936002)(107886003)(356005)(81166007)(26005)(8676002)(4326008)(2616005)(36860700001)(6286002)(83380400001)(186003)(55016003)(36756003)(336012)(1076003)(426003)(70586007)(70206006)(36900700001)(20210929001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2022 15:40:18.1423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 193df303-4c9d-4cd3-af4e-08d9e1ab5222 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: BN8NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5171 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 realtime timestamp configure work for Linux as same as Windows. This patch removes it to the function implemented in the folder shared between the operating systems, removing the duplication. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 23 ++----------------- drivers/net/mlx5/mlx5.c | 37 ++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5.h | 3 +++ drivers/net/mlx5/windows/mlx5_os.c | 22 +----------------- 4 files changed, 43 insertions(+), 42 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 2fb91fec06..bb90cc4426 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1516,27 +1516,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, priv->dev_port); } } - if (sh->cdev->config.devx) { - uint32_t reg[MLX5_ST_SZ_DW(register_mtutc)]; - - err = hca_attr->access_register_user ? - mlx5_devx_cmd_register_read - (sh->cdev->ctx, MLX5_REGISTER_ID_MTUTC, 0, - reg, MLX5_ST_SZ_DW(register_mtutc)) : ENOTSUP; - if (!err) { - uint32_t ts_mode; - - /* MTUTC register is read successfully. */ - ts_mode = MLX5_GET(register_mtutc, reg, - time_stamp_mode); - if (ts_mode == MLX5_MTUTC_TIMESTAMP_MODE_REAL_TIME) - config->rt_timestamp = 1; - } else { - /* Kernel does not support register reading. */ - if (hca_attr->dev_freq_khz == (NS_PER_S / MS_PER_S)) - config->rt_timestamp = 1; - } - } + if (sh->cdev->config.devx) + mlx5_rt_timestamp_config(sh, config, hca_attr); /* * If HW has bug working with tunnel packet decapsulation and * scatter FCS, and decapsulation is needed, clear the hw_fcs_strip diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index b371a87355..5146359100 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1129,6 +1129,43 @@ mlx5_setup_tis(struct mlx5_dev_ctx_shared *sh) return 0; } +/** + * Configure realtime timestamp format. + * + * @param sh + * Pointer to mlx5_dev_ctx_shared object. + * @param config + * Device configuration parameters. + * @param hca_attr + * Pointer to DevX HCA capabilities structure. + */ +void +mlx5_rt_timestamp_config(struct mlx5_dev_ctx_shared *sh, + struct mlx5_dev_config *config, + struct mlx5_hca_attr *hca_attr) +{ + uint32_t dw_cnt = MLX5_ST_SZ_DW(register_mtutc); + uint32_t reg[dw_cnt]; + int ret = ENOTSUP; + + if (hca_attr->access_register_user) + ret = mlx5_devx_cmd_register_read(sh->cdev->ctx, + MLX5_REGISTER_ID_MTUTC, 0, + reg, dw_cnt); + if (!ret) { + uint32_t ts_mode; + + /* MTUTC register is read successfully. */ + ts_mode = MLX5_GET(register_mtutc, reg, time_stamp_mode); + if (ts_mode == MLX5_MTUTC_TIMESTAMP_MODE_REAL_TIME) + config->rt_timestamp = 1; + } else { + /* Kernel does not support register reading. */ + if (hca_attr->dev_freq_khz == (NS_PER_S / MS_PER_S)) + config->rt_timestamp = 1; + } +} + /** * Allocate shared device context. If there is multiport device the * master and representors will share this context, if there is single diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 6bc7a34f60..0f90d757e9 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1517,6 +1517,9 @@ void mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh); port_id < RTE_MAX_ETHPORTS; \ port_id = mlx5_eth_find_next(port_id + 1, dev)) int mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs); +void mlx5_rt_timestamp_config(struct mlx5_dev_ctx_shared *sh, + struct mlx5_dev_config *config, + struct mlx5_hca_attr *hca_attr); struct mlx5_dev_ctx_shared * mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn, const struct mlx5_dev_config *config); diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c index 178e58b4d7..a9c7ba2a14 100644 --- a/drivers/net/mlx5/windows/mlx5_os.c +++ b/drivers/net/mlx5/windows/mlx5_os.c @@ -483,27 +483,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, DRV_LOG(DEBUG, "VLAN stripping is %ssupported", (config->hw_vlan_strip ? "" : "not ")); config->hw_fcs_strip = hca_attr->scatter_fcs; - } - if (sh->devx) { - uint32_t reg[MLX5_ST_SZ_DW(register_mtutc)]; - - err = hca_attr->access_register_user ? - mlx5_devx_cmd_register_read - (sh->cdev->ctx, MLX5_REGISTER_ID_MTUTC, 0, - reg, MLX5_ST_SZ_DW(register_mtutc)) : ENOTSUP; - if (!err) { - uint32_t ts_mode; - - /* MTUTC register is read successfully. */ - ts_mode = MLX5_GET(register_mtutc, reg, - time_stamp_mode); - if (ts_mode == MLX5_MTUTC_TIMESTAMP_MODE_REAL_TIME) - config->rt_timestamp = 1; - } else { - /* Kernel does not support register reading. */ - if (hca_attr->dev_freq_khz == (NS_PER_S / MS_PER_S)) - config->rt_timestamp = 1; - } + mlx5_rt_timestamp_config(sh, config, hca_attr); } if (config->mprq.enabled) { DRV_LOG(WARNING, "Multi-Packet RQ isn't supported"); -- 2.25.1