SVN: rc-scripts/tags/0.4.0.27: AUTHORS po/pl.po rc.d/init.d/functions rc.d/rc.shutdown

siefca siefca at pld-linux.org
Sun Nov 26 09:17:25 CET 2006


Author: siefca
Date: Sun Nov 26 09:17:24 2006
New Revision: 7994

Modified:
   rc-scripts/tags/0.4.0.27/AUTHORS
   rc-scripts/tags/0.4.0.27/po/pl.po
   rc-scripts/tags/0.4.0.27/rc.d/init.d/functions
   rc-scripts/tags/0.4.0.27/rc.d/rc.shutdown
Log:
- implemented workaround for Wake-On-Lan in nVidia nForce ethernet driver


Modified: rc-scripts/tags/0.4.0.27/AUTHORS
==============================================================================
--- rc-scripts/tags/0.4.0.27/AUTHORS	(original)
+++ rc-scripts/tags/0.4.0.27/AUTHORS	Sun Nov 26 09:17:24 2006
@@ -29,8 +29,10 @@
 Michał Kochanowicz <mkochano at pld-linux.org>
 	fixes, progress()
 	
-Paweł Wilk <siefca at pl.qmail.org>
-	executing scripts on iface up/down
+Paweł Wilk <siefca at gnu.org>
+        executing scripts on iface up/down
+        timezone setup & resolvesymlink
+        nVidia ethernet Wake-On-Lan work-around
 
 Robert Ślaski <robin at atm.com.pl>
 	ATM support

Modified: rc-scripts/tags/0.4.0.27/po/pl.po
==============================================================================
--- rc-scripts/tags/0.4.0.27/po/pl.po	(original)
+++ rc-scripts/tags/0.4.0.27/po/pl.po	Sun Nov 26 09:17:24 2006
@@ -684,6 +684,10 @@
 msgid "Unsetting time zone information"
 msgstr "Usuwanie informacji o strefie czasowej"
 
+#: ../rc.d/init.d/functions:930
+msgid "Forcing sleep state for the nForce interface %s"
+msgstr "Wymuszanie stanu uśpienia dla interfejsu nForce %s"
+
 #~ msgid "%s (pid %s) is running..."
 #~ msgstr "%s (pid %s) jest uruchomiony..."
 

Modified: rc-scripts/tags/0.4.0.27/rc.d/init.d/functions
==============================================================================
--- rc-scripts/tags/0.4.0.27/rc.d/init.d/functions	(original)
+++ rc-scripts/tags/0.4.0.27/rc.d/init.d/functions	Sun Nov 26 09:17:24 2006
@@ -894,6 +894,59 @@
 	echo $SELINUX > $selinuxfs/enforce
 }
 
+# Wake-On-Lan workaround for nForce ethernet drivers.
+# To realy help it also requires patched kernel module.
+# Written by Pawel Wilk using idea from Arjen Verweij,
+# see http://atlas.et.tudelft.nl/verwei90/nforce2/wol.html
+#
+# Call it only when system halts/suspends, there is
+# no return to the D0 power state after execution!
+#
+forcedeth_workaround()
+{
+    [ -x /sbin/ethtool ] || return 2
+    [ -x /sbin/pci-config || return 2
+    grep -qi forcedeth /proc/modules || return 0
+    
+    # TIMERIRQ DISABLED is a token in description, which
+    # protects us against system hang - only patched module will have it
+    modinfo -F description forcedeth | grep -qi 'timerirq disabled' || return 0
+
+    typeset iface bus_dev_fn bus lookfor dev_index cur_state
+
+    for iface in $(ip link show | awk -F'[ :]+' '/eth[0-9]+/ {print $2}')
+    do
+	if LC_ALL=C ethtool -i "${iface}" 2>&1 | egrep -qi 'driver:[[:blank:]]forcedeth'; then
+	    case $(LC_ALL=C ethtool "${iface}" 2>&1 | awk 'tolower($1) ~ "wake-on:" {print $2}') in
+		*d*) continue ;; # 'd' letter means that the WON was DISABLED for interface
+		"") continue ;;  # empty string means that the WON is not supported here
+	    esac
+	    bus_dev_fn=$(LC_ALL=C ethtool -i ${iface} 2>&1 | awk -F'[ :.]+' '/^bus-info:/ {printf ("%d %d %d",$3,$4,$5) }')
+	    if [ -n "${bus_dev_fn}" -a "${bus_dev_fn}" != "0 0 0" ]; then
+		bus=$(echo "${bus_dev_fn}" | awk '{print $1}')
+		lookfor=$(echo "${bus_dev_fn}" | awk '{print "at bus "$1" device/function "$2"/"$3}')
+		dev_index=$(LC_ALL=C pci-config -B${bus} 2>&1 | grep -i "${lookfor}" | awk '/Device \#[0-9]+/ {print $2}')
+		if [ -n "${dev_index}" ]; then
+		    show "Forcing sleep state for the nForce interface %s" ${iface} ; busy
+		    ip link set ${iface} up 2>&1 >/dev/null # need it to be up
+		    sleep 1
+		    pci-config -S -$dev_index 2>&1 >/dev/null
+		    RESULT=$?
+		    cur_state=$(pci-config -a -$dev_index 2>&1 | awk -F'[ \t:.]+' ' tolower($2$3) ~ "powerstate" {print tolower($4)}')
+		    if [ "${cur_state}" != "d3" ]; then
+			RESULT=1
+		    fi
+		    if [ $RESULT -gt 0 ]; then
+                	fail
+            	    else
+                        ok
+                    fi
+		fi
+	    fi
+	fi
+    done
+}
+
 # Remove duplicate entries from mtab (for vserver guest use only)
 clean_vserver_mtab() {
 	:>/etc/mtab.clean

Modified: rc-scripts/tags/0.4.0.27/rc.d/rc.shutdown
==============================================================================
--- rc-scripts/tags/0.4.0.27/rc.d/rc.shutdown	(original)
+++ rc-scripts/tags/0.4.0.27/rc.d/rc.shutdown	Sun Nov 26 09:17:24 2006
@@ -48,6 +48,9 @@
 halt -w
 
 if ! is_yes "$VSERVER"; then
+	# Work-around for the nVidia drivers Wake-On-Lan functionality.
+	forcedeth_workaround
+
 	# Turn off swap, then unmount file systems.
 	run_cmd "Turning off swap" swapoff -a
 


More information about the pld-cvs-commit mailing list