Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #219 from mariux64/add-net_qdisc_nfs_low
net_qdisc_nfs_low: Add script
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /bin/bash | ||
|
||
. /etc/local/mxhost.conf | ||
|
||
case "$1" in | ||
start) | ||
tc qdisc add dev $MX_NETDEV root handle 10: prio | ||
tc qdisc add dev $MX_NETDEV parent 10:1 handle 20: sfq # band 0 highest priority | ||
tc qdisc add dev $MX_NETDEV parent 10:2 handle 30: sfq # band 2 | ||
tc qdisc add dev $MX_NETDEV parent 10:3 handle 40: sfq # band 3 | ||
|
||
tc filter add dev $MX_NETDEV parent 10: handle 100: protocol ip prio 4 u32 divisor 1 | ||
tc filter add dev $MX_NETDEV parent 10: handle 100:0:1 protocol ip prio 4 u32 ht 100: match tcp dst 2049 FFFF flowid 10:2 | ||
|
||
# The "root filter list is always 800:0. | ||
# "match ip firstfrag" compiles to "match 00002000/00003fff at 4" which | ||
# includes the "more fragments" flag, so only initial fragments of a | ||
# fragmented packet would be selected, not single fragments of an | ||
# unfragmented packet. So use "match u32 00000000 00001fff at 4" to | ||
# make sure, this is a initial segment and has a tcp header. | ||
|
||
tc filter add dev $MX_NETDEV parent 10: handle 800:0:1 protocol ip prio 4 u32 ht 800: \ | ||
match ip protocol 06 ff \ | ||
match u32 00000000 00001fff at 4 \ | ||
offset at 0 mask 0f00 shift 6 \ | ||
link 100: | ||
tc filter add dev $MX_NETDEV parent 10: handle 800:0:2 protocol ip prio 4 u32 ht 800: match u32 0 0 flowid 10:1 | ||
;; | ||
stop) | ||
tc filter delete dev $MX_NETDEV | ||
tc qdisc delete dev $MX_NETDEV root | ||
;; | ||
restart) | ||
$0 stop | ||
$0 start | ||
;; | ||
status) | ||
tc -s qdisc show dev $MX_NETDEV | ||
tc -s filter show dev $MX_NETDEV | ||
;; | ||
*) | ||
echo "usage: $0 { start | stop | restart | status }" >&2 | ||
exit 1 | ||
esac |