Commit graph

2176 commits

Author SHA1 Message Date
Maciej enczykowski
e5a32ae658 bpf loader - add support for new schedcls type
am: ffa7aadf75

Change-Id: I60395d1d0db2551f704b204fbe166ab1f34a6f8d
2019-01-25 02:12:12 -08:00
Maciej Żenczykowski
ffa7aadf75 bpf loader - add support for new schedcls type
which maps to BPF_PROG_TYPE_SCHED_CLS

Bug: 65674744
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7ca5912756c575e2c0667b9dae2d24471845e028
2019-01-24 23:16:10 -08:00
Chenbo Feng
c8c3020a50 Merge "Do not take cumulative network stats anymore" am: 5b2a4f4159 am: c451e95209
am: fd6718e01b

Change-Id: I846bcbde5be8b6ecb83e93280de68a1fc2486a03
2019-01-24 11:50:41 -08:00
Chenbo Feng
fd6718e01b Merge "Do not take cumulative network stats anymore" am: 5b2a4f4159
am: c451e95209

Change-Id: Icdfadb3269bb746bae6a630a8a9fdd0682eeee58
2019-01-24 11:13:12 -08:00
Chenbo Feng
c451e95209 Merge "Do not take cumulative network stats anymore"
am: 5b2a4f4159

Change-Id: I189c5a1cfc24585d887d38b94e3a04870e9e2286
2019-01-24 10:55:26 -08:00
Chenbo Feng
5b2a4f4159 Merge "Do not take cumulative network stats anymore" 2019-01-24 18:16:25 +00:00
Connor O'Brien
0d8c4105f7 Add time_in_state.o to build am: c8885ccf3f am: 5dfa15cadb
am: a7de47192b

Change-Id: I8ea1b8cfdecee7b13340d0f0522f237dbef8add1
2019-01-23 15:53:54 -08:00
Connor O'Brien
a7de47192b Add time_in_state.o to build am: c8885ccf3f
am: 5dfa15cadb

Change-Id: I5ac698538c5e0c1550c871705bc2dba00a0e8d3b
2019-01-23 15:49:49 -08:00
Connor O'Brien
5dfa15cadb Add time_in_state.o to build
am: c8885ccf3f

Change-Id: Ic46a2f95767377390af60b3209bfe7ec682ca877
2019-01-23 15:44:17 -08:00
Connor O'Brien
c8885ccf3f Add time_in_state.o to build
bpfloader now has CAP_SYS_ADMIN, which allows it to load programs like
time_in_state.o that use eBPF's tracepoint support.

Test: make bpfloader
Test: ls /sys/fs/bpf/ shows time_in_state progs and maps are created
Bug: 112334572
Bug: 78498733
Change-Id: Iedff50381c9ee2b3bdfc6c01b2e2ccaeaf0917d5
Signed-off-by: Connor O'Brien <connoro@google.com>
2019-01-23 12:09:19 -08:00
Chenbo Feng
9cd8f14ed0 Do not take cumulative network stats anymore
Use two maps to record the details of network stats and swap and clean
up after system server pulls the stats. The kernel program checks the
bpf map currently enabled before updating the stats and updates on the
corresponding map. Remove the TAG_STATS_MAP since we don't need to worry
about uid stats overflow problem. All the stats can be stored in the
same map until system server scrapes the stats and clean it up.

Bug: 79171384
Test: dumpsys netd trafficcontroller
      CtsUsageStatsTestCases

Change-Id: Ic79e382f51bf21eee78c4cac5a8a97edaf3654cd
2019-01-22 18:40:10 -08:00
Steven Moreland
65e2b23220 Replace clang-format with symlink.
Automatic consistency.

Bug: 122835115
Test: manual
Change-Id: I3ca92906c3bde25d3314ea3da91f1c42d09332f4
2019-01-18 14:26:33 -08:00
Joel Fernandes
f83ce2a102 Set bpf.progs_loaded property when programs finish loading am: d3ec871017 am: b4ea87be03
am: d3e821739d

Change-Id: I5053bd645c065fd5cd2d611d93a72b9cf6d7be3e
2019-01-14 15:50:15 -08:00
Joel Fernandes
fc1338768e bpfloader: Make it an init service am: 6e1341ef20 am: 71ae90e0f2
am: a95fc2631b

Change-Id: Idba3781a765b36c0a3a0b2228fc98f51fae99084
2019-01-14 15:50:05 -08:00
Joel Fernandes
d3e821739d Set bpf.progs_loaded property when programs finish loading am: d3ec871017
am: b4ea87be03

Change-Id: I01d613fab6393ea54c0cd1508eac3866999e08a8
2019-01-14 15:01:42 -08:00
Joel Fernandes
a95fc2631b bpfloader: Make it an init service am: 6e1341ef20
am: 71ae90e0f2

Change-Id: Ifd0ff0462a86998de551183f96826da5f4e90b9b
2019-01-14 15:01:32 -08:00
Joel Fernandes
b4ea87be03 Set bpf.progs_loaded property when programs finish loading
am: d3ec871017

Change-Id: Ia26b08e968e04085b9e22ef70711f19b4f2843ac
2019-01-14 14:06:42 -08:00
Joel Fernandes
71ae90e0f2 bpfloader: Make it an init service
am: 6e1341ef20

Change-Id: I40258fe60be096d614ecf838f11a2fc2d097e2ae
2019-01-14 14:06:35 -08:00
Joel Fernandes
d3ec871017 Set bpf.progs_loaded property when programs finish loading
The property bpf.progs_loaded will be used by services expecting BPF
programs to be loaded and wait before they are loaded.

Bug: 112334572

Change-Id: I19daa0caa84e2659e8790f0dd551d95ab824e13b
Signed-off-by: Joel Fernandes <joelaf@google.com>
2019-01-11 09:02:11 -05:00
Chenbo Feng
d4f64096d3 New bpfloader netd kernel program am: c1dd7648b1 am: 8a9681b360
am: f6c30042b7

Change-Id: Ia1be0c726c98d1aa41dfb198888d6ce80a3319fc
2019-01-09 11:35:00 -08:00
Chenbo Feng
f6c30042b7 New bpfloader netd kernel program am: c1dd7648b1
am: 8a9681b360

Change-Id: I5d686647b75c5ab0beb4ddf6c9327a719ba29e71
2019-01-09 11:15:50 -08:00
Chenbo Feng
8a9681b360 New bpfloader netd kernel program
am: c1dd7648b1

Change-Id: I543955a4d19bc6fd4cd79b6bdd6ea547de217b63
2019-01-09 10:53:27 -08:00
Joel Fernandes
6e1341ef20 bpfloader: Make it an init service
With this, bpfloader does not need to be started by netd and will load
at boot time.

Bug: 112334572
Change-Id: Iad777ed0a5bb5995dbf2fc176a220292a4c5e41f
Signed-off-by: Joel Fernandes <joelaf@google.com>
2019-01-07 20:17:42 -05:00
Chenbo Feng
c1dd7648b1 New bpfloader netd kernel program
Change the netd bpf program to the new format. Adding map definition and
necessary helper functions to the kernel program code. Move the netd bpf
programs out of bpfloader to a new directory.

Test: dumpsys netd trafficcontroller
Bug: 112334572
Change-Id: I9287285d188e966193532b1522b5d3e67e32e930
2019-01-07 20:17:42 -05:00
Chih-Hung Hsieh
3da0528055 Remove unused using decls. am: 18d8bfcfe9 am: df2c186b85
am: 762b1d1bee

Change-Id: Ic194b43f2f5aa8a7a9f9cd620a679af7b89f9fdc
2018-12-19 16:09:36 -08:00
Chih-Hung Hsieh
762b1d1bee Remove unused using decls. am: 18d8bfcfe9
am: df2c186b85

Change-Id: I8e8c528343eaa8bb0277324b519e26f9dcce36a4
2018-12-19 15:57:16 -08:00
Chih-Hung Hsieh
df2c186b85 Remove unused using decls.
am: 18d8bfcfe9

Change-Id: I6d5ac3fabfc687b4aa3b52c4488d68042e9a5955
2018-12-19 15:47:43 -08:00
Chih-Hung Hsieh
18d8bfcfe9 Remove unused using decls.
Bug: 121209395
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,misc-unused-using-decls
Change-Id: I42d89c904c562ea2860510844c139b93ebee4637
2018-12-18 15:02:11 -08:00
Joel Fernandes
96f5772bf9 Initial checkin for relocatable ELF loader and link with bcc am: d76a2004a6 am: 6ed41e94a5
am: 50dd665575

Change-Id: I9fe9c9e1e8d86820693fc5ab2d0fc3cc92d98cac
2018-12-17 16:46:53 -08:00
Joel Fernandes
50dd665575 Initial checkin for relocatable ELF loader and link with bcc am: d76a2004a6
am: 6ed41e94a5

Change-Id: I10bf1c680fb76544b75c29cdfcfe043ea7ac3a0a
2018-12-17 16:41:50 -08:00
Joel Fernandes
6ed41e94a5 Initial checkin for relocatable ELF loader and link with bcc
am: d76a2004a6

Change-Id: I292123efc24bc6a761353cc829a2e8596c1c4547
2018-12-17 16:32:46 -08:00
Joel Fernandes
d76a2004a6 Initial checkin for relocatable ELF loader and link with bcc
* Wrote a relocatable ELF loader from scratch. The loader library loads
all objects in /system/etc/bpf/, parses and fixes up eBPF instructions
based on relocation information, creates maps and programs and pins
them. A single API call without arguments is made which results in this
operation. The API has all the information it needs from the filesystem
and the ELF objects, so there is no configuration stored in the code
calling the loader API essentially making it zero conf. Initially this
will be used by time_in_state statistics collection using tracepoints.
In the future, netd's eBPF C code should be rewritten to use this
infrastructure and the old ELF loader can be gotten rid off. This is the
first step.

* Link libbpf with libbpf_android which will come from the external/ bcc
project. This will be used for tracepoint and perf eBPF support. In the
future it can be used for other things as kernel eBPF support advances.

This patch will be merged only after bcc is cloned into external/ to
prevent build breakage.

Bug: 112334572
Change-Id: Ic0fd9504e18031132d40bb627c5e44058d59c9f8
Signed-off-by: Joel Fernandes <joelaf@google.com>
2018-12-17 22:27:56 +00:00
Yi Kong
249768e328 Use size_t instead of unsigned int am: 4a74569453 am: 08333b4f40
am: b519321d89

Change-Id: Ic7292dd6fd052c7a811d0d097e84b65b49855b3d
2018-12-16 19:43:03 -08:00
Yi Kong
b519321d89 Use size_t instead of unsigned int am: 4a74569453
am: 08333b4f40

Change-Id: I607f36e5b26ee2f29ca14937053c1181ea81761d
2018-12-16 19:39:03 -08:00
Yi Kong
08333b4f40 Use size_t instead of unsigned int
am: 4a74569453

Change-Id: I89fcb241e31734931e0170f5bc4bfdf65fa4da18
2018-12-16 19:33:57 -08:00
Yi Kong
4a74569453 Use size_t instead of unsigned int
Addresses follow-up review on commit fc3c769.

Test: m checkbuild
Change-Id: I79cd341c425ebe27cc66584540398fc98e94be50
2018-12-16 18:23:19 -08:00
Yi Kong
a5a5937d31 Fix sign-compare warning am: cb8e0a08ea am: a66d9d59dd
am: bbf889512c

Change-Id: I0749caa6b985233fc971426eb85acbfeb0ae4295
2018-12-14 18:39:30 -08:00
Yi Kong
bbf889512c Fix sign-compare warning am: cb8e0a08ea
am: a66d9d59dd

Change-Id: I062ca6e1d4473de18560f8fb93602a429de203af
2018-12-14 18:35:30 -08:00
Yi Kong
a66d9d59dd Fix sign-compare warning
am: cb8e0a08ea

Change-Id: I2850472be94e7802aaa280dcba1dd30d026075dc
2018-12-14 18:31:28 -08:00
Yi Kong
cb8e0a08ea Fix sign-compare warning
system/bpf/bpfloader/BpfLoader.cpp:79:23: error: comparison of integers of different signs: 'int' and 'std::__1::vector<android::bpf::BpfMapInfo, std::__1::allocator<android::bpf::BpfMapInfo> >::size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
    for (int i = 0; i < mapPatterns.size(); i++) {
                    ~ ^ ~~~~~~~~~~~~~~~~~~`

Test: m checkbuild
Change-Id: If2891bfc7655aea34499975763f72e0a25b32289
2018-12-14 14:31:42 -08:00
Chenbo Feng
0214acd2cd Revert "resolve merge conflicts of 9b44fcfedc34a5f34ea08c7ed15014c4caedbd9f to master-arc-dev"
This reverts commit ea08523a09.

Reason for revert: This change should not be added in master. We need to keep this project identical between aosp master and internal master

Change-Id: I10ba2e4126a01573b74377c04871aaed39092e6e
2018-12-12 14:42:50 -08:00
Elliott Hughes
4bb6730a10 C++17 is the default now. am: fc3c7690fe am: f6b6d72d9f
am: 76ee4f28f6

Change-Id: I71108046cd6fa8ae0566b01a4aa366655f0331de
2018-12-07 18:07:24 -08:00
Elliott Hughes
76ee4f28f6 C++17 is the default now. am: fc3c7690fe
am: f6b6d72d9f

Change-Id: I076fdf3fbc953f3539b70e749a90c67421d9eea4
2018-12-07 18:02:26 -08:00
Elliott Hughes
f6b6d72d9f C++17 is the default now.
am: fc3c7690fe

Change-Id: I71bcd81bd872e467009a90a72e54a974f7194ece
2018-12-07 17:59:25 -08:00
Elliott Hughes
fc3c7690fe C++17 is the default now.
Test: builds
Change-Id: Ieb3cf0a0c035e1b2fcea4a5e80bb0c1df473349f
2018-12-03 09:36:31 -08:00
Chenbo Feng
2fa50de7af Code style clean up am: 1f20ad3d78 am: 5006e6a662
am: 9e85c4bda7

Change-Id: I311b33c78af85540f0b1efcdc66b01409f965040
2018-11-29 13:02:50 -08:00
Chenbo Feng
9e85c4bda7 Code style clean up am: 1f20ad3d78
am: 5006e6a662

Change-Id: I5dad88bb91ec0629077627c66e83b077b111fa82
2018-11-29 12:54:23 -08:00
Chenbo Feng
5006e6a662 Code style clean up
am: 1f20ad3d78

Change-Id: I52c8d6ecc4f77f9de96e7abbee3c92d52c9d67f1
2018-11-29 12:50:15 -08:00
Chenbo Feng
1f20ad3d78 Code style clean up
Apply the git clang format on the bpf project to make sure the existing
code compliance with the standard.

Test: project compiles and bpfMapTest pass.
Bug: 112334572
Change-Id: I4774aa2a197be2c671f6fb307c1fc9b71edfeeec
2018-11-28 11:31:36 -08:00
Chenbo Feng
0f52167b71 Skip the bpf native tests on old devices am: 249e2f869e am: e86dee8f01
am: f4a511c0da

Change-Id: Ibbcf56506a3f3a13c18fb58dfa2eb59e9c0fe2a8
2018-11-26 14:33:01 -08:00