This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-kni/bpf/bpf_conf_def.h
luwenpeng f7ea81dad8 TSG-10254 eBPF支持二元组分流
TSG-10527 eBPF支持四元组分流
TSG-10369 KNI多线程在TAP模式下支持eBPF分流
2022-05-31 17:38:42 +08:00

54 lines
969 B
C

#ifndef _BPF_CONF_DEF_H_
#define _BPF_CONF_DEF_H_
#ifdef __cplusplus
extern "C"
{
#endif
#define BPF_CONF_KEY_DEBUG_LOG "bpf_debug_log"
#define BPF_CONF_KEY_HASH_MODE "bpf_hash_mode"
#define BPF_CONF_KEY_QUEUE_NUM "bpf_queue_num"
#define __uint(name, val) int(*name)[val]
#define __type(name, val) val *name
#define SEC(NAME) __attribute__((section(NAME), used))
typedef enum bpf_hash_mode_s
{
BPF_HASH_MODE_TUPLE2 = 0x2,
BPF_HASH_MODE_TUPLE4 = 0x4,
} bpf_hash_mode_t;
typedef struct bpf_conf_key_s
{
char str[32];
} bpf_conf_key_t;
typedef struct bpf_conf_kv_s
{
bpf_conf_key_t key;
__u32 val;
} bpf_conf_kv_t;
typedef struct bpf_conf_s
{
bpf_conf_kv_t debug_log;
bpf_conf_kv_t hash_mode;
bpf_conf_kv_t queue_num;
} bpf_conf_t;
struct
{
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, bpf_conf_key_t);
__type(value, __u32);
__uint(max_entries, 16);
} bpf_conf_map SEC(".maps");
#ifdef __cplusplus
}
#endif
#endif