Use SingleWriterBpfMap in BpfNetMaps.
Most of the maps used by BpfNetMaps are configuration maps that
in production code are only written to by BpfNetMaps. Move these
maps to SingleWriterBpfMap to take advantage of caching.
Specifically, the following are only written by BpfNetMaps in
production code:
- sConfigurationMap
- sUidOwnerMap
- sUidPermissionMap
- sDataSaverEnabledMap
- sIngressDiscardMap
Additionally:
- firewall.cpp writes to sConfigurationMap, sUidOwnerMap, and
sDataSaverEnabledMap, but that code only runs in tests because
it requires root privileges.
- NetworkStackBpfNetMaps also uses sConfigurationMap,
sUidOwnerMap and sDataSaverEnabledMap, but it opens all of them
with BPF_F_RDONLY so cannot write to them.
sCookieTagMap is left uncached because it's also written to by
netd (as part of socket tagging) and ClatCoordinator.
Fix: 343166906
Test: no-op replacement, covered by existing tests
Change-Id: Ie2619949477323d557b8906cf082e86a78512847
1 file changed