Created
May 28, 2024 19:17
-
-
Save Fail-Safe/536e5aa3864ee54078d17bf54b7d76e7 to your computer and use it in GitHub Desktop.
Updates all `aql_txq_limit` values to user-specified choice.
This file contains hidden or 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
#!/bin/sh | |
argc() { argc=$#; } | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: Enter your AQL preference as 'latency', 'balanced', 'bandwidth', or an integer value for aql_txq_limit." >&2 | |
exit 1 | |
fi | |
aql_txqs=$(find /sys/ -name 'aql_txq_limit') | |
argc $aql_txqs | |
if [ "$argc" -eq 0 ]; then | |
echo "Error: No AQL tx queues found." | |
exit 1 | |
fi | |
aql_txq_limit=$(echo "$1" | awk '{print tolower($0)}') | |
if [ "$aql_txq_limit" == "latency" ]; then | |
aql_txq_limit=1500 | |
elif [ "$aql_txq_limit" == "balanced" ]; then | |
aql_txq_limit=5000 | |
elif [ "$aql_txq_limit" == "bandwidth" ]; then | |
aql_txq_limit=15000 | |
elif [ "$aql_txq_limit" -eq "$aql_txq_limit" ] 2>/dev/null; then | |
echo -e "\nInfo: Valid integer value provided." | |
else | |
echo "Error: Invalid AQL preference provided. Enter your AQL preference as 'latency', 'balanced', 'bandwidth', or an integer value for aql_txq_limit." | |
exit 1 | |
fi | |
for aql_txq in $aql_txqs; do | |
echo -e "\n>> Device setting: $aql_txq <<" | |
echo "Before:" | |
cat "$aql_txq" | |
for ac in 0 1 2 3; do echo $ac $aql_txq_limit $aql_txq_limit > "$aql_txq"; done | |
echo -e "\nAfter:" | |
cat "$aql_txq" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment