@@ -218,6 +218,10 @@ enum bpf_attach_type {
218
218
219
219
#define BPF_OBJ_NAME_LEN 16U
220
220
221
+ /* Flags for accessing BPF object */
222
+ #define BPF_F_RDONLY (1U << 3)
223
+ #define BPF_F_WRONLY (1U << 4)
224
+
221
225
union bpf_attr {
222
226
struct { /* anonymous struct used by BPF_MAP_CREATE command */
223
227
__u32 map_type ; /* one of enum bpf_map_type */
@@ -260,6 +264,7 @@ union bpf_attr {
260
264
struct { /* anonymous struct used by BPF_OBJ_* commands */
261
265
__aligned_u64 pathname ;
262
266
__u32 bpf_fd ;
267
+ __u32 file_flags ;
263
268
};
264
269
265
270
struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
@@ -287,6 +292,7 @@ union bpf_attr {
287
292
__u32 map_id ;
288
293
};
289
294
__u32 next_id ;
295
+ __u32 open_flags ;
290
296
};
291
297
292
298
struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */
@@ -607,12 +613,22 @@ union bpf_attr {
607
613
* int bpf_setsockopt(bpf_socket, level, optname, optval, optlen)
608
614
* Calls setsockopt. Not all opts are available, only those with
609
615
* integer optvals plus TCP_CONGESTION.
610
- * Supported levels: SOL_SOCKET and IPROTO_TCP
616
+ * Supported levels: SOL_SOCKET and IPPROTO_TCP
611
617
* @bpf_socket: pointer to bpf_socket
612
- * @level: SOL_SOCKET or IPROTO_TCP
618
+ * @level: SOL_SOCKET or IPPROTO_TCP
613
619
* @optname: option name
614
620
* @optval: pointer to option value
615
- * @optlen: length of optval in byes
621
+ * @optlen: length of optval in bytes
622
+ * Return: 0 or negative error
623
+ *
624
+ * int bpf_getsockopt(bpf_socket, level, optname, optval, optlen)
625
+ * Calls getsockopt. Not all opts are available.
626
+ * Supported levels: IPPROTO_TCP
627
+ * @bpf_socket: pointer to bpf_socket
628
+ * @level: IPPROTO_TCP
629
+ * @optname: option name
630
+ * @optval: pointer to option value
631
+ * @optlen: length of optval in bytes
616
632
* Return: 0 or negative error
617
633
*
618
634
* int bpf_skb_adjust_room(skb, len_diff, mode, flags)
@@ -623,10 +639,9 @@ union bpf_attr {
623
639
* @flags: reserved for future use
624
640
* Return: 0 on success or negative error code
625
641
*
626
- * int bpf_sk_redirect_map(skb, map, key, flags)
642
+ * int bpf_sk_redirect_map(map, key, flags)
627
643
* Redirect skb to a sock in map using key as a lookup key for the
628
644
* sock in map.
629
- * @skb: pointer to skb
630
645
* @map: pointer to sockmap
631
646
* @key: key to lookup sock in map
632
647
* @flags: reserved for future use
@@ -643,6 +658,21 @@ union bpf_attr {
643
658
* @xdp_md: pointer to xdp_md
644
659
* @delta: An positive/negative integer to be added to xdp_md.data_meta
645
660
* Return: 0 on success or negative on error
661
+ *
662
+ * int bpf_perf_event_read_value(map, flags, buf, buf_size)
663
+ * read perf event counter value and perf event enabled/running time
664
+ * @map: pointer to perf_event_array map
665
+ * @flags: index of event in the map or bitmask flags
666
+ * @buf: buf to fill
667
+ * @buf_size: size of the buf
668
+ * Return: 0 on success or negative error code
669
+ *
670
+ * int bpf_perf_prog_read_value(ctx, buf, buf_size)
671
+ * read perf prog attached perf event counter and enabled/running time
672
+ * @ctx: pointer to ctx
673
+ * @buf: buf to fill
674
+ * @buf_size: size of the buf
675
+ * Return : 0 on success or negative error code
646
676
*/
647
677
#define __BPF_FUNC_MAPPER (FN ) \
648
678
FN(unspec), \
@@ -701,7 +731,8 @@ union bpf_attr {
701
731
FN(sock_map_update), \
702
732
FN(xdp_adjust_meta), \
703
733
FN(perf_event_read_value), \
704
- FN(perf_prog_read_value),
734
+ FN(perf_prog_read_value), \
735
+ FN(getsockopt),
705
736
706
737
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
707
738
* function eBPF program intends to call
@@ -745,7 +776,9 @@ enum bpf_func_id {
745
776
#define BPF_F_ZERO_CSUM_TX (1ULL << 1)
746
777
#define BPF_F_DONT_FRAGMENT (1ULL << 2)
747
778
748
- /* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */
779
+ /* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and
780
+ * BPF_FUNC_perf_event_read_value flags.
781
+ */
749
782
#define BPF_F_INDEX_MASK 0xffffffffULL
750
783
#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK
751
784
/* BPF_FUNC_perf_event_output for sk_buff input context. */
@@ -873,7 +906,7 @@ struct bpf_prog_info {
873
906
__u32 created_by_uid ;
874
907
__u32 nr_map_ids ;
875
908
__aligned_u64 map_ids ;
876
- char name [BPF_OBJ_NAME_LEN ];
909
+ char name [BPF_OBJ_NAME_LEN ];
877
910
} __attribute__((aligned (8 )));
878
911
879
912
struct bpf_map_info {
@@ -933,9 +966,22 @@ enum {
933
966
BPF_SOCK_OPS_NEEDS_ECN , /* If connection's congestion control
934
967
* needs ECN
935
968
*/
969
+ BPF_SOCK_OPS_BASE_RTT , /* Get base RTT. The correct value is
970
+ * based on the path and may be
971
+ * dependent on the congestion control
972
+ * algorithm. In general it indicates
973
+ * a congestion threshold. RTTs above
974
+ * this indicate congestion
975
+ */
936
976
};
937
977
938
978
#define TCP_BPF_IW 1001 /* Set TCP initial congestion window */
939
979
#define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */
940
980
981
+ struct bpf_perf_event_value {
982
+ __u64 counter ;
983
+ __u64 enabled ;
984
+ __u64 running ;
985
+ };
986
+
941
987
#endif /* _UAPI__LINUX_BPF_H__ */
0 commit comments