netd_updatable: only wait for bpf on <=V

netd is after synchronous start of bpfloader,
so we don't actually need to wait for it at all.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia1bcf8ac7d6756be44a1382581e6f2b5188bcb58
This commit is contained in:
Maciej Żenczykowski 2024-10-02 22:48:19 +00:00
commit 23c02b0b7f

View file

@ -201,7 +201,7 @@ static inline void waitForNetProgsLoaded() {
}
}
Status BpfHandler::init(const char* cg2_path) {
static inline void waitForBpf() {
// Note: netd *can* be restarted, so this might get called a second time after boot is complete
// at which point we don't need to (and shouldn't) wait for (more importantly start) loading bpf
@ -229,6 +229,21 @@ Status BpfHandler::init(const char* cg2_path) {
}
ALOGI("BPF programs are loaded");
}
Status BpfHandler::init(const char* cg2_path) {
// This wait is effectively a no-op on U QPR3+ devices (as netd starts
// *after* the synchronous exec_startbpfloader which calls NetBpfLoad)
// but checking for U QPR3 is hard.
//
// Waiting should not be required on U QPR3+ devices,
// ...
//
// ...unless someone changed 'exec_start bpfloader' to 'start bpfloader'
// in the rc file.
//
// TODO: should be: if (!modules::sdklevel::IsAtLeastW())
if (android_get_device_api_level() <= __ANDROID_API_V__) waitForBpf();
RETURN_IF_NOT_OK(initPrograms(cg2_path));
RETURN_IF_NOT_OK(initMaps());