-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ dietpi-disable_offload: https://github.com/Fourdee/DietPi/issues/2028#issue-352323603
- Loading branch information
Daniel (Fourdee)
committed
Aug 21, 2018
1 parent
ef34710
commit 8d8f905
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 | ||
#----------------------------------------------------------------------------------- | ||
|
||
} |