From c1a9f4ab4cd6fd272864cc0f3efdfdf99eee934a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Mon, 20 Jan 2025 12:09:13 -0800 Subject: [PATCH] Revert "NetBpfLoad: hacky way to make LPM_TRIE bpf maps work." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit dcb2e7496cd43c6e041d3a1f55b5b61405ef98fd. Reason for revert: will use negative size to imply no prealloc instead. Test: TreeHugger Signed-off-by: Maciej Żenczykowski Change-Id: If1ce59acc592435537bce1d61857ba964bf8b6e6 --- bpf/loader/NetBpfLoad.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bpf/loader/NetBpfLoad.cpp b/bpf/loader/NetBpfLoad.cpp index 32b506dd12..59712b1e11 100644 --- a/bpf/loader/NetBpfLoad.cpp +++ b/bpf/loader/NetBpfLoad.cpp @@ -604,9 +604,6 @@ static bool mapMatchesExpectations(const unique_fd& fd, const string& mapName, if (type == BPF_MAP_TYPE_DEVMAP || type == BPF_MAP_TYPE_DEVMAP_HASH) desired_map_flags |= BPF_F_RDONLY_PROG; - if (type == BPF_MAP_TYPE_LPM_TRIE) - desired_map_flags |= BPF_F_NO_PREALLOC; - // The .h file enforces that this is a power of two, and page size will // also always be a power of two, so this logic is actually enough to // force it to be a multiple of the page size, as required by the kernel. @@ -782,7 +779,7 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector& .key_size = md[i].key_size, .value_size = md[i].value_size, .max_entries = max_entries, - .map_flags = md[i].map_flags | (type == BPF_MAP_TYPE_LPM_TRIE ? BPF_F_NO_PREALLOC : 0), + .map_flags = md[i].map_flags, }; if (isAtLeastKernelVersion(4, 15, 0)) strlcpy(req.map_name, mapNames[i].c_str(), sizeof(req.map_name));