fcoe: moved edd detection to settled initqueue
authorHarald Hoyer <harald@redhat.com>
Mon, 2 May 2011 09:25:13 +0000 (11:25 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 2 May 2011 09:25:13 +0000 (11:25 +0200)
At the time of modprobing edd, all pci devices must exist and have to be
initialized for the symlinks to work.

modules.d/95fcoe/fcoe-edd.sh [new file with mode: 0755]
modules.d/95fcoe/module-setup.sh
modules.d/95fcoe/parse-fcoe.sh

diff --git a/modules.d/95fcoe/fcoe-edd.sh b/modules.d/95fcoe/fcoe-edd.sh
new file mode 100755 (executable)
index 0000000..5a81a2e
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+dcb=$1
+
+if ! [ -d /sys/firmware/edd ]; then
+    modprobe edd
+    while ! [ -d /sys/firmware/edd ]; do sleep 0.1; done
+fi
+
+for disk in /sys/firmware/edd/int13_*; do
+    [ -d $disk ] || continue
+    for nic in ${disk}/pci_dev/net/*; do
+        [ -d $nic ] || continue
+        if [ -e ${nic}/address ]; then
+           fcoe_interface=${nic##*/}
+           if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then
+               /sbin/fcoe-up $fcoe_interface $dcb
+               > "/tmp/.fcoe-$fcoe_interface"
+           fi
+        fi
+    done
+done
+modprobe -r edd
index 2ebff09..6738836 100755 (executable)
@@ -29,8 +29,8 @@ install() {
     mkdir -m 0755 -p "$initdir/var/lib/lldpad"
 
     inst "$moddir/fcoe-up" "/sbin/fcoe-up"
+    inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
     inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
-    inst_hook pre-udev 60 "$moddir/fcoe-genrules.sh"
     inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
 }
 
index ab80d78..08c6722 100755 (executable)
@@ -51,20 +51,7 @@ if [ "$fcoe_interface" = "edd" ]; then
     if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
         warn "Invalid FCoE DCB option: $fcoe_dcb"
     fi
-    [ -d /sys/firmware/edd ] || modprobe edd
-    # parse edd interfaces
-    for disk in /sys/firmware/edd/int13_*; do
-        [ -d $disk ] || continue
-        for nic in ${disk}/pci_dev/net/*; do
-            [ -d $nic ] || continue
-            if [ -e ${nic}/address ]; then
-                unset fcoe_mac
-                unset fcoe_interface
-                fcoe_mac=$(cat ${nic}/address)
-                [ -n "$fcoe_mac" ] && . $(command -v fcoe-genrules.sh)
-            fi
-        done
-    done
+    /sbin/initqueue --settled --unique /sbin/fcoe-edd $fcoe_dcb
 else
     for fcoe in $(getargs fcoe=); do
         unset fcoe_mac