59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
#ifndef _BPF_CONF_KERNEL_H_
|
|
#define _BPF_CONF_KERNEL_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include "bpf_helpers.h"
|
|
#include "bpf_conf_def.h"
|
|
|
|
static inline void bpf_conf_lookup_map(bpf_conf_t *conf)
|
|
{
|
|
__u32 *val;
|
|
|
|
__builtin_memcpy(conf->debug_log.key.str, BPF_CONF_KEY_DEBUG_LOG, 13);
|
|
val = (__u32 *)bpf_map_lookup_elem(&bpf_conf_map, &conf->debug_log.key);
|
|
if (val)
|
|
{
|
|
conf->debug_log.val = *val;
|
|
}
|
|
|
|
__builtin_memcpy(conf->hash_mode.key.str, BPF_CONF_KEY_HASH_MODE, 13);
|
|
val = (__u32 *)bpf_map_lookup_elem(&bpf_conf_map, &conf->hash_mode.key);
|
|
if (val)
|
|
{
|
|
conf->hash_mode.val = *val;
|
|
}
|
|
|
|
__builtin_memcpy(conf->queue_num.key.str, BPF_CONF_KEY_QUEUE_NUM, 13);
|
|
val = (__u32 *)bpf_map_lookup_elem(&bpf_conf_map, &conf->queue_num.key);
|
|
if (val)
|
|
|
|
{
|
|
conf->queue_num.val = *val;
|
|
}
|
|
}
|
|
|
|
static inline __u32 bpf_conf_get_debug_log(bpf_conf_t *conf)
|
|
{
|
|
return conf->debug_log.val;
|
|
}
|
|
|
|
static inline __u32 bpf_conf_get_hash_mode(bpf_conf_t *conf)
|
|
{
|
|
return conf->hash_mode.val;
|
|
}
|
|
|
|
static inline __u32 bpf_conf_get_queue_num(bpf_conf_t *conf)
|
|
{
|
|
return conf->queue_num.val;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|