Commit Graph

6 Commits

Author SHA1 Message Date
Tyler Wear
11f494faa6 DscpPolicy BPF IPv4 Checksum Offset, DSCP Value Storage
Use the correct offset for the eth header when calculating the
checksum.

Store the DSCP value in BPF map for subsequent skb's instead
of the TOS so the calculation and checksum is correct.

Bug: 234808633

Change-Id: Ib40d4575455f34a8970eca8751b590319e2ee1ad
2022-07-11 13:13:57 -07:00
Tyler Wear
a8ca597aec DscpPolicy Move to kernel 5.15
Require at least kernel 5.15. Feature is not required on older
kernels and may impact boot time unnecessarily.

Bug: 235559605
Change-Id: I2e4b509de1d8940fc63ae057a8326f13c0fd1420
2022-06-30 19:41:03 +00:00
Maciej Żenczykowski
f769952212 bpf programs: switch from integers to #define'd bpfloader versions
(per request from Lorenzo)

We do bump block/clatd/dscp_policy requirements from 0.12 to 0.13,
but this effectively doesn't matter:

- Beta2 is too old either way (pre-0.12)
- Beta3 is new enough (0.13)
- versions in between are simply obsolete / unused / not important
- bpfloader 0.12 won't boot right anyway due to lack of netd maps/programs
  (which cause a netd startup failure)

This allows us to have one less #define in the header files,
with a hard to write explanation about what exactly v0.12 is (or was).

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1ecf15f9d7abbb82ec6bd49848255fab6a41aed4
2022-05-24 16:11:09 -07:00
Maciej Żenczykowski
acebffb966 add proper minimum bpfloader version annotations for block/clatd/dscp_policy/netd
In practice this doesn't actually really matter, since older versions
of the bpfloader won't even look in the relevant directories:

BpfLoader v0.9 is the first one that looks into
  '/apex/com.android.tethering/etc/bpf/net_shared',
but it is only v0.12 that pins the resulting programs and maps
correctly into
  /sys/fs/bpf/net_shared/
hence the annotations for block/clatd/dscp_policy.

BpfLoader v0.13 is the first one that looks into
  '/apex/com.android.tethering/etc/bpf/netd_shared'
subdirectory and pins into
  /sys/fs/bpf/netd_shared/
hence the annotation for netd.

But it's best to explicitly document the intent.

Note that in practice the mainline module will fail spectacularly
on a T OS if it can't find the programs and maps
(presumably due to the bpfloader being too old)
but will work on S even though the bpfloader there is much older,
because these programs/maps are not required on pre-T OS.

This change is thus really only documentation.

Bug: 218408035
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5ffa2faf83ca337b84e34b01df84436629989c58
2022-05-16 17:09:58 -07:00
Tyler Wear
3ad8089d19 Add IPv6 Handling for DSCP Policies and Support Interfaces with MAC Addresses
Add bpf functionality to handle IPv6 packets and apply
DSCP value.
Also support DSCP policy rules on multiple interfaces
simultaneously.

Test: atest DscpPolicyTest

Bug: 217166486
Change-Id: I452a87355fd0382a4c38b84aa3465505951d9bf0
2022-04-15 07:53:51 -07:00
Tyler Wear
723882126a Process DSCP QoS events for policies
New events to handle adding and removing of DSCP QoS policies.
Async indication sends status back to client if the policy
has been added, failed, or if the policy limit has been
reached.

Bug: 202871011
Change-Id: I7988d22ae625ad0dd415927d2943de4a749e6fb8
2022-01-27 10:19:27 +00:00