History

bpf: Add BPF_SOCK_OPS_TSTAMP_SND_SW_CB callback

Support sw SCM_TSTAMP_SND case for bpf timestamping. Add a new sock_ops callback, BPF_SOCK_OPS_TSTAMP_SND_SW_CB. This callback will occur at the same timestamping point as the user space's software SCM_TSTAMP_SND. The BPF program can use it to get the same SCM_TSTAMP_SND timestamp without modifying the user-space application. Based on this patch, BPF program will get the software timestamp when the driver is ready to send the skb. In the sebsequent patch, the hardware timestamp will be supported.

Jason Xing committed 1 year ago

Commit ecebb171 parent 6b98ec74 files · +17 −2Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/bpf.h+4−0
@@ -7036,6 +7036,10 @@ enum { · 7035 unmodified lines
70367036 * SK_BPF_CB_TX_TIMESTAMPING
70377037 * feature is on.
70387038 */
7039+ BPF_SOCK_OPS_TSTAMP_SND_SW_CB, /* Called when skb is about to send
7040+ * to the nic when SK_BPF_CB_TX_TIMESTAMPING
7041+ * feature is on.
7042+ */
70397043 };
70407044
70417045 /* List of TCP states. There is a build check in net/ipv4/tcp.c to detect