fcoe: add EDD parsing

[backport of 70dfe537]
master
Harald Hoyer 2011-03-07 13:27:42 +01:00
parent 6767fdaaed
commit 6fecffaab5
3 changed files with 41 additions and 11 deletions

View File

@ -577,10 +577,10 @@ netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 </programlisting></par
<title>FCoE</title> <title>FCoE</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><envar>netroot=</envar><constant>fcoe</constant>:<replaceable>&lt;interface|MAC&gt;</replaceable>:<replaceable>{dcb|nodcb}</replaceable></term> <term><envar>fcoe=</envar><replaceable>&lt;edd|interface|MAC&gt;</replaceable>:<replaceable>{dcb|nodcb}</replaceable></term>
<listitem> <listitem>
<para>Try to connect to a FCoE SAN through the NIC specified by <replaceable>&lt;interface&gt;</replaceable> or <replaceable>&lt;MAC&gt;</replaceable>, <para>Try to connect to a FCoE SAN through the NIC specified by <replaceable>&lt;interface&gt;</replaceable> or <replaceable>&lt;MAC&gt;</replaceable> or EDD settings.
for the second argument, currently only nodcb is supported. <remark>Note: letters in the MAC-address must be lowercase!</remark></para> For the second argument, currently only nodcb is supported. This parameter can be specified multiple times. <remark>Note: letters in the MAC-address must be lowercase!</remark></para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>

View File

@ -17,7 +17,7 @@ depends() {
} }


installkernel() { installkernel() {
instmods fcoe 8021q instmods fcoe 8021q edd
} }


install() { install() {
@ -29,6 +29,7 @@ install() {
mkdir -p "$initdir/var/lib/lldpad" mkdir -p "$initdir/var/lib/lldpad"


inst "$moddir/fcoe-up" "/sbin/fcoe-up" 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 pre-udev 60 "$moddir/fcoe-genrules.sh"
inst_hook cmdline 99 "$moddir/parse-fcoe.sh" inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
} }

View File

@ -20,6 +20,9 @@
# If it's not set we don't continue # If it's not set we don't continue
[ -z "$fcoe" ] && return [ -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() { parse_fcoe_opts() {
local IFS=: local IFS=:
set $fcoe set $fcoe
@ -28,22 +31,48 @@ parse_fcoe_opts() {
2) 2)
fcoe_interface=$1 fcoe_interface=$1
fcoe_dcb=$2 fcoe_dcb=$2
return 0
;; ;;
7) 7)
fcoe_mac=$1:$2:$3:$4:$5:$6 fcoe_mac=$1:$2:$3:$4:$5:$6
fcoe_dcb=$7 fcoe_dcb=$7
return 0
;; ;;
*) *)
die "Invalid arguments for fcoe=" warn "Invalid arguments for fcoe=$fcoe"
return 1
;; ;;
esac esac
} }


parse_fcoe_opts parse_fcoe_opts


if [ "$fcoe_interface" = "edd" ]; then
if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
die "Invalid FCoE DCB option: $fcoe_dcb" 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 fi

# FCoE actually supported?
[ -e /sys/module/fcoe/parameters/create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE"