From nobody Wed Apr 1 22:13:32 2026 Received: from BYAPR05CU005.outbound.protection.outlook.com (mail-westusazon11010010.outbound.protection.outlook.com [52.101.85.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B1113C7E05; Wed, 1 Apr 2026 10:25:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.85.10 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775039140; cv=fail; b=hqbcuW39xc7baVqLBnTsAuVnO5m1aaU14ggIFNbrWH9glQg1lTmy1vW+DdMfw3XrnTieChNmvsyWcsPS9UGpOkY36sapTHjS/LjcE1q/Hk0hI3aG0S8hruoSZ3Ep861lUIHgnVefYsB/fbFz1G1/HRxXWO7SYToQRkNIq08NN4k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775039140; c=relaxed/simple; bh=e7pD+SnWNuXw8TK1/Nyy4RHi+xAYZZyQLMDpxLtighU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YYnZzxxCSVaUAPJslrV8GHlHrtHUxebHzCdvWDiWtTSMe6TvIv/tPlB1v3CEbWqjrJ02dD+98vZR+nM/M7vPUZAfxKmJAhiU1UXs7BUyUPMAXaAUowJD6I6AWszAS16+2x9C6SxyuMjeUS7GUWtXqnAx6YJ5beDEPAGQKIRLVM4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=HpDbPYvO; arc=fail smtp.client-ip=52.101.85.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="HpDbPYvO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x3nqFyFmlkpFmFhBJTOUnpdlydeTJa+Q0ClWOGJ8CmNTjFRfSFHEq50PYJ9KUUGxmWGypAqthZiYWWWhiOLgT95tuoSOix9Jjt+u0xb6IiknuqoDfxBphgEAULsWvY20C1c9xq13IyfRfrWAlGgzOa5VfvvLBXIlcy5FDiMRnK2cixpcNxX2Gym2HYQtjNzzrR+IV1gpOS8EvwRzzH3T8a6SiH852Kq3Bjys/Wu55rhhqkLYK9whQKTNMdG9bLjiAoB6szNFBuxz61XgqCkfyzxurLcq7S6zsh6rHmJc460ihqqh4dum6Iatw4iFmvA8wHvlWfrCf33ag7Ng+jZT/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=9MpHdyNS4m4ePci4dHS+YzKF8y689np9zWZJLbAXOF8=; b=eDDmEDrjwzMWnGVjpYxkYwF6ZaDkhtiySiwmuDWKjSt6rp4phmYd78n/Lmj5niu93sqlnnJYCV/h71yt09yu65H3frkcyNeAEp4mKbpakh1sU3zKctR+pFiiznogPaWBMqrn+8y45yxTuRy3aVANQbjrX9c1WSV6TjsOXrvoojaNv4KFrKcNKJnFM1DhF8ZhmQN1YxJvUXtFs9awaomP+Bdvia2XGA11i9Q9cC+EscdVBHvhtMxXvTb4uhmPjH+xBRKMn4mZ9IF5wC7uTWtYi1UYxVP9AMUqlIH6ZSDY8ZtPflV2/+KfxYH/U+f1aRVGUvGV1rRdT88cN2eSuHxakA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ziepe.ca smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9MpHdyNS4m4ePci4dHS+YzKF8y689np9zWZJLbAXOF8=; b=HpDbPYvOIVzhL8zHFwzapcfnXAVAksAirXcqDAj/Y+UdrhW4FwPXUKHhRl+9+ThUy1hPhq/TxbFQyLYpFl7s+kRUt+qdxkOtGI5UhUeteJuMAO2LcO9GGP2q3YEHDDuUREfqA2pSL62p1MiO26GxTY7JeqdTqtHClnb2qFIL5rU= Received: from DS7P220CA0010.NAMP220.PROD.OUTLOOK.COM (2603:10b6:8:1ca::8) by DM3PR12MB9391.namprd12.prod.outlook.com (2603:10b6:0:3d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17; Wed, 1 Apr 2026 10:25:33 +0000 Received: from DS3PEPF000099DD.namprd04.prod.outlook.com (2603:10b6:8:1ca:cafe::1e) by DS7P220CA0010.outlook.office365.com (2603:10b6:8:1ca::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9745.31 via Frontend Transport; Wed, 1 Apr 2026 10:25:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by DS3PEPF000099DD.mail.protection.outlook.com (10.167.17.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17 via Frontend Transport; Wed, 1 Apr 2026 10:25:32 +0000 Received: from satlexmb10.amd.com (10.181.42.219) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 1 Apr 2026 05:25:32 -0500 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb10.amd.com (10.181.42.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 1 Apr 2026 05:25:31 -0500 Received: from xhdipdslab46.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Wed, 1 Apr 2026 05:25:28 -0500 From: Abhijit Gangurde To: , , , , , , , CC: , , , , , Abhijit Gangurde Subject: [PATCH 1/4] net: ionic: register PHC for rdma timestamping Date: Wed, 1 Apr 2026 15:54:58 +0530 Message-ID: <20260401102501.3395305-2-abhijit.gangurde@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260401102501.3395305-1-abhijit.gangurde@amd.com> References: <20260401102501.3395305-1-abhijit.gangurde@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DD:EE_|DM3PR12MB9391:EE_ X-MS-Office365-Filtering-Correlation-Id: b06a32cb-b0ba-4ac4-ef48-08de8fd90181 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700016|376014|82310400026|1800799024|18002099003|56012099003|22082099003; X-Microsoft-Antispam-Message-Info: CZThh2TfTIGkFtsCSpKdrSamQEG7NNoOx9RI1g6GqEffG2FTc7ka3vOlY42Nh1oFHZE7aBSZUqgmn9vDDbwJrSGPAuB1zoy7rA7M9uyZ/5Qnqniu1ZYWb19yiDZ1BF5ogE1pM0jd5FBOiXU0Go3nUHs8T5Fwpod/vIpEbu9jfBHyH7lRxq91h6jOd7oSAZCRo6MfFXQrYVrN4PPSq9w+cF2+TlXFWrnmNd2IgfdIiLEVXE9puuZPXY38tJhyS2C0hWxmyuZ0cEs9x6TePCyYYx4fxM2JPCcL/RfL+86DRWEvFkEgovUe48I+VhKEXlFmjQJNPEwrSaQynYRoRxBQzcsqTVJvhF+LawobCaqQtoqIYHn5GPiFk6sIuo44WgzZEmdot6pb+611uevsEarJiEjMD6FyIvEzmWjgDA2n3GFkG/TVIfuDQRXJb3vkVoLA78BO0KGVwioWn0nA5l01PFiJ3djbApZRsWv4b9HXmGLdu7BkrvDJX8jR8iFVGIUbbGv5xLNwGg69t1Mwm6aUnBh2pWfkJfM8gV8IoPVzNJAajy9n8xSpDs8nLjj7wi3WDX7/ixVZgRWdgKV6XPYgahMaJ5yoGr4bM5S9U8slgQSPo+3q+OBVmM7szupAA/LWl3dh5aexApa90+loZ4ReqOCHVPPizPvnAIn3EG+sF4/RsA/PZMWVZ/1/TUkhO8xwxfAuWiyuNKgrbQ0MQ1RpYvra2MU4ACguWnFH3fn668jYWuf2rwxE2EwQb8nDHy5TXUWk8kuBBKhTOSn2kClmIg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(36860700016)(376014)(82310400026)(1800799024)(18002099003)(56012099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hqMysg/mUGGD5qmqaLDNmDVRVGdgiHt1055B83LiGQn1sCUQ8iW2R4XZ594aH6r7Gq919QdpnbqGhjJdwOeLZwubEO8T+9FCQG6ZzJW48mIMJCmsB4vdPbevRqnQ90FvvURDV0qukU1L6EtwEMIcjKxIh7sLb9Lv4MWLyQy+zhsJAdFZUYlt84Lx+PkuiAc7wEFYU+fKoOU6LIj78Fui70Z+vdJxf7Z+Ts5zvMx/ezWvWMQcGOGCRiQmS8EmTUgyMmQbrfJyCcZ8/IG9KspulSu0+ysb6km75S9BqARilG60Yqgf2QbsXJlY5wfWpNScBpUZwWbvqg6guryIc5n6F4Pb6adSw5ZctUqdNqh4XWOIO3FTAsVarC4Wp9/NgRPivsNyeudS8i53x5h41VJ6j/f/dvgPx8SmxSEAQ/GbB6QHC0UU/STmOH7lP6pYfUpT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2026 10:25:32.8334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b06a32cb-b0ba-4ac4-ef48-08de8fd90181 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DD.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9391 Content-Type: text/plain; charset="utf-8" Currently, the driver only registers the PTP Hardware Clock (PHC) if Ethernet hardware timestamping is supported. Update the registration logic to register the PHC if the device supports either Ethernet hardware timestamping or RDMA completion timestamping. Co-developed-by: Allen Hubbe Signed-off-by: Allen Hubbe Signed-off-by: Abhijit Gangurde --- .../net/ethernet/pensando/ionic/ionic_if.h | 1 + .../net/ethernet/pensando/ionic/ionic_lif.c | 5 ++++- .../net/ethernet/pensando/ionic/ionic_phc.c | 20 ++++++++++++------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_if.h b/drivers/net/e= thernet/pensando/ionic/ionic_if.h index 47559c909c8b..3c34d5913729 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_if.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_if.h @@ -1179,6 +1179,7 @@ enum ionic_eth_hw_features { IONIC_ETH_HW_TX_CSUM_GENEVE =3D BIT(18), IONIC_ETH_HW_TSO_GENEVE =3D BIT(19), IONIC_ETH_HW_TIMESTAMP =3D BIT(20), + IONIC_ETH_HW_RDMA_TIMESTAMP =3D BIT(21), }; =20 /** diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/= ethernet/pensando/ionic/ionic_lif.c index 637e635bbf03..9d86f795f5f6 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1498,7 +1498,8 @@ static int ionic_set_nic_features(struct ionic_lif *l= if, ctx.cmd.lif_setattr.features =3D ionic_netdev_features_to_nic(features); =20 if (lif->phc) - ctx.cmd.lif_setattr.features |=3D cpu_to_le64(IONIC_ETH_HW_TIMESTAMP); + ctx.cmd.lif_setattr.features |=3D lif->ionic->ident.lif.eth.config.featu= res & + cpu_to_le64(IONIC_ETH_HW_TIMESTAMP | IONIC_ETH_HW_RDMA_TIMESTAMP); =20 err =3D ionic_adminq_post_wait(lif, &ctx); if (err) @@ -1549,6 +1550,8 @@ static int ionic_set_nic_features(struct ionic_lif *l= if, dev_dbg(dev, "feature ETH_HW_TSO_UDP_CSUM\n"); if (lif->hw_features & IONIC_ETH_HW_TIMESTAMP) dev_dbg(dev, "feature ETH_HW_TIMESTAMP\n"); + if (lif->hw_features & IONIC_ETH_HW_RDMA_TIMESTAMP) + dev_dbg(dev, "feature ETH_HW_RDMA_TIMESTAMP\n"); =20 return 0; } diff --git a/drivers/net/ethernet/pensando/ionic/ionic_phc.c b/drivers/net/= ethernet/pensando/ionic/ionic_phc.c index 05b44fc482f8..116408099974 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_phc.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_phc.c @@ -77,7 +77,8 @@ static int ionic_lif_hwstamp_set_ts_config(struct ionic_l= if *lif, bool rx_all; __le64 mask; =20 - if (!lif->phc || !lif->phc->ptp) + if (!lif->phc || !lif->phc->ptp || + !(lif->hw_features & IONIC_ETH_HW_TIMESTAMP)) return -EOPNOTSUPP; =20 mutex_lock(&lif->phc->config_lock); @@ -210,7 +211,8 @@ int ionic_hwstamp_set(struct net_device *netdev, struct ionic_lif *lif =3D netdev_priv(netdev); int err; =20 - if (!lif->phc || !lif->phc->ptp) + if (!lif->phc || !lif->phc->ptp || + !(lif->hw_features & IONIC_ETH_HW_TIMESTAMP)) return -EOPNOTSUPP; =20 mutex_lock(&lif->queue_lock); @@ -228,7 +230,8 @@ void ionic_lif_hwstamp_replay(struct ionic_lif *lif) { int err; =20 - if (!lif->phc || !lif->phc->ptp) + if (!lif->phc || !lif->phc->ptp || + !(lif->hw_features & IONIC_ETH_HW_TIMESTAMP)) return; =20 mutex_lock(&lif->queue_lock); @@ -242,7 +245,8 @@ void ionic_lif_hwstamp_recreate_queues(struct ionic_lif= *lif) { int err; =20 - if (!lif->phc || !lif->phc->ptp) + if (!lif->phc || !lif->phc->ptp || + !(lif->hw_features & IONIC_ETH_HW_TIMESTAMP)) return; =20 mutex_lock(&lif->phc->config_lock); @@ -267,7 +271,8 @@ int ionic_hwstamp_get(struct net_device *netdev, { struct ionic_lif *lif =3D netdev_priv(netdev); =20 - if (!lif->phc || !lif->phc->ptp) + if (!lif->phc || !lif->phc->ptp || + !(lif->hw_features & IONIC_ETH_HW_TIMESTAMP)) return -EOPNOTSUPP; =20 mutex_lock(&lif->phc->config_lock); @@ -506,7 +511,8 @@ static const struct ptp_clock_info ionic_ptp_info =3D { =20 void ionic_lif_register_phc(struct ionic_lif *lif) { - if (!lif->phc || !(lif->hw_features & IONIC_ETH_HW_TIMESTAMP)) + if (!lif->phc || + !(lif->hw_features & (IONIC_ETH_HW_TIMESTAMP | IONIC_ETH_HW_RDMA_TIME= STAMP))) return; =20 lif->phc->ptp =3D ptp_clock_register(&lif->phc->ptp_info, lif->ionic->dev= ); @@ -545,7 +551,7 @@ void ionic_lif_alloc_phc(struct ionic_lif *lif) return; =20 features =3D le64_to_cpu(ionic->ident.lif.eth.config.features); - if (!(features & IONIC_ETH_HW_TIMESTAMP)) + if (!(features & (IONIC_ETH_HW_TIMESTAMP | IONIC_ETH_HW_RDMA_TIMESTAMP))) return; =20 phc =3D devm_kzalloc(ionic->dev, sizeof(*phc), GFP_KERNEL); --=20 2.43.0 From nobody Wed Apr 1 22:13:32 2026 Received: from SJ2PR03CU001.outbound.protection.outlook.com (mail-westusazon11012002.outbound.protection.outlook.com [52.101.43.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A4783EE1E2; Wed, 1 Apr 2026 10:25:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.43.2 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775039147; cv=fail; b=PMg7yFUDcat5Jc6U4Cj6PdTYsYhX9v/FftvpKTPMgPpjRZTR5zKgvDqVi72lg8euexIL/wiySMDjTOrhjLcFggxxxs4tIYi4pzDUD8D09RHupqEeX1Ibg3pJdfCIe6ifw2aXOWjvnZK8AjmmwOnytuLuH3O/lP82tSzPYwckuF0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775039147; c=relaxed/simple; bh=YYyOgpcRS58FD/UYY9qiuLmvXHhIAtcVI/a5Q3FNmFU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=owQCyAyyb2uE1er1ZJQJA0eyb6BPuKUyrXKgv1vu8N/Kco4MYFgoS5Uj74qMhazRhhr/oW26KOaOUhzrQLvmeEYtWZQR8k6Ig38qmmLSslDeyH2fzjEGfRQaYLcGqEdOUdyEjwKLSlzEFJP8a/OeC+ndjxAh5G89kr/BbC/LO40= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=0cOYwnwx; arc=fail smtp.client-ip=52.101.43.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="0cOYwnwx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AP87p7NQtUPJRuSm2iOV5InA9pDUwtR2zAg/Zcs9ztY8aqXdkXJQxd48o5rrBlD92Xt45cxloNl/Wzg6ivkbTpsCNPwAgj9YferX+BNFgVPaIuscMsLpMe/e+P4ozVJ22FEbF/hZfUjoqy/YyQ50KyRJCrhS5A40T17PB1Dvy2YzRNSleinzC9LelO2TGHm8FJ1NPlwtr/jh2bVIarzAkzqc8aMciOHeI3NlA+pZIq/9buFyi58h7ewzodaEJsjrJA2cB+UsDwnoOkwggWwBGhit+ERbAmjc05fpluJ92ZkQuf4i83zMVyPYkcOIQOETVarnvovOz8tUXLXsUKqRLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Gy3V8rzyVeA8OITbCUlZZhMBl0ptJhSAjx/DArG8XP8=; b=kWFAnAtGwxlINb/Xzjr84jPWx9HJxrTaiNQ+DjM+orjRaqSc8jBNmLVJZnya+dACbh3JY5mEH5ONvhffpXbwwCvGSCqaoSCoeqZuDo03n54YwSdqGL6GQQOjXhfxn46jgGj+YP++7lL6FtrtrSLmRl6fssljKQqMuFqLBcSU+j/KH8l2V50Y55aXrA9KeW2mD40EYgx35Gp9H3X+m5A3FbkDCmj9N7DsIzH6bja8PAzq1HZ//z2E90sAdGDTLpIGq7xwqyMvwqwcWzqyhTP8h5gAe59ylDgSYWTSnEEJ2zKwasa30KqyYY+ajRwxN9zAlMiFCzJ0FYomVCUD3b6c5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ziepe.ca smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Gy3V8rzyVeA8OITbCUlZZhMBl0ptJhSAjx/DArG8XP8=; b=0cOYwnwxhNtpon+GjI/rF6s0JuDdbyaUnqk2gO9ivqZkGL+OiuxsjiHHaxAyEgSPCrmNndan7LJFOTuXkvSa8s0Cc93lYgVrkd47A/Pz738MzTyzXrcK88L7DONsvWpCKnDaQrw6gDjJbue+iGOkbZMno5bKx9eu9Q084B0STr4= Received: from MN2PR04CA0015.namprd04.prod.outlook.com (2603:10b6:208:d4::28) by SA1PR12MB5657.namprd12.prod.outlook.com (2603:10b6:806:234::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.15; Wed, 1 Apr 2026 10:25:40 +0000 Received: from BN3PEPF0000B077.namprd04.prod.outlook.com (2603:10b6:208:d4:cafe::1d) by MN2PR04CA0015.outlook.office365.com (2603:10b6:208:d4::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9745.29 via Frontend Transport; Wed, 1 Apr 2026 10:25:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BN3PEPF0000B077.mail.protection.outlook.com (10.167.243.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17 via Frontend Transport; Wed, 1 Apr 2026 10:25:39 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 1 Apr 2026 05:25:39 -0500 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 1 Apr 2026 03:25:39 -0700 Received: from xhdipdslab46.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Wed, 1 Apr 2026 05:25:35 -0500 From: Abhijit Gangurde To: , , , , , , , CC: , , , , , Abhijit Gangurde Subject: [PATCH 2/4] net: ionic: Add PHC state page for user space access Date: Wed, 1 Apr 2026 15:54:59 +0530 Message-ID: <20260401102501.3395305-3-abhijit.gangurde@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260401102501.3395305-1-abhijit.gangurde@amd.com> References: <20260401102501.3395305-1-abhijit.gangurde@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B077:EE_|SA1PR12MB5657:EE_ X-MS-Office365-Filtering-Correlation-Id: 847d26a7-6932-4339-0a78-08de8fd9059e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700016|7416014|56012099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: scrUdlenFQu5bKzolaaJwOD3246XMXbwWq6FdfusRqVQlia0ldNJdu+F05lxpwtwWxImSid409V5os7z3MIb7f1IKAtWIX920t7do9vKgcI9dFVMSJmjKub9n34pMZ+ZmRirzb+/KI1Gg4fN6q3iQzbEHsN7/+IPvVV81KTo2YOO0v4GkMU8Uj09fJEDh+zMRGfBalhbxyukGaez2LV8UaEYmcAqwh/Ghz/fXUymf2uak/lnv27zC5XQlAmzK/nAJ2KvP5x0g3q8L4ztPl2XXK+oBolqvFyoc+oH/1/pcejORQ2zDZYGArttk+adaHMGCbrRanDFm1CWQs6SKIjawBXKE/FTDUi9CL9IOxt0NQhbrohKOXs9Ul6gmVxgaRXO9sDPM0Si1Xu/vm7Vt+p+/IxICnHBCJA2sgd94FpRUfoCvQBVHy9fT+nlu9s0x2Km29jghWarQCOv+XP6EWq4EO+QtW6KXeFj3OtOdEEzlzM6oK5YLpaV3aB7qC53YLq1kAug1P4lBfaSSanVZAHBfrPOwSxi9YrLxPrKycOP/JoIAG96ZAwpqQ4OE/Uz8rTFIirq97vgE4a4ZMZt8XTCIltkWC5jPVdZ8rmngkiaefDFQrMyuyfWk6uEumsBZfG7genhIJ8iWoLcz1ejqm0N6M0YZa8cwjFJrmaDowBMMmXLAcewDlXdJ6bcP35wlpIQa/qfVNsZCmo5ZqzmginnMgiVnCgf5sfWxw6oroGlMyOoNMoUJ6gsbqCnQRp7i4Ul6Sn3pm5HN5Nqazv6lXsymw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700016)(7416014)(56012099003)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ePwb3+rrZCHhsbfGWOh2To5LB/utBM5rGZqZlmadAkF8Zy4p9G7whQHiMTSpDI11rOC4A/vU8hJfXqLqsRgEb0zSZHrYicxKZTgX9ZQEPLW+TmI/PDVBoEgUeiopIF4KU/YbXKVXz5xkHBRhD7e0bc9FHTeB1EoSMW+fI3pNDf/JDKDd+jApNGYKbRgprNJIQGORJ0zQMAp3kV93gVm6gtWzlbN67kQt6GFQg/fQSkuDlU4r/uZv8yKtLQjuKR+RGMbuR9PySDnUq5i+HseSJgZSlqrmIaSE0YkZRi+1z8MqipmhuDLlaMv3/9gyVV44Pb5YGBNIXoraEfFXi8i0Iz6/7dAsHi88Y6O9eM0TWGqB6XpZdXbFul5ShUpc7LqeUzPfqphjtI3ddGIXQi2UAy9zObzvgRKl5KMMdO0Ts0dCaV6uMVC43EUY9S2VWALg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2026 10:25:39.7685 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 847d26a7-6932-4339-0a78-08de8fd9059e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B077.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5657 Content-Type: text/plain; charset="utf-8" Add a page associated with the PHC that can be mapped to user space, allowing applications to access hardware timestamp information. In order to synchronize between kernel and user space, a sequence number is incremented at the beginning and end of each update. An odd number means the data is being updated while an even number means the update is complete. To guarantee that the data structure was accessed atomically, user space will: repeat: seq1 =3D goto if odd seq2 =3D if seq1 !=3D seq2 goto repeat This mechanism acts as a guard against reading invalid state during concurrent updates. Co-developed-by: Allen Hubbe Signed-off-by: Allen Hubbe Signed-off-by: Abhijit Gangurde --- .../net/ethernet/pensando/ionic/ionic_lif.h | 3 +- .../net/ethernet/pensando/ionic/ionic_phc.c | 41 +++++++++++++++++++ include/uapi/rdma/ionic-abi.h | 11 +++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/= ethernet/pensando/ionic/ionic_lif.h index 8e10f66dc50e..0b820af2b523 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -249,7 +249,7 @@ struct ionic_lif { }; =20 struct ionic_phc { - spinlock_t lock; /* lock for cc and tc */ + spinlock_t lock; /* lock for state_page, cc and tc */ struct cyclecounter cc; struct timecounter tc; =20 @@ -262,6 +262,7 @@ struct ionic_phc { long aux_work_delay; =20 struct ptp_clock_info ptp_info; + struct ionic_phc_state *state_page; struct ptp_clock *ptp; struct ionic_lif *lif; }; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_phc.c b/drivers/net/= ethernet/pensando/ionic/ionic_phc.c index 116408099974..61eaf3834608 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_phc.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_phc.c @@ -3,6 +3,7 @@ =20 #include #include +#include =20 #include "ionic.h" #include "ionic_bus.h" @@ -334,6 +335,26 @@ static int ionic_setphc_cmd(struct ionic_phc *phc, str= uct ionic_admin_ctx *ctx) return ionic_adminq_post(phc->lif, ctx); } =20 +static void ionic_phc_state_page_update(struct ionic_phc *phc) +{ + struct ionic_phc_state *state =3D phc->state_page; + u32 seq; + + /* read current seq */ + seq =3D smp_load_acquire(&state->seq) & ~1; + + /* make seq odd for updating */ + smp_store_mb(state->seq, seq | 1); + + state->tick =3D phc->tc.cycle_last; + state->nsec =3D phc->tc.nsec; + state->frac =3D phc->tc.frac; + state->mult =3D phc->cc.mult; + + /* make seq the next even number for update completed */ + smp_store_release(&state->seq, seq + 2); +} + static int ionic_phc_adjfine(struct ptp_clock_info *info, long scaled_ppm) { struct ionic_phc *phc =3D container_of(info, struct ionic_phc, ptp_info); @@ -361,6 +382,8 @@ static int ionic_phc_adjfine(struct ptp_clock_info *inf= o, long scaled_ppm) timecounter_read(&phc->tc); phc->cc.mult =3D adj; =20 + ionic_phc_state_page_update(phc); + /* Setphc commands are posted in-order, sequenced by phc->lock. We * need to drop the lock before waiting for the command to complete. */ @@ -386,6 +409,8 @@ static int ionic_phc_adjtime(struct ptp_clock_info *inf= o, s64 delta) =20 timecounter_adjtime(&phc->tc, delta); =20 + ionic_phc_state_page_update(phc); + /* Setphc commands are posted in-order, sequenced by phc->lock. We * need to drop the lock before waiting for the command to complete. */ @@ -415,6 +440,8 @@ static int ionic_phc_settime64(struct ptp_clock_info *i= nfo, =20 timecounter_init(&phc->tc, &phc->cc, ns); =20 + ionic_phc_state_page_update(phc); + /* Setphc commands are posted in-order, sequenced by phc->lock. We * need to drop the lock before waiting for the command to complete. */ @@ -472,6 +499,8 @@ static long ionic_phc_aux_work(struct ptp_clock_info *i= nfo) /* update point-in-time basis to now */ timecounter_read(&phc->tc); =20 + ionic_phc_state_page_update(phc); + /* Setphc commands are posted in-order, sequenced by phc->lock. We * need to drop the lock before waiting for the command to complete. */ @@ -558,6 +587,12 @@ void ionic_lif_alloc_phc(struct ionic_lif *lif) if (!phc) return; =20 + phc->state_page =3D (void *)get_zeroed_page(GFP_KERNEL); + if (!phc->state_page) { + devm_kfree(ionic->dev, phc); + return; + } + phc->lif =3D lif; =20 phc->cc.read =3D ionic_cc_read; @@ -569,6 +604,7 @@ void ionic_lif_alloc_phc(struct ionic_lif *lif) dev_err(lif->ionic->dev, "Invalid device PHC mask multiplier %u, disabling HW timestamp support\= n", phc->cc.mult); + free_page((unsigned long)phc->state_page); devm_kfree(lif->ionic->dev, phc); lif->phc =3D NULL; return; @@ -652,6 +688,10 @@ void ionic_lif_alloc_phc(struct ionic_lif *lif) */ phc->ptp_info.max_adj =3D NORMAL_PPB; =20 + phc->state_page->mask =3D phc->cc.mask; + phc->state_page->shift =3D phc->cc.shift; + ionic_phc_state_page_update(phc); + lif->phc =3D phc; } =20 @@ -662,6 +702,7 @@ void ionic_lif_free_phc(struct ionic_lif *lif) =20 mutex_destroy(&lif->phc->config_lock); =20 + free_page((unsigned long)lif->phc->state_page); devm_kfree(lif->ionic->dev, lif->phc); lif->phc =3D NULL; } diff --git a/include/uapi/rdma/ionic-abi.h b/include/uapi/rdma/ionic-abi.h index 7b589d3e9728..97f695510380 100644 --- a/include/uapi/rdma/ionic-abi.h +++ b/include/uapi/rdma/ionic-abi.h @@ -112,4 +112,15 @@ struct ionic_srq_resp { __aligned_u64 rq_cmb_offset; }; =20 +struct ionic_phc_state { + __u32 seq; + __u32 rsvd; + __aligned_u64 mask; + __aligned_u64 tick; + __aligned_u64 nsec; + __aligned_u64 frac; + __u32 mult; + __u32 shift; +}; + #endif /* IONIC_ABI_H */ --=20 2.43.0 From nobody Wed Apr 1 22:13:32 2026 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11013050.outbound.protection.outlook.com [40.93.201.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5F1C3EF0BF; Wed, 1 Apr 2026 10:25:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.201.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775039151; cv=fail; b=KijUjmMw80EWB7UpV8K9Kylm4BTHJjPaDpNMKwzIZzMxSdUKb2MGz1Z78HHHgdmiaRAJS1Dk96ctVhCG4hpojsxpUYTzGOsLukU97U2kvIOwcKD3LH0I3eE4dQ1YfqMXutFV9PE+bhsGIoc2sB1tUSBhWlI08lJxsZ4gFBS7OWc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775039151; c=relaxed/simple; bh=YM593Yj0/u+q8pFCAOh84dZA/nnCwup6Ez+9Hv2Jgbo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kghfj8ka5Bx574QruQKiUOCrQMhiA3Fr1at/V7iR2veyFOl27U3sxXZzjbMBv/aQ+uJhptXeWZbJ72qOfXdJotDVNlHfJ+eNBjz3IPXJUYXFFtoM9yKdq0h6VP1jnZL4wcJdRehj8ulMeGVTksPH4TF87U4G1ybYdGmpryV2OXI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=NlCH7LfL; arc=fail smtp.client-ip=40.93.201.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="NlCH7LfL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GT4oWocvRRzVAVfKmt9gDvDFjpUHmAzWWNi27EJwIRRXdt9QZbyoVVKP70Y0Y3bZ0J0vNObCS+uySd7KAjKTpnkNRbFVQAS2XWYoNJxQ2T5Rg93SnG6cmTp05ffvH87EjVdEI0Om8vB3zLjtizDYZbLRtBpQ0bxjBuw29V+OeqcgVG4OjCYNy8gc6Vpgrpe9qRNFMBTONttaPtlIh2FhQFiaE6J+vVo/yqLZpvHc5wD0QOamOwiWCLKDYsTGv4PPayqLtQS8J/bpApHXbzZn77iQ19waRCyLAWoD/geZKg9p/WWU4xXY0QP9xlxg6uU09hJ9BtFf5FOKEZ1MjttK6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=dtgvuNnxX8uBnrE8lndR6+yAHZgPnS5EJ88/sKA0P/o=; b=mMQalNh0jfgk0U8GXMUgU6rTBl9n1s3EIeCyIlYwsJC5hSWh3csfkSXljJ/97Lp9YQiOjXQ1aT9qLUoPv7LJI9U2/aqgMm1gkavnT2ReHr0Iiby9S2hcXjFLr9YahnMuD3ZM2Aq2UeLuftaTJ2rvnFqU0pzgTUz+KNMWYsmWtZAUBYxtbgsl3k69jqDRxNu6QikKUrHD3q8HKGMdaNFi/VkHzLqnBauWJixaPB2jsEwohwRicoLbPA4qjnpNohnsfmxc3dsPUmXrWo+4rnkkCpOi6tCR6lcvV9AsYDOKnzslu4W2gg+BzuXrFq3Xkx6PIntziTBygnfIlXrQDYa0Ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ziepe.ca smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dtgvuNnxX8uBnrE8lndR6+yAHZgPnS5EJ88/sKA0P/o=; b=NlCH7LfLdFdtUIPSOld9aKY/OQ9pd3gidDq/3878Y25aqdA787E7mf8u6qzKhp4E3qtka7J62CWBb6vzow9PlWVfW49IjwDUTNqHsRqMGuPM6PMVDOces0a+1l/874IZ1aQSk34+V0oTZin7Xm9Bzc/Sc0v19r/dUWuSHD1wIrM= Received: from MN2PR04CA0006.namprd04.prod.outlook.com (2603:10b6:208:d4::19) by DS0PR12MB6631.namprd12.prod.outlook.com (2603:10b6:8:d1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17; Wed, 1 Apr 2026 10:25:45 +0000 Received: from BN3PEPF0000B077.namprd04.prod.outlook.com (2603:10b6:208:d4:cafe::d2) by MN2PR04CA0006.outlook.office365.com (2603:10b6:208:d4::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9745.30 via Frontend Transport; Wed, 1 Apr 2026 10:25:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BN3PEPF0000B077.mail.protection.outlook.com (10.167.243.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17 via Frontend Transport; Wed, 1 Apr 2026 10:25:45 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Wed, 1 Apr 2026 05:25:44 -0500 Received: from satlexmb07.amd.com (10.181.42.216) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 1 Apr 2026 05:25:44 -0500 Received: from xhdipdslab46.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Wed, 1 Apr 2026 05:25:40 -0500 From: Abhijit Gangurde To: , , , , , , , CC: , , , , , Abhijit Gangurde Subject: [PATCH 3/4] RDMA/ionic: map PHC state into user space Date: Wed, 1 Apr 2026 15:55:00 +0530 Message-ID: <20260401102501.3395305-4-abhijit.gangurde@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260401102501.3395305-1-abhijit.gangurde@amd.com> References: <20260401102501.3395305-1-abhijit.gangurde@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: abhijit.gangurde@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B077:EE_|DS0PR12MB6631:EE_ X-MS-Office365-Filtering-Correlation-Id: ec84f319-9265-4563-46f5-08de8fd908ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700016|7416014|376014|22082099003|56012099003|18002099003; X-Microsoft-Antispam-Message-Info: pjpx/WyUYvecQcUs4/Q6qRmkYFL9iNQ2jd3tk9YPffKOXiYjQtIg+lx6SDABaRb9rzlQo8qguCWgQciE86QbzrvIUR5bFLCqJlqb7RQYCW4mvNe5G33sSB81xS7XsrfUFEZCzjdtbXOQJRgKeJyhdoy5/0YthQeBUDHPxovCB/7qBBTnooAN2zvkpc0pYyvFfqvKKMgd1Qh8k0VTPEkXJIJZAUbbevcdAzbPRz8Doo/G8oIhjQ6VoJ98YlSGyMTSEb72zWrxqqzhuTEVS2wfFKyUItSQs4aQYtqavougJc57kDe1MoJoq4TEQvAdBE864UoSMmzs8W3WqGXRimLLq+orABrgTToMDpYdL51nuWCgmqim+/ZbfxSxTGS1auwcLDN1GtFkrpKzFX35H+5LoZw0Fdzl/amdA17TNcFcakNBDjFNZU5n+iyqq5LyfrgO84YNK6hO7WvQA5J++IWMs7xUvEkwIUe/d5cLSpnv3NU8TlrLx9fEBmZnJJNbRLMLNYnxQCnhRHEZgs6m/pBZxS3GMUgZHjeghSX87Pi48+eN+v9jlfBBcYjw1iBs8nHuZS4POZKfI//8vgqDGaOvgvlSDSAMIbMcoGFG6uGgF33YwRdaDRAC7ppoDR3oxDrO0RwPf6gkk+cJWmXHm3KkHuK5MO/XgUqAhGyVWIF4m4nADxgbfLt+1YSM/1Qz+0PBJvms3h2aknwiE7i75JxkCZmU124kFm0xkd6+o4T4Mj3Kmx3t+gnGELRLvWvcEVSo6yCqq7PwCl27/kE9JGORiA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700016)(7416014)(376014)(22082099003)(56012099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8t5S1SxCtS3oT/lzkteX+42o5u3FPO8EV3VWgydrqUHprNFZNbXOKN7lUIzQTaWdkvVjD03iVy3rz1/eBumSknGu3ylgbofpwpe6TCitw12N2Km8f4wss+Z7ZsmNmEAaEYfHMIJUzP9BlzFnKZ2SYf82jz/a2GYhj/uh210RkVNe5NVcMd2apkLfqwql0TEoDN/28VyxphD0/7Sbjpn/MTyw0UVv68zIa+t5C+PA+a9Tw5vzm7CAkoYz46Icii/aa5ZdbZbUJ+WVnaU2jV00xhnLmNV1kecA/Oacoshw50TfAg3mjS2qO4aDgYnC1k1iKIC22JdtEObZU5+DqKrZ6mM95ddZnWxTbFvfQXxd8WwxLxN2ztw9tRv/I2YzrIy60pDAA7lxz2xlL4ptcKA8kQYaxQGHdUdm/uAkEy9b96k6QZS1PNEwfVNZZj3/xegW X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2026 10:25:45.3042 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec84f319-9265-4563-46f5-08de8fd908ea X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B077.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6631 Content-Type: text/plain; charset="utf-8" Enable user space applications to access the PHC state page when firmware RDMA completion timestamp is supported. This mapping allows user space to convert RDMA completion timestamps to system wall time without kernel transitions, minimizing latency overhead. Applications can directly read the PHC state through mmap, enabling efficient timestamp correlation for precision timing applications. Co-developed-by: Allen Hubbe Signed-off-by: Allen Hubbe Signed-off-by: Abhijit Gangurde --- .../infiniband/hw/ionic/ionic_controlpath.c | 36 ++++++++++++++++++- drivers/infiniband/hw/ionic/ionic_ibdev.h | 2 ++ drivers/infiniband/hw/ionic/ionic_lif_cfg.c | 2 ++ drivers/infiniband/hw/ionic/ionic_lif_cfg.h | 1 + include/uapi/rdma/ionic-abi.h | 1 + 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infi= niband/hw/ionic/ionic_controlpath.c index a5671da3db64..5a0b189f9855 100644 --- a/drivers/infiniband/hw/ionic/ionic_controlpath.c +++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c @@ -391,6 +391,16 @@ int ionic_alloc_ucontext(struct ib_ucontext *ibctx, st= ruct ib_udata *udata) goto err_mmap_dbell; } =20 + if (dev->lif_cfg.phc_state) { + ctx->mmap_phc =3D ionic_mmap_entry_insert(ctx, PAGE_SIZE, 0, + IONIC_MMAP_PHC, + &resp.phc_offset); + if (!ctx->mmap_phc) { + rc =3D -ENOMEM; + goto err_mmap_phc; + } + } + resp.page_shift =3D PAGE_SHIFT; =20 resp.dbell_offset =3D db_phys & ~PAGE_MASK; @@ -414,13 +424,15 @@ int ionic_alloc_ucontext(struct ib_ucontext *ibctx, s= truct ib_udata *udata) if (dev->lif_cfg.rq_expdb) resp.expdb_qtypes |=3D IONIC_EXPDB_RQ; =20 - rc =3D ib_copy_to_udata(udata, &resp, sizeof(resp)); + rc =3D ib_respond_udata(udata, resp); if (rc) goto err_resp; =20 return 0; =20 err_resp: + rdma_user_mmap_entry_remove(ctx->mmap_phc); +err_mmap_phc: rdma_user_mmap_entry_remove(ctx->mmap_dbell); err_mmap_dbell: ionic_put_dbid(dev, ctx->dbid); @@ -433,10 +445,26 @@ void ionic_dealloc_ucontext(struct ib_ucontext *ibctx) struct ionic_ibdev *dev =3D to_ionic_ibdev(ibctx->device); struct ionic_ctx *ctx =3D to_ionic_ctx(ibctx); =20 + rdma_user_mmap_entry_remove(ctx->mmap_phc); rdma_user_mmap_entry_remove(ctx->mmap_dbell); ionic_put_dbid(dev, ctx->dbid); } =20 +static int ionic_mmap_phc_stage(struct ionic_ibdev *dev, + struct vm_area_struct *vma) +{ + if (!(vma->vm_flags & VM_SHARED)) + return -EINVAL; + + if (vma->vm_flags & (VM_WRITE | VM_EXEC)) + return -EPERM; + + vm_flags_clear(vma, VM_MAYWRITE); + + return vm_insert_page(vma, vma->vm_start, + virt_to_page(dev->lif_cfg.phc_state)); +} + int ionic_mmap(struct ib_ucontext *ibctx, struct vm_area_struct *vma) { struct ionic_ibdev *dev =3D to_ionic_ibdev(ibctx->device); @@ -455,6 +483,12 @@ int ionic_mmap(struct ib_ucontext *ibctx, struct vm_ar= ea_struct *vma) ionic_entry =3D container_of(rdma_entry, struct ionic_mmap_entry, rdma_entry); =20 + if (ionic_entry->mmap_flags & IONIC_MMAP_PHC) { + rc =3D ionic_mmap_phc_stage(dev, vma); + rdma_user_mmap_entry_put(rdma_entry); + return rc; + } + ibdev_dbg(&dev->ibdev, "writecombine? %d\n", ionic_entry->mmap_flags & IONIC_MMAP_WC); if (ionic_entry->mmap_flags & IONIC_MMAP_WC) diff --git a/drivers/infiniband/hw/ionic/ionic_ibdev.h b/drivers/infiniband= /hw/ionic/ionic_ibdev.h index 63828240d659..08655c4d8297 100644 --- a/drivers/infiniband/hw/ionic/ionic_ibdev.h +++ b/drivers/infiniband/hw/ionic/ionic_ibdev.h @@ -72,6 +72,7 @@ enum ionic_admin_flags { =20 enum ionic_mmap_flag { IONIC_MMAP_WC =3D BIT(0), + IONIC_MMAP_PHC =3D BIT(1), }; =20 struct ionic_mmap_entry { @@ -173,6 +174,7 @@ struct ionic_ctx { struct ib_ucontext ibctx; u32 dbid; struct rdma_user_mmap_entry *mmap_dbell; + struct rdma_user_mmap_entry *mmap_phc; }; =20 struct ionic_tbl_buf { diff --git a/drivers/infiniband/hw/ionic/ionic_lif_cfg.c b/drivers/infiniba= nd/hw/ionic/ionic_lif_cfg.c index f3cd281c3a2f..e3f2df1f9e6a 100644 --- a/drivers/infiniband/hw/ionic/ionic_lif_cfg.c +++ b/drivers/infiniband/hw/ionic/ionic_lif_cfg.c @@ -40,6 +40,8 @@ void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ion= ic_lif_cfg *cfg) cfg->dbid_count =3D le32_to_cpu(lif->ionic->ident.dev.ndbpgs_per_lif); cfg->dbpage =3D lif->kern_dbpage; cfg->intr_ctrl =3D lif->ionic->idev.intr_ctrl; + if (ident->eth.config.features & cpu_to_le64(IONIC_ETH_HW_RDMA_TIMESTAMP)) + cfg->phc_state =3D lif->phc->state_page; =20 cfg->db_phys =3D lif->ionic->bars[IONIC_PCI_BAR_DBELL].bus_addr; =20 diff --git a/drivers/infiniband/hw/ionic/ionic_lif_cfg.h b/drivers/infiniba= nd/hw/ionic/ionic_lif_cfg.h index 20853429f623..2b29e646c193 100644 --- a/drivers/infiniband/hw/ionic/ionic_lif_cfg.h +++ b/drivers/infiniband/hw/ionic/ionic_lif_cfg.h @@ -23,6 +23,7 @@ struct ionic_lif_cfg { u64 __iomem *dbpage; struct ionic_intr __iomem *intr_ctrl; phys_addr_t db_phys; + void *phc_state; =20 u64 page_size_supported; u32 npts_per_lif; diff --git a/include/uapi/rdma/ionic-abi.h b/include/uapi/rdma/ionic-abi.h index 97f695510380..abd1bde0991f 100644 --- a/include/uapi/rdma/ionic-abi.h +++ b/include/uapi/rdma/ionic-abi.h @@ -48,6 +48,7 @@ struct ionic_ctx_resp { __u8 expdb_qtypes; =20 __u8 rsvd2[3]; + __aligned_u64 phc_offset; }; =20 struct ionic_qdesc { --=20 2.43.0 From nobody Wed Apr 1 22:13:32 2026 Received: from PH0PR06CU001.outbound.protection.outlook.com (mail-westus3azon11011029.outbound.protection.outlook.com [40.107.208.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD4723F2111; Wed, 1 Apr 2026 10:25:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.208.29 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775039157; cv=fail; b=sOQBgpbjsxA2VgjXy6jOeFTt2cKCcFOpXEtElUNXd/nMQKXYETKQ+XziSH1DSDsLm3cFAEffGVB+gvbnO4kA2iWugtq114iUCe3K+RiEYNG/vyIJtDJT/fUXf2Nt2uqdYnhOyRtONlfDhq660fACmrtvb0PI3Ro7wSPADL+PkQA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775039157; c=relaxed/simple; bh=eMYNowOFUhuRcDDp73Hi3cFIYgTd17uUvVPQt5dokHU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K7zl+UiV7zS3hPMWiCHqrNn/KSagSv06Bm22nTtC/IQJUgNZcriLlnoy+rMwlSje1chrDL8oTTjQkmD/HYTrPunqeaUmymrEzAULqifB5oS3b0P+w3hA4reQCWrgxu9aNXNw/R0NsfDCkNEF1e0Zjv1SO1PdeA18HszrcPbWLUE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=frBARuNw; arc=fail smtp.client-ip=40.107.208.29 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="frBARuNw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=D2DN7S++DQrXkEqeH01xuI/DqhKpugf87sPgrwMjitLO58ySAN0xljslYKTuwzrNLD0645erpkJDpi2Vd85V7Us/T2uaE9OBufGpi6+k7OnkuKnMU1KwnDptTkna5rJ0KuMZwYwqwkj7lbj9fgiEkSFNkhN1I0RVRanQSCgfapYlGq0rykELAlu8VZMbaUZiz5PJ63Ue1LXQz69xF0bWnTdK9yCo+8ygtaBHmkdRFCXtjPsDRetMjxsrwUiKolbdqz8ipgH3w4iZF8Oj7X2nGjszlrhGaNmemJf095pm0ZopmIrg4O5S8N0Wu/zvSO2hLEes6EBV3QL4MNLiVw8esA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=yMe7Azw7JSxyTgI/jHxFnhhmL0JukzyPj2qiasOI90w=; b=toWed/BjhhXT1bi4rXbfOO9feU7DjDT/0LpIx7hhsIhukIeP6xWKZHUWUkgt2R1Qt8JRqpjWIqKHY+ZGHqwOQNOJn35vnB1BMBNAalkxVW5OL5BeX6vDw2x+znrOvYru5CUqEiYT3zPS7wG7dSuvepK9itdt/ws79RifuQHk5JSNgDkjrEdWhF9DiYDtK9taJB/e0g6NG95jk2auql6dxVNxgAzAqo4+wJ31+dpv5OoB1WZ/NvPoRuDIhLxNp1qLx7TWxUkxOQV8ySduIMJj2xn/VsF+gVo8+ArtxB0UJm4HwZfp0DLD1KPV51PEGjGrwFgTHct/8ynW/DhWQdTSJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ziepe.ca smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yMe7Azw7JSxyTgI/jHxFnhhmL0JukzyPj2qiasOI90w=; b=frBARuNwoalReaCcGyejVs7+IMBHRwJEw0W1xaw+yatlm5JODB2sciHYcywjTsb08Wzl6fOS/hpsfjN9uPW2KStAT1svGN+N8trGVfL4A5iwCWbEYblK13H8xeY8PQ4oCiosb5uhoAF8gZ6kAznbKOlElVlcynIfz83G+VEowk4= Received: from DM6PR03CA0073.namprd03.prod.outlook.com (2603:10b6:5:333::6) by SAWPR12MB999142.namprd12.prod.outlook.com (2603:10b6:806:4e1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17; Wed, 1 Apr 2026 10:25:51 +0000 Received: from DS3PEPF000099E0.namprd04.prod.outlook.com (2603:10b6:5:333:cafe::be) by DM6PR03CA0073.outlook.office365.com (2603:10b6:5:333::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9745.30 via Frontend Transport; Wed, 1 Apr 2026 10:25:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by DS3PEPF000099E0.mail.protection.outlook.com (10.167.17.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17 via Frontend Transport; Wed, 1 Apr 2026 10:25:50 +0000 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 1 Apr 2026 05:25:49 -0500 Received: from xhdipdslab46.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Wed, 1 Apr 2026 05:25:46 -0500 From: Abhijit Gangurde To: , , , , , , , CC: , , , , , Abhijit Gangurde Subject: [PATCH 4/4] RDMA/ionic: add completion timestamp to CQE format Date: Wed, 1 Apr 2026 15:55:01 +0530 Message-ID: <20260401102501.3395305-5-abhijit.gangurde@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260401102501.3395305-1-abhijit.gangurde@amd.com> References: <20260401102501.3395305-1-abhijit.gangurde@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E0:EE_|SAWPR12MB999142:EE_ X-MS-Office365-Filtering-Correlation-Id: 6884ffcd-c2cd-4afc-dc53-08de8fd90bfd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|1800799024|36860700016|18002099003|56012099003|22082099003; X-Microsoft-Antispam-Message-Info: I4kDUpiUVez6sgvKdYIG2nhx6n/nrKUiuG6DBnLdVju9zgFKGUlTJVqYk868zremDbViTG7VXGpkmgxjANuOL1B2mKmVrz3c7GVDmMmt8SoUmhbHiFpMMN25nP9mWcMjaXbmrSkWot9/jTyse+tVM8r37xg5J2nWg/mGIARKxD8CuxU2YaaMtpF+5rVp7I0bT5yzjGcTHGgveOjNTnmHhWfgBBVYhMHQf9EbspjyrPjU9gKuBc7wron6TiU4NIVCaif375HLp7VOxgHml+YyWCJSPVpFM0abslpFgEZLQJqkhUCOwMQWHZbYkCr//p767OKQwUjFmpRFl5DYEuB/LaEaWC3HAaVBr+JPqxOHoSeGMlR7pTd+PbV2rh6TtOmol89WUODP0k4AveRHxa+im0o98B05/ZGWYTMFUU12+Buj8/d2NaW9dU1YJSOkau26zUREOnjcbJv4Z1CC65MfVREvP1q0EAmrBMDmd40YJD4BdIz7WBuLk58nrweoC4o0wXk9Lr72cK5Xgwil5SzF3FgZc0lxltqYV82RPSfPvuox9jSn9u7eDCsFrCMXNvUbfWgUHwIfDkReuEdwSCeA4y9R7IAklBG1tJc+K2TFpWN7gioXlhrjWE/tZzDStg9vT+AADWiCdW5RX2p3PnnjxOOPSGx0BNsD2Lx+2mVDJ221ekkL0uBO0y8N2rtIkOsBx1+MKTpL/QR8NGLYQAIAaQhFkp82/u3NcUq3swCe7q2XEOvdVXvKhoKnBZQdu/jZZiTWpcjy5OTjhHqS1dIRaQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(1800799024)(36860700016)(18002099003)(56012099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZVSPEImS2QiqFg3W0cHxDHcZuxa6VvwTlqJuavfwne8JsiJIjpU5Vq83pEy3Kw+UAV9kYkGceGwpppOdv9+GFaUP+I5Jr+a8TEf0bMjarz8Kz8t45F7eBZreJ/z/MwLYKfdpb92p7w/7pXqgqY07yno3gajzMlfj1NgHnC3u0zcBPf0kAIro/C9tBf+Y0n4tTidK/jiXamG0pVSNyR7QrQiIO0CRvtxzzBF1m5iInLyRZGTGYKhcz0vON/Z+3IcVqAmNAxTE/Q8KeWXIViuEDkNlhpq3rosqJqKrh+GKzJl1/1NCty7jSGF4M4NeyTXXYRkttE5Ps+doCIs4nntyJJJTsvvu8kfjv4n9pUjJ+rzOqeGXrbTIIULL6nLq6BGBWjurV6yoiV9p34N5avsKC/RReypgDJD1YVFj4e9q496Q0AX6Q6wh/Az6qa+06mfH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2026 10:25:50.4282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6884ffcd-c2cd-4afc-dc53-08de8fd90bfd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SAWPR12MB999142 Content-Type: text/plain; charset="utf-8" Update the CQE structure to include hardware timestamp. When firmware supports RDMA completion timestamps, the hardware populates the timestamp field. Co-developed-by: Allen Hubbe Signed-off-by: Allen Hubbe Signed-off-by: Abhijit Gangurde --- drivers/infiniband/hw/ionic/ionic_datapath.c | 43 ++++++++++---------- drivers/infiniband/hw/ionic/ionic_fw.h | 12 ++++-- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/drivers/infiniband/hw/ionic/ionic_datapath.c b/drivers/infinib= and/hw/ionic/ionic_datapath.c index aa2944887f23..3e2300f7ea10 100644 --- a/drivers/infiniband/hw/ionic/ionic_datapath.c +++ b/drivers/infiniband/hw/ionic/ionic_datapath.c @@ -32,6 +32,7 @@ static int ionic_flush_recv(struct ionic_qp *qp, struct i= b_wc *wc) { struct ionic_rq_meta *meta; struct ionic_v1_wqe *wqe; + u64 wqe_idx; =20 if (!qp->rq_flush) return 0; @@ -40,21 +41,22 @@ static int ionic_flush_recv(struct ionic_qp *qp, struct= ib_wc *wc) return 0; =20 wqe =3D ionic_queue_at_cons(&qp->rq); + wqe_idx =3D le64_to_cpu(wqe->base.wqe_idx); =20 - /* wqe_id must be a valid queue index */ - if (unlikely(wqe->base.wqe_id >> qp->rq.depth_log2)) { + /* wqe_idx must be a valid queue index */ + if (unlikely(wqe_idx >> qp->rq.depth_log2)) { ibdev_warn(qp->ibqp.device, "flush qp %u recv index %llu invalid\n", - qp->qpid, (unsigned long long)wqe->base.wqe_id); + qp->qpid, (unsigned long long)wqe_idx); return -EIO; } =20 - /* wqe_id must indicate a request that is outstanding */ - meta =3D &qp->rq_meta[wqe->base.wqe_id]; + /* wqe_idx must indicate a request that is outstanding */ + meta =3D &qp->rq_meta[wqe_idx]; if (unlikely(meta->next !=3D IONIC_META_POSTED)) { ibdev_warn(qp->ibqp.device, "flush qp %u recv index %llu not posted\n", - qp->qpid, (unsigned long long)wqe->base.wqe_id); + qp->qpid, (unsigned long long)wqe_idx); return -EIO; } =20 @@ -133,8 +135,8 @@ static int ionic_poll_recv(struct ionic_ibdev *dev, str= uct ionic_cq *cq, { struct ionic_qp *qp =3D NULL; struct ionic_rq_meta *meta; + u16 vlan_tag, wqe_idx; u32 src_qpn, st_len; - u16 vlan_tag; u8 op; =20 if (cqe_qp->rq_flush) @@ -144,7 +146,7 @@ static int ionic_poll_recv(struct ionic_ibdev *dev, str= uct ionic_cq *cq, =20 st_len =3D be32_to_cpu(cqe->status_length); =20 - /* ignore wqe_id in case of flush error */ + /* ignore wqe_idx in case of flush error */ if (ionic_v1_cqe_error(cqe) && st_len =3D=3D IONIC_STS_WQE_FLUSHED_ERR) { cqe_qp->rq_flush =3D true; cq->flush =3D true; @@ -160,20 +162,19 @@ static int ionic_poll_recv(struct ionic_ibdev *dev, s= truct ionic_cq *cq, return -EIO; } =20 - /* wqe_id must be a valid queue index */ - if (unlikely(cqe->recv.wqe_id >> qp->rq.depth_log2)) { + wqe_idx =3D le64_to_cpu(cqe->recv.wqe_idx_timestamp) & IONIC_V1_CQE_WQE_I= DX_MASK; + /* wqe_idx must be a valid queue index */ + if (unlikely(wqe_idx >> qp->rq.depth_log2)) { ibdev_warn(&dev->ibdev, - "qp %u recv index %llu invalid\n", - qp->qpid, (unsigned long long)cqe->recv.wqe_id); + "qp %u recv index %u invalid\n", qp->qpid, wqe_idx); return -EIO; } =20 - /* wqe_id must indicate a request that is outstanding */ - meta =3D &qp->rq_meta[cqe->recv.wqe_id]; + /* wqe_idx must indicate a request that is outstanding */ + meta =3D &qp->rq_meta[wqe_idx]; if (unlikely(meta->next !=3D IONIC_META_POSTED)) { ibdev_warn(&dev->ibdev, - "qp %u recv index %llu not posted\n", - qp->qpid, (unsigned long long)cqe->recv.wqe_id); + "qp %u recv index %u not posted\n", qp->qpid, wqe_idx); return -EIO; } =20 @@ -408,7 +409,7 @@ static int ionic_comp_msn(struct ionic_qp *qp, struct i= onic_v1_cqe *cqe) static int ionic_comp_npg(struct ionic_qp *qp, struct ionic_v1_cqe *cqe) { struct ionic_sq_meta *meta; - u16 cqe_idx; + u16 wqe_idx; u32 st_len; =20 if (qp->sq_flush) @@ -430,8 +431,8 @@ static int ionic_comp_npg(struct ionic_qp *qp, struct i= onic_v1_cqe *cqe) return 0; } =20 - cqe_idx =3D cqe->send.npg_wqe_id & qp->sq.mask; - meta =3D &qp->sq_meta[cqe_idx]; + wqe_idx =3D le64_to_cpu(cqe->send.npg_wqe_idx_timestamp) & qp->sq.mask; + meta =3D &qp->sq_meta[wqe_idx]; meta->local_comp =3D true; =20 if (ionic_v1_cqe_error(cqe)) { @@ -811,7 +812,7 @@ static void ionic_prep_base(struct ionic_qp *qp, meta->signal =3D false; meta->local_comp =3D false; =20 - wqe->base.wqe_id =3D qp->sq.prod; + wqe->base.wqe_idx =3D cpu_to_le64(qp->sq.prod); =20 if (wr->send_flags & IB_SEND_FENCE) wqe->base.flags |=3D cpu_to_be16(IONIC_V1_FLAG_FENCE); @@ -1205,7 +1206,7 @@ static int ionic_prep_recv(struct ionic_qp *qp, =20 meta->wrid =3D wr->wr_id; =20 - wqe->base.wqe_id =3D meta - qp->rq_meta; + wqe->base.wqe_idx =3D cpu_to_le64(meta - qp->rq_meta); wqe->base.num_sge_key =3D wr->num_sge; =20 /* total length for recv goes in base imm_data_key */ diff --git a/drivers/infiniband/hw/ionic/ionic_fw.h b/drivers/infiniband/hw= /ionic/ionic_fw.h index adfbb89d856c..ee23062a1762 100644 --- a/drivers/infiniband/hw/ionic/ionic_fw.h +++ b/drivers/infiniband/hw/ionic/ionic_fw.h @@ -332,7 +332,7 @@ struct ionic_v1_cqe { __le16 old_rq_cq_cindex; } admin; struct { - __u64 wqe_id; + __le64 wqe_idx_timestamp; __be32 src_qpn_op; __u8 src_mac[6]; __be16 vlan_tag; @@ -342,13 +342,19 @@ struct ionic_v1_cqe { __u8 rsvd[4]; __be32 msg_msn; __u8 rsvd2[8]; - __u64 npg_wqe_id; + __le64 npg_wqe_idx_timestamp; } send; }; __be32 status_length; __be32 qid_type_flags; }; =20 +/* bits for cqe wqe_idx and timestamp */ +enum ionic_v1_cqe_wqe_idx_timestamp_bits { + IONIC_V1_CQE_WQE_IDX_MASK =3D 0xffff, + IONIC_V1_CQE_TIMESTAMP_SHIFT =3D 16, +}; + /* bits for cqe recv */ enum ionic_v1_cqe_src_qpn_bits { IONIC_V1_CQE_RECV_QPN_MASK =3D 0xffffff, @@ -423,7 +429,7 @@ static inline u32 ionic_v1_cqe_qtf_qid(u32 qtf) =20 /* v1 base wqe header */ struct ionic_v1_base_hdr { - __u64 wqe_id; + __le64 wqe_idx; __u8 op; __u8 num_sge_key; __be16 flags; --=20 2.43.0