@@ -7019,6 +7019,11 @@ enum {
* by the kernel or the
* earlier bpf-progs.
*/
+ BPF_SOCK_OPS_TS_SCHED_OPT_CB, /* Called when skb is passing through
+ * dev layer when SO_TIMESTAMPING
+ * feature is on. It indicates the
+ * recorded timestamp.
+ */
};
/* List of TCP states. There is a build check in net/ipv4/tcp.c to detect
@@ -5548,8 +5548,22 @@ static bool bpf_skb_tstamp_tx(struct sock *sk, u32 scm_flag,
return false;
tp = tcp_sk(sk);
- if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_TX_TIMESTAMPING_OPT_CB_FLAG))
+ if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_TX_TIMESTAMPING_OPT_CB_FLAG)) {
+ struct timespec64 tstamp;
+ u32 cb_flag;
+
+ switch (scm_flag) {
+ case SCM_TSTAMP_SCHED:
+ cb_flag = BPF_SOCK_OPS_TS_SCHED_OPT_CB;
+ break;
+ default:
+ return true;
+ }
+
+ tstamp = ktime_to_timespec64(ktime_get_real());
+ tcp_call_bpf_2arg(sk, cb_flag, tstamp.tv_sec, tstamp.tv_nsec);
return true;
+ }
return false;
}
@@ -7018,6 +7018,11 @@ enum {
* by the kernel or the
* earlier bpf-progs.
*/
+ BPF_SOCK_OPS_TS_SCHED_OPT_CB, /* Called when skb is passing through
+ * dev layer when SO_TIMESTAMPING
+ * feature is on. It indicates the
+ * recorded timestamp.
+ */
};
/* List of TCP states. There is a build check in net/ipv4/tcp.c to detect