* [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set()
@ 2025-05-08 13:41 Vladimir Oltean
2025-05-08 13:41 ` [PATCH net-next 2/2] net: dpaa2-eth: add ndo_hwtstamp_get() implementation Vladimir Oltean
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Vladimir Oltean @ 2025-05-08 13:41 UTC (permalink / raw)
To: netdev
Cc: Köry Maincent, Ioana Ciornei, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, linux-kernel
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 DPAA2 Ethernet driver to the new API, so that the
ndo_eth_ioctl() path can be removed completely.
This driver only responds to SIOCSHWTSTAMP (not SIOCGHWTSTAMP) so
convert just that.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # LX2160A
---
.../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 25 ++++++++-----------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 29886a8ba73f..13b44fc170dc 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -2585,40 +2585,37 @@ static int dpaa2_eth_set_features(struct net_device *net_dev,
return 0;
}
-static int dpaa2_eth_ts_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+static int dpaa2_eth_hwtstamp_set(struct net_device *dev,
+ struct kernel_hwtstamp_config *config,
+ struct netlink_ext_ack *extack)
{
struct dpaa2_eth_priv *priv = netdev_priv(dev);
- struct hwtstamp_config config;
if (!dpaa2_ptp)
return -EINVAL;
- if (copy_from_user(&config, rq->ifr_data, sizeof(config)))
- return -EFAULT;
-
- switch (config.tx_type) {
+ switch (config->tx_type) {
case HWTSTAMP_TX_OFF:
case HWTSTAMP_TX_ON:
case HWTSTAMP_TX_ONESTEP_SYNC:
- priv->tx_tstamp_type = config.tx_type;
+ priv->tx_tstamp_type = config->tx_type;
break;
default:
return -ERANGE;
}
- if (config.rx_filter == HWTSTAMP_FILTER_NONE) {
+ if (config->rx_filter == HWTSTAMP_FILTER_NONE) {
priv->rx_tstamp = false;
} else {
priv->rx_tstamp = true;
/* TS is set for all frame types, not only those requested */
- config.rx_filter = HWTSTAMP_FILTER_ALL;
+ config->rx_filter = HWTSTAMP_FILTER_ALL;
}
if (priv->tx_tstamp_type == HWTSTAMP_TX_ONESTEP_SYNC)
dpaa2_ptp_onestep_reg_update_method(priv);
- return copy_to_user(rq->ifr_data, &config, sizeof(config)) ?
- -EFAULT : 0;
+ return 0;
}
static int dpaa2_eth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
@@ -2626,9 +2623,6 @@ static int dpaa2_eth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
struct dpaa2_eth_priv *priv = netdev_priv(dev);
int err;
- if (cmd == SIOCSHWTSTAMP)
- return dpaa2_eth_ts_ioctl(dev, rq, cmd);
-
mutex_lock(&priv->mac_lock);
if (dpaa2_eth_is_type_phy(priv)) {
@@ -3034,7 +3028,8 @@ static const struct net_device_ops dpaa2_eth_ops = {
.ndo_xsk_wakeup = dpaa2_xsk_wakeup,
.ndo_setup_tc = dpaa2_eth_setup_tc,
.ndo_vlan_rx_add_vid = dpaa2_eth_rx_add_vid,
- .ndo_vlan_rx_kill_vid = dpaa2_eth_rx_kill_vid
+ .ndo_vlan_rx_kill_vid = dpaa2_eth_rx_kill_vid,
+ .ndo_hwtstamp_set = dpaa2_eth_hwtstamp_set,
};
static void dpaa2_eth_cdan_cb(struct dpaa2_io_notification_ctx *ctx)
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] net: dpaa2-eth: add ndo_hwtstamp_get() implementation
2025-05-08 13:41 [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set() Vladimir Oltean
@ 2025-05-08 13:41 ` Vladimir Oltean
2025-05-08 20:41 ` Vadim Fedorenko
2025-05-08 20:41 ` [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set() Vadim Fedorenko
2025-05-09 23:50 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Vladimir Oltean @ 2025-05-08 13:41 UTC (permalink / raw)
To: netdev
Cc: Köry Maincent, Ioana Ciornei, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, linux-kernel
Allow SIOCGHWTSTAMP to retrieve the current timestamping settings on
DPNIs. This reflects what has been done in dpaa2_eth_hwtstamp_set().
Tested with hwstamp_ctl -i endpmac17. Before the change, it prints
"Device driver does not have support for non-destructive SIOCGHWTSTAMP."
After the change, it retrieves the previously set configuration.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # LX2160A
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 13b44fc170dc..2ec2c3dab250 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -2618,6 +2618,21 @@ static int dpaa2_eth_hwtstamp_set(struct net_device *dev,
return 0;
}
+static int dpaa2_eth_hwtstamp_get(struct net_device *dev,
+ struct kernel_hwtstamp_config *config)
+{
+ struct dpaa2_eth_priv *priv = netdev_priv(dev);
+
+ if (!dpaa2_ptp)
+ return -EINVAL;
+
+ config->tx_type = priv->tx_tstamp_type;
+ config->rx_filter = priv->rx_tstamp ? HWTSTAMP_FILTER_ALL :
+ HWTSTAMP_FILTER_NONE;
+
+ return 0;
+}
+
static int dpaa2_eth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct dpaa2_eth_priv *priv = netdev_priv(dev);
@@ -3029,6 +3044,7 @@ static const struct net_device_ops dpaa2_eth_ops = {
.ndo_setup_tc = dpaa2_eth_setup_tc,
.ndo_vlan_rx_add_vid = dpaa2_eth_rx_add_vid,
.ndo_vlan_rx_kill_vid = dpaa2_eth_rx_kill_vid,
+ .ndo_hwtstamp_get = dpaa2_eth_hwtstamp_get,
.ndo_hwtstamp_set = dpaa2_eth_hwtstamp_set,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set()
2025-05-08 13:41 [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 13:41 ` [PATCH net-next 2/2] net: dpaa2-eth: add ndo_hwtstamp_get() implementation Vladimir Oltean
@ 2025-05-08 20:41 ` Vadim Fedorenko
2025-05-09 23:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Vadim Fedorenko @ 2025-05-08 20:41 UTC (permalink / raw)
To: Vladimir Oltean, netdev
Cc: Köry Maincent, Ioana Ciornei, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, linux-kernel
On 08/05/2025 14:41, Vladimir Oltean wrote:
> 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 DPAA2 Ethernet driver to the new API, so that the
> ndo_eth_ioctl() path can be removed completely.
>
> This driver only responds to SIOCSHWTSTAMP (not SIOCGHWTSTAMP) so
> convert just that.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # LX2160A
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 2/2] net: dpaa2-eth: add ndo_hwtstamp_get() implementation
2025-05-08 13:41 ` [PATCH net-next 2/2] net: dpaa2-eth: add ndo_hwtstamp_get() implementation Vladimir Oltean
@ 2025-05-08 20:41 ` Vadim Fedorenko
0 siblings, 0 replies; 5+ messages in thread
From: Vadim Fedorenko @ 2025-05-08 20:41 UTC (permalink / raw)
To: Vladimir Oltean, netdev
Cc: Köry Maincent, Ioana Ciornei, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, linux-kernel
On 08/05/2025 14:41, Vladimir Oltean wrote:
> Allow SIOCGHWTSTAMP to retrieve the current timestamping settings on
> DPNIs. This reflects what has been done in dpaa2_eth_hwtstamp_set().
>
> Tested with hwstamp_ctl -i endpmac17. Before the change, it prints
> "Device driver does not have support for non-destructive SIOCGHWTSTAMP."
> After the change, it retrieves the previously set configuration.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # LX2160A
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set()
2025-05-08 13:41 [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 13:41 ` [PATCH net-next 2/2] net: dpaa2-eth: add ndo_hwtstamp_get() implementation Vladimir Oltean
2025-05-08 20:41 ` [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set() Vadim Fedorenko
@ 2025-05-09 23:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-09 23:50 UTC (permalink / raw)
To: Vladimir Oltean
Cc: netdev, kory.maincent, ioana.ciornei, andrew, davem, edumazet,
kuba, pabeni, horms, richardcochran, linux-kernel
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 8 May 2025 16:41:01 +0300 you wrote:
> 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 DPAA2 Ethernet driver to the new API, so that the
> ndo_eth_ioctl() path can be removed completely.
>
> This driver only responds to SIOCSHWTSTAMP (not SIOCGHWTSTAMP) so
> convert just that.
>
> [...]
Here is the summary with links:
- [net-next,1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set()
https://git.kernel.org/netdev/net-next/c/b6e79c5da8c2
- [net-next,2/2] net: dpaa2-eth: add ndo_hwtstamp_get() implementation
https://git.kernel.org/netdev/net-next/c/d27c6e8975c6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-05-09 23:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-08 13:41 [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 13:41 ` [PATCH net-next 2/2] net: dpaa2-eth: add ndo_hwtstamp_get() implementation Vladimir Oltean
2025-05-08 20:41 ` Vadim Fedorenko
2025-05-08 20:41 ` [PATCH net-next 1/2] net: dpaa2-eth: convert to ndo_hwtstamp_set() Vadim Fedorenko
2025-05-09 23:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.