summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2020-06-10 11:26:32 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-10 11:26:32 +0000
commit6d63ab415841e3717d15ceb40b89b431aaf98b6b (patch)
tree75df536040221136419fcd5f49564d83fe41db3a
parentdd540f7a4a925c8e6692974cfa2aaa8d0ca6eae0 (diff)
parenta7077cb39d3b910ceb0a5fdfc405183670c987f6 (diff)
downloadnetd-6d63ab415841e3717d15ceb40b89b431aaf98b6b.tar.gz
bpf_progs/offload.c - reduce memory usage by shrinking maps am: a7077cb39d
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/netd/+/11821977 Change-Id: I95ae8c8c23f4ea2644296fb1af744b8ffe6d89b0
-rw-r--r--bpf_progs/offload.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/bpf_progs/offload.c b/bpf_progs/offload.c
index f3334b45..d13b4b92 100644
--- a/bpf_progs/offload.c
+++ b/bpf_progs/offload.c
@@ -28,13 +28,11 @@ DEFINE_BPF_MAP_GRW(tether_ingress_map, HASH, TetherIngressKey, TetherIngressValu
AID_NETWORK_STACK)
// Tethering stats, indexed by upstream interface.
-DEFINE_BPF_MAP_GRW(tether_stats_map, HASH, uint32_t, TetherStatsValue, IFACE_STATS_MAP_SIZE,
- AID_NETWORK_STACK)
+DEFINE_BPF_MAP_GRW(tether_stats_map, HASH, uint32_t, TetherStatsValue, 16, AID_NETWORK_STACK)
// Tethering data limit, indexed by upstream interface.
// (tethering allowed when stats[iif].rxBytes + stats[iif].txBytes < limit[iif])
-DEFINE_BPF_MAP_GRW(tether_limit_map, HASH, uint32_t, uint64_t, IFACE_STATS_MAP_SIZE,
- AID_NETWORK_STACK)
+DEFINE_BPF_MAP_GRW(tether_limit_map, HASH, uint32_t, uint64_t, 16, AID_NETWORK_STACK)
static inline __always_inline int do_forward(struct __sk_buff* skb, bool is_ethernet) {
int l2_header_size = is_ethernet ? sizeof(struct ethhdr) : 0;