Martin KaFai Lau says: ==================== pull-request: bpf-next 2025-02-20 We've added 19 non-merge commits during the last 8 day(s) which contain a total of 35 files changed, 1126 insertions(+), 53 deletions(-). The main changes are: 1) Add TCP_RTO_MAX_MS support to bpf_set/getsockopt, from Jason Xing 2) Add network TX timestamping support to BPF sock_ops, from Jason Xing 3) Add TX metadata Launch Time support, from Song Yoong Siang * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: igc: Add launch time support to XDP ZC igc: Refactor empty frame insertion for launch time support net: stmmac: Add launch time support to XDP ZC selftests/bpf: Add launch time request to xdp_hw_metadata xsk: Add launch time hardware offload support to XDP Tx metadata selftests/bpf: Add simple bpf tests in the tx path for timestamping feature bpf: Support selective sampling for bpf timestamping bpf: Add BPF_SOCK_OPS_TSTAMP_SENDMSG_CB callback bpf: Add BPF_SOCK_OPS_TSTAMP_ACK_CB callback bpf: Add BPF_SOCK_OPS_TSTAMP_SND_HW_CB callback bpf: Add BPF_SOCK_OPS_TSTAMP_SND_SW_CB callback bpf: Add BPF_SOCK_OPS_TSTAMP_SCHED_CB callback net-timestamp: Prepare for isolating two modes of SO_TIMESTAMPING bpf: Disable unsafe helpers in TX timestamping callbacks bpf: Prevent unsafe access to the sock fields in the BPF timestamping callback bpf: Prepare the sock_ops ctx and call bpf prog for TX timestamping bpf: Add networking timestamping support to bpf_get/setsockopt() selftests/bpf: Add rto max for bpf_setsockopt test bpf: Support TCP_RTO_MAX_MS for bpf_setsockopt ====================
Showing the changes to include/uapi/linux (3 of 35 files). Show all
Unified · Split
| @@ -6913,6 +6913,12 @@ enum { · 6912 unmodified lines | |||
| 6913 | BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7F, | 6913 | BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7F, |
| 6914 | }; | 6914 | }; |
| 6915 | 6915 | ||
| 6916 | enum { | ||
| 6917 | SK_BPF_CB_TX_TIMESTAMPING = 1<<0, | ||
| 6918 | SK_BPF_CB_MASK = (SK_BPF_CB_TX_TIMESTAMPING - 1) | | ||
| 6919 | SK_BPF_CB_TX_TIMESTAMPING | ||
| 6920 | }; | ||
| 6921 | |||
| 6916 | /* List of known BPF sock_ops operators. | 6922 | /* List of known BPF sock_ops operators. |
| 6917 | * New entries can only be added at the end | 6923 | * New entries can only be added at the end |
| 6918 | */ | 6924 | */ |
| @@ -7025,6 +7031,29 @@ enum { · 106 unmodified lines | |||
| 7025 | * by the kernel or the | 7031 | * by the kernel or the |
| 7026 | * earlier bpf-progs. | 7032 | * earlier bpf-progs. |
| 7027 | */ | 7033 | */ |
| 7034 | BPF_SOCK_OPS_TSTAMP_SCHED_CB, /* Called when skb is passing | ||
| 7035 | * through dev layer when | ||
| 7036 | * SK_BPF_CB_TX_TIMESTAMPING | ||
| 7037 | * feature is on. | ||
| 7038 | */ | ||
| 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 | */ | ||
| 7043 | BPF_SOCK_OPS_TSTAMP_SND_HW_CB, /* Called in hardware phase when | ||
| 7044 | * SK_BPF_CB_TX_TIMESTAMPING feature | ||
| 7045 | * is on. | ||
| 7046 | */ | ||
| 7047 | BPF_SOCK_OPS_TSTAMP_ACK_CB, /* Called when all the skbs in the | ||
| 7048 | * same sendmsg call are acked | ||
| 7049 | * when SK_BPF_CB_TX_TIMESTAMPING | ||
| 7050 | * feature is on. | ||
| 7051 | */ | ||
| 7052 | BPF_SOCK_OPS_TSTAMP_SENDMSG_CB, /* Called when every sendmsg syscall | ||
| 7053 | * is triggered. It's used to correlate | ||
| 7054 | * sendmsg timestamp with corresponding | ||
| 7055 | * tskey. | ||
| 7056 | */ | ||
| 7028 | }; | 7057 | }; |
| 7029 | 7058 | ||
| 7030 | /* List of TCP states. There is a build check in net/ipv4/tcp.c to detect | 7059 | /* List of TCP states. There is a build check in net/ipv4/tcp.c to detect |
| @@ -7091,6 +7120,7 @@ enum { · 60 unmodified lines | |||
| 7091 | TCP_BPF_SYN_IP = 1006, /* Copy the IP[46] and TCP header */ | 7120 | TCP_BPF_SYN_IP = 1006, /* Copy the IP[46] and TCP header */ |
| 7092 | TCP_BPF_SYN_MAC = 1007, /* Copy the MAC, IP[46], and TCP header */ | 7121 | TCP_BPF_SYN_MAC = 1007, /* Copy the MAC, IP[46], and TCP header */ |
| 7093 | TCP_BPF_SOCK_OPS_CB_FLAGS = 1008, /* Get or Set TCP sock ops flags */ | 7122 | TCP_BPF_SOCK_OPS_CB_FLAGS = 1008, /* Get or Set TCP sock ops flags */ |
| 7123 | SK_BPF_CB_FLAGS = 1009, /* Get or set sock ops flags in socket */ | ||
| 7094 | }; | 7124 | }; |
| 7095 | 7125 | ||
| 7096 | enum { | 7126 | enum { |
| @@ -127,6 +127,12 @@ struct xdp_options { · 126 unmodified lines | |||
| 127 | */ | 127 | */ |
| 128 | #define XDP_TXMD_FLAGS_CHECKSUM (1 << 1) | 128 | #define XDP_TXMD_FLAGS_CHECKSUM (1 << 1) |
| 129 | 129 | ||
| 130 | /* Request launch time hardware offload. The device will schedule the packet for | ||
| 131 | * transmission at a pre-determined time called launch time. The value of | ||
| 132 | * launch time is communicated via launch_time field of struct xsk_tx_metadata. | ||
| 133 | */ | ||
| 134 | #define XDP_TXMD_FLAGS_LAUNCH_TIME (1 << 2) | ||
| 135 | |||
| 130 | /* AF_XDP offloads request. 'request' union member is consumed by the driver | 136 | /* AF_XDP offloads request. 'request' union member is consumed by the driver |
| 131 | * when the packet is being transmitted. 'completion' union member is | 137 | * when the packet is being transmitted. 'completion' union member is |
| 132 | * filled by the driver when the transmit completion arrives. | 138 | * filled by the driver when the transmit completion arrives. |
| @@ -142,6 +148,10 @@ struct xsk_tx_metadata { · 9 unmodified lines | |||
| 142 | __u16 csum_start; | 148 | __u16 csum_start; |
| 143 | /* Offset from csum_start where checksum should be stored. */ | 149 | /* Offset from csum_start where checksum should be stored. */ |
| 144 | __u16 csum_offset; | 150 | __u16 csum_offset; |
| 151 | |||
| 152 | /* XDP_TXMD_FLAGS_LAUNCH_TIME */ | ||
| 153 | /* Launch time in nanosecond against the PTP HW Clock */ | ||
| 154 | __u64 launch_time; | ||
| 145 | } request; | 155 | } request; |
| 146 | 156 | ||
| 147 | struct { | 157 | struct { |
| @@ -59,10 +59,13 @@ enum netdev_xdp_rx_metadata { · 58 unmodified lines | |||
| 59 | * by the driver. | 59 | * by the driver. |
| 60 | * @NETDEV_XSK_FLAGS_TX_CHECKSUM: L3 checksum HW offload is supported by the | 60 | * @NETDEV_XSK_FLAGS_TX_CHECKSUM: L3 checksum HW offload is supported by the |
| 61 | * driver. | 61 | * driver. |
| 62 | * @NETDEV_XSK_FLAGS_TX_LAUNCH_TIME_FIFO: Launch time HW offload is supported | ||
| 63 | * by the driver. | ||
| 62 | */ | 64 | */ |
| 63 | enum netdev_xsk_flags { | 65 | enum netdev_xsk_flags { |
| 64 | NETDEV_XSK_FLAGS_TX_TIMESTAMP = 1, | 66 | NETDEV_XSK_FLAGS_TX_TIMESTAMP = 1, |
| 65 | NETDEV_XSK_FLAGS_TX_CHECKSUM = 2, | 67 | NETDEV_XSK_FLAGS_TX_CHECKSUM = 2, |
| 68 | NETDEV_XSK_FLAGS_TX_LAUNCH_TIME_FIFO = 4, | ||
| 66 | }; | 69 | }; |
| 67 | 70 | ||
| 68 | enum netdev_queue_type { | 71 | enum netdev_queue_type { |