projects
/
flowspec-xdp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Drop union in rate limiting struct that is just confusing
[flowspec-xdp]
/
xdp.c
diff --git
a/xdp.c
b/xdp.c
index 75a44ff2a16d0a22a3cd462107feeec7dd3997c1..de4d86e73697000cd3dbd031821ed3aacec0798b 100644
(file)
--- a/
xdp.c
+++ b/
xdp.c
@@
-175,10
+175,7
@@
struct {
#ifdef RATE_CNT
struct ratelimit {
struct bpf_spin_lock lock;
#ifdef RATE_CNT
struct ratelimit {
struct bpf_spin_lock lock;
- union {
- int64_t sent_bytes;
- int64_t sent_packets;
- } rate;
+ int64_t sent_rate;
int64_t sent_time;
};
struct {
int64_t sent_time;
};
struct {
@@
-194,16
+191,14
@@
struct {
// map_check_btf as of Linux 5.10).
// This isn't exactly accurate, but at least its faster.
struct percpu_ratelimit {
// map_check_btf as of Linux 5.10).
// This isn't exactly accurate, but at least its faster.
struct percpu_ratelimit {
- union {
- int64_t sent_bytes;
- int64_t sent_packets;
- } rate;
+ int64_t sent_rate;
int64_t sent_time;
};
#define V6_SRC_RATE_DEFINE(n, limit) \
struct { \
__uint(type, BPF_MAP_TYPE_LRU_PERCPU_HASH); \
int64_t sent_time;
};
#define V6_SRC_RATE_DEFINE(n, limit) \
struct { \
__uint(type, BPF_MAP_TYPE_LRU_PERCPU_HASH); \
+ __uint(map_flags, BPF_F_NO_COMMON_LRU); \
__uint(max_entries, limit); \
uint128_t *key; \
struct percpu_ratelimit *value; \
__uint(max_entries, limit); \
uint128_t *key; \
struct percpu_ratelimit *value; \
@@
-212,6
+207,7
@@
struct { \
#define V4_SRC_RATE_DEFINE(n, limit) \
struct { \
__uint(type, BPF_MAP_TYPE_LRU_PERCPU_HASH); \
#define V4_SRC_RATE_DEFINE(n, limit) \
struct { \
__uint(type, BPF_MAP_TYPE_LRU_PERCPU_HASH); \
+ __uint(map_flags, BPF_F_NO_COMMON_LRU); \
__uint(max_entries, limit); \
__u32 *key; \
struct percpu_ratelimit *value; \
__uint(max_entries, limit); \
__u32 *key; \
struct percpu_ratelimit *value; \