diff options
| author | Vladimir Oltean <[email protected]> | 2023-08-07 19:33:20 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2023-08-09 22:59:21 +0000 |
| commit | b63e78fca889e07931ec8f259701718a24e5052e (patch) | |
| tree | d486889627adb4441379f617eca900ba55e8a140 /drivers/net/netdevsim/netdev.c | |
| parent | net: ptp: create a mock-up PTP Hardware Clock driver (diff) | |
| download | kernel-b63e78fca889e07931ec8f259701718a24e5052e.tar.gz kernel-b63e78fca889e07931ec8f259701718a24e5052e.zip | |
net: netdevsim: use mock PHC driver
I'd like to make netdevsim offload tc-taprio, but currently, this Qdisc
emits a ETHTOOL_GET_TS_INFO call to the driver to make sure that it has
a PTP clock, so that it is reasonably capable of offloading the schedule.
By using the mock PHC driver, that becomes possible.
Hardware timestamping is not necessary, and netdevsim does not support
packet I/O anyway.
Signed-off-by: Vladimir Oltean <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
| -rw-r--r-- | drivers/net/netdevsim/netdev.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 0c8daeb0d62b..2a4a0c4065cf 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -291,13 +291,19 @@ static void nsim_setup(struct net_device *dev) static int nsim_init_netdevsim(struct netdevsim *ns) { + struct mock_phc *phc; int err; + phc = mock_phc_create(&ns->nsim_bus_dev->dev); + if (IS_ERR(phc)) + return PTR_ERR(phc); + + ns->phc = phc; ns->netdev->netdev_ops = &nsim_netdev_ops; err = nsim_udp_tunnels_info_create(ns->nsim_dev, ns->netdev); if (err) - return err; + goto err_phc_destroy; rtnl_lock(); err = nsim_bpf_init(ns); @@ -320,6 +326,8 @@ err_ipsec_teardown: err_utn_destroy: rtnl_unlock(); nsim_udp_tunnels_info_destroy(ns->netdev); +err_phc_destroy: + mock_phc_destroy(ns->phc); return err; } @@ -383,6 +391,7 @@ void nsim_destroy(struct netdevsim *ns) rtnl_unlock(); if (nsim_dev_port_is_pf(ns->nsim_dev_port)) nsim_udp_tunnels_info_destroy(dev); + mock_phc_destroy(ns->phc); free_netdev(dev); } |
