Lines Matching +full:xdp +full:- +full:rx +full:- +full:metadata
1 // SPDX-License-Identifier: GPL-2.0
30 SEC("xdp")
31 int rx(struct xdp_md *ctx) in rx() function
39 u64 timestamp = -1; in rx()
42 data = (void *)(long)ctx->data; in rx()
43 data_end = (void *)(long)ctx->data_end; in rx()
46 if (eth->h_proto == bpf_htons(ETH_P_IP)) { in rx()
48 if (iph + 1 < data_end && iph->protocol == IPPROTO_UDP) in rx()
51 if (eth->h_proto == bpf_htons(ETH_P_IPV6)) { in rx()
53 if (ip6h + 1 < data_end && ip6h->nexthdr == IPPROTO_UDP) in rx()
64 if (udp->dest != bpf_htons(8080)) in rx()
67 /* Reserve enough for all custom metadata. */ in rx()
69 ret = bpf_xdp_adjust_meta(ctx, -(int)sizeof(struct xdp_meta)); in rx()
73 data = (void *)(long)ctx->data; in rx()
74 data_meta = (void *)(long)ctx->data_meta; in rx()
81 /* Export metadata. */ in rx()
84 * timestamp, so put some non-zero value into AF_XDP frame for in rx()
89 meta->rx_timestamp = 1; in rx()
91 bpf_xdp_metadata_rx_hash(ctx, &meta->rx_hash, &meta->rx_hash_type); in rx()
92 bpf_xdp_metadata_rx_vlan_tag(ctx, &meta->rx_vlan_proto, in rx()
93 &meta->rx_vlan_tci); in rx()
95 return bpf_redirect_map(&xsk, ctx->rx_queue_index, XDP_PASS); in rx()