diff options
author | junyulai <junyulai@google.com> | 2018-06-25 21:51:14 +0800 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-07-23 23:01:18 +0000 |
commit | 9598764092881814eebf40713793d152ec639c22 (patch) | |
tree | e44ba8fbbd4eaad246988e06c1cf8aa3dbb81424 | |
parent | cab85f2d4b9e15c3759ba3640ac2a11ff9dee2b9 (diff) | |
download | base-9598764092881814eebf40713793d152ec639c22.tar.gz |
DO NOT MERGE: use legacy way to get tcp packet count
The current networkStats getIfaceStats implementation check if
bpf is enabled, and use bpf to get all traffic stats. However,
the bpf implementation did not contain tcp packet counts. So
data stall detection in DcTracker could not get the packet
count to trigger data stall. Hence the data stall never
triggers for device that enables bpf.
This solution is for short term solution that rollback the
design to use xt_qtaguid for bpf enabled device.
Bug: 110443385
Test: 1. fake data stall to trigger data stall recovery
2. enable debug log to make sure tcp packet count is
correct
3. runtest frameworks-net
4. run cts -m CtsUsageStatsTestCases
Change-Id: I1ce9e92fe194da2ea0a3eec014fd50bb50cdd44a
(cherry picked from commit a5c3fb10f25768f62f796f75b4b9f6b4962b19ab)
-rw-r--r-- | services/core/java/com/android/server/net/NetworkStatsService.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java index addc479404e9..fec510f28a9c 100644 --- a/services/core/java/com/android/server/net/NetworkStatsService.java +++ b/services/core/java/com/android/server/net/NetworkStatsService.java @@ -941,7 +941,13 @@ public class NetworkStatsService extends INetworkStatsService.Stub { @Override public long getIfaceStats(String iface, int type) { - return nativeGetIfaceStat(iface, type, checkBpfStatsEnable()); + // eBPF code doesn't provide per-interface TCP counters. Use xt_qtaguid for now. + // TODO: delete getMobileTcp(Rx|Tx)Packets entirely. See b/110443385 . + if (type == TYPE_TCP_TX_PACKETS || type == TYPE_TCP_RX_PACKETS) { + return nativeGetIfaceStat(iface, type, false); + } else { + return nativeGetIfaceStat(iface, type, checkBpfStatsEnable()); + } } @Override |