[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250112113748.73504-11-kerneljasonxing@gmail.com>
Date: Sun, 12 Jan 2025 19:37:43 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
dsahern@...nel.org,
willemdebruijn.kernel@...il.com,
willemb@...gle.com,
ast@...nel.org,
daniel@...earbox.net,
andrii@...nel.org,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
john.fastabend@...il.com,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org,
horms@...nel.org
Cc: bpf@...r.kernel.org,
netdev@...r.kernel.org,
Jason Xing <kerneljasonxing@...il.com>
Subject: [PATCH net-next v5 10/15] net-timestamp: support hw SCM_TSTAMP_SND for bpf extension
To avoid changing so many callers using SKBTX_HW_TSTAMP from drivers,
use this simple modification like this patch does to support printing
hardware timestamp.
Signed-off-by: Jason Xing <kerneljasonxing@...il.com>
---
include/linux/skbuff.h | 4 +++-
net/core/skbuff.c | 2 +-
net/socket.c | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4f38c17c67a7..d3ef8db94a94 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -470,7 +470,7 @@ struct skb_shared_hwtstamps {
/* Definitions for tx_flags in struct skb_shared_info */
enum {
/* generate hardware time stamp */
- SKBTX_HW_TSTAMP = 1 << 0,
+ __SKBTX_HW_TSTAMP = 1 << 0,
/* generate software time stamp when queueing packet to NIC */
SKBTX_SW_TSTAMP = 1 << 1,
@@ -494,6 +494,8 @@ enum {
SKBTX_BPF = 1 << 7,
};
+#define SKBTX_HW_TSTAMP (__SKBTX_HW_TSTAMP | SKBTX_BPF)
+
#define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | \
SKBTX_SCHED_TSTAMP | \
SKBTX_BPF)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 17b9d8061f04..4bc7a424eb8a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5551,7 +5551,7 @@ static bool skb_enable_app_tstamp(struct sk_buff *skb, int tstype, bool sw)
if (sw)
flag = SKBTX_SW_TSTAMP;
else
- flag = SKBTX_HW_TSTAMP;
+ flag = __SKBTX_HW_TSTAMP;
break;
case SCM_TSTAMP_ACK:
if (TCP_SKB_CB(skb)->txstamp_ack)
diff --git a/net/socket.c b/net/socket.c
index 4afe31656a2b..57343341bfb6 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -676,7 +676,7 @@ void __sock_tx_timestamp(__u32 tsflags, __u8 *tx_flags)
u8 flags = *tx_flags;
if (tsflags & SOF_TIMESTAMPING_TX_HARDWARE) {
- flags |= SKBTX_HW_TSTAMP;
+ flags |= __SKBTX_HW_TSTAMP;
/* PTP hardware clocks can provide a free running cycle counter
* as a time base for virtual clocks. Tell driver to use the
--
2.43.5
Powered by blists - more mailing lists