Files
wlan-ap/feeds/ucentral/atfpolicy/files/atfpolicy.init
John Crispin a77d881147 atfpolicy: add package
Add a Airtime Scheduler that adjusts an UEs ATF weight based on its
WMM/TID usage.

Fixes: WIFI-5703
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-11 02:22:02 +01:00

58 lines
931 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (c) 2021 OpenWrt.org
START=50
USE_PROCD=1
PROG=/usr/sbin/atfpolicy
add_option() {
local type="$1"
local name="$2"
config_get val "$cfg" "$name"
[ -n "$val" ] && json_add_$type "$name" "$val"
}
add_defaults() {
cfg="$1"
json_add_boolean reset 1
add_option int vo_queue_weight
add_option int update_pkt_threshold
add_option int bulk_percent_thresh
add_option int prio_percent_thresh
add_option int weight_normal
add_option int weight_prio
add_option int weight_bulk
}
reload_service() {
json_init
config_load atfpolicy
config_foreach add_defaults defaults
ubus call atfpolicy config "$(json_dump)"
}
service_triggers() {
procd_add_reload_trigger atfpolicy
}
start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
}
service_started() {
ubus -t 10 wait_for atfpolicy
[ $? = 0 ] && reload_service
}