8#ifndef BACKENDS_EBPF_EBPFOPTIONS_H_
9#define BACKENDS_EBPF_EBPFOPTIONS_H_
11#include "frontends/common/options.h"
15enum XDP2TC { XDP2TC_NONE, XDP2TC_META, XDP2TC_HEAD, XDP2TC_CPUMAP };
17class EbpfOptions :
public CompilerOptions {
30 enum XDP2TC xdp2tcMode = XDP2TC_NONE;
38 void calculateXDP2TCMode() {
45 <<
"XDP2TC 'meta' mode cannot be used if XDP is enabled. "
46 "Falling back to 'head' mode. For more information see "
47 "https://github.com/p4lang/p4c/blob/main/backends/ebpf/psa/README.md#xdp2tc-mode"
49 xdp2tcMode = XDP2TC_HEAD;
52 std::cout <<
"Setting XDP2TC 'head' mode by default for XDP-based hook." << std::endl;
53 xdp2tcMode = XDP2TC_HEAD;
55 std::cout <<
"Setting XDP2TC 'meta' mode by default for TC-based hook." << std::endl;
57 xdp2tcMode = XDP2TC_META;
59 BUG_CHECK(xdp2tcMode != XDP2TC_NONE,
"xdp2tc mode should not be set to NONE, bug?");
bool generateToXDP
generate program to XDP layer
Definition ebpfOptions.h:28
bool loadIRFromJson
read from json
Definition ebpfOptions.h:22
unsigned int maxTernaryMasks
maximum number of unique ternary masks
Definition ebpfOptions.h:32
bool emitTraceMessages
tracing eBPF code execution
Definition ebpfOptions.h:26
bool emitExterns
Externs generation.
Definition ebpfOptions.h:24
bool enableTableCache
Enable table cache for LPM and ternary tables.
Definition ebpfOptions.h:34
std::filesystem::path outputFile
file to output to
Definition ebpfOptions.h:20
Definition parser_options.h:170
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13