]>
git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/test/bpf/t3.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
7 * Accepts pointer to struct rte_mbuf as an input parameter.
8 * Dump the mbuf into stdout if it is an ARP packet (aka tcpdump 'arp').
10 * clang -O2 -I${RTE_SDK}/${RTE_TARGET}/include \
11 * -target bpf -Wno-int-to-void-pointer-cast -c t3.c
17 #include <net/ethernet.h>
18 #include <rte_config.h>
21 extern void rte_pktmbuf_dump(FILE *, const struct rte_mbuf
*, unsigned int);
24 entry(const void *pkt
)
26 const struct rte_mbuf
*mb
;
27 const struct ether_header
*eth
;
30 eth
= rte_pktmbuf_mtod(mb
, const struct ether_header
*);
32 if (eth
->ether_type
== __builtin_bswap16(ETHERTYPE_ARP
))
33 rte_pktmbuf_dump(stdout
, mb
, 64);