Skip to content

Instantly share code, notes, and snippets.

@lzlrd
Created April 3, 2025 23:52
Show Gist options
  • Save lzlrd/22c655e5f05533eb61d4a63e40aadf22 to your computer and use it in GitHub Desktop.
Save lzlrd/22c655e5f05533eb61d4a63e40aadf22 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
rxGroListFlag=false
txNocacheCopyFlag=false
if [ $# -eq 0 ]; then
echo "[ethtool-offload] Enabling offloading on all interfaces."
interfaces="$(ip -o link show | awk -F': ' '{print $2}' | grep -v "lo" | sed 's/@.*$//')"
else
echo "[ethtool-offload] Enabling offloading on the following interfaces: $@."
interfaces="$@"
fi
for i in $interfaces; do
ethtool --offload "$i" rx on tx on sg on tso on ufo on gso on gro on lro on rxvlan on txvlan on ntuple on rxhash on rx-udp-gro-forwarding on
echo "[ethtool-offload] Disabling tx-nocache-copy on $i..."
if [ "$txNocacheCopyFlag" = false ]; then
echo "[ethtool-offload] See https://enterprise-support.nvidia.com/s/article/how-to-bypass-local-cache--disable-tx-nocache-copy-x for more information."
txNocacheCopyFlag=true
fi
ethtool -K "$i" "tx-nocache-copy" off
# echo "[ethtool-offload] Disabling rx-gro-list on $i..."
# if [ "$rxGroListFlag" = false ]; then
# echo "[ethtool-offload] See https://tailscale.com/blog/quic-udp-throughput for more information."
# rxGroListFlag=true
# fi
# ethtool -K "$i" "rx-gro-list" off
done
ACTION=="add", SUBSYSTEM=="net", RUN+="/usr/local/sbin/ethtool-offload %k"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment