Let netd decide when to swap stats map
To protect stats map from overflow, netd need to know how many stats
entries exist in the current live stats map when tagging the socket. To
prevent racing against framework stats reading actions during tagging
sockets, let netd handle the map swap action instead.
Bug: 111441138
Test: android.app.usage.cts.NetworkUsageStatsTest
android.net.cts.TrafficStatsTest
Change-Id: I1b63e50a67be07472dba32744c8598c1788d0b75
diff --git a/server/TrafficController.h b/server/TrafficController.h
index cd4f88d..d30749b 100644
--- a/server/TrafficController.h
+++ b/server/TrafficController.h
@@ -88,6 +88,11 @@
bpf::BpfLevel getBpfLevel();
/*
+ * Swap the stats map config from current active stats map to the idle one.
+ */
+ netdutils::Status swapActiveStatsMap();
+
+ /*
* Add the interface name and index pair into the eBPF map.
*/
int addInterface(const char* name, uint32_t ifaceIndex);