@@ -6900,8 +6900,11 @@ enum {
* options first before the BPF program does.
*/
BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = (1<<6),
+ /* Call bpf when the kernel is generating tx timestamps.
+ */
+ BPF_SOCK_OPS_TX_TIMESTAMPING_OPT_CB_FLAG = (1<<7),
/* Mask of all currently supported cb flags */
- BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7F,
+ BPF_SOCK_OPS_ALL_CB_FLAGS = 0xFF,
};
/* List of known BPF sock_ops operators.
@@ -5621,11 +5621,19 @@ static void skb_tstamp_tx_output(struct sk_buff *orig_skb,
static void bpf_skb_tstamp_tx_output(struct sock *sk, int tstype)
{
+ struct tcp_sock *tp;
u32 tsflags;
+ if (!sk_is_tcp(sk))
+ return;
+
tsflags = READ_ONCE(sk->sk_tsflags[BPFPROG_TS_REQUESTOR]);
if (!sk_tstamp_tx_flags(sk, tsflags, tstype))
return;
+
+ tp = tcp_sk(sk);
+ if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_TX_TIMESTAMPING_OPT_CB_FLAG))
+ return;
}
void __skb_tstamp_tx(struct sk_buff *orig_skb,
@@ -6899,8 +6899,11 @@ enum {
* options first before the BPF program does.
*/
BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = (1<<6),
+ /* Call bpf when the kernel is generating tx timestamps.
+ */
+ BPF_SOCK_OPS_TX_TIMESTAMPING_OPT_CB_FLAG = (1<<7),
/* Mask of all currently supported cb flags */
- BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7F,
+ BPF_SOCK_OPS_ALL_CB_FLAGS = 0xFF,
};
/* List of known BPF sock_ops operators.