]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/95fcoe/parse-fcoe.sh
95fcoe: Fix startup when fcoe module is included
[thirdparty/dracut.git] / modules.d / 95fcoe / parse-fcoe.sh
1 #!/bin/sh
2 #
3 # Supported formats:
4 # fcoe=<networkdevice>:<dcb|nodcb>:<fabric|vn2vn>
5 # fcoe=<macaddress>:<dcb|nodcb>:<fabric|vn2vn>
6 #
7 # Note currently only nodcb is supported, the dcb option is reserved for
8 # future use.
9 #
10 # Note letters in the macaddress must be lowercase!
11 #
12 # Examples:
13 # fcoe=eth0:nodcb:vn2vn
14 # fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric
15
16 if ! getargbool 0 rd.nofcoe ; then
17 info "rd.nofcoe=0: skipping fcoe"
18 return 0
19 fi
20
21 [ -z "$fcoe" ] && fcoe=$(getarg fcoe=)
22
23 # If it's not set we don't continue
24 [ -z "$fcoe" ] && return
25
26 [ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
27
28 initqueue --onetime modprobe -b -q bnx2fc
29
30 parse_fcoe_opts() {
31 local OLDIFS="$IFS"
32 local IFS=:
33 set $fcoe
34 IFS="$OLDIFS"
35
36 case $# in
37 2)
38 fcoe_interface=$1
39 fcoe_dcb=$2
40 fcoe_mode="fabric"
41 return 0
42 ;;
43 3)
44 fcoe_interface=$1
45 fcoe_dcb=$2
46 fcoe_mode=$3
47 return 0
48 ;;
49 7)
50 fcoe_mac=$1:$2:$3:$4:$5:$6
51 fcoe_dcb=$7
52 fcoe_mode="fabric"
53 return 0
54 ;;
55 8)
56 fcoe_mac=$1:$2:$3:$4:$5:$6
57 fcoe_dcb=$7
58 fcoe_mode=$8
59 return 0
60 ;;
61 *)
62 warn "Invalid arguments for fcoe=$fcoe"
63 return 1
64 ;;
65 esac
66 }
67
68 parse_fcoe_opts
69
70 if [ "$fcoe_interface" = "edd" ]; then
71 if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
72 warn "Invalid FCoE DCB option: $fcoe_dcb"
73 fi
74 /sbin/initqueue --settled --unique /sbin/fcoe-edd $fcoe_dcb
75 else
76 for fcoe in $(getargs fcoe=); do
77 unset fcoe_mac
78 unset fcoe_interface
79 parse_fcoe_opts
80 if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
81 warn "Invalid FCoE DCB option: $fcoe_dcb"
82 fi
83 . $(command -v fcoe-genrules.sh)
84 done
85 fi