diff options
author | David S. Miller <davem@davemloft.net> | 2023-04-03 10:04:27 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-04-03 10:04:27 +0100 |
commit | 858e5b06409f65d09dc60e32432e4b8e12e4dba0 (patch) | |
tree | e59030b8a2b0657651f7b0528d270f0d2d585a72 /net/dsa/port.c | |
parent | 51aaa68222d6c34f0373cf95223ce2f230329e8f (diff) | |
parent | 88c0a6b503b7f4fffb68a8d49c3987870c5b1d6b (diff) | |
download | linux-858e5b06409f65d09dc60e32432e4b8e12e4dba0.tar.gz linux-858e5b06409f65d09dc60e32432e4b8e12e4dba0.tar.bz2 linux-858e5b06409f65d09dc60e32432e4b8e12e4dba0.zip |
Merge branch 'dsa_master_ioctl-notifier'
Vladimir Oltean says:
====================
net: Convert dsa_master_ioctl() to netdev notifier
This is preparatory work in order for Maxim Georgiev to be able to start
the API conversion process of hardware timestamping from ndo_eth_ioctl()
to ndo_hwtstamp_set():
https://lore.kernel.org/netdev/20230331045619.40256-1-glipus@gmail.com/
In turn, Maxim Georgiev's work is a preparation so that Köry Maincent is
able to make the active hardware timestamping layer selectable by user
space.
https://lore.kernel.org/netdev/20230308135936.761794-1-kory.maincent@bootlin.com/
So, quite some dependency chain.
Before this patch set, DSA prevented the conversion of any networking
driver from the ndo_eth_ioctl() API to the ndo_hwtstamp_set() API,
because it wanted to validate the hwtstamping settings on the DSA
master, and it was only coded up to do this using the old API.
After this patch set, a new netdev notifier exists, which does not
depend on anything that would constitute the "soon-to-be-legacy" API,
but rather, it uses a newly introduced struct kernel_hwtstamp_config,
and it doesn't issue any ioctl at all, being thus compatible both with
ndo_eth_ioctl(), and with the not-yet-introduced, but now possible,
ndo_hwtstamp_set().
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/port.c')
-rw-r--r-- | net/dsa/port.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/dsa/port.c b/net/dsa/port.c index 15cee17769e9..71ba30538411 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -114,19 +114,21 @@ static bool dsa_port_can_configure_learning(struct dsa_port *dp) return !err; } -bool dsa_port_supports_hwtstamp(struct dsa_port *dp, struct ifreq *ifr) +bool dsa_port_supports_hwtstamp(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; + struct ifreq ifr = {}; int err; if (!ds->ops->port_hwtstamp_get || !ds->ops->port_hwtstamp_set) return false; /* "See through" shim implementations of the "get" method. - * This will clobber the ifreq structure, but we will either return an - * error, or the master will overwrite it with proper values. + * Since we can't cook up a complete ioctl request structure, this will + * fail in copy_to_user() with -EFAULT, which hopefully is enough to + * detect a valid implementation. */ - err = ds->ops->port_hwtstamp_get(ds, dp->index, ifr); + err = ds->ops->port_hwtstamp_get(ds, dp->index, &ifr); return err != -EOPNOTSUPP; } |