android_packages_modules_Co.../netd
Maciej Żenczykowski 9017a07049 switch netd_configuration_map from hash map to array
This eliminates the need for netd_updatable BpfHandler.cpp
to initialize the hash map with a zero.

On startup the map will be freshly initialized and thus zero.

On restart it might not be empty, but it doesn't matter to netd.
Furthermore the mainline component of the system server will
re-initialize it again anyway:
see service/native/TrafficController.cpp initMaps()

This does remove the ability to call deleteValue on a key,
since that would always return -EINVAL, but since we don't
currently do that, that's really a feature.

(It does suggest though that we should have a BpfMapNonNullable
 class which is writeable, but without a deleteValue() function)

Additionally BpfMap arrays are more efficient for the kernel bpf jit
compiler, as - on newer kernels - it can optimize the read/write
into a simple memory access (as opposed to a bpf helper call).

Before:
  $ adb shell ls -l /sys/fs/bpf/netd_shared/map_netd_configuration_map
  -rw-rw---- 1 root net_bw_acct 0 2022-06-11 08:20 /sys/fs/bpf/netd_shared/ map_netd_configuration_map

After:
  $ adbz shell ls -l /sys/fs/bpf/netd_shared/map_netd_configuration_map
  -r--rw---- 1 root net_bw_acct 0 2022-06-16 15:03 /sys/fs/bpf/netd_shared/map_netd_configuration_map

Bug: 218408035
Bug: 235590615
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I21730e4fa22fbf0c94ab0ca5c5db03aa000b7680
(cherry picked from commit b10e055f4b)
Merged-In: I21730e4fa22fbf0c94ab0ca5c5db03aa000b7680
2022-06-21 03:19:36 +00:00
..
include
Android.bp [LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity 2022-02-10 10:57:23 -08:00
BpfHandler.cpp switch netd_configuration_map from hash map to array 2022-06-21 03:19:36 +00:00
BpfHandler.h switch netd_configuration_map from hash map to array 2022-06-21 03:19:36 +00:00
BpfHandlerTest.cpp switch netd_configuration_map from hash map to array 2022-06-21 03:19:36 +00:00
NetdUpdatable.cpp
NetdUpdatable.h
libnetd_updatable.map.txt