mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 05:32:00 +00:00
e7e6c774f5
This commit replaces separate headers with a single vmlinux.h to tracing programs. Thanks to that, we no longer need to define the argument structure for tracing programs directly. For example, argument for the sched_switch tracpepoint (sched_switch_args) can be replaced with the vmlinux.h provided trace_event_raw_sched_switch. Additional defines have been added to the BPF program either directly or through the inclusion of net_shared.h. Defined values are PERF_MAX_STACK_DEPTH, IFNAMSIZ constants and __stringify() macro. This change enables the BPF program to access internal structures with BTF generated "vmlinux.h" header. Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Link: https://lore.kernel.org/r/20230818090119.477441-3-danieltimlee@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
35 lines
843 B
C
35 lines
843 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef _NET_SHARED_H
|
|
#define _NET_SHARED_H
|
|
|
|
#define AF_INET 2
|
|
#define AF_INET6 10
|
|
|
|
#define ETH_ALEN 6
|
|
#define ETH_P_802_3_MIN 0x0600
|
|
#define ETH_P_8021Q 0x8100
|
|
#define ETH_P_8021AD 0x88A8
|
|
#define ETH_P_IP 0x0800
|
|
#define ETH_P_IPV6 0x86DD
|
|
#define ETH_P_ARP 0x0806
|
|
#define IPPROTO_ICMPV6 58
|
|
|
|
#define TC_ACT_OK 0
|
|
#define TC_ACT_SHOT 2
|
|
|
|
#define IFNAMSIZ 16
|
|
|
|
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
|
|
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
#define bpf_ntohs(x) __builtin_bswap16(x)
|
|
#define bpf_htons(x) __builtin_bswap16(x)
|
|
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
|
|
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
#define bpf_ntohs(x) (x)
|
|
#define bpf_htons(x) (x)
|
|
#else
|
|
# error "Endianness detection needs to be set up for your compiler?!"
|
|
#endif
|
|
|
|
#endif
|