17#ifndef BACKENDS_EBPF_EBPFOPTIONS_H_
18#define BACKENDS_EBPF_EBPFOPTIONS_H_
20#include "frontends/common/options.h"
24enum XDP2TC { XDP2TC_NONE, XDP2TC_META, XDP2TC_HEAD, XDP2TC_CPUMAP };
39 enum XDP2TC xdp2tcMode = XDP2TC_NONE;
47 void calculateXDP2TCMode() {
54 <<
"XDP2TC 'meta' mode cannot be used if XDP is enabled. "
55 "Falling back to 'head' mode. For more information see "
56 "https://github.com/p4lang/p4c/blob/main/backends/ebpf/psa/README.md#xdp2tc-mode"
58 xdp2tcMode = XDP2TC_HEAD;
61 std::cout <<
"Setting XDP2TC 'head' mode by default for XDP-based hook." << std::endl;
62 xdp2tcMode = XDP2TC_HEAD;
64 std::cout <<
"Setting XDP2TC 'meta' mode by default for TC-based hook." << std::endl;
66 xdp2tcMode = XDP2TC_META;
68 BUG_CHECK(xdp2tcMode != XDP2TC_NONE,
"xdp2tc mode should not be set to NONE, bug?");
72using EbpfContext = P4CContextWithOptions<EbpfOptions>;
Definition frontends/common/options.h:30
Definition ebpfOptions.h:26
bool generateToXDP
generate program to XDP layer
Definition ebpfOptions.h:37
bool loadIRFromJson
read from json
Definition ebpfOptions.h:31
unsigned int maxTernaryMasks
maximum number of unique ternary masks
Definition ebpfOptions.h:41
bool emitTraceMessages
tracing eBPF code execution
Definition ebpfOptions.h:35
bool emitExterns
Externs generation.
Definition ebpfOptions.h:33
bool enableTableCache
Enable table cache for LPM and ternary tables.
Definition ebpfOptions.h:43
std::filesystem::path outputFile
file to output to
Definition ebpfOptions.h:29
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24