1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 Intel Corporation 3 */ 4 5 /* 6 * eBPF program sample. 7 * Accepts pointer to struct rte_mbuf as an input parameter. 8 * cleanup mbuf's vlan_tci and all related RX flags 9 * (RTE_MBUF_F_RX_VLAN_PKT | RTE_MBUF_F_RX_VLAN_STRIPPED). 10 * Doesn't touch contents of packet data. 11 * To compile: 12 * clang -O2 -target bpf -Wno-int-to-void-pointer-cast -c t2.c 13 * 14 * NOTE: if DPDK is not installed system-wide, add compiler flag with path 15 * to DPDK rte_mbuf.h file, e.g. "clang -I/path/to/dpdk/headers -O2 ..." 16 */ 17 18 #include <stdint.h> 19 #include <stddef.h> 20 #include <rte_config.h> 21 #include <rte_mbuf_core.h> 22 23 uint64_t entry(void * pkt)24entry(void *pkt) 25 { 26 struct rte_mbuf *mb; 27 28 mb = pkt; 29 mb->vlan_tci = 0; 30 mb->ol_flags &= ~(RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED); 31 32 return 1; 33 } 34