Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Daniel Borkmann says:

====================
pull-request: bpf-next 2025-01-07

We've added 7 non-merge commits during the last 32 day(s) which contain
a total of 11 files changed, 190 insertions(+), 103 deletions(-).

The main changes are:

1) Migrate the test_xdp_meta.sh BPF selftest into test_progs
framework, from Bastien Curutchet.

2) Add ability to configure head/tailroom for netkit devices,
from Daniel Borkmann.

3) Fixes and improvements to the xdp_hw_metadata selftest,
from Song Yoong Siang.

* tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next:
selftests/bpf: Extend netkit tests to validate set {head,tail}room
netkit: Add add netkit {head,tail}room to rt_link.yaml
netkit: Allow for configuring needed_{head,tail}room
selftests/bpf: Migrate test_xdp_meta.sh into xdp_context_test_run.c
selftests/bpf: test_xdp_meta: Rename BPF sections
selftests/bpf: Enable Tx hwtstamp in xdp_hw_metadata
selftests/bpf: Actuate tx_metadata_len in xdp_hw_metadata
====================

Link: https://patch.msgid.link/20250107130908.143644-1-daniel@iogearbox.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+190 -103
+6
Documentation/netlink/specs/rt_link.yaml
··· 2169 2169 name: peer-scrub 2170 2170 type: u32 2171 2171 enum: netkit-scrub 2172 + - 2173 + name: headroom 2174 + type: u16 2175 + - 2176 + name: tailroom 2177 + type: u16 2172 2178 2173 2179 sub-messages: 2174 2180 -
+43 -23
drivers/net/netkit.c
··· 338 338 enum netkit_scrub scrub_peer = NETKIT_SCRUB_DEFAULT; 339 339 enum netkit_mode mode = NETKIT_L3; 340 340 unsigned char ifname_assign_type; 341 + u16 headroom = 0, tailroom = 0; 341 342 struct ifinfomsg *ifmp = NULL; 342 343 struct net_device *peer; 343 344 char ifname[IFNAMSIZ]; ··· 372 371 if (err < 0) 373 372 return err; 374 373 } 374 + if (data[IFLA_NETKIT_HEADROOM]) 375 + headroom = nla_get_u16(data[IFLA_NETKIT_HEADROOM]); 376 + if (data[IFLA_NETKIT_TAILROOM]) 377 + tailroom = nla_get_u16(data[IFLA_NETKIT_TAILROOM]); 375 378 } 376 379 377 380 if (ifmp && tbp[IFLA_IFNAME]) { ··· 395 390 return PTR_ERR(peer); 396 391 397 392 netif_inherit_tso_max(peer, dev); 393 + if (headroom) { 394 + peer->needed_headroom = headroom; 395 + dev->needed_headroom = headroom; 396 + } 397 + if (tailroom) { 398 + peer->needed_tailroom = tailroom; 399 + dev->needed_tailroom = tailroom; 400 + } 398 401 399 402 if (mode == NETKIT_L2 && !(ifmp && tbp[IFLA_ADDRESS])) 400 403 eth_hw_addr_random(peer); ··· 414 401 nk->policy = policy_peer; 415 402 nk->scrub = scrub_peer; 416 403 nk->mode = mode; 404 + nk->headroom = headroom; 417 405 bpf_mprog_bundle_init(&nk->bundle); 418 406 419 407 err = register_netdevice(peer); ··· 440 426 nk->policy = policy_prim; 441 427 nk->scrub = scrub_prim; 442 428 nk->mode = mode; 429 + nk->headroom = headroom; 443 430 bpf_mprog_bundle_init(&nk->bundle); 444 431 445 432 err = register_netdevice(dev); ··· 865 850 struct net_device *peer = rtnl_dereference(nk->peer); 866 851 enum netkit_action policy; 867 852 struct nlattr *attr; 868 - int err; 853 + int err, i; 854 + static const struct { 855 + u32 attr; 856 + char *name; 857 + } fixed_params[] = { 858 + { IFLA_NETKIT_MODE, "operating mode" }, 859 + { IFLA_NETKIT_SCRUB, "scrubbing" }, 860 + { IFLA_NETKIT_PEER_SCRUB, "peer scrubbing" }, 861 + { IFLA_NETKIT_PEER_INFO, "peer info" }, 862 + { IFLA_NETKIT_HEADROOM, "headroom" }, 863 + { IFLA_NETKIT_TAILROOM, "tailroom" }, 864 + }; 869 865 870 866 if (!nk->primary) { 871 867 NL_SET_ERR_MSG(extack, ··· 884 858 return -EACCES; 885 859 } 886 860 887 - if (data[IFLA_NETKIT_MODE]) { 888 - NL_SET_ERR_MSG_ATTR(extack, data[IFLA_NETKIT_MODE], 889 - "netkit link operating mode cannot be changed after device creation"); 890 - return -EACCES; 891 - } 892 - 893 - if (data[IFLA_NETKIT_SCRUB]) { 894 - NL_SET_ERR_MSG_ATTR(extack, data[IFLA_NETKIT_SCRUB], 895 - "netkit scrubbing cannot be changed after device creation"); 896 - return -EACCES; 897 - } 898 - 899 - if (data[IFLA_NETKIT_PEER_SCRUB]) { 900 - NL_SET_ERR_MSG_ATTR(extack, data[IFLA_NETKIT_PEER_SCRUB], 901 - "netkit scrubbing cannot be changed after device creation"); 902 - return -EACCES; 903 - } 904 - 905 - if (data[IFLA_NETKIT_PEER_INFO]) { 906 - NL_SET_ERR_MSG_ATTR(extack, data[IFLA_NETKIT_PEER_INFO], 907 - "netkit peer info cannot be changed after device creation"); 908 - return -EINVAL; 861 + for (i = 0; i < ARRAY_SIZE(fixed_params); i++) { 862 + attr = data[fixed_params[i].attr]; 863 + if (attr) { 864 + NL_SET_ERR_MSG_ATTR_FMT(extack, attr, 865 + "netkit link %s cannot be changed after device creation", 866 + fixed_params[i].name); 867 + return -EACCES; 868 + } 909 869 } 910 870 911 871 if (data[IFLA_NETKIT_POLICY]) { ··· 926 914 nla_total_size(sizeof(u32)) + /* IFLA_NETKIT_PEER_SCRUB */ 927 915 nla_total_size(sizeof(u32)) + /* IFLA_NETKIT_MODE */ 928 916 nla_total_size(sizeof(u8)) + /* IFLA_NETKIT_PRIMARY */ 917 + nla_total_size(sizeof(u16)) + /* IFLA_NETKIT_HEADROOM */ 918 + nla_total_size(sizeof(u16)) + /* IFLA_NETKIT_TAILROOM */ 929 919 0; 930 920 } 931 921 ··· 943 929 if (nla_put_u32(skb, IFLA_NETKIT_MODE, nk->mode)) 944 930 return -EMSGSIZE; 945 931 if (nla_put_u32(skb, IFLA_NETKIT_SCRUB, nk->scrub)) 932 + return -EMSGSIZE; 933 + if (nla_put_u16(skb, IFLA_NETKIT_HEADROOM, dev->needed_headroom)) 934 + return -EMSGSIZE; 935 + if (nla_put_u16(skb, IFLA_NETKIT_TAILROOM, dev->needed_tailroom)) 946 936 return -EMSGSIZE; 947 937 948 938 if (peer) { ··· 965 947 [IFLA_NETKIT_MODE] = NLA_POLICY_MAX(NLA_U32, NETKIT_L3), 966 948 [IFLA_NETKIT_POLICY] = { .type = NLA_U32 }, 967 949 [IFLA_NETKIT_PEER_POLICY] = { .type = NLA_U32 }, 950 + [IFLA_NETKIT_HEADROOM] = { .type = NLA_U16 }, 951 + [IFLA_NETKIT_TAILROOM] = { .type = NLA_U16 }, 968 952 [IFLA_NETKIT_SCRUB] = NLA_POLICY_MAX(NLA_U32, NETKIT_SCRUB_DEFAULT), 969 953 [IFLA_NETKIT_PEER_SCRUB] = NLA_POLICY_MAX(NLA_U32, NETKIT_SCRUB_DEFAULT), 970 954 [IFLA_NETKIT_PRIMARY] = { .type = NLA_REJECT,
+2
include/uapi/linux/if_link.h
··· 1315 1315 IFLA_NETKIT_MODE, 1316 1316 IFLA_NETKIT_SCRUB, 1317 1317 IFLA_NETKIT_PEER_SCRUB, 1318 + IFLA_NETKIT_HEADROOM, 1319 + IFLA_NETKIT_TAILROOM, 1318 1320 __IFLA_NETKIT_MAX, 1319 1321 }; 1320 1322 #define IFLA_NETKIT_MAX (__IFLA_NETKIT_MAX - 1)
+2
tools/include/uapi/linux/if_link.h
··· 1315 1315 IFLA_NETKIT_MODE, 1316 1316 IFLA_NETKIT_SCRUB, 1317 1317 IFLA_NETKIT_PEER_SCRUB, 1318 + IFLA_NETKIT_HEADROOM, 1319 + IFLA_NETKIT_TAILROOM, 1318 1320 __IFLA_NETKIT_MAX, 1319 1321 }; 1320 1322 #define IFLA_NETKIT_MAX (__IFLA_NETKIT_MAX - 1)
-1
tools/testing/selftests/bpf/Makefile
··· 129 129 TEST_PROGS := test_kmod.sh \ 130 130 test_xdp_redirect.sh \ 131 131 test_xdp_redirect_multi.sh \ 132 - test_xdp_meta.sh \ 133 132 test_tunnel.sh \ 134 133 test_lwt_seg6local.sh \ 135 134 test_lirc_mode2.sh \
+31 -18
tools/testing/selftests/bpf/prog_tests/tc_netkit.c
··· 14 14 #include "netlink_helpers.h" 15 15 #include "tc_helpers.h" 16 16 17 + #define NETKIT_HEADROOM 32 18 + #define NETKIT_TAILROOM 8 19 + 17 20 #define MARK 42 18 21 #define PRIO 0xeb9f 19 22 #define ICMP_ECHO 8 23 + 24 + #define FLAG_ADJUST_ROOM (1 << 0) 25 + #define FLAG_SAME_NETNS (1 << 1) 20 26 21 27 struct icmphdr { 22 28 __u8 type; ··· 41 35 }; 42 36 43 37 static int create_netkit(int mode, int policy, int peer_policy, int *ifindex, 44 - bool same_netns, int scrub, int peer_scrub) 38 + int scrub, int peer_scrub, __u32 flags) 45 39 { 46 40 struct rtnl_handle rth = { .fd = -1 }; 47 41 struct iplink_req req = {}; ··· 69 63 addattr32(&req.n, sizeof(req), IFLA_NETKIT_SCRUB, scrub); 70 64 addattr32(&req.n, sizeof(req), IFLA_NETKIT_PEER_SCRUB, peer_scrub); 71 65 addattr32(&req.n, sizeof(req), IFLA_NETKIT_MODE, mode); 66 + if (flags & FLAG_ADJUST_ROOM) { 67 + addattr16(&req.n, sizeof(req), IFLA_NETKIT_HEADROOM, NETKIT_HEADROOM); 68 + addattr16(&req.n, sizeof(req), IFLA_NETKIT_TAILROOM, NETKIT_TAILROOM); 69 + } 72 70 addattr_nest_end(&req.n, data); 73 71 addattr_nest_end(&req.n, linkinfo); 74 72 ··· 97 87 " addr ee:ff:bb:cc:aa:dd"), 98 88 "set hwaddress"); 99 89 } 100 - if (same_netns) { 90 + if (flags & FLAG_SAME_NETNS) { 101 91 ASSERT_OK(system("ip link set dev " netkit_peer " up"), 102 92 "up peer"); 103 93 ASSERT_OK(system("ip addr add dev " netkit_peer " 10.0.0.2/24"), ··· 194 184 int err, ifindex; 195 185 196 186 err = create_netkit(NETKIT_L2, NETKIT_PASS, NETKIT_PASS, 197 - &ifindex, false, NETKIT_SCRUB_DEFAULT, 198 - NETKIT_SCRUB_DEFAULT); 187 + &ifindex, NETKIT_SCRUB_DEFAULT, 188 + NETKIT_SCRUB_DEFAULT, 0); 199 189 if (err) 200 190 return; 201 191 ··· 309 299 int err, ifindex; 310 300 311 301 err = create_netkit(mode, NETKIT_PASS, NETKIT_PASS, 312 - &ifindex, false, NETKIT_SCRUB_DEFAULT, 313 - NETKIT_SCRUB_DEFAULT); 302 + &ifindex, NETKIT_SCRUB_DEFAULT, 303 + NETKIT_SCRUB_DEFAULT, 0); 314 304 if (err) 315 305 return; 316 306 ··· 438 428 int err, ifindex; 439 429 440 430 err = create_netkit(mode, NETKIT_PASS, NETKIT_PASS, 441 - &ifindex, false, NETKIT_SCRUB_DEFAULT, 442 - NETKIT_SCRUB_DEFAULT); 431 + &ifindex, NETKIT_SCRUB_DEFAULT, 432 + NETKIT_SCRUB_DEFAULT, 0); 443 433 if (err) 444 434 return; 445 435 ··· 553 543 int err, ifindex, ifindex2; 554 544 555 545 err = create_netkit(NETKIT_L3, NETKIT_PASS, NETKIT_PASS, 556 - &ifindex, true, NETKIT_SCRUB_DEFAULT, 557 - NETKIT_SCRUB_DEFAULT); 546 + &ifindex, NETKIT_SCRUB_DEFAULT, 547 + NETKIT_SCRUB_DEFAULT, FLAG_SAME_NETNS); 558 548 if (err) 559 549 return; 560 550 ··· 665 655 int err, ifindex; 666 656 667 657 err = create_netkit(mode, NETKIT_PASS, NETKIT_PASS, 668 - &ifindex, false, NETKIT_SCRUB_DEFAULT, 669 - NETKIT_SCRUB_DEFAULT); 658 + &ifindex, NETKIT_SCRUB_DEFAULT, 659 + NETKIT_SCRUB_DEFAULT, 0); 670 660 if (err) 671 661 return; 672 662 ··· 743 733 struct bpf_link *link; 744 734 745 735 err = create_netkit(mode, NETKIT_PASS, NETKIT_PASS, 746 - &ifindex, true, NETKIT_SCRUB_DEFAULT, 747 - NETKIT_SCRUB_DEFAULT); 736 + &ifindex, NETKIT_SCRUB_DEFAULT, 737 + NETKIT_SCRUB_DEFAULT, FLAG_SAME_NETNS); 748 738 if (err) 749 739 return; 750 740 ··· 809 799 serial_test_tc_netkit_pkt_type_mode(NETKIT_L3); 810 800 } 811 801 812 - static void serial_test_tc_netkit_scrub_type(int scrub) 802 + static void serial_test_tc_netkit_scrub_type(int scrub, bool room) 813 803 { 814 804 LIBBPF_OPTS(bpf_netkit_opts, optl); 815 805 struct test_tc_link *skel; ··· 817 807 int err, ifindex; 818 808 819 809 err = create_netkit(NETKIT_L2, NETKIT_PASS, NETKIT_PASS, 820 - &ifindex, false, scrub, scrub); 810 + &ifindex, scrub, scrub, 811 + room ? FLAG_ADJUST_ROOM : 0); 821 812 if (err) 822 813 return; 823 814 ··· 853 842 ASSERT_EQ(skel->bss->seen_tc8, true, "seen_tc8"); 854 843 ASSERT_EQ(skel->bss->mark, scrub == NETKIT_SCRUB_NONE ? MARK : 0, "mark"); 855 844 ASSERT_EQ(skel->bss->prio, scrub == NETKIT_SCRUB_NONE ? PRIO : 0, "prio"); 845 + ASSERT_EQ(skel->bss->headroom, room ? NETKIT_HEADROOM : 0, "headroom"); 846 + ASSERT_EQ(skel->bss->tailroom, room ? NETKIT_TAILROOM : 0, "tailroom"); 856 847 cleanup: 857 848 test_tc_link__destroy(skel); 858 849 ··· 865 852 866 853 void serial_test_tc_netkit_scrub(void) 867 854 { 868 - serial_test_tc_netkit_scrub_type(NETKIT_SCRUB_DEFAULT); 869 - serial_test_tc_netkit_scrub_type(NETKIT_SCRUB_NONE); 855 + serial_test_tc_netkit_scrub_type(NETKIT_SCRUB_DEFAULT, false); 856 + serial_test_tc_netkit_scrub_type(NETKIT_SCRUB_NONE, true); 870 857 }
+87
tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
··· 2 2 #include <test_progs.h> 3 3 #include <network_helpers.h> 4 4 #include "test_xdp_context_test_run.skel.h" 5 + #include "test_xdp_meta.skel.h" 6 + 7 + #define TX_ADDR "10.0.0.1" 8 + #define RX_ADDR "10.0.0.2" 9 + #define RX_NAME "veth0" 10 + #define TX_NAME "veth1" 11 + #define TX_NETNS "xdp_context_tx" 12 + #define RX_NETNS "xdp_context_rx" 5 13 6 14 void test_xdp_context_error(int prog_fd, struct bpf_test_run_opts opts, 7 15 __u32 data_meta, __u32 data, __u32 data_end, ··· 111 103 112 104 test_xdp_context_test_run__destroy(skel); 113 105 } 106 + 107 + void test_xdp_context_functional(void) 108 + { 109 + LIBBPF_OPTS(bpf_tc_hook, tc_hook, .attach_point = BPF_TC_INGRESS); 110 + LIBBPF_OPTS(bpf_tc_opts, tc_opts, .handle = 1, .priority = 1); 111 + struct netns_obj *rx_ns = NULL, *tx_ns = NULL; 112 + struct bpf_program *tc_prog, *xdp_prog; 113 + struct test_xdp_meta *skel = NULL; 114 + struct nstoken *nstoken = NULL; 115 + int rx_ifindex; 116 + int ret; 117 + 118 + tx_ns = netns_new(TX_NETNS, false); 119 + if (!ASSERT_OK_PTR(tx_ns, "create tx_ns")) 120 + return; 121 + 122 + rx_ns = netns_new(RX_NETNS, false); 123 + if (!ASSERT_OK_PTR(rx_ns, "create rx_ns")) 124 + goto close; 125 + 126 + SYS(close, "ip link add " RX_NAME " netns " RX_NETNS 127 + " type veth peer name " TX_NAME " netns " TX_NETNS); 128 + 129 + nstoken = open_netns(RX_NETNS); 130 + if (!ASSERT_OK_PTR(nstoken, "setns rx_ns")) 131 + goto close; 132 + 133 + SYS(close, "ip addr add " RX_ADDR "/24 dev " RX_NAME); 134 + SYS(close, "ip link set dev " RX_NAME " up"); 135 + 136 + skel = test_xdp_meta__open_and_load(); 137 + if (!ASSERT_OK_PTR(skel, "open and load skeleton")) 138 + goto close; 139 + 140 + rx_ifindex = if_nametoindex(RX_NAME); 141 + if (!ASSERT_GE(rx_ifindex, 0, "if_nametoindex rx")) 142 + goto close; 143 + 144 + tc_hook.ifindex = rx_ifindex; 145 + ret = bpf_tc_hook_create(&tc_hook); 146 + if (!ASSERT_OK(ret, "bpf_tc_hook_create")) 147 + goto close; 148 + 149 + tc_prog = bpf_object__find_program_by_name(skel->obj, "ing_cls"); 150 + if (!ASSERT_OK_PTR(tc_prog, "open ing_cls prog")) 151 + goto close; 152 + 153 + tc_opts.prog_fd = bpf_program__fd(tc_prog); 154 + ret = bpf_tc_attach(&tc_hook, &tc_opts); 155 + if (!ASSERT_OK(ret, "bpf_tc_attach")) 156 + goto close; 157 + 158 + xdp_prog = bpf_object__find_program_by_name(skel->obj, "ing_xdp"); 159 + if (!ASSERT_OK_PTR(xdp_prog, "open ing_xdp prog")) 160 + goto close; 161 + 162 + ret = bpf_xdp_attach(rx_ifindex, 163 + bpf_program__fd(xdp_prog), 164 + 0, NULL); 165 + if (!ASSERT_GE(ret, 0, "bpf_xdp_attach")) 166 + goto close; 167 + 168 + close_netns(nstoken); 169 + 170 + nstoken = open_netns(TX_NETNS); 171 + if (!ASSERT_OK_PTR(nstoken, "setns tx_ns")) 172 + goto close; 173 + 174 + SYS(close, "ip addr add " TX_ADDR "/24 dev " TX_NAME); 175 + SYS(close, "ip link set dev " TX_NAME " up"); 176 + ASSERT_OK(SYS_NOFAIL("ping -c 1 " RX_ADDR), "ping"); 177 + 178 + close: 179 + close_netns(nstoken); 180 + test_xdp_meta__destroy(skel); 181 + netns_free(rx_ns); 182 + netns_free(tx_ns); 183 + } 184 +
+15
tools/testing/selftests/bpf/progs/test_tc_link.c
··· 8 8 #include <linux/if_packet.h> 9 9 #include <bpf/bpf_endian.h> 10 10 #include <bpf/bpf_helpers.h> 11 + #include <bpf/bpf_core_read.h> 11 12 12 13 char LICENSE[] SEC("license") = "GPL"; 13 14 ··· 28 27 bool seen_mcast; 29 28 30 29 int mark, prio; 30 + unsigned short headroom, tailroom; 31 31 32 32 SEC("tc/ingress") 33 33 int tc1(struct __sk_buff *skb) ··· 106 104 return TCX_PASS; 107 105 } 108 106 107 + struct sk_buff { 108 + struct net_device *dev; 109 + }; 110 + 111 + struct net_device { 112 + unsigned short needed_headroom; 113 + unsigned short needed_tailroom; 114 + }; 115 + 109 116 SEC("tc/egress") 110 117 int tc8(struct __sk_buff *skb) 111 118 { 119 + struct net_device *dev = BPF_CORE_READ((struct sk_buff *)skb, dev); 120 + 112 121 seen_tc8 = true; 113 122 mark = skb->mark; 114 123 prio = skb->priority; 124 + headroom = BPF_CORE_READ(dev, needed_headroom); 125 + tailroom = BPF_CORE_READ(dev, needed_tailroom); 115 126 return TCX_PASS; 116 127 }
+2 -2
tools/testing/selftests/bpf/progs/test_xdp_meta.c
··· 8 8 #define round_up(x, y) ((((x) - 1) | __round_mask(x, y)) + 1) 9 9 #define ctx_ptr(ctx, mem) (void *)(unsigned long)ctx->mem 10 10 11 - SEC("t") 11 + SEC("tc") 12 12 int ing_cls(struct __sk_buff *ctx) 13 13 { 14 14 __u8 *data, *data_meta, *data_end; ··· 28 28 return diff ? TC_ACT_SHOT : TC_ACT_OK; 29 29 } 30 30 31 - SEC("x") 31 + SEC("xdp") 32 32 int ing_xdp(struct xdp_md *ctx) 33 33 { 34 34 __u8 *data, *data_meta, *data_end;
-58
tools/testing/selftests/bpf/test_xdp_meta.sh
··· 1 - #!/bin/sh 2 - 3 - BPF_FILE="test_xdp_meta.bpf.o" 4 - # Kselftest framework requirement - SKIP code is 4. 5 - readonly KSFT_SKIP=4 6 - readonly NS1="ns1-$(mktemp -u XXXXXX)" 7 - readonly NS2="ns2-$(mktemp -u XXXXXX)" 8 - 9 - cleanup() 10 - { 11 - if [ "$?" = "0" ]; then 12 - echo "selftests: test_xdp_meta [PASS]"; 13 - else 14 - echo "selftests: test_xdp_meta [FAILED]"; 15 - fi 16 - 17 - set +e 18 - ip link del veth1 2> /dev/null 19 - ip netns del ${NS1} 2> /dev/null 20 - ip netns del ${NS2} 2> /dev/null 21 - } 22 - 23 - ip link set dev lo xdp off 2>/dev/null > /dev/null 24 - if [ $? -ne 0 ];then 25 - echo "selftests: [SKIP] Could not run test without the ip xdp support" 26 - exit $KSFT_SKIP 27 - fi 28 - set -e 29 - 30 - ip netns add ${NS1} 31 - ip netns add ${NS2} 32 - 33 - trap cleanup 0 2 3 6 9 34 - 35 - ip link add veth1 type veth peer name veth2 36 - 37 - ip link set veth1 netns ${NS1} 38 - ip link set veth2 netns ${NS2} 39 - 40 - ip netns exec ${NS1} ip addr add 10.1.1.11/24 dev veth1 41 - ip netns exec ${NS2} ip addr add 10.1.1.22/24 dev veth2 42 - 43 - ip netns exec ${NS1} tc qdisc add dev veth1 clsact 44 - ip netns exec ${NS2} tc qdisc add dev veth2 clsact 45 - 46 - ip netns exec ${NS1} tc filter add dev veth1 ingress bpf da obj ${BPF_FILE} sec t 47 - ip netns exec ${NS2} tc filter add dev veth2 ingress bpf da obj ${BPF_FILE} sec t 48 - 49 - ip netns exec ${NS1} ip link set dev veth1 xdp obj ${BPF_FILE} sec x 50 - ip netns exec ${NS2} ip link set dev veth2 xdp obj ${BPF_FILE} sec x 51 - 52 - ip netns exec ${NS1} ip link set dev veth1 up 53 - ip netns exec ${NS2} ip link set dev veth2 up 54 - 55 - ip netns exec ${NS1} ping -c 1 10.1.1.22 56 - ip netns exec ${NS2} ping -c 1 10.1.1.11 57 - 58 - exit 0
+2 -1
tools/testing/selftests/bpf/xdp_hw_metadata.c
··· 79 79 .fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS, 80 80 .comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS, 81 81 .frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE, 82 - .flags = XSK_UMEM__DEFAULT_FLAGS, 82 + .flags = XDP_UMEM_TX_METADATA_LEN, 83 83 .tx_metadata_len = sizeof(struct xsk_tx_metadata), 84 84 }; 85 85 __u32 idx = 0; ··· 551 551 { 552 552 struct hwtstamp_config cfg = { 553 553 .rx_filter = HWTSTAMP_FILTER_ALL, 554 + .tx_type = HWTSTAMP_TX_ON, 554 555 }; 555 556 556 557 hwtstamp_ioctl(SIOCGHWTSTAMP, ifname, &saved_hwtstamp_cfg);