* [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set()
@ 2025-05-08 12:47 Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 1/3] net: dpaa_eth: convert to ndo_hwtstamp_set() Vladimir Oltean
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Vladimir Oltean @ 2025-05-08 12:47 UTC (permalink / raw)
To: netdev
Cc: Köry Maincent, Madalin Bucur, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, Russell King, linux-kernel
This is part of the effort to finalize the conversion of drivers to the
dedicated hardware timestamping API.
In the case of the DPAA1 Ethernet driver, a bit more care is needed,
because dpaa_ioctl() looks a bit strange. It handles the "set" IOCTL but
not the "get", and even the phylink_mii_ioctl() portion could do with
some cleanup.
Vladimir Oltean (3):
net: dpaa_eth: convert to ndo_hwtstamp_set()
net: dpaa_eth: add ndo_hwtstamp_get() implementation
net: dpaa_eth: simplify dpaa_ioctl()
.../net/ethernet/freescale/dpaa/dpaa_eth.c | 41 ++++++++++---------
1 file changed, 21 insertions(+), 20 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/3] net: dpaa_eth: convert to ndo_hwtstamp_set()
2025-05-08 12:47 [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vladimir Oltean
@ 2025-05-08 12:47 ` Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 2/3] net: dpaa_eth: add ndo_hwtstamp_get() implementation Vladimir Oltean
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Oltean @ 2025-05-08 12:47 UTC (permalink / raw)
To: netdev
Cc: Köry Maincent, Madalin Bucur, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, Russell King, 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 DPAA1 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>
---
.../net/ethernet/freescale/dpaa/dpaa_eth.c | 21 +++++++------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 4948b4906584..d5458a5fb971 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -3089,15 +3089,13 @@ static int dpaa_xdp_xmit(struct net_device *net_dev, int n,
return nxmit;
}
-static int dpaa_ts_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+static int dpaa_hwtstamp_set(struct net_device *dev,
+ struct kernel_hwtstamp_config *config,
+ struct netlink_ext_ack *extack)
{
struct dpaa_priv *priv = netdev_priv(dev);
- struct hwtstamp_config config;
- if (copy_from_user(&config, rq->ifr_data, sizeof(config)))
- return -EFAULT;
-
- switch (config.tx_type) {
+ switch (config->tx_type) {
case HWTSTAMP_TX_OFF:
/* Couldn't disable rx/tx timestamping separately.
* Do nothing here.
@@ -3112,7 +3110,7 @@ static int dpaa_ts_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return -ERANGE;
}
- if (config.rx_filter == HWTSTAMP_FILTER_NONE) {
+ if (config->rx_filter == HWTSTAMP_FILTER_NONE) {
/* Couldn't disable rx/tx timestamping separately.
* Do nothing here.
*/
@@ -3121,11 +3119,10 @@ static int dpaa_ts_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
priv->mac_dev->set_tstamp(priv->mac_dev->fman_mac, true);
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;
}
- return copy_to_user(rq->ifr_data, &config, sizeof(config)) ?
- -EFAULT : 0;
+ return 0;
}
static int dpaa_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
@@ -3139,9 +3136,6 @@ static int dpaa_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
cmd);
}
- if (cmd == SIOCSHWTSTAMP)
- return dpaa_ts_ioctl(net_dev, rq, cmd);
-
return ret;
}
@@ -3160,6 +3154,7 @@ static const struct net_device_ops dpaa_ops = {
.ndo_change_mtu = dpaa_change_mtu,
.ndo_bpf = dpaa_xdp,
.ndo_xdp_xmit = dpaa_xdp_xmit,
+ .ndo_hwtstamp_set = dpaa_hwtstamp_set,
};
static int dpaa_napi_add(struct net_device *net_dev)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 2/3] net: dpaa_eth: add ndo_hwtstamp_get() implementation
2025-05-08 12:47 [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 1/3] net: dpaa_eth: convert to ndo_hwtstamp_set() Vladimir Oltean
@ 2025-05-08 12:47 ` Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 3/3] net: dpaa_eth: simplify dpaa_ioctl() Vladimir Oltean
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Oltean @ 2025-05-08 12:47 UTC (permalink / raw)
To: netdev
Cc: Köry Maincent, Madalin Bucur, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, Russell King, linux-kernel
Allow SIOCGHWTSTAMP to retrieve the current timestamping settings
on DPAA1 interfaces. This reflects what has been done in
dpaa_hwtstamp_set().
Tested with hwstamp_ctl -i fm1-mac9.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index d5458a5fb971..5b8d87a0bf82 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -3089,6 +3089,18 @@ static int dpaa_xdp_xmit(struct net_device *net_dev, int n,
return nxmit;
}
+static int dpaa_hwtstamp_get(struct net_device *dev,
+ struct kernel_hwtstamp_config *config)
+{
+ struct dpaa_priv *priv = netdev_priv(dev);
+
+ config->tx_type = priv->tx_tstamp ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
+ config->rx_filter = priv->rx_tstamp ? HWTSTAMP_FILTER_ALL :
+ HWTSTAMP_FILTER_NONE;
+
+ return 0;
+}
+
static int dpaa_hwtstamp_set(struct net_device *dev,
struct kernel_hwtstamp_config *config,
struct netlink_ext_ack *extack)
@@ -3154,6 +3166,7 @@ static const struct net_device_ops dpaa_ops = {
.ndo_change_mtu = dpaa_change_mtu,
.ndo_bpf = dpaa_xdp,
.ndo_xdp_xmit = dpaa_xdp_xmit,
+ .ndo_hwtstamp_get = dpaa_hwtstamp_get,
.ndo_hwtstamp_set = dpaa_hwtstamp_set,
};
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 3/3] net: dpaa_eth: simplify dpaa_ioctl()
2025-05-08 12:47 [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 1/3] net: dpaa_eth: convert to ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 2/3] net: dpaa_eth: add ndo_hwtstamp_get() implementation Vladimir Oltean
@ 2025-05-08 12:47 ` Vladimir Oltean
2025-05-08 20:39 ` [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vadim Fedorenko
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Oltean @ 2025-05-08 12:47 UTC (permalink / raw)
To: netdev
Cc: Köry Maincent, Madalin Bucur, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, Russell King, linux-kernel
phylink_mii_ioctl() handles multiple ioctls in addition to just
SIOCGMIIREG: SIOCGMIIPHY, SIOCSMIIREG. Don't filter these out.
Also, phylink can handle the case where net_dev->phydev is NULL (like
optical SFP module, fixed-link). Be like other drivers and let phylink
do so without any driver-side call filtering.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 5b8d87a0bf82..23c23cca2620 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -3139,16 +3139,9 @@ static int dpaa_hwtstamp_set(struct net_device *dev,
static int dpaa_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
{
- int ret = -EINVAL;
struct dpaa_priv *priv = netdev_priv(net_dev);
- if (cmd == SIOCGMIIREG) {
- if (net_dev->phydev)
- return phylink_mii_ioctl(priv->mac_dev->phylink, rq,
- cmd);
- }
-
- return ret;
+ return phylink_mii_ioctl(priv->mac_dev->phylink, rq, cmd);
}
static const struct net_device_ops dpaa_ops = {
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set()
2025-05-08 12:47 [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vladimir Oltean
` (2 preceding siblings ...)
2025-05-08 12:47 ` [PATCH net-next 3/3] net: dpaa_eth: simplify dpaa_ioctl() Vladimir Oltean
@ 2025-05-08 20:39 ` Vadim Fedorenko
2025-05-09 6:09 ` Madalin Bucur (OSS)
2025-05-09 23:50 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Vadim Fedorenko @ 2025-05-08 20:39 UTC (permalink / raw)
To: Vladimir Oltean, netdev
Cc: Köry Maincent, Madalin Bucur, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Richard Cochran, Russell King, linux-kernel
On 08/05/2025 13:47, Vladimir Oltean wrote:
> This is part of the effort to finalize the conversion of drivers to the
> dedicated hardware timestamping API.
>
> In the case of the DPAA1 Ethernet driver, a bit more care is needed,
> because dpaa_ioctl() looks a bit strange. It handles the "set" IOCTL but
> not the "get", and even the phylink_mii_ioctl() portion could do with
> some cleanup.
>
> Vladimir Oltean (3):
> net: dpaa_eth: convert to ndo_hwtstamp_set()
> net: dpaa_eth: add ndo_hwtstamp_get() implementation
> net: dpaa_eth: simplify dpaa_ioctl()
>
> .../net/ethernet/freescale/dpaa/dpaa_eth.c | 41 ++++++++++---------
> 1 file changed, 21 insertions(+), 20 deletions(-)
>
For the series:
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set()
2025-05-08 12:47 [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vladimir Oltean
` (3 preceding siblings ...)
2025-05-08 20:39 ` [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vadim Fedorenko
@ 2025-05-09 6:09 ` Madalin Bucur (OSS)
2025-05-09 23:50 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Madalin Bucur (OSS) @ 2025-05-09 6:09 UTC (permalink / raw)
To: Vladimir Oltean, netdev
Cc: Köry Maincent, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Richard Cochran,
Russell King, linux-kernel
> -----Original Message-----
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> Sent: Thursday, May 8, 2025 3:48 PM
> To: netdev@vger.kernel.org
> Cc: Köry Maincent <kory.maincent@bootlin.com>; Madalin Bucur
> <madalin.bucur@nxp.com>; Andrew Lunn <andrew@lunn.ch>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Simon
> Horman <horms@kernel.org>; Richard Cochran <richardcochran@gmail.com>;
> Russell King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org
> Subject: [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get()
> and ndo_hwtstamp_set()
>
> This is part of the effort to finalize the conversion of drivers to the
> dedicated hardware timestamping API.
>
> In the case of the DPAA1 Ethernet driver, a bit more care is needed,
> because dpaa_ioctl() looks a bit strange. It handles the "set" IOCTL but
> not the "get", and even the phylink_mii_ioctl() portion could do with
> some cleanup.
>
> Vladimir Oltean (3):
> net: dpaa_eth: convert to ndo_hwtstamp_set()
> net: dpaa_eth: add ndo_hwtstamp_get() implementation
> net: dpaa_eth: simplify dpaa_ioctl()
>
> .../net/ethernet/freescale/dpaa/dpaa_eth.c | 41 ++++++++++---------
> 1 file changed, 21 insertions(+), 20 deletions(-)
>
> --
> 2.43.0
For the series:
Acked-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Thank you!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set()
2025-05-08 12:47 [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vladimir Oltean
` (4 preceding siblings ...)
2025-05-09 6:09 ` Madalin Bucur (OSS)
@ 2025-05-09 23:50 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-09 23:50 UTC (permalink / raw)
To: Vladimir Oltean
Cc: netdev, kory.maincent, madalin.bucur, andrew, davem, edumazet,
kuba, pabeni, horms, richardcochran, linux, linux-kernel
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 8 May 2025 15:47:50 +0300 you wrote:
> This is part of the effort to finalize the conversion of drivers to the
> dedicated hardware timestamping API.
>
> In the case of the DPAA1 Ethernet driver, a bit more care is needed,
> because dpaa_ioctl() looks a bit strange. It handles the "set" IOCTL but
> not the "get", and even the phylink_mii_ioctl() portion could do with
> some cleanup.
>
> [...]
Here is the summary with links:
- [net-next,1/3] net: dpaa_eth: convert to ndo_hwtstamp_set()
https://git.kernel.org/netdev/net-next/c/b45bf3f84ec4
- [net-next,2/3] net: dpaa_eth: add ndo_hwtstamp_get() implementation
https://git.kernel.org/netdev/net-next/c/7bf230556bfa
- [net-next,3/3] net: dpaa_eth: simplify dpaa_ioctl()
https://git.kernel.org/netdev/net-next/c/c2d0b7da611a
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] 7+ messages in thread
end of thread, other threads:[~2025-05-09 23:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-08 12:47 [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 1/3] net: dpaa_eth: convert to ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 2/3] net: dpaa_eth: add ndo_hwtstamp_get() implementation Vladimir Oltean
2025-05-08 12:47 ` [PATCH net-next 3/3] net: dpaa_eth: simplify dpaa_ioctl() Vladimir Oltean
2025-05-08 20:39 ` [PATCH net-next 0/3] dpaa_eth conversion to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vadim Fedorenko
2025-05-09 6:09 ` Madalin Bucur (OSS)
2025-05-09 23:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®