From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from AS8PR03CU001.outbound.protection.outlook.com (mail-westeuropeazon11012002.outbound.protection.outlook.com [52.101.71.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 D9360320B for ; Mon, 12 May 2025 16:00:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.71.2 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747065650; cv=fail; b=LMd7PBX7ZN2Cal42z2j+dI3Q2WhSBEGJpdOWvyV8XE7h0CDms1lCssFlWwj1ewbWfb05/L0UHrWxWqK6xI2jXZD/XOa0ourFhkdp/uCx7S+5lWH9DxreYccCkjDgI9UI8vV8nf02pi4koAR5iDjzNhOFxKpGGpANGY9aby7q1Rs= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747065650; c=relaxed/simple; bh=ICFyFAWWXvrIMVwvEIsBXJZZLUS6h3eQJwU3kdEvO+Q=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Feeq7H5G55mnNe7H1tZLw2MZFW9h4SJMWquF/PQApFslvBTmTs/YxMkbnqdSFwhQ40EKFp5auQFOEQj6cUwYtD48hgLDGZSvYEegRZK+eCJnGW+Eb6L95xTHT/UPNIcbNxzEjYhTnT95ZvoUstdDxVADd9rHSE/GCPDHInmxLNA= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=nNxgdt0C; arc=fail smtp.client-ip=52.101.71.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="nNxgdt0C" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A6ivAk3L9ja8+/SqZeodqHppkPes6oV21hynPVeTUbQXGlKnhU+BaXmitmnaSoY7vvDyzuWVbNnt6TFu6ZkuiRqghXvl5Gc45Tqv8aSNAWM1bNafHTXXw1yNHnTwB3qqVDiRDn1x3IFFazXI2t9aFAOWEKJZCipQO//LySSXNT9Xf+b4vkqOtaRZrQnx7Y9lPcx/Uuc1KajCidJREmbgLuLgAqJisLPU0Pledp2evBkaXtsOZfYZmWUBef3Fy4cRSbIZQ5bup1tuOJlQHHoxmtpthXZJZSOsdvlWw6LbaWymrmZlLrWbo4a1NDgDdXlZ037sju7924eFOL29WPjJMw== 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=iT8sElKmpupguMesv4F4JH4UVOdTFv7IUDRh54sxAss=; b=aOm0Qliu3hIgIeFS2UPLq4/5E7E01tth1dpBNNtqKLHmFNImIPfc+w35NhIi0sbHs5d/9xa3yvoKt4ZI/bXnhFY+prb25Xsw2t1vlBCUZR66q6lnoiH+ZJW9CFOab/burhOYOt08AU7o2p4fdwSKghcv85cy7dEh5r6HAIzaGj4lGHqfhrSBIu18u1ZJv/dc4XyPP8M4KJeK+qMSSkHHpHYp9s9CuK7PlwTKoCZNBAD1iG+sCNYG7RAQ+nTb2vd26Pw4vLLGPqwd7QjiLnhgFp8CAhLPyM85MsWP0yV1EKevNk7oUWjF9+Kwu7cluT0vO9RR9DjU4N+c/4EnRXysHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iT8sElKmpupguMesv4F4JH4UVOdTFv7IUDRh54sxAss=; b=nNxgdt0CnlPZhQdADJjdGnws8MEJbLad5N0Mm4BNua0QyTFEiZck2St/AMVoavJcOKF5YsvUAyWh0O6hBh46Gzqd9wV8EFfAYW4ORvz0OlrxjFuDaX86uLpG6ZKxAmOhZFQd91FiuIntBQZEewSdif2K4cijWK4Pp2aQZgoCBJ0EbhzSS3NK4ENHDjKC3WKuIauid+qimDDZCYf8Rgqn8b++ZSIZel72zcXqGf3bToGbiV7XHpRhhjzNSpvA0xZfXle3bCJfmfr/rNmgPUCSO8PWjX8+hP1uDAil5vcuLwg16cBU+NsI2LQfQ9bsp4Zhl3Y/ycoU5m7+EhSBp03fog== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by PA4PR04MB7822.eurprd04.prod.outlook.com (2603:10a6:102:b8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8722.28; Mon, 12 May 2025 16:00:45 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%4]) with mapi id 15.20.8722.027; Mon, 12 May 2025 16:00:45 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Jacob Keller , Tony Nguyen , Przemek Kitszel , intel-wired-lan@lists.osuosl.org, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Vadim Fedorenko , Richard Cochran Subject: [PATCH net-next] ice: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() Date: Mon, 12 May 2025 19:00:36 +0300 Message-ID: <20250512160036.909434-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: VI1PR07CA0308.eurprd07.prod.outlook.com (2603:10a6:800:130::36) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|PA4PR04MB7822:EE_ X-MS-Office365-Filtering-Correlation-Id: dc76efa4-e3db-47b9-7cd9-08dd916e278a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?4KtMj8UGaKvapdcKrtmFz6c06G1JGB9yPfQTUomtLaVhyVPpIKCDK6B5FZ+9?= =?us-ascii?Q?RS1WWZjGuHoU/jjQ/uqyKjBfe5zRCtgNpT4GHXdHw6nndyWX3otW/LlzyYdU?= =?us-ascii?Q?uP7bH7cndBPlWc7DekuINFdety7VMRxS1CmE1K+qEO3zsyLWBxZWYLWlGhuw?= =?us-ascii?Q?MbLNaRWmQJOBH5tkKizi8UlKa5TwIpBhXkHBKumZcmstpCSjBFRajGqV0juI?= =?us-ascii?Q?M9W0Nm+RAsLHyYupp3u7SN024UQwyFX002T30v8AX2QjkIjamywj3BKT3VUx?= =?us-ascii?Q?XG9WPTxSxDehJqqtD7xU7wCNxkGqbH4TELODgNh7Ea2YBGlY9jc1tG1Ra7zu?= =?us-ascii?Q?UeYLkQTTiyuPc8rHu5Qn2wppCr5d1JIjrfez1bz+NJohfaGoDT/HMT8NrSWI?= =?us-ascii?Q?7/8l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?us-ascii?Q?yWJsFzRfTelI5zWAFPYa95+0mV9/iEvSJeib8uoAol6e5+JOuXtnlcTxNCCQ?= =?us-ascii?Q?ZIPAAeQ2P/okkHJBbKRLS9ftDpFIoeOTjWNez/WW3r4vEVjG9xm7Ve5GI6Ag?= =?us-ascii?Q?cLurSoVUTBKV7SGinKvlb08//tLCk5OgOVrOxqKJ24UdJAE9lVh9bw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LRYvVz2uYhsAPcN2JlvaPwYz/ogdG/IxUPphiogQ7hQWR+HJN04ZFytp2ktW?= =?us-ascii?Q?LwYxcTtWS+ssNeCHJUzpuaF0y7oqQduprwVx3PyRQMoUS7emfwS+ZCbzkSmB?= =?us-ascii?Q?JW5gD062bZgOwYmRrt/IsjUfNHhonj4h8Yv83SIgWojg24bid6Jy4RdcaskE?= =?us-ascii?Q?r4JL8LF4BlB3uLIQRi4vReh77GNoNmU+amzW7lIOVbWUMUw3kErAUKBmyw+u?= =?us-ascii?Q?Ws2PyD0ssXFQBNUP5gX/q/q/1su0W5NDKIWCw6H33Sumau+4Ps7QVWdlB+6S?= =?us-ascii?Q?gaK703RFgFpCSSrwnS4gXGM4DVnC/g1FsdZcS/iDMhpYCL10DctmTarqxCHu?= =?us-ascii?Q?c8hak+1DIDci6yl8aJZpN2QjpdnWMCy1eNyrE0VU1E8O3Pn03sz7o4wn2s35?= =?us-ascii?Q?DUaVnX64LTwOixmQ4fD+vQUlk+9tdOjKS77wb+FX8SSFH7vKavxZLZ5zsWjs?= =?us-ascii?Q?pO7pjPzY0EKKTyFPjsriZ54t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q?zDExcrRnna0dyW3WxjFoz6nksnMQ0bhXgs6A8HRxdmIM2GqH7MYMw2mYnYIM?= =?us-ascii?Q?CW+uYtqDVtNC4UlsdyWy1yfPKX7PMqT5OgOjl7FBWznQIDi/IViwhVzDlQ7g?= =?us-ascii?Q?/9BkYiy92L306Zc0s1wHnSdseo9VSAnD5xiIuXs0DD1qbL2LfklMjJvTA10E?= =?us-ascii?Q?hOPrT0n0+vh0Wr8cYAI/2mJOjxYz2ZFAI5qGxsscHi4zbP9f+G9f4Tt0Gf3N?= =?us-ascii?Q?yQ=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc76efa4-e3db-47b9-7cd9-08dd916e278a X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2025 16:00:45.3864 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W+gpYgSRY1Kdw1QZZhma/tsEYjT0U0cCfGXZsoHK4utwOvEuLfWCZ+A6Z8/RXwMdy9bUXQCAHAV4RzgeVpz4mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7822 New timestamping API was introduced in commit 66f7223039c0 ("net: add NDOs for configuring hardware timestamping") from kernel v6.6. It is time to convert the Intel ice driver to the new API, so that timestamping configuration can be removed from the ndo_eth_ioctl() path completely. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/intel/ice/ice_main.c | 24 +----------- drivers/net/ethernet/intel/ice/ice_ptp.c | 45 ++++++++++++----------- drivers/net/ethernet/intel/ice/ice_ptp.h | 17 ++++++--- 3 files changed, 37 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 1fbe13ee93a8..674d90d6a081 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -7880,27 +7880,6 @@ int ice_change_mtu(struct net_device *netdev, int new_mtu) return err; } -/** - * ice_eth_ioctl - Access the hwtstamp interface - * @netdev: network interface device structure - * @ifr: interface request data - * @cmd: ioctl command - */ -static int ice_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) -{ - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_pf *pf = np->vsi->back; - - switch (cmd) { - case SIOCGHWTSTAMP: - return ice_ptp_get_ts_config(pf, ifr); - case SIOCSHWTSTAMP: - return ice_ptp_set_ts_config(pf, ifr); - default: - return -EOPNOTSUPP; - } -} - /** * ice_aq_str - convert AQ err code to a string * @aq_err: the AQ error code to convert @@ -9734,7 +9713,6 @@ static const struct net_device_ops ice_netdev_ops = { .ndo_change_mtu = ice_change_mtu, .ndo_get_stats64 = ice_get_stats64, .ndo_set_tx_maxrate = ice_set_tx_maxrate, - .ndo_eth_ioctl = ice_eth_ioctl, .ndo_set_vf_spoofchk = ice_set_vf_spoofchk, .ndo_set_vf_mac = ice_set_vf_mac, .ndo_get_vf_config = ice_get_vf_cfg, @@ -9758,4 +9736,6 @@ static const struct net_device_ops ice_netdev_ops = { .ndo_bpf = ice_xdp, .ndo_xdp_xmit = ice_xdp_xmit, .ndo_xsk_wakeup = ice_xsk_wakeup, + .ndo_hwtstamp_get = ice_ptp_hwtstamp_get, + .ndo_hwtstamp_set = ice_ptp_hwtstamp_set, }; diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index b79a148ed0f2..d7b04af745d0 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -2359,23 +2359,24 @@ static int ice_ptp_getcrosststamp(struct ptp_clock_info *info, } /** - * ice_ptp_get_ts_config - ioctl interface to read the timestamping config - * @pf: Board private structure - * @ifr: ioctl data + * ice_ptp_hwtstamp_get - interface to read the timestamping config + * @netdev: network interface device structure + * @config: Timestamping configuration structure * * Copy the timestamping config to user buffer */ -int ice_ptp_get_ts_config(struct ice_pf *pf, struct ifreq *ifr) +int ice_ptp_hwtstamp_get(struct net_device *netdev, + struct kernel_hwtstamp_config *config) { - struct hwtstamp_config *config; + struct ice_netdev_priv *np = netdev_priv(netdev); + struct ice_pf *pf = np->vsi->back; if (pf->ptp.state != ICE_PTP_READY) return -EIO; - config = &pf->ptp.tstamp_config; + *config = pf->ptp.tstamp_config; - return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? - -EFAULT : 0; + return 0; } /** @@ -2383,8 +2384,8 @@ int ice_ptp_get_ts_config(struct ice_pf *pf, struct ifreq *ifr) * @pf: Board private structure * @config: hwtstamp settings requested or saved */ -static int -ice_ptp_set_timestamp_mode(struct ice_pf *pf, struct hwtstamp_config *config) +static int ice_ptp_set_timestamp_mode(struct ice_pf *pf, + struct kernel_hwtstamp_config *config) { switch (config->tx_type) { case HWTSTAMP_TX_OFF: @@ -2428,32 +2429,32 @@ ice_ptp_set_timestamp_mode(struct ice_pf *pf, struct hwtstamp_config *config) } /** - * ice_ptp_set_ts_config - ioctl interface to control the timestamping - * @pf: Board private structure - * @ifr: ioctl data + * ice_ptp_hwtstamp_set - interface to control the timestamping + * @netdev: network interface device structure + * @config: Timestamping configuration structure + * @extack: Netlink extended ack structure for error reporting * * Get the user config and store it */ -int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr) +int ice_ptp_hwtstamp_set(struct net_device *netdev, + struct kernel_hwtstamp_config *config, + struct netlink_ext_ack *extack) { - struct hwtstamp_config config; + struct ice_netdev_priv *np = netdev_priv(netdev); + struct ice_pf *pf = np->vsi->back; int err; if (pf->ptp.state != ICE_PTP_READY) return -EAGAIN; - if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) - return -EFAULT; - - err = ice_ptp_set_timestamp_mode(pf, &config); + err = ice_ptp_set_timestamp_mode(pf, config); if (err) return err; /* Return the actual configuration set */ - config = pf->ptp.tstamp_config; + *config = pf->ptp.tstamp_config; - return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? - -EFAULT : 0; + return 0; } /** diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h index 3b769a0cad00..da9bfd46d750 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp.h @@ -262,7 +262,7 @@ struct ice_ptp { struct ptp_extts_request extts_rqs[GLTSYN_EVNT_H_IDX_MAX]; struct ptp_clock_info info; struct ptp_clock *clock; - struct hwtstamp_config tstamp_config; + struct kernel_hwtstamp_config tstamp_config; u64 reset_time; u32 tx_hwtstamp_skipped; u32 tx_hwtstamp_timeouts; @@ -294,8 +294,11 @@ struct ice_ptp { #if IS_ENABLED(CONFIG_PTP_1588_CLOCK) int ice_ptp_clock_index(struct ice_pf *pf); struct ice_pf; -int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr); -int ice_ptp_get_ts_config(struct ice_pf *pf, struct ifreq *ifr); +int ice_ptp_hwtstamp_get(struct net_device *netdev, + struct kernel_hwtstamp_config *config); +int ice_ptp_hwtstamp_set(struct net_device *netdev, + struct kernel_hwtstamp_config *config, + struct netlink_ext_ack *extack); void ice_ptp_restore_timestamp_mode(struct ice_pf *pf); void ice_ptp_extts_event(struct ice_pf *pf); @@ -316,12 +319,16 @@ void ice_ptp_init(struct ice_pf *pf); void ice_ptp_release(struct ice_pf *pf); void ice_ptp_link_change(struct ice_pf *pf, bool linkup); #else /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */ -static inline int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr) + +static inline int ice_ptp_hwtstamp_get(struct net_device *netdev, + struct kernel_hwtstamp_config *config) { return -EOPNOTSUPP; } -static inline int ice_ptp_get_ts_config(struct ice_pf *pf, struct ifreq *ifr) +static inline int ice_ptp_hwtstamp_set(struct net_device *netdev, + struct kernel_hwtstamp_config *config, + struct netlink_ext_ack *extack) { return -EOPNOTSUPP; } -- 2.43.0