summaryrefstree
path: root/system_ext/bin/netbox.sh
blob: e6a2c06e1be2ab12b0ce081a67fb69b8a7b42d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/system/bin/sh
# SPDX-FileCopyrightText: 2016-2023 Unisoc (Shanghai) Technologies Co., Ltd
# SPDX-License-Identifier: LicenseRef-Unisoc-General-1.0

LOG_TAG="netbox.sh"

function exe_log()
{
	local cmd="$@"
	local emsg="$(eval $cmd 2>&1)"

	log -p d -t "$LOG_TAG" "$cmd ecode=$? $emsg"
}

function gro_switch()
{
	for fileGro in $(ls /sys/devices/platform/sipa-eth*/gro_enable)
		do
			exe_log "echo $1 > $fileGro";
		done

	exe_log "echo $1 > /sys/module/seth/parameters/gro_enable"
}

if [ "$1" == "gro" ]; then
	if [ "$2" == "on" ]; then
		gro_switch 1;
	elif [ "$2" == "off" ]; then
		gro_switch 0;
	fi
fi