Lines Matching +full:tx +full:- +full:sec

1 // SPDX-License-Identifier: GPL-2.0
15 #include <asm-generic/errno-base.h>
38 } stats SEC(".maps");
45 } dut_stats SEC(".maps");
52 } cpu_map SEC(".maps");
59 } dev_map SEC(".maps");
67 void *data_end = (void *)(long)xdp->data_end; in xdp_process_echo_packet()
68 void *data = (void *)(long)xdp->data; in xdp_process_echo_packet()
75 return -EINVAL; in xdp_process_echo_packet()
77 if (eh->h_proto == bpf_htons(ETH_P_IP)) { in xdp_process_echo_packet()
86 return -EINVAL; in xdp_process_echo_packet()
88 if (saddr != ih->saddr) in xdp_process_echo_packet()
89 return -EINVAL; in xdp_process_echo_packet()
91 if (daddr != ih->daddr) in xdp_process_echo_packet()
92 return -EINVAL; in xdp_process_echo_packet()
94 if (ih->protocol != IPPROTO_UDP) in xdp_process_echo_packet()
95 return -EINVAL; in xdp_process_echo_packet()
98 } else if (eh->h_proto == bpf_htons(ETH_P_IPV6)) { in xdp_process_echo_packet()
104 return -EINVAL; in xdp_process_echo_packet()
106 if (!ipv6_addr_equal(saddr, ih6->saddr)) in xdp_process_echo_packet()
107 return -EINVAL; in xdp_process_echo_packet()
109 if (!ipv6_addr_equal(daddr, ih6->daddr)) in xdp_process_echo_packet()
110 return -EINVAL; in xdp_process_echo_packet()
112 if (ih6->nexthdr != IPPROTO_UDP) in xdp_process_echo_packet()
113 return -EINVAL; in xdp_process_echo_packet()
117 return -EINVAL; in xdp_process_echo_packet()
121 return -EINVAL; in xdp_process_echo_packet()
123 port = dut ? uh->dest : uh->source; in xdp_process_echo_packet()
125 return -EINVAL; in xdp_process_echo_packet()
129 return -EINVAL; in xdp_process_echo_packet()
131 return bpf_htons(tlv->type) == CMD_ECHO ? 0 : -EINVAL; in xdp_process_echo_packet()
135 xdp_update_stats(struct xdp_md *xdp, bool tx, bool dut) in xdp_update_stats() argument
139 if (xdp_process_echo_packet(xdp, tx)) in xdp_update_stats()
140 return -EINVAL; in xdp_update_stats()
155 SEC("xdp")
163 SEC("xdp")
173 SEC("xdp")
181 SEC("xdp")
190 SEC("xdp")
199 SEC("xdp")
202 void *data = (void *)(long)xdp->data; in xdp_do_tx()
209 __builtin_memcpy(tmp_mac, eh->h_source, ETH_ALEN); in xdp_do_tx()
210 __builtin_memcpy(eh->h_source, eh->h_dest, ETH_ALEN); in xdp_do_tx()
211 __builtin_memcpy(eh->h_dest, tmp_mac, ETH_ALEN); in xdp_do_tx()
216 SEC("xdp")
225 SEC("tp_btf/xdp_exception")
238 SEC("tp_btf/xdp_cpumap_kthread")
251 SEC("xdp/cpumap")
254 void *data = (void *)(long)xdp->data; in xdp_do_redirect_cpumap()
261 __builtin_memcpy(tmp_mac, eh->h_source, ETH_ALEN); in xdp_do_redirect_cpumap()
262 __builtin_memcpy(eh->h_source, eh->h_dest, ETH_ALEN); in xdp_do_redirect_cpumap()
263 __builtin_memcpy(eh->h_dest, tmp_mac, ETH_ALEN); in xdp_do_redirect_cpumap()
268 char _license[] SEC("license") = "GPL";