Skip to content

Commit

Permalink
v6.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel (Fourdee) committed Aug 21, 2018
1 parent ef34710 commit 8d8f905
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions rootfs/etc/network/if-up.d/dietpi-disable_offload
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
{
#////////////////////////////////////
# dietpi-disable_offload
#
#////////////////////////////////////
# Created by Daniel Knight
# Based on original fix & code by @carlosedp: https://github.com/Fourdee/DietPi/issues/2028#issue-352323603
#
#////////////////////////////////////
#
# Info:
# - Sets TCP/UDP offloading disabled for the required devices, which are prone to retransmissions and reset errors.
# - Currently known: RK3399/rock64
#
# Exit codes:
# - 1=failure
# ethtool does not exist
# Failed to set ethtool to flagged devices
# - 0=ok
#
#////////////////////////////////////

#///////////////////////////////////////////////////////////////////////////////////
# Globals
#///////////////////////////////////////////////////////////////////////////////////
CMD=$(which ethtool)
EXIT_CODE=1

#///////////////////////////////////////////////////////////////////////////////////
# Main Loop
#///////////////////////////////////////////////////////////////////////////////////
#-----------------------------------------------------------------------------------
#Ethtool exists?
if [[ $CMD ]]; then

EXIT_CODE=0 #Set success for all devices by default

if [[ -d /sys/devices/platform/fe300000.ethernet/net/$IFACE ||
-d /sys/devices/platform/ff540000.eth/net/$IFACE ||
-d /sys/devices/platform/ff540000.ethernet/net/$IFACE ]]; then

$CMD -K $IFACE rx off tx off
EXIT_CODE=$? #Update exit code once applied

fi

fi
#-----------------------------------------------------------------------------------
exit $EXIT_CODE
#-----------------------------------------------------------------------------------

}

0 comments on commit 8d8f905

Please sign in to comment.