|
@@ -1,3 +1,9 @@
|
|
1
|
+# This program is free software; you can redistribute it and/or modify
|
|
2
|
+# it under the terms of the GNU General Public License version 2 as
|
|
3
|
+# published by the Free Software Foundation.
|
|
4
|
+#
|
|
5
|
+# Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
|
|
6
|
+
|
1
|
7
|
#improve the logread output
|
2
|
8
|
sqm_logger() {
|
3
|
9
|
logger -t SQM -s ${1}
|
|
@@ -74,42 +80,6 @@ get_ifb_associated_with_if() {
|
74
|
80
|
echo ${CUR_IFB}
|
75
|
81
|
}
|
76
|
82
|
|
77
|
|
-# what is the lowest-index currently not used ifb device
|
78
|
|
-#sm: hopefully this is not required any longer, and can be deleted after a bit more testing...
|
79
|
|
-get_lowest_unused_ifb() {
|
80
|
|
- LOWEST_FREE_IFB=
|
81
|
|
- # this just returns a list of currently existing IFBs, these need not be associated with any interface
|
82
|
|
- CUR_UP_IFBS=$( ifconfig | grep -o -e ifb'[[:digit:]]\+' )
|
83
|
|
- # the possible IFBs (N in insmod ifb numifbs=N)
|
84
|
|
- here=$( pwd )
|
85
|
|
- cd /sys/devices/virtual/net/
|
86
|
|
- CUR_ALLOWED_IFBS=$( ls -d ifb* )
|
87
|
|
- sqm_logger "Currently allowed IFBs: ${CUR_ALLOWED_IFBS}"
|
88
|
|
- cd ${here}
|
89
|
|
- # this is the sorted list of the active ifbs
|
90
|
|
- # note for 3.10.32 unused and even down IFBs linger on in the tc output, so take $CUR_UP_IFBS instead
|
91
|
|
- # a better test might be to check for each allowed IFB whether it is in use
|
92
|
|
- # but the only way I figured out doing this means interating over all interfaces and that sounds costly
|
93
|
|
- # so instead we rely on stop.sh actually calling ifconfig ${LAST_USED_IFB} down
|
94
|
|
- CUR_USED_IFBS=$( tc -d qdisc | grep -o -e ifb'[[:digit:]]\+' | sort -u)
|
95
|
|
- sqm_logger "Currently used IFBs: ${CUR_USED_IFBS}"
|
96
|
|
- # now find the lowest index not in the sorted list
|
97
|
|
- local CUR_IDX=0
|
98
|
|
- while [ -z "$LOWEST_FREE_IFB" ]
|
99
|
|
- do
|
100
|
|
- #TMP=$( echo "${CUR_USED_IFBS}" | grep -o -e ifb${CUR_IDX} )
|
101
|
|
- TMP=$( echo "${CUR_UP_IFBS}" | grep -o -e ifb${CUR_IDX} )
|
102
|
|
- [ -z "$TMP" ] && LOWEST_FREE_IFB="ifb"${CUR_IDX}
|
103
|
|
- CUR_IDX=$(( $CUR_IDX + 1 ))
|
104
|
|
- done
|
105
|
|
- # check whether the number is in the allowed range
|
106
|
|
- LOWEST_FREE_IFB=$( echo "${CUR_ALLOWED_IFBS}" | grep -o -e ${LOWEST_FREE_IFB} )
|
107
|
|
- [ -z "${LOWEST_FREE_IFB}" ] && sqm_logger "The IFB candidate ifb$(( ${CUR_IDX} - 1 )) is not in the range of allowed IFBs, bailing out..."
|
108
|
|
- sqm_logger "selected ifb index: ${LOWEST_FREE_IFB}"
|
109
|
|
- echo ${LOWEST_FREE_IFB}
|
110
|
|
-}
|
111
|
|
-
|
112
|
|
-# instead of playing around with indices just create a named IFB
|
113
|
83
|
# ATTENTION, IFB names can only be 15 chararcters, so we chop of excessive characters at the start of the interface name
|
114
|
84
|
# if required
|
115
|
85
|
create_new_ifb_for_if() {
|
|
@@ -134,8 +104,6 @@ get_ifb_for_if() {
|
134
|
104
|
CUR_IF=$1
|
135
|
105
|
# if an ifb is already associated return that
|
136
|
106
|
CUR_IFB=$( get_ifb_associated_with_if ${CUR_IF} )
|
137
|
|
- # otherwise find the lowest unused ifb device
|
138
|
|
- #[ -z "$CUR_IFB" ] && CUR_IFB=$( get_lowest_unused_ifb )
|
139
|
107
|
[ -z "$CUR_IFB" ] && CUR_IFB=$( create_new_ifb_for_if ${CUR_IF} )
|
140
|
108
|
[ -z "$CUR_IFB" ] && sqm_logger "Could not find existing IFB for ${CUR_IF}, nor create a new IFB instead..."
|
141
|
109
|
echo ${CUR_IFB}
|
|
@@ -145,13 +113,6 @@ get_ifb_for_if() {
|
145
|
113
|
[ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) # automagically get the right IFB device for the IFACE"
|
146
|
114
|
|
147
|
115
|
|
148
|
|
-
|
149
|
|
-#sqm_logger "iqdisc opts: ${iqdisc_opts}"
|
150
|
|
-#sqm_logger "eqdisc opts: ${eqdisc_opts}"
|
151
|
|
-
|
152
|
|
-#sqm_logger "LLAM: ${LLAM}"
|
153
|
|
-#sqm_logger "LINKLAYER: ${LINKLAYER}"
|
154
|
|
-
|
155
|
116
|
get_htb_adsll_string() {
|
156
|
117
|
ADSLL=""
|
157
|
118
|
if [ "$LLAM" = "htb_private" -a "$LINKLAYER" != "none" ];
|