Commit Graph

11 Commits

Author SHA1 Message Date
Maciej Żenczykowski 242af39425 dscpPolicy.c - old/new_first_u32 is actually be32
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I10b19a010000f1f49c2a48448f413376045bfe1f
2022-08-22 09:12:26 +00:00
Maciej Żenczykowski 640752bc4c dscpPolicy - sport is network endian, dport is host endian
be more consistent, and thus also less htons() calls

Test: TreeHugger, atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia331a33a615a598e061db53ae180fffaef7a4342
2022-08-09 23:03:20 +00:00
Maciej Żenczykowski a44510ba0c dscpPolicy - remove bpf byteswap in favour of userspace
Test: atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7a008434d58fc0fba5b503eb6fcfbca15bb2015c
2022-08-09 14:59:46 +00:00
Maciej Żenczykowski 1feaa43cbb dscpPolicy - further improvements
Bug: 237485762
Test: atest DscpPolicyTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia88b14609cad4604523e3fc41860c980ee11abe0
2022-08-09 14:48:20 +00:00
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
Tyler Wear 4e8949b216 DscpPolicy Optimize skb store bytes
Use a single skb store bytes for IPv6 instead of 2 api
calls for 2 uint8_t values, use 1 for a single uint32_t value.

Bug: 234808633
Change-Id: I31ecc6d7036fd71b10c60d320c1dc5ebf0b86cca
2022-07-26 13:10:54 -07:00
Patrick Rohr 7f325ccccb DscpPolicy: match_policy is_eth is always true
The raw IP program was removed, so there is no need to support it
anymore in match_policy().

Test: TH
Bug: 235559605
Change-Id: I755a9a55e3ad33a210145b2cc09578fdf4d66c79
2022-07-25 13:31:14 -07:00
Patrick Rohr 51cf563115 DscpPolicy: remove bpf support for raw ip
This program was only used for tests as WiFi interfaces should always
include an ethernet header. Since the test has moved from tun to tap,
this can be deleted.
Support for using this program was already removed in a previous CL.

Test: TH
Bug: 235559605
Change-Id: I2148bce60992070790ba237176b99a40597ee751
2022-07-25 13:31:14 -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