tune usb irq (dwc3) based on usb function

This among other things greatly increases tethering performance.

Bug: 202103325
Test: tput improved
(synced from commit f9e02b98b8243d2db566df16d4e763250ac9efaf)

Change-Id: I19b22d748352eb04bc27d85c0f69fa2571b63d53
This commit is contained in:
Ray Chi 2022-01-11 18:30:46 +08:00 committed by TreeHugger Robot
parent cac15c0134
commit a872edb528
4 changed files with 29 additions and 0 deletions

View file

@ -89,6 +89,12 @@ on property:vendor.usb.config=*
on property:persist.vendor.usb.usbradio.config=*
start usbd
on property:vendor.usb.dwc3_irq=medium
exec /vendor/bin/hw/set_usb_irq.sh medium
on property:vendor.usb.dwc3_irq=big
exec /vendor/bin/hw/set_usb_irq.sh big
on charger
mkdir /config/usb_gadget/g1
mkdir /config/usb_gadget/g1/strings/0x409

View file

@ -264,6 +264,7 @@ PRODUCT_COPY_FILES += \
# Shell scripts
PRODUCT_COPY_FILES += \
device/google/gs201/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \
device/google/$(TARGET_BOARD_PLATFORM)/set_usb_irq.sh:$(TARGET_COPY_OUT_VENDOR)/bin/hw/set_usb_irq.sh
# insmod files
PRODUCT_COPY_FILES += \

16
set_usb_irq.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# Switch into /proc/irq/$IRQ for the dwc3 usb controller
cd /proc/irq/*/dwc3/.. || exit 7
# Move the USB Controller (DWC3) interrupt as requested
# Modem and DIT are on 0/2/5 depending on throughput, so avoid those.
# 0-3 small, 4-5 medium, 6-7 big
case "$1" in
medium) core=4;;
big) core=6;;
*) core=0;;
esac
# This can sometimes fail due to smp_affinity_list no longer existing...
echo "${core}" > smp_affinity_list

View file

@ -390,6 +390,12 @@ Return<void> UsbGadget::setCurrentUsbFunctions(uint64_t functions,
goto error;
}
if (functions & GadgetFunction::NCM) {
SetProperty("vendor.usb.dwc3_irq", "big");
} else {
SetProperty("vendor.usb.dwc3_irq", "medium");
}
ALOGI("Usb Gadget setcurrent functions called successfully");
return Void();