@@ -143,12 +143,6 @@ enum bpf_attach_type {
143
143
144
144
#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
145
145
146
- enum bpf_sockmap_flags {
147
- BPF_SOCKMAP_UNSPEC ,
148
- BPF_SOCKMAP_STRPARSER ,
149
- __MAX_BPF_SOCKMAP_FLAG
150
- };
151
-
152
146
/* If BPF_F_ALLOW_OVERRIDE flag is used in BPF_PROG_ATTACH command
153
147
* to the given target_fd cgroup the descendent cgroup will be able to
154
148
* override effective bpf program that was inherited from this cgroup
@@ -368,9 +362,20 @@ union bpf_attr {
368
362
* int bpf_redirect(ifindex, flags)
369
363
* redirect to another netdev
370
364
* @ifindex: ifindex of the net device
371
- * @flags: bit 0 - if set, redirect to ingress instead of egress
372
- * other bits - reserved
373
- * Return: TC_ACT_REDIRECT
365
+ * @flags:
366
+ * cls_bpf:
367
+ * bit 0 - if set, redirect to ingress instead of egress
368
+ * other bits - reserved
369
+ * xdp_bpf:
370
+ * all bits - reserved
371
+ * Return: cls_bpf: TC_ACT_REDIRECT on success or TC_ACT_SHOT on error
372
+ * xdp_bfp: XDP_REDIRECT on success or XDP_ABORT on error
373
+ * int bpf_redirect_map(map, key, flags)
374
+ * redirect to endpoint in map
375
+ * @map: pointer to dev map
376
+ * @key: index in map to lookup
377
+ * @flags: --
378
+ * Return: XDP_REDIRECT on success or XDP_ABORT on error
374
379
*
375
380
* u32 bpf_get_route_realm(skb)
376
381
* retrieve a dst's tclassid
@@ -577,6 +582,12 @@ union bpf_attr {
577
582
* @map: pointer to sockmap to update
578
583
* @key: key to insert/update sock in map
579
584
* @flags: same flags as map update elem
585
+ *
586
+ * int bpf_xdp_adjust_meta(xdp_md, delta)
587
+ * Adjust the xdp_md.data_meta by delta
588
+ * @xdp_md: pointer to xdp_md
589
+ * @delta: An positive/negative integer to be added to xdp_md.data_meta
590
+ * Return: 0 on success or negative on error
580
591
*/
581
592
#define __BPF_FUNC_MAPPER (FN ) \
582
593
FN(unspec), \
@@ -632,7 +643,8 @@ union bpf_attr {
632
643
FN(skb_adjust_room), \
633
644
FN(redirect_map), \
634
645
FN(sk_redirect_map), \
635
- FN(sock_map_update),
646
+ FN(sock_map_update), \
647
+ FN(xdp_adjust_meta),
636
648
637
649
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
638
650
* function eBPF program intends to call
@@ -710,14 +722,17 @@ struct __sk_buff {
710
722
__u32 data_end ;
711
723
__u32 napi_id ;
712
724
713
- /* accessed by BPF_PROG_TYPE_sk_skb types */
725
+ /* Accessed by BPF_PROG_TYPE_sk_skb types from here to ... */
714
726
__u32 family ;
715
727
__u32 remote_ip4 ; /* Stored in network byte order */
716
728
__u32 local_ip4 ; /* Stored in network byte order */
717
729
__u32 remote_ip6 [4 ]; /* Stored in network byte order */
718
730
__u32 local_ip6 [4 ]; /* Stored in network byte order */
719
731
__u32 remote_port ; /* Stored in network byte order */
720
732
__u32 local_port ; /* stored in host byte order */
733
+ /* ... here. */
734
+
735
+ __u32 data_meta ;
721
736
};
722
737
723
738
struct bpf_tunnel_key {
@@ -753,20 +768,23 @@ struct bpf_sock {
753
768
__u32 family ;
754
769
__u32 type ;
755
770
__u32 protocol ;
771
+ __u32 mark ;
772
+ __u32 priority ;
756
773
};
757
774
758
775
#define XDP_PACKET_HEADROOM 256
759
776
760
777
/* User return codes for XDP prog type.
761
778
* A valid XDP program must return one of these defined values. All other
762
- * return codes are reserved for future use. Unknown return codes will result
763
- * in packet drop .
779
+ * return codes are reserved for future use. Unknown return codes will
780
+ * result in packet drops and a warning via bpf_warn_invalid_xdp_action() .
764
781
*/
765
782
enum xdp_action {
766
783
XDP_ABORTED = 0 ,
767
784
XDP_DROP ,
768
785
XDP_PASS ,
769
786
XDP_TX ,
787
+ XDP_REDIRECT ,
770
788
};
771
789
772
790
/* user accessible metadata for XDP packet hook
@@ -775,6 +793,7 @@ enum xdp_action {
775
793
struct xdp_md {
776
794
__u32 data ;
777
795
__u32 data_end ;
796
+ __u32 data_meta ;
778
797
};
779
798
780
799
enum sk_action {
0 commit comments