Home
last modified time | relevance | path

Searched refs:skb (Results 1 – 25 of 115) sorted by relevance

12345

/external/linux-kselftest/tools/testing/selftests/bpf/progs/
Dtest_tc_tunnel.c72 static __always_inline int encap_ipv4(struct __sk_buff *skb, __u8 encap_proto, in encap_ipv4() argument
97 if (bpf_skb_load_bytes(skb, ETH_HLEN, &iph6_inner, in encap_ipv4()
114 if (bpf_skb_load_bytes(skb, ETH_HLEN, &iph_inner, in encap_ipv4()
125 if (bpf_skb_load_bytes(skb, ETH_HLEN + tcp_off, in encap_ipv4()
179 if (bpf_skb_load_bytes(skb, 0, (__u8 *)&h_outer + olen, in encap_ipv4()
187 if (bpf_skb_adjust_room(skb, olen, BPF_ADJ_ROOM_MAC, flags)) in encap_ipv4()
199 if (bpf_skb_store_bytes(skb, ETH_HLEN, &h_outer, olen, in encap_ipv4()
207 if (bpf_skb_load_bytes(skb, 0, &eth, sizeof(eth)) < 0) in encap_ipv4()
210 if (bpf_skb_store_bytes(skb, 0, &eth, sizeof(eth), 0) < 0) in encap_ipv4()
217 static __always_inline int encap_ipv6(struct __sk_buff *skb, __u8 encap_proto, in encap_ipv6() argument
[all …]
Dbpf_flow.c91 static __always_inline void *bpf_flow_dissect_get_header(struct __sk_buff *skb, in bpf_flow_dissect_get_header() argument
95 void *data_end = (void *)(long)skb->data_end; in bpf_flow_dissect_get_header()
96 void *data = (void *)(long)skb->data; in bpf_flow_dissect_get_header()
97 __u16 thoff = skb->flow_keys->thoff; in bpf_flow_dissect_get_header()
108 if (bpf_skb_load_bytes(skb, thoff, buffer, hdr_size)) in bpf_flow_dissect_get_header()
115 static __always_inline int parse_eth_proto(struct __sk_buff *skb, __be16 proto) in parse_eth_proto() argument
117 struct bpf_flow_keys *keys = skb->flow_keys; in parse_eth_proto()
121 bpf_tail_call(skb, &jmp_table, IP); in parse_eth_proto()
124 bpf_tail_call(skb, &jmp_table, IPV6); in parse_eth_proto()
128 bpf_tail_call(skb, &jmp_table, MPLS); in parse_eth_proto()
[all …]
Dtest_tunnel_kern.c47 int _gre_set_tunnel(struct __sk_buff *skb) in _gre_set_tunnel() argument
58 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in _gre_set_tunnel()
69 int _gre_get_tunnel(struct __sk_buff *skb) in _gre_get_tunnel() argument
75 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); in _gre_get_tunnel()
86 int _ip6gretap_set_tunnel(struct __sk_buff *skb) in _ip6gretap_set_tunnel() argument
98 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in _ip6gretap_set_tunnel()
110 int _ip6gretap_get_tunnel(struct __sk_buff *skb) in _ip6gretap_get_tunnel() argument
116 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), in _ip6gretap_get_tunnel()
130 int _erspan_set_tunnel(struct __sk_buff *skb) in _erspan_set_tunnel() argument
142 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in _erspan_set_tunnel()
[all …]
Dtest_lwt_seg6local.c53 static __always_inline struct ip6_srh_t *get_srh(struct __sk_buff *skb) in get_srh() argument
60 data_end = (void *)(long)skb->data_end; in get_srh()
61 cursor = (void *)(long)skb->data; in get_srh()
88 int update_tlv_pad(struct __sk_buff *skb, uint32_t new_pad, in update_tlv_pad() argument
94 err = bpf_lwt_seg6_adjust_srh(skb, pad_off, in update_tlv_pad()
108 err = bpf_lwt_seg6_store_bytes(skb, pad_off, in update_tlv_pad()
118 int is_valid_tlv_boundary(struct __sk_buff *skb, struct ip6_srh_t *srh, in is_valid_tlv_boundary() argument
126 srh_off = (char *)srh - (char *)(long)skb->data; in is_valid_tlv_boundary()
144 err = bpf_skb_load_bytes(skb, cur_off, &tlv, sizeof(tlv)); in is_valid_tlv_boundary()
177 int add_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, uint32_t tlv_off, in add_tlv() argument
[all …]
Dtailcall1.c15 int bpf_func_##x(struct __sk_buff *skb) \
24 int entry(struct __sk_buff *skb) in entry() argument
29 bpf_tail_call(skb, &jmp_table, 0); in entry()
30 bpf_tail_call(skb, &jmp_table, 0); in entry()
31 bpf_tail_call(skb, &jmp_table, 0); in entry()
32 bpf_tail_call(skb, &jmp_table, 0); in entry()
34 bpf_tail_call(skb, &jmp_table, 1); in entry()
35 bpf_tail_call(skb, &jmp_table, 1); in entry()
36 bpf_tail_call(skb, &jmp_table, 1); in entry()
37 bpf_tail_call(skb, &jmp_table, 1); in entry()
[all …]
Dtest_sk_lookup_kern.c57 int bpf_sk_lookup_test0(struct __sk_buff *skb) in bpf_sk_lookup_test0() argument
59 void *data_end = (void *)(long)skb->data_end; in bpf_sk_lookup_test0()
60 void *data = (void *)(long)skb->data; in bpf_sk_lookup_test0()
75 sk = bpf_sk_lookup_tcp(skb, tuple, tuple_len, BPF_F_CURRENT_NETNS, 0); in bpf_sk_lookup_test0()
82 int bpf_sk_lookup_test1(struct __sk_buff *skb) in bpf_sk_lookup_test1() argument
87 sk = bpf_sk_lookup_tcp(skb, &tuple, sizeof(tuple), BPF_F_CURRENT_NETNS, 0); in bpf_sk_lookup_test1()
94 int bpf_sk_lookup_uaf(struct __sk_buff *skb) in bpf_sk_lookup_uaf() argument
100 sk = bpf_sk_lookup_tcp(skb, &tuple, sizeof(tuple), BPF_F_CURRENT_NETNS, 0); in bpf_sk_lookup_uaf()
109 int bpf_sk_lookup_modptr(struct __sk_buff *skb) in bpf_sk_lookup_modptr() argument
115 sk = bpf_sk_lookup_tcp(skb, &tuple, sizeof(tuple), BPF_F_CURRENT_NETNS, 0); in bpf_sk_lookup_modptr()
[all …]
Dtailcall2.c14 int bpf_func_0(struct __sk_buff *skb) in bpf_func_0() argument
16 bpf_tail_call(skb, &jmp_table, 1); in bpf_func_0()
21 int bpf_func_1(struct __sk_buff *skb) in bpf_func_1() argument
23 bpf_tail_call(skb, &jmp_table, 2); in bpf_func_1()
28 int bpf_func_2(struct __sk_buff *skb) in bpf_func_2() argument
34 int bpf_func_3(struct __sk_buff *skb) in bpf_func_3() argument
36 bpf_tail_call(skb, &jmp_table, 4); in bpf_func_3()
41 int bpf_func_4(struct __sk_buff *skb) in bpf_func_4() argument
43 bpf_tail_call(skb, &jmp_table, 3); in bpf_func_4()
48 int entry(struct __sk_buff *skb) in entry() argument
[all …]
Dtest_tc_edt.c27 static inline int throttle_flow(struct __sk_buff *skb) in throttle_flow() argument
31 uint64_t delay_ns = ((uint64_t)skb->len) * NS_PER_SEC / in throttle_flow()
39 tstamp = skb->tstamp; in throttle_flow()
56 bpf_skb_ecn_set_ce(skb); in throttle_flow()
60 skb->tstamp = next_tstamp; in throttle_flow()
65 static inline int handle_tcp(struct __sk_buff *skb, struct tcphdr *tcp) in handle_tcp() argument
67 void *data_end = (void *)(long)skb->data_end; in handle_tcp()
74 return throttle_flow(skb); in handle_tcp()
79 static inline int handle_ipv4(struct __sk_buff *skb) in handle_ipv4() argument
81 void *data_end = (void *)(long)skb->data_end; in handle_ipv4()
[all …]
Dtest_seg6_loop.c53 static __always_inline struct ip6_srh_t *get_srh(struct __sk_buff *skb) in get_srh() argument
60 data_end = (void *)(long)skb->data_end; in get_srh()
61 cursor = (void *)(long)skb->data; in get_srh()
87 static __always_inline int update_tlv_pad(struct __sk_buff *skb, in update_tlv_pad() argument
94 err = bpf_lwt_seg6_adjust_srh(skb, pad_off, in update_tlv_pad()
108 err = bpf_lwt_seg6_store_bytes(skb, pad_off, in update_tlv_pad()
117 static __always_inline int is_valid_tlv_boundary(struct __sk_buff *skb, in is_valid_tlv_boundary() argument
127 srh_off = (char *)srh - (char *)(long)skb->data; in is_valid_tlv_boundary()
147 err = bpf_skb_load_bytes(skb, cur_off, &tlv, sizeof(tlv)); in is_valid_tlv_boundary()
179 static __always_inline int add_tlv(struct __sk_buff *skb, in add_tlv() argument
[all …]
Dkfree_skb.c61 struct sk_buff *, skb, void *, location)
75 users = skb->users.refs.counter;
76 data = skb->data;
77 dev = skb->dev;
80 cb8 = (__u8 *)&skb->cb;
81 cb32 = (__u32 *)&skb->cb;
88 bpf_probe_read_kernel(&pkt_type, sizeof(pkt_type), _(&skb->__pkt_type_offset));
96 _(skb->len), users, pkt_type);
97 bpf_printk("skb->queue_mapping %d\n", _(skb->queue_mapping));
107 bpf_skb_output(skb, &perf_buf_map, (72ull << 32) | BPF_F_CURRENT_CPU,
[all …]
Dtest_pkt_access.c39 int test_pkt_access_subprog1(volatile struct __sk_buff *skb) in test_pkt_access_subprog1() argument
41 return skb->len * 2; in test_pkt_access_subprog1()
45 int test_pkt_access_subprog2(int val, volatile struct __sk_buff *skb) in test_pkt_access_subprog2() argument
47 return skb->len * val; in test_pkt_access_subprog2()
51 int test_pkt_access(struct __sk_buff *skb) in test_pkt_access() argument
53 void *data_end = (void *)(long)skb->data_end; in test_pkt_access()
54 void *data = (void *)(long)skb->data; in test_pkt_access()
81 if (test_pkt_access_subprog1(skb) != skb->len * 2) in test_pkt_access()
83 if (test_pkt_access_subprog2(2, skb) != skb->len * 2) in test_pkt_access()
Dsockmap_parse_prog.c8 int bpf_prog1(struct __sk_buff *skb) in bpf_prog1() argument
10 void *data_end = (void *)(long) skb->data_end; in bpf_prog1()
11 void *data = (void *)(long) skb->data; in bpf_prog1()
12 __u32 lport = skb->local_port; in bpf_prog1()
13 __u32 rport = skb->remote_port; in bpf_prog1()
19 err = bpf_skb_pull_data(skb, 10); in bpf_prog1()
23 data_end = (void *)(long)skb->data_end; in bpf_prog1()
24 data = (void *)(long)skb->data; in bpf_prog1()
35 return skb->len; in bpf_prog1()
/external/linux-kselftest/tools/testing/selftests/bpf/prog_tests/
Dskb_ctx.c6 struct __sk_buff skb = { in test_skb_ctx() local
18 .ctx_in = &skb, in test_skb_ctx()
19 .ctx_size_in = sizeof(skb), in test_skb_ctx()
20 .ctx_out = &skb, in test_skb_ctx()
21 .ctx_size_out = sizeof(skb), in test_skb_ctx()
37 tattr.ctx_size_in = sizeof(skb); in test_skb_ctx()
44 tattr.ctx_size_out = sizeof(skb); in test_skb_ctx()
48 skb.len = 1; in test_skb_ctx()
51 skb.len = 0; in test_skb_ctx()
53 skb.tc_index = 1; in test_skb_ctx()
[all …]
/external/bcc/tests/python/
Dtest_brb.c57 int pem(struct __sk_buff *skb) { in pem() argument
67 if (skb->tc_index == 0) { in pem()
68 skb->tc_index = 1; in pem()
69 skb->cb[0] = skb->cb[1] = 0; in pem()
72 meta.prog_id = skb->cb[0]; in pem()
74 meta.rx_port_id = skb->cb[1]; in pem()
78 ifindex = skb->ingress_ifindex; in pem()
84 skb->cb[0] = dest_p->prog_id; in pem()
85 skb->cb[1] = dest_p->port_id; in pem()
86 jump.call(skb, dest_p->prog_id); in pem()
[all …]
Dtest_call1.c14 int parse_ether(struct __sk_buff *skb) { in parse_ether() argument
22 switch (bpf_dext_pkt(skb, cur + 12, 0, 16)) { in parse_ether()
23 case 0x0800: jump.call(skb, S_IP); in parse_ether()
24 case 0x0806: jump.call(skb, S_ARP); in parse_ether()
26 jump.call(skb, S_EOP); in parse_ether()
30 int parse_arp(struct __sk_buff *skb) { in parse_arp() argument
38 jump.call(skb, S_EOP); in parse_arp()
42 int parse_ip(struct __sk_buff *skb) { in parse_ip() argument
50 jump.call(skb, S_EOP); in parse_ip()
54 int eop(struct __sk_buff *skb) { in eop() argument
/external/bcc/examples/networking/tunnel_monitor/
Dmonitor.c47 int handle_ingress(struct __sk_buff *skb) { in handle_ingress() argument
48 skb->cb[CB_FLAGS] = IS_INGRESS; in handle_ingress()
49 parser.call(skb, 1); // jump to generic packet parser in handle_ingress()
54 int handle_egress(struct __sk_buff *skb) { in handle_egress() argument
55 skb->cb[CB_FLAGS] = 0; in handle_egress()
56 parser.call(skb, 1); // jump to generic packet parser in handle_egress()
61 int handle_outer(struct __sk_buff *skb) { in handle_outer() argument
77 skb->cb[CB_SIP] = ip->src; in handle_outer()
78 skb->cb[CB_DIP] = ip->dst; in handle_outer()
94 skb->cb[CB_VNI] = vxlan->key; in handle_outer()
[all …]
/external/bcc/src/lua/bpf/spec/
Dcodegen_spec.lua183 input = function (skb)
194 input = function (skb)
211 input = function (skb)
230 input = function (skb)
250 input = function (skb)
251 return skb.len
262 input = function (skb)
263 local ptr = skb.data + 5
277 input = function (skb)
278 local ptr = skb.data + 5
[all …]
/external/iproute2/include/
Dbpf_api.h160 static void BPF_FUNC(tail_call, struct __sk_buff *skb, void *map,
168 static uint32_t BPF_FUNC(get_cgroup_classid, struct __sk_buff *skb);
171 static uint32_t BPF_FUNC(get_route_realm, struct __sk_buff *skb);
172 static uint32_t BPF_FUNC(get_hash_recalc, struct __sk_buff *skb);
173 static uint32_t BPF_FUNC(set_hash_invalid, struct __sk_buff *skb);
177 static int BPF_FUNC(clone_redirect, struct __sk_buff *skb, int ifindex,
181 static int BPF_FUNC(skb_load_bytes, struct __sk_buff *skb, uint32_t off,
183 static int BPF_FUNC(skb_store_bytes, struct __sk_buff *skb, uint32_t off,
186 static int BPF_FUNC(l3_csum_replace, struct __sk_buff *skb, uint32_t off,
188 static int BPF_FUNC(l4_csum_replace, struct __sk_buff *skb, uint32_t off,
[all …]
/external/iputils/Modules/
Dpg3.c241 struct sk_buff *skb; in fill_packet() local
247 skb = alloc_skb(pkt_size+64+16, GFP_ATOMIC); in fill_packet()
248 if (!skb) { in fill_packet()
253 skb_reserve(skb, 16); in fill_packet()
256 eth = (__u8 *) skb_push(skb, 14); in fill_packet()
257 iph = (struct iphdr*)skb_put(skb, sizeof( struct iphdr)); in fill_packet()
258 udph = (struct udphdr*)skb_put(skb, sizeof( struct udphdr)); in fill_packet()
284 skb->protocol = __constant_htons(ETH_P_IP); in fill_packet()
285 skb->mac.raw = ((u8*)iph) - 14; in fill_packet()
286 skb->dev = odev; in fill_packet()
[all …]
/external/iproute2/examples/bpf/
Dbpf_tailcall.c56 int cls_case1(struct __sk_buff *skb) in __section_tail()
62 printt("case1: map-val: %d from:%u\n", *val, skb->cb[0]); in __section_tail()
64 skb->cb[0] = ENTRY_0; in __section_tail()
65 tail_call(skb, &jmp_ex, ENTRY_0); in __section_tail()
71 int cls_case2(struct __sk_buff *skb) in __section_tail()
77 printt("case2: map-val: %d from:%u\n", *val, skb->cb[0]); in __section_tail()
79 skb->cb[0] = ENTRY_1; in __section_tail()
80 tail_call(skb, &jmp_tc, ENTRY_0); in __section_tail()
86 int cls_exit(struct __sk_buff *skb) in __section_tail()
92 printt("exit: map-val: %d from:%u\n", *val, skb->cb[0]); in __section_tail()
[all …]
/external/bcc/examples/networking/vlan_learning/
Dvlan_learning.c20 int handle_phys2virt(struct __sk_buff *skb) { in handle_phys2virt() argument
22 if (!skb->vlan_present) in handle_phys2virt()
31 lock_xadd(&leaf->tx_bytes, skb->len); in handle_phys2virt()
37 out_leaf->out_ifindex = skb->ifindex; in handle_phys2virt()
38 out_leaf->vlan_tci = skb->vlan_tci; in handle_phys2virt()
39 out_leaf->vlan_proto = skb->vlan_proto; in handle_phys2virt()
41 bpf_skb_vlan_pop(skb); in handle_phys2virt()
42 bpf_clone_redirect(skb, leaf->out_ifindex, 0); in handle_phys2virt()
48 int handle_virt2phys(struct __sk_buff *skb) { in handle_virt2phys() argument
52 int src_ifindex = skb->ifindex; in handle_virt2phys()
[all …]
/external/llvm-project/llvm/test/CodeGen/BPF/
Dremove_truncate_4.ll6 ;load_byte(void *skb, unsigned long long off) asm("llvm.bpf.load.byte");
8 ;load_half(void *skb, unsigned long long off) asm("llvm.bpf.load.half");
12 ;int func_b(struct __sk_buff *skb)
14 ; uint8_t t = load_byte(skb, 0);
18 ;int func_h(struct __sk_buff *skb)
20 ; uint16_t t = load_half(skb, 0);
24 ;int func_w(struct __sk_buff *skb)
26 ; uint32_t t = load_word(skb, 0);
33 define i32 @func_b(%struct.__sk_buff* %skb) local_unnamed_addr #0 {
35 %0 = bitcast %struct.__sk_buff* %skb to i8*
[all …]
/external/bcc/examples/networking/distributed_bridge/
Dtunnel_mesh.c19 int handle_ingress(struct __sk_buff *skb) { in handle_ingress() argument
22 bpf_skb_get_tunnel_key(skb, &tkey, in handle_ingress()
32 skb->tc_index = 1; in handle_ingress()
33 bpf_clone_redirect(skb, *ifindex, 1/*ingress*/); in handle_ingress()
42 int handle_egress(struct __sk_buff *skb) { in handle_egress() argument
43 int ifindex = skb->ifindex; in handle_egress()
51 if (skb->tc_index) { in handle_egress()
61 bpf_skb_set_tunnel_key(skb, &tkey, in handle_egress()
63 bpf_clone_redirect(skb, cfg->tunnel_ifindex, 0/*egress*/); in handle_egress()
/external/kernel-headers/original/uapi/linux/netfilter/
Dnfnetlink_compat.h47 #define NFA_NEST(skb, type) \ argument
48 ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
49 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
51 #define NFA_NEST_END(skb, start) \ argument
52 ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
53 (skb)->len; })
54 #define NFA_NEST_CANCEL(skb, start) \ argument
56 skb_trim(skb, (unsigned char *) (start) - (skb)->data); \
/external/libnfnetlink/include/libnfnetlink/
Dlinux_nfnetlink_compat.h44 #define NFA_NEST(skb, type) \ argument
45 ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
46 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
48 #define NFA_NEST_END(skb, start) \ argument
49 ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
50 (skb)->len; })
51 #define NFA_NEST_CANCEL(skb, start) \ argument
53 skb_trim(skb, (unsigned char *) (start) - (skb)->data); \

12345