@@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ltq-dsl-base
-PKG_RELEASE:=2
+PKG_RELEASE:=3
include $(INCLUDE_DIR)/package.mk
@@ -7,16 +7,24 @@ else
XDSL_CTRL=dsl_cpe_control
fi
+DSL_PIPE_LOCKED=0
+
#
# Basic functions to send CLI commands to the vdsl_cpe_control daemon
#
+dsl_init() {
+ killall -q -0 ${XDSL_CTRL} && lock /var/lock/dsl_pipe && DSL_PIPE_LOCKED=1
+ trap dsl_deinit EXIT INT KILL TERM
+}
+dsl_deinit() {
+ test $DSL_PIPE_LOCKED -gt 0 && lock -u /var/lock/dsl_pipe && DSL_PIPE_LOCKED=0
+ exit
+}
dsl_cmd() {
- killall -q -0 ${XDSL_CTRL} && (
- lock /var/lock/dsl_pipe
- echo "$@" > /tmp/pipe/dsl_cpe0_cmd
- cat /tmp/pipe/dsl_cpe0_ack
- lock -u /var/lock/dsl_pipe
- )
+ test $DSL_PIPE_LOCKED -eq 0 && return
+
+ echo "$@" > /tmp/pipe/dsl_cpe0_cmd
+ cat /tmp/pipe/dsl_cpe0_ack
}
dsl_val() {
expr "$1" : '.*'$2'=\([-\.[:alnum:]]*\).*'
@@ -783,6 +791,7 @@ line_features() {
}
dslstat() {
+ dsl_init
vendor
chipset
xtse
Instead of locking/unlocking it for every command. Reduces the runtime for the dslstat/lucistat commands to ~66%. Before: real 0m 2.66s user 0m 0.90s sys 0m 1.76s After: real 0m 1.76s user 0m 0.63s sys 0m 1.13s Signed-off-by: Andre Heider <a.heider@gmail.com> --- v2: bump PKG_RELEASE package/network/utils/ltq-dsl-base/Makefile | 2 +- .../files/lib/functions/lantiq_dsl.sh | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-)