Skip to content

Commit

Permalink
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
donald committed Nov 25, 2021
2 parents ab2b5aa + 4fb8115 commit e2029c3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions install.sh
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
@@ -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

0 comments on commit e2029c3

Please sign in to comment.