Commit graph

1356 commits

Author SHA1 Message Date
Connor O'Brien
00fa9635f8 Make BpfLoadTest parameterized to support multiple test programs
This will enable testing both with & without BTF enabled once
necessary build changes are merged.

Test: libbpf_load_test passes
Bug: 203823368
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ifd89b6c0701791c216807e913d9a4803d9a4dd20
2022-01-21 18:24:21 -08:00
Ken Chen
e4559ccd55 Allow bpfloader to handle 'net_shared' subdirectory am: 6d69784cdc am: c9c3c7c994 am: 84fc2d9edb
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1952237

Change-Id: I96f604ebefd6f58767afb603199801b3828f6e8e
2022-01-19 06:16:48 +00:00
Ken Chen
84fc2d9edb Allow bpfloader to handle 'net_shared' subdirectory am: 6d69784cdc am: c9c3c7c994
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1952237

Change-Id: I7bba6dbe31613df6709cf5ea6ffb50b3d132cc3b
2022-01-19 05:58:38 +00:00
Ken Chen
c9c3c7c994 Allow bpfloader to handle 'net_shared' subdirectory am: 6d69784cdc
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1952237

Change-Id: I789dc82f4ab623d864e5433797665ca4ac3158b7
2022-01-19 05:40:41 +00:00
Ken Chen
6d69784cdc Allow bpfloader to handle 'net_shared' subdirectory
netd.c is moved from netd to tethering mainline module.

Bump BpfLoader to v0.9

Bug: 202086915
Test: cd system/netd; atest
Test: atest TrafficStatsTest NetworkUsageStatsTest
Change-Id: I0b8ba90bbbe4e16d979c4a40d6fdbbaac0d14d27
2022-01-19 04:18:53 +00:00
Connor O'Brien
52863b6ba6 Update Loader.cpp for updated bcc
bpf_create_map and bpf_prog_load have been renamed, so update those
calls. bcc now depends on upstream libbpf and has deleted its
redundant implementations of bpf_obj_pin and bpf_obj_get, so add
upstream libbpf as a dependency.

Test: m libbpf_android
Bug: 203823368
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I324cab44227b0e2f73873f37a28d640ab2373204
2022-01-18 09:26:17 -08:00
Ken Chen
df41916a11 [NETD-BPF#22] Move a few headers to frameworks/libs/net am: d568947cd7 am: d428cdb532 am: b6adf11ce6
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1928474

Change-Id: I4f09ab5b62c3b8d5a38d4d6d7b1cb8a851b3e51a
2021-12-23 17:38:26 +00:00
Ken Chen
11503d2604 Rename bpf_map_utils to bpf_headers am: fb045621be am: 0f3da9cda6 am: 2fcbe703cd
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1931605

Change-Id: I04d91924dd0549b80216778bb91b987626430a48
2021-12-23 17:38:07 +00:00
Ken Chen
b6adf11ce6 [NETD-BPF#22] Move a few headers to frameworks/libs/net am: d568947cd7 am: d428cdb532
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1928474

Change-Id: I09655c9baa0b4e9f080f1046bb5dd35f7edc6bb7
2021-12-23 17:21:44 +00:00
Ken Chen
2fcbe703cd Rename bpf_map_utils to bpf_headers am: fb045621be am: 0f3da9cda6
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1931605

Change-Id: Ia0b2d6c3603452776dc26831e1fae5e09099622d
2021-12-23 17:21:23 +00:00
Ken Chen
d428cdb532 [NETD-BPF#22] Move a few headers to frameworks/libs/net am: d568947cd7
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1928474

Change-Id: Id632a620c7fcd921fbd884a6d3ff18b8ca99b37a
2021-12-23 16:52:18 +00:00
Ken Chen
0f3da9cda6 Rename bpf_map_utils to bpf_headers am: fb045621be
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1931605

Change-Id: Id0582dc9f134a3274715d720b077dbf40ace556d
2021-12-23 16:51:51 +00:00
Ken Chen
d568947cd7 [NETD-BPF#22] Move a few headers to frameworks/libs/net
BPF headers used by both platform and mainline modules should be in
frameworks/libs/net.

Bug: 202086915
Test: build and boot
Test: cd packages/modules/Connectivity/netd; atest
Change-Id: Id9ac888d5519b2a8663232610d36386cabfe4e94
2021-12-23 09:50:01 +08:00
Ken Chen
fb045621be Rename bpf_map_utils to bpf_headers
Use a generic name so that it can contain more bpf related headers.

Bug: 202086915
Test: build
Change-Id: I36d93cbc77723464df84023752915e1e79e623df
2021-12-21 15:36:25 +08:00
Connor O'Brien
11ec908aff Rename libbpf to libbpf_bcc am: 474eb0baa0 am: a8fd7326aa am: 9fa0872599
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1906070

Change-Id: Icf157a88d5103be39fcdff8580aa1467b8250e09
2021-12-17 01:30:27 +00:00
Connor O'Brien
9fa0872599 Rename libbpf to libbpf_bcc am: 474eb0baa0 am: a8fd7326aa
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1906070

Change-Id: I63e02eceb6563a40c26a2b2fcd3ca8be9a29ed7a
2021-12-17 01:13:49 +00:00
Connor O'Brien
a8fd7326aa Rename libbpf to libbpf_bcc am: 474eb0baa0
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1906070

Change-Id: Ie103197999f949af3e97f5d46307831418be9b33
2021-12-17 00:53:15 +00:00
Connor O'Brien
474eb0baa0 Rename libbpf to libbpf_bcc
This is to prevent a name collision with "upstream"
libbpf (external/libbpf) which is built using the same name.

Bug: 203823368
Test: build cuttlefish
Test: m libbpf_load_test
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I9bb798a9b5d832511bed471f01575bba14a1a9d3
2021-12-16 13:16:05 -08:00
Ken Chen
6cdcd3dbfc [NETD-BPF#14] Move BPF map definition and utils to frameworks/libs/net/ am: b1d4888ec2 am: 18af063372 am: 8e2e81b87f
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869329

Change-Id: I7d2c03fdb45ab98e18fa288327b101fc7d4ed425
2021-12-04 13:59:57 +00:00
Ken Chen
624ae395ef [NETD-BPF#13] Delete libbpf_android_test from system/bpf am: b81aef32e5 am: 798d0ae220 am: 53ccd5627c
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1871536

Change-Id: I84ef0cf9885faa788ba06dc844b06d1b76a47829
2021-12-04 13:59:56 +00:00
Ken Chen
8e2e81b87f [NETD-BPF#14] Move BPF map definition and utils to frameworks/libs/net/ am: b1d4888ec2 am: 18af063372
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869329

Change-Id: I64f1bd06f39157921b3fee08e18ed65eb770e65f
2021-12-04 13:47:08 +00:00
Ken Chen
53ccd5627c [NETD-BPF#13] Delete libbpf_android_test from system/bpf am: b81aef32e5 am: 798d0ae220
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1871536

Change-Id: I76cfb677633bcc043ea011398c4369acf33e6b0a
2021-12-04 13:47:06 +00:00
Ken Chen
18af063372 [NETD-BPF#14] Move BPF map definition and utils to frameworks/libs/net/ am: b1d4888ec2
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869329

Change-Id: Id05f96e6956be81adcce0c568bac678b8ea8cfaa
2021-12-04 13:27:08 +00:00
Ken Chen
798d0ae220 [NETD-BPF#13] Delete libbpf_android_test from system/bpf am: b81aef32e5
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1871536

Change-Id: If327280bc344a0cd980ae7b565fa7615c5d20e04
2021-12-04 13:27:07 +00:00
Ken Chen
b1d4888ec2 [NETD-BPF#14] Move BPF map definition and utils to frameworks/libs/net/
Move BPF map definition and utilities to a common place that easy to be
referenced from both mainline module and platform code.

Bug: 202086915
Test: m; flash; boot
Test: cd system/netd/ && atest
Test: cd packages/modules/Connectivity && atest
Test: m gpuservice_unittest libtimeinstate_test bpf_module_test
      CtsAppOpsTestCases libbpf_load_test VtsBootconfigTest
      vts_test_binary_bpf_module bpf_benchmark libbpf_load_test
      libbpf_android_test
Change-Id: Ib15cf78c2da97bff835fb406c866676eec77c013
2021-12-04 03:42:55 +00:00
Ken Chen
b81aef32e5 [NETD-BPF#13] Delete libbpf_android_test from system/bpf
The test will be moved to frameworks/libs/net along with header files.

Bug: 202086915
Test: m
Merged-In: I1de9c1f443f8bf90ef341e4867866093e62f427d
Change-Id: I1de9c1f443f8bf90ef341e4867866093e62f427d
2021-12-04 02:30:36 +00:00
Ken Chen
416aa4b846 [NETD-BPF#10] Add WaitForProgsLoaded.h am: 5b0fbc192e am: 0f9e8af368 am: 2e70f46b48
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869328

Change-Id: Ie18a7a9bdb12830a9559e57ed863bbb035fa3acc
2021-12-03 10:41:11 +00:00
Ken Chen
2e70f46b48 [NETD-BPF#10] Add WaitForProgsLoaded.h am: 5b0fbc192e am: 0f9e8af368
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869328

Change-Id: Iaa6620f85e16322fe5fc59cbeaed6c766c5be4ff
2021-12-03 10:30:50 +00:00
Ken Chen
0f9e8af368 [NETD-BPF#10] Add WaitForProgsLoaded.h am: 5b0fbc192e
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869328

Change-Id: I87ce9bbb4b16e08375e149a3bf418228ab8289ce
2021-12-03 10:15:14 +00:00
Ken Chen
a7d95946ef Merge "[NETD_BPF#8] Move BpfUtils.cpp to BpfUtils.h" am: edfca8b548 am: eb3273cd75 am: 9f3e43abb6
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869327

Change-Id: I46ecac9bbda4a674d82421bf04c8e8ae752a1c45
2021-12-03 09:50:47 +00:00
Ken Chen
9f3e43abb6 Merge "[NETD_BPF#8] Move BpfUtils.cpp to BpfUtils.h" am: edfca8b548 am: eb3273cd75
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869327

Change-Id: I90537fbab5aaa70a29a28b84fe664451af727818
2021-12-03 09:33:48 +00:00
Ken Chen
eb3273cd75 Merge "[NETD_BPF#8] Move BpfUtils.cpp to BpfUtils.h" am: edfca8b548
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1869327

Change-Id: Ie5613d2a86e8b32866b3a4dd91a1d64e6d9b0ee9
2021-12-03 09:20:00 +00:00
Ken Chen
5b0fbc192e [NETD-BPF#10] Add WaitForProgsLoaded.h
Move waitForProgsLoaded() from libbpf_android.h to a single header file.
A transitional commit of separating headers, utilities from bfploader.

Bug: 202086915
Test: build; flash; cd system/netd; atest
Change-Id: Ief1bcd09e973f952c29859a7a8fba92c8626e32d
2021-12-03 08:16:24 +00:00
Ken Chen
edfca8b548 Merge "[NETD_BPF#8] Move BpfUtils.cpp to BpfUtils.h" 2021-12-03 08:15:06 +00:00
Paul Lawrence
848edf331f Support fuse prog types am: 9548f9fbed am: f691bedf1d am: 3c639df877
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1894086

Change-Id: I88f01738e70527c69f3fe1e82dba86c728447e02
2021-11-29 16:58:46 +00:00
Paul Lawrence
3c639df877 Support fuse prog types am: 9548f9fbed am: f691bedf1d
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1894086

Change-Id: I169e46cf1a07dc9330dd5346a0b5f1cd690b004a
2021-11-29 16:45:04 +00:00
Paul Lawrence
f691bedf1d Support fuse prog types am: 9548f9fbed
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1894086

Change-Id: I87b30e592b2104c302aa09721b7683eed08f096b
2021-11-29 16:33:04 +00:00
Paul Lawrence
9548f9fbed Support fuse prog types
When fuse-bpf lands in the kernel, support reading its bpf program type
from /sys/fs/fuse/bpf_prog_type_fuse and load such programs.

This is to allow development of fuse-bpf to continue, and is needed
until such time as fuse-bpf is upstreamed and this value is fixed.

Bug: 202785178
Test: Along with change to bpfprogs, prog_fuse_media_fuse_media appears
in /sys/fs/bpf

Change-Id: I83636f25b0a0c678b3ee48c6450d9c8dc157387b
2021-11-23 00:28:12 +00:00
Ken Chen
02c2536103 [NETD_BPF#8] Move BpfUtils.cpp to BpfUtils.h
Functions in BpfUtils.cpp are trivial, they can be static inlined
in BpfUtils.h.

Bug: 202086915
Test: m; flash; boot; cd system/netd && atest
Test: m gpuservice_unittest libtimeinstate_test bpf_module_test
      CtsAppOpsTestCases libmeminfo_test VtsBootconfigTest
      vts_test_binary_bpf_module
Change-Id: Ie1ece23b6fc9a4db5fc95930209a10da1e528cb5
2021-11-21 10:59:39 +08:00
Maciej Żenczykowski
f4858cf090 fix 'cgroupsockaddr' support am: 2b203138cb am: cb9d56d7f8 am: ef6a079d07
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1897227

Change-Id: Ic93093c9b16b516b524b2373da5d2dd3e2a5e1a3
2021-11-19 13:23:50 +00:00
Maciej Żenczykowski
ef6a079d07 fix 'cgroupsockaddr' support am: 2b203138cb am: cb9d56d7f8
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1897227

Change-Id: I335cb59b41867cfece23d064de071eb1fed007ff
2021-11-19 13:07:42 +00:00
Maciej Żenczykowski
cb9d56d7f8 fix 'cgroupsockaddr' support am: 2b203138cb
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1897227

Change-Id: Ie824bebe88bd9edd4a958060a1aa0bdb7422fe78
2021-11-19 12:56:41 +00:00
Maciej Żenczykowski
2b203138cb fix 'cgroupsockaddr' support
... it does prefix matching - and first match wins.

By appending / to the strings this no longer matters.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I54f41fbccd2632334adb9d1ae4fcc44cd1b0141f
2021-11-19 11:18:57 +00:00
Maciej Żenczykowski
70b2d210eb document how to debug bpfloader failures am: e49e0c60cd am: cd132dc1fc am: 298d16e28c
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1896605

Change-Id: I40bc752c4384e93c0d70f15724668ea1571c1e1a
2021-11-19 02:02:58 +00:00
Maciej Żenczykowski
298d16e28c document how to debug bpfloader failures am: e49e0c60cd am: cd132dc1fc
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1896605

Change-Id: I0ea803dd88b137dab3803783343f9931bdf2bb6f
2021-11-19 01:50:29 +00:00
Maciej Żenczykowski
cd132dc1fc document how to debug bpfloader failures am: e49e0c60cd
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1896605

Change-Id: Ib243829d791547f7680ca0c78111616e6c6377c6
2021-11-19 01:33:46 +00:00
Maciej Żenczykowski
e49e0c60cd document how to debug bpfloader failures
Test: N/A
Bug: 204131517
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia6a8ca026f3ab403443e130dceb2aca0ce0f2343
2021-11-19 01:18:12 +00:00
Maciej Żenczykowski
e7f7b4907e Merge "add mainline module support for targetting only newer bpfloader versions" am: 210d6be5ac am: c50acfa7b9 am: d87a5be05f
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1895608

Change-Id: Ib8387ebcfbf6ae436db7a36b23c466d08119a7a2
2021-11-18 07:58:43 +00:00
Treehugger Robot
458b630552 Merge "rename SEC() to SECTION()" am: bc8df444d1 am: bab48348a4 am: 453f93e9db
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1895607

Change-Id: Ic84ea528924826a79c7e885eb73041b415c658bc
2021-11-18 07:58:35 +00:00
Maciej Żenczykowski
d87a5be05f Merge "add mainline module support for targetting only newer bpfloader versions" am: 210d6be5ac am: c50acfa7b9
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1895608

Change-Id: I36b582d3e23283373b0fbdf9db9ff79b029210b0
2021-11-18 07:47:04 +00:00