Skip to content

Instantly share code, notes, and snippets.

@thejhh
Created February 11, 2017 10:09
Show Gist options
  • Select an option

  • Save thejhh/a8b6155a32cc32b715b0a9eb20b0b131 to your computer and use it in GitHub Desktop.

Select an option

Save thejhh/a8b6155a32cc32b715b0a9eb20b0b131 to your computer and use it in GitHub Desktop.
Fix rx and tx in e100 network driver with ethtool
#!/bin/bash
# Copyright 2017 Jaakko-Heikki Heusala <jheusala@iki.fi>
# MIT License
#
# Use like:
#
# auto eth0
# iface eth0 inet dhcp
# pre-up /usr/local/sbin/fix-e100.sh eth0
#
interface="$1"
if test "$interface"; then
:
else
echo "USAGE: $0 ethX" >&2
exit 1
fi
ethtool='/sbin/ethtool'
if test -x $ethtool; then
:
else
echo "ERROR: You need ethtool installed." >&2
exit 2
fi
values="$(ethtool -g "$interface"|grep -F 'Current hardware settings:' -A 4|grep -E '^(RX|TX):'|sort|awk '{print $2}'|tr '\n' '\t')"
rx="$(echo "$values"|awk '{print $1}')"
tx="$(echo "$values"|awk '{print $2}')"
if test "x$rx" = x256; then
:
else
"$ethtool" -G "$interface" rx 256
fi
if test "x$tx" = x256; then
:
else
"$ethtool" -G "$interface" tx 256
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment