Message ID | 20230405063330.36287-1-glipus@gmail.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [RFC,v3,1/5] Add NDOs for hardware timestamp get/set | expand |
On Wed, Apr 05, 2023 at 12:33:30AM -0600, Maxim Georgiev wrote: > Changing netdevsim driver to use the newly introduced ndo_hwtstamp_get/set > callback functions instead of implementing full-blown SIOCGHWTSTAMP/ > SIOCSHWTSTAMP IOCTLs handling logic. > > Suggested-by: Jakub Kicinski <kuba@kernel.org> > Signed-off-by: Maxim Georgiev <glipus@gmail.com> > --- The commit message describes a conversion, but this isn't a conversion, it's new functionality (which to my eyes is also incomplete). Also, what happened to: | I'd vote to split netdevsim out, and it needs a selftest which | exercises it under tools/testing/selftests/drivers/net/netdevsim/ | to get merged... https://lore.kernel.org/netdev/20230403141918.3257a195@kernel.org/
On Wed, Apr 5, 2023 at 6:18 AM Vladimir Oltean <vladimir.oltean@nxp.com> wrote: > > On Wed, Apr 05, 2023 at 12:33:30AM -0600, Maxim Georgiev wrote: > > Changing netdevsim driver to use the newly introduced ndo_hwtstamp_get/set > > callback functions instead of implementing full-blown SIOCGHWTSTAMP/ > > SIOCSHWTSTAMP IOCTLs handling logic. > > > > Suggested-by: Jakub Kicinski <kuba@kernel.org> > > Signed-off-by: Maxim Georgiev <glipus@gmail.com> > > --- > > The commit message describes a conversion, but this isn't a conversion, > it's new functionality (which to my eyes is also incomplete). That's true, the commit message is misleading, the patch misses the logic allowing ethtool to read the timestamp config, and I still don't have test results for this patch. I didn't get to it yet. Let me do the right thing and drop patches 4/5 and 5/5 from the stack temporarily until I get them right. > > Also, what happened to: > > | I'd vote to split netdevsim out, and it needs a selftest which > | exercises it under tools/testing/selftests/drivers/net/netdevsim/ > | to get merged... > > https://lore.kernel.org/netdev/20230403141918.3257a195@kernel.org/
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 35fa1ca98671..6c29dfa3bb4e 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -238,6 +238,28 @@ nsim_set_features(struct net_device *dev, netdev_features_t features) return 0; } +static int +nsim_hwtstamp_get(struct net_device *dev, + struct kernel_hwtstamp_config *kernel_config, + struct netlink_ext_ack *extack) +{ + struct netdevsim *ns = netdev_priv(dev); + + *kernel_config = ns->hw_tstamp_config; + return 0; +} + +static int +nsim_hwtstamp_set(struct net_device *dev, + struct kernel_hwtstamp_config *kernel_config, + struct netlink_ext_ack *extack) +{ + struct netdevsim *ns = netdev_priv(dev); + + ns->hw_tstamp_config = *kernel_config; + return 0; +} + static const struct net_device_ops nsim_netdev_ops = { .ndo_start_xmit = nsim_start_xmit, .ndo_set_rx_mode = nsim_set_rx_mode, @@ -256,6 +278,8 @@ static const struct net_device_ops nsim_netdev_ops = { .ndo_setup_tc = nsim_setup_tc, .ndo_set_features = nsim_set_features, .ndo_bpf = nsim_bpf, + .ndo_hwtstamp_get = nsim_hwtstamp_get, + .ndo_hwtstamp_set = nsim_hwtstamp_set, }; static const struct net_device_ops nsim_vf_netdev_ops = { diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h index 7d8ed8d8df5c..e78e88a0baa1 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -102,6 +102,7 @@ struct netdevsim { } udp_ports; struct nsim_ethtool ethtool; + struct kernel_hwtstamp_config hw_tstamp_config; }; struct netdevsim *
Changing netdevsim driver to use the newly introduced ndo_hwtstamp_get/set callback functions instead of implementing full-blown SIOCGHWTSTAMP/ SIOCSHWTSTAMP IOCTLs handling logic. Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Maxim Georgiev <glipus@gmail.com> --- drivers/net/netdevsim/netdev.c | 24 ++++++++++++++++++++++++ drivers/net/netdevsim/netdevsim.h | 1 + 2 files changed, 25 insertions(+)