Steven Webster fc33582e4f Traffic control fixes and refresh
This commit fixes a couple of issues surrounding the main StarlingX
traffic control script.  The following has been changed:

- The name of the script has been changed to remove the 'cgcs_'
  prefix

- Obsolete code involving the (old) infrastructure network and
  related consolidation with the management interface has been
  removed.

- There is no more class/qdisc for live-migration, since that
  traffic now runs over the cluster-host network.  It should
  be prioritized via a kubernetes network policy instead.
  (not in this commit)

- The code has been cleaned up to define the handles and qdisc
  parameters globally so they can be changed once instead of
  in each tc command.

- SM heartbeats are treated as high priority traffic. Previously,
  we were only treating a tos of 0x10 (low delay) as high priority
  traffic, while SM uses a DSCP value of 0xc0.

- The script now handles IPv6

Closes-Bug: #1839386
Change-Id: I32cd58842865d8c8efe9444b23b05a96f1df168a
Signed-off-by: Steven Webster <steven.webster@windriver.com>
2019-10-28 17:34:31 -05:00

83 lines
2.7 KiB
Bash
Executable File

#! /bin/bash
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Loads Up Utilities and Commands Variables
source /usr/local/sbin/collect_parms
source /usr/local/sbin/collect_utils
SERVICE="tc"
LOGFILE="${extradir}/tc.info"
echo "${hostname}: Traffic Controls . : ${LOGFILE}"
###############################################################################
# Interface Info
###############################################################################
delimiter ${LOGFILE} "cat /etc/network/interfaces"
if [ -f /etc/network/interfaces ]; then
cat /etc/network/interfaces >> ${LOGFILE}
else
echo "/etc/network/interfaces NOT FOUND" >> ${LOGFILE}
fi
delimiter ${LOGFILE} "ip link"
ip link >> ${LOGFILE}
for i in $(ip link | grep mtu | grep eth |awk '{print $2}' | sed 's#:##g'); do
delimiter ${LOGFILE} "ethtool ${i}"
ethtool ${i} >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "cat /sys/class/net/${i}/speed"
cat /sys/class/net/${i}/speed >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "ethtool -S ${i}"
ethtool -S ${i} >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
done
###############################################################################
# TC Configuration Script (/usr/local/bin/tc_setup.sh)
###############################################################################
delimiter ${LOGFILE} "cat /usr/local/bin/tc_setup.sh"
if [ -f /usr/local/bin/tc_setup.sh ]; then
cat /usr/local/bin/tc_setup.sh >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
else
echo "/usr/local/bin/tc_setup.sh NOT FOUND" >> ${LOGFILE}
fi
###############################################################################
# TC Configuration
###############################################################################
delimiter ${LOGFILE} "tc qdisc show"
tc qdisc show >> ${LOGFILE}
for i in $(ip link | grep htb | awk '{print $2}' | sed 's#:##g'); do
delimiter ${LOGFILE} "tc class show dev ${i}"
tc class show dev ${i} >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "tc filter show dev ${i}"
tc filter show dev ${i} >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
done
###############################################################################
# TC Statistics
###############################################################################
delimiter ${LOGFILE} "tc -s qdisc show"
tc -s qdisc show >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
for i in $(ip link | grep htb | awk '{print $2}' | sed 's#:##g'); do
delimiter ${LOGFILE} "tc -s class show dev ${i}"
tc -s class show dev ${i} >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
delimiter ${LOGFILE} "tc -s filter show dev ${i}"
tc -s filter show dev ${i} >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
done
exit 0