From 48879625cf32383f0c8edcfcb50aa9d1296b772e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Mon, 9 Jun 2025 15:16:09 -0700 Subject: [PATCH] bpf/progs/netd.c: increase per uid map sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some devices are hitting limits, but these maps are small. Additionally one is indexed by app uid, while the other by unix uid. Where unix uid = nr Android users * nr app uids. Give things a little bit more room for growth. Also remove the useless constant from the .h, most - if not all - of them should not be there. Bug: 418664814 Test: TreeHugger Flag: EXEMPT mainline Signed-off-by: Maciej Żenczykowski Change-Id: I81227cc81e6a406120d669a1decef023df4590fe --- bpf/progs/netd.c | 4 ++-- bpf/progs/netd.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bpf/progs/netd.c b/bpf/progs/netd.c index 93ef5c5f21..7d6e74b4fa 100644 --- a/bpf/progs/netd.c +++ b/bpf/progs/netd.c @@ -73,8 +73,8 @@ DEFINE_BPF_MAP_NO_NETD(app_uid_stats_map, HASH, uint32_t, StatsValue, APP_STATS_ DEFINE_BPF_MAP_RO_NETD(stats_map_A, HASH, StatsKey, StatsValue, STATS_MAP_SIZE) DEFINE_BPF_MAP_RO_NETD(stats_map_B, HASH, StatsKey, StatsValue, STATS_MAP_SIZE) DEFINE_BPF_MAP_NO_NETD(iface_stats_map, HASH, uint32_t, StatsValue, IFACE_STATS_MAP_SIZE) -DEFINE_BPF_MAP_RO_NETD(uid_owner_map, HASH, uint32_t, UidOwnerValue, UID_OWNER_MAP_SIZE) -DEFINE_BPF_MAP_RO_NETD(uid_permission_map, HASH, uint32_t, uint8_t, UID_OWNER_MAP_SIZE) +DEFINE_BPF_MAP_RO_NETD(uid_owner_map, HASH, uint32_t, UidOwnerValue, 20000) +DEFINE_BPF_MAP_RO_NETD(uid_permission_map, HASH, uint32_t, uint8_t, 6000) DEFINE_BPF_MAP_NO_NETD(ingress_discard_map, HASH, IngressDiscardKey, IngressDiscardValue, INGRESS_DISCARD_MAP_SIZE) diff --git a/bpf/progs/netd.h b/bpf/progs/netd.h index aa5f9cc9bf..f9b5e54a41 100644 --- a/bpf/progs/netd.h +++ b/bpf/progs/netd.h @@ -128,7 +128,6 @@ static const int STATS_MAP_SIZE = 5000; static const int IFACE_INDEX_NAME_MAP_SIZE = 1000; static const int IFACE_STATS_MAP_SIZE = 1000; static const int CONFIGURATION_MAP_SIZE = 2; -static const int UID_OWNER_MAP_SIZE = 4000; static const int INGRESS_DISCARD_MAP_SIZE = 100; static const int PACKET_TRACE_BUF_SIZE = 32 * 1024; static const int DATA_SAVER_ENABLED_MAP_SIZE = 1;