* [RFC PATCH v3 4/5] Convert netdevsim driver to use ndo_hwtstamp_get/set for hw timestamp requests
@ 2023-04-05 6:33 Maxim Georgiev
2023-04-05 12:18 ` Vladimir Oltean
0 siblings, 1 reply; 3+ messages in thread
From: Maxim Georgiev @ 2023-04-05 6:33 UTC (permalink / raw)
To: kory.maincent
Cc: kuba, netdev, glipus, maxime.chevallier, vladimir.oltean,
vadim.fedorenko, richardcochran, gerhard
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(+)
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 *
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH v3 4/5] Convert netdevsim driver to use ndo_hwtstamp_get/set for hw timestamp requests
2023-04-05 6:33 [RFC PATCH v3 4/5] Convert netdevsim driver to use ndo_hwtstamp_get/set for hw timestamp requests Maxim Georgiev
@ 2023-04-05 12:18 ` Vladimir Oltean
2023-04-05 16:35 ` Max Georgiev
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Oltean @ 2023-04-05 12:18 UTC (permalink / raw)
To: Maxim Georgiev
Cc: kory.maincent, kuba, netdev, maxime.chevallier, vadim.fedorenko,
richardcochran, gerhard
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH v3 4/5] Convert netdevsim driver to use ndo_hwtstamp_get/set for hw timestamp requests
2023-04-05 12:18 ` Vladimir Oltean
@ 2023-04-05 16:35 ` Max Georgiev
0 siblings, 0 replies; 3+ messages in thread
From: Max Georgiev @ 2023-04-05 16:35 UTC (permalink / raw)
To: Vladimir Oltean
Cc: kory.maincent, kuba, netdev, maxime.chevallier, vadim.fedorenko,
richardcochran, gerhard
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-05 16:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05 6:33 [RFC PATCH v3 4/5] Convert netdevsim driver to use ndo_hwtstamp_get/set for hw timestamp requests Maxim Georgiev
2023-04-05 12:18 ` Vladimir Oltean
2023-04-05 16:35 ` Max Georgiev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).