Commit Graph

4 Commits

Author SHA1 Message Date
Maciej Żenczykowski
d7b92c03e9 dscpPolicy.c - cache result-less lookups as well
It is most definitely worthwhile to cache negative lookups as well!

Test: TreeHugger, atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iab1a57a2611a891642fef0c5897918c16e0ca540
2022-07-27 16:20:51 -07:00
Maciej Żenczykowski
f75b7e199a dscpPolicy.c - increase size of cache map
(and merge the ipv4 and ipv6 caches into one,
as there really is no need for separate ones)

Test: TreeHugger, atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie62393ea428885076ef59af69ac3eafeeba2934f
2022-07-27 16:20:40 -07:00
Maciej Żenczykowski
0ff4ec058b dscpPolicy.c - remove spurious map A/B
The 'switch_comp_map' is never written to,
hence map A is always used anyway...

Additionally this is backwards - ie. the *wrong* maps were A/B:
it is not the cache that should be A/B but rather the policy map(s).

This simplification has the nice benefit of making the program
much simpler and thus presumably optimizing bpf verifier processing
and thus bpfloader runtime during boot.

The fact that these socket cache maps are never cleared from userspace
is a different bug that needs to be fixed.

Bug: 235559605
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic2b0d20cd4e9e7290fb9fae38e1625ea1ed85a78
2022-07-27 16:20:40 -07:00
Ken Chen
74ff3ee501 Rename dscp_policy.o to dscpPolicy.o
Underscore character may cause bpf prog/map naming collision. For
example, x.o with map y_z and x_y.o with map z both result in x_y_z
prog/map name, which should be prevented during compile-time.

aosp/2147825 will prohibit underscore character in bpf source name
(source name derives the obj name). Existing bpf modules with underscore
characters in source name need to be updated accordingly.

Bug: 236706995
Test: atest bpf_existence_test
Test: adb root; adb shell ls -l sys/fs/bpf/net_shared | grep dscpPolicy
Change-Id: Ibe98944d09d42bd11b78b5e9ae35ded48c70416d
2022-07-21 21:00:09 +08:00