Merge "Ignore BPF tethering offload test if tether config is disabled"
This commit is contained in:
@@ -944,6 +944,8 @@ public class BpfCoordinator {
|
|||||||
* be allowed to be accessed on the handler thread.
|
* be allowed to be accessed on the handler thread.
|
||||||
*/
|
*/
|
||||||
public void dump(@NonNull IndentingPrintWriter pw) {
|
public void dump(@NonNull IndentingPrintWriter pw) {
|
||||||
|
// Note that EthernetTetheringTest#isTetherConfigBpfOffloadEnabled relies on
|
||||||
|
// "mIsBpfEnabled" to check tethering config via dumpsys. Beware of the change if any.
|
||||||
pw.println("mIsBpfEnabled: " + mIsBpfEnabled);
|
pw.println("mIsBpfEnabled: " + mIsBpfEnabled);
|
||||||
pw.println("Polling " + (mPollingStarted ? "started" : "not started"));
|
pw.println("Polling " + (mPollingStarted ? "started" : "not started"));
|
||||||
pw.println("Stats provider " + (mStatsProvider != null
|
pw.println("Stats provider " + (mStatsProvider != null
|
||||||
|
|||||||
@@ -1125,12 +1125,18 @@ public class EthernetTetheringTest {
|
|||||||
@IgnoreUpTo(Build.VERSION_CODES.R)
|
@IgnoreUpTo(Build.VERSION_CODES.R)
|
||||||
public void testTetherUdpV4AfterR() throws Exception {
|
public void testTetherUdpV4AfterR() throws Exception {
|
||||||
final String kernelVersion = VintfRuntimeInfo.getKernelVersion();
|
final String kernelVersion = VintfRuntimeInfo.getKernelVersion();
|
||||||
boolean usingBpf = isUdpOffloadSupportedByKernel(kernelVersion);
|
final boolean isUdpOffloadSupported = isUdpOffloadSupportedByKernel(kernelVersion);
|
||||||
if (!usingBpf) {
|
if (!isUdpOffloadSupported) {
|
||||||
Log.i(TAG, "testTetherUdpV4AfterR will skip BPF offload test for kernel "
|
Log.i(TAG, "testTetherUdpV4AfterR will skip BPF offload test for kernel "
|
||||||
+ kernelVersion);
|
+ kernelVersion);
|
||||||
}
|
}
|
||||||
runUdp4Test(initTetheringTester(toList(TEST_IP4_ADDR), toList(TEST_IP4_DNS)), usingBpf);
|
final boolean isTetherConfigBpfOffloadEnabled = isTetherConfigBpfOffloadEnabled();
|
||||||
|
if (!isTetherConfigBpfOffloadEnabled) {
|
||||||
|
Log.i(TAG, "testTetherUdpV4AfterR will skip BPF offload test "
|
||||||
|
+ "because tethering config doesn't enable BPF offload.");
|
||||||
|
}
|
||||||
|
runUdp4Test(initTetheringTester(toList(TEST_IP4_ADDR), toList(TEST_IP4_DNS)),
|
||||||
|
isUdpOffloadSupported && isTetherConfigBpfOffloadEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -1189,6 +1195,21 @@ public class EthernetTetheringTest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isTetherConfigBpfOffloadEnabled() throws Exception {
|
||||||
|
final String dumpStr = DumpTestUtils.dumpService(Context.TETHERING_SERVICE, "--short");
|
||||||
|
|
||||||
|
// BPF offload tether config can be overridden by "config_tether_enable_bpf_offload" in
|
||||||
|
// packages/modules/Connectivity/Tethering/res/values/config.xml. OEM may disable config by
|
||||||
|
// RRO to override the enabled default value. Get the tethering config via dumpsys.
|
||||||
|
// $ dumpsys tethering
|
||||||
|
// mIsBpfEnabled: true
|
||||||
|
boolean enabled = dumpStr.contains("mIsBpfEnabled: true");
|
||||||
|
if (!enabled) {
|
||||||
|
Log.d(TAG, "BPF offload tether config not enabled: " + dumpStr);
|
||||||
|
}
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private Inet6Address getClatIpv6Address(TetheringTester tester, TetheredDevice tethered)
|
private Inet6Address getClatIpv6Address(TetheringTester tester, TetheredDevice tethered)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user