* [PATCH] veth: add software timestamping
@ 2018-08-29 15:24 Michael Walle
2018-09-01 5:57 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Michael Walle @ 2018-08-29 15:24 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, David S . Miller, Michael Walle
Provide a software TX timestamp as well as the ethtool query interface
and report the software timestamp capabilities.
Tested with "ethtool -T" and two linuxptp instances each bound to a
tunnel endpoint.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/net/veth.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 8d679c8b7f25..bc8faf13a731 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -24,6 +24,7 @@
#include <linux/filter.h>
#include <linux/ptr_ring.h>
#include <linux/bpf_trace.h>
+#include <linux/net_tstamp.h>
#define DRV_NAME "veth"
#define DRV_VERSION "1.0"
@@ -114,6 +115,18 @@ static void veth_get_ethtool_stats(struct net_device *dev,
data[0] = peer ? peer->ifindex : 0;
}
+static int veth_get_ts_info(struct net_device *dev,
+ struct ethtool_ts_info *info)
+{
+ info->so_timestamping =
+ SOF_TIMESTAMPING_TX_SOFTWARE |
+ SOF_TIMESTAMPING_RX_SOFTWARE |
+ SOF_TIMESTAMPING_SOFTWARE;
+ info->phc_index = -1;
+
+ return 0;
+}
+
static const struct ethtool_ops veth_ethtool_ops = {
.get_drvinfo = veth_get_drvinfo,
.get_link = ethtool_op_get_link,
@@ -121,6 +134,7 @@ static const struct ethtool_ops veth_ethtool_ops = {
.get_sset_count = veth_get_sset_count,
.get_ethtool_stats = veth_get_ethtool_stats,
.get_link_ksettings = veth_get_link_ksettings,
+ .get_ts_info = veth_get_ts_info,
};
/* general routines */
@@ -201,6 +215,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
skb_record_rx_queue(skb, rxq);
}
+ skb_tx_timestamp(skb);
if (likely(veth_forward_skb(rcv, skb, rq, rcv_xdp) == NET_RX_SUCCESS)) {
struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] veth: add software timestamping
2018-08-29 15:24 [PATCH] veth: add software timestamping Michael Walle
@ 2018-09-01 5:57 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-09-01 5:57 UTC (permalink / raw)
To: michael; +Cc: netdev, linux-kernel
From: Michael Walle <michael@walle.cc>
Date: Wed, 29 Aug 2018 17:24:11 +0200
> Provide a software TX timestamp as well as the ethtool query interface
> and report the software timestamp capabilities.
>
> Tested with "ethtool -T" and two linuxptp instances each bound to a
> tunnel endpoint.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
Applied to net-next.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-01 5:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29 15:24 [PATCH] veth: add software timestamping Michael Walle
2018-09-01 5:57 ` David Miller
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).