From 6fecffaab56d1ed09667b76b128e310574acba32 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 7 Mar 2011 13:27:42 +0100 Subject: [PATCH] fcoe: add EDD parsing [backport of 70dfe537] --- dracut.kernel.7.xml | 6 ++--- modules.d/95fcoe/module-setup.sh | 3 ++- modules.d/95fcoe/parse-fcoe.sh | 43 ++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/dracut.kernel.7.xml b/dracut.kernel.7.xml index 32e73cf0..2b0d09c8 100644 --- a/dracut.kernel.7.xml +++ b/dracut.kernel.7.xml @@ -577,10 +577,10 @@ netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 FCoE - netroot=fcoe:<interface|MAC>:{dcb|nodcb} + fcoe=<edd|interface|MAC>:{dcb|nodcb} - Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC>, -for the second argument, currently only nodcb is supported. Note: letters in the MAC-address must be lowercase! + Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC> or EDD settings. +For the second argument, currently only nodcb is supported. This parameter can be specified multiple times. Note: letters in the MAC-address must be lowercase! diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh index d5500bbf..f07a9aef 100755 --- a/modules.d/95fcoe/module-setup.sh +++ b/modules.d/95fcoe/module-setup.sh @@ -17,7 +17,7 @@ depends() { } installkernel() { - instmods fcoe 8021q + instmods fcoe 8021q edd } install() { @@ -29,6 +29,7 @@ install() { mkdir -p "$initdir/var/lib/lldpad" inst "$moddir/fcoe-up" "/sbin/fcoe-up" + 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" } diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh index 492cca00..4576d68a 100755 --- a/modules.d/95fcoe/parse-fcoe.sh +++ b/modules.d/95fcoe/parse-fcoe.sh @@ -20,6 +20,9 @@ # If it's not set we don't continue [ -z "$fcoe" ] && return +# FCoE actually supported? +[ -e /sys/module/fcoe/parameters/create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE" + parse_fcoe_opts() { local IFS=: set $fcoe @@ -28,22 +31,48 @@ parse_fcoe_opts() { 2) fcoe_interface=$1 fcoe_dcb=$2 + return 0 ;; 7) fcoe_mac=$1:$2:$3:$4:$5:$6 fcoe_dcb=$7 + return 0 ;; *) - die "Invalid arguments for fcoe=" + warn "Invalid arguments for fcoe=$fcoe" + return 1 ;; esac } parse_fcoe_opts -if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then - die "Invalid FCoE DCB option: $fcoe_dcb" -fi - -# FCoE actually supported? -[ -e /sys/module/fcoe/parameters/create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE" +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" ] && source /sbin/fcoe-genrules.sh + fi + done + done +else + for fcoe in $(getargs fcoe=); do + unset fcoe_mac + unset fcoe_interface + parse_fcoe_opts + if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then + warn "Invalid FCoE DCB option: $fcoe_dcb" + fi + source /sbin/fcoe-genrules.sh + done +fi \ No newline at end of file