125d11a86SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 225d11a86SBruce Richardson * Copyright(c) 2018 Intel Corporation 325d11a86SBruce Richardson */ 425d11a86SBruce Richardson 525d11a86SBruce Richardson /* 625d11a86SBruce Richardson * eBPF program sample. 725d11a86SBruce Richardson * Accepts pointer to struct rte_mbuf as an input parameter. 825d11a86SBruce Richardson * cleanup mbuf's vlan_tci and all related RX flags 9*daa02b5cSOlivier Matz * (RTE_MBUF_F_RX_VLAN_PKT | RTE_MBUF_F_RX_VLAN_STRIPPED). 1025d11a86SBruce Richardson * Doesn't touch contents of packet data. 1125d11a86SBruce Richardson * To compile: 12f399b017SCiara Power * clang -O2 -target bpf -Wno-int-to-void-pointer-cast -c t2.c 13f399b017SCiara Power * 14f399b017SCiara Power * NOTE: if DPDK is not installed system-wide, add compiler flag with path 15f399b017SCiara Power * to DPDK rte_mbuf.h file, e.g. "clang -I/path/to/dpdk/headers -O2 ..." 1625d11a86SBruce Richardson */ 1725d11a86SBruce Richardson 1825d11a86SBruce Richardson #include <stdint.h> 1925d11a86SBruce Richardson #include <stddef.h> 2025d11a86SBruce Richardson #include <rte_config.h> 21b50bcefdSKonstantin Ananyev #include <rte_mbuf_core.h> 2225d11a86SBruce Richardson 2325d11a86SBruce Richardson uint64_t entry(void * pkt)2425d11a86SBruce Richardsonentry(void *pkt) 2525d11a86SBruce Richardson { 2625d11a86SBruce Richardson struct rte_mbuf *mb; 2725d11a86SBruce Richardson 2825d11a86SBruce Richardson mb = pkt; 2925d11a86SBruce Richardson mb->vlan_tci = 0; 30*daa02b5cSOlivier Matz mb->ol_flags &= ~(RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED); 3125d11a86SBruce Richardson 3225d11a86SBruce Richardson return 1; 3325d11a86SBruce Richardson } 34