Skip to content

net_qdisc_nfs_low: Add script #219

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ install_data prun/pman.1 "$DESTDIR$usr_mandir/m
install_exec crashkernel/startup-crashmemory "$DESTDIR$usr_sbindir/startup-crashmemory"
install_data crashkernel/startup-crashmemory.service "$DESTDIR$systemdunitdir/startup-crashmemory.service"
install_exec mxsnoop/mxsnoop.sh "$DESTDIR$usr_sbindir/mxsnoop.sh"
install_exec net_qdisc_nfs_low/net_qdisc_nfs_low "$DESTDIR$usr_sbindir/net_qdisc_nfs_low"

postinstall
exit
44 changes: 44 additions & 0 deletions net_qdisc_nfs_low/net_qdisc_nfs_low
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