Blame 0105-fcoe-start-with-fcoemon-instead-of-fipvlan.patch

Harald Hoyer bb31e7
From 4891d9a2ce693f5649b4a0e9214d00488e0b128c Mon Sep 17 00:00:00 2001
Harald Hoyer bb31e7
From: Chris Leech <cleech@redhat.com>
Harald Hoyer bb31e7
Date: Fri, 3 Jul 2015 13:40:12 +0200
Harald Hoyer bb31e7
Subject: [PATCH] fcoe: start with fcoemon instead of fipvlan
Harald Hoyer bb31e7
Harald Hoyer bb31e7
(cherry picked from commit d02f522089863af2a802cef9e63965349bfcc819)
Harald Hoyer bb31e7
---
Harald Hoyer bb31e7
 modules.d/95fcoe/fcoe-up.sh      | 30 ++++++++++++++++++++++++++++--
Harald Hoyer bb31e7
 modules.d/95fcoe/module-setup.sh |  8 +++++---
Harald Hoyer bb31e7
 modules.d/95fcoe/parse-fcoe.sh   |  5 +----
Harald Hoyer bb31e7
 3 files changed, 34 insertions(+), 9 deletions(-)
Harald Hoyer bb31e7
Harald Hoyer bb31e7
diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh
Harald Hoyer bb31e7
index 950e4b6..fb3b4c4 100755
Harald Hoyer bb31e7
--- a/modules.d/95fcoe/fcoe-up.sh
Harald Hoyer bb31e7
+++ b/modules.d/95fcoe/fcoe-up.sh
Harald Hoyer bb31e7
@@ -15,6 +15,7 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 netif=$1
Harald Hoyer bb31e7
 dcb=$2
Harald Hoyer bb31e7
+vlan="yes"
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 iflink=$(cat /sys/class/net/$netif/iflink)
Harald Hoyer bb31e7
 ifindex=$(cat /sys/class/net/$netif/ifindex)
Harald Hoyer bb31e7
@@ -29,6 +30,21 @@ linkup "$netif"
Harald Hoyer bb31e7
 netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
Harald Hoyer bb31e7
 netdriver=${netdriver##*/}
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
+write_fcoemon_cfg() {
Harald Hoyer bb31e7
+    echo FCOE_ENABLE=\"yes\" > /etc/fcoe/cfg-$netif
Harald Hoyer bb31e7
+    if [ "$dcb" = "dcb" ]; then
Harald Hoyer bb31e7
+        echo DCB_REQUIRED=\"yes\" >> /etc/fcoe/cfg-$netif
Harald Hoyer bb31e7
+    else
Harald Hoyer bb31e7
+        echo DCB_REQUIRED=\"no\" >> /etc/fcoe/cfg-$netif
Harald Hoyer bb31e7
+    fi
Harald Hoyer bb31e7
+    if [ "$vlan" = "yes" ]; then
Harald Hoyer bb31e7
+	    echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-$netif
Harald Hoyer bb31e7
+    else
Harald Hoyer bb31e7
+	    echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-$netif
Harald Hoyer bb31e7
+    fi
Harald Hoyer bb31e7
+    echo MODE=\"fabric\" >> /etc/fcoe/cfg-$netif
Harald Hoyer bb31e7
+}
Harald Hoyer bb31e7
+
Harald Hoyer bb31e7
 if [ "$dcb" = "dcb" ]; then
Harald Hoyer bb31e7
     # wait for lldpad to be ready
Harald Hoyer bb31e7
     i=0
Harald Hoyer bb31e7
@@ -47,6 +63,13 @@ if [ "$dcb" = "dcb" ]; then
Harald Hoyer bb31e7
     done
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
     while [ $i -lt 60 ]; do
Harald Hoyer bb31e7
+        dcbtool sc "$netif" pfc e:1 a:1 w:1 && break
Harald Hoyer bb31e7
+        info "Retrying to turn dcb on"
Harald Hoyer bb31e7
+        sleep 1
Harald Hoyer bb31e7
+        i=$(($i+1))
Harald Hoyer bb31e7
+    done
Harald Hoyer bb31e7
+
Harald Hoyer bb31e7
+    while [ $i -lt 60 ]; do
Harald Hoyer bb31e7
         dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
Harald Hoyer bb31e7
         info "Retrying to turn fcoe on"
Harald Hoyer bb31e7
         sleep 1
Harald Hoyer bb31e7
@@ -55,7 +78,8 @@ if [ "$dcb" = "dcb" ]; then
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
     sleep 1
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-    fipvlan "$netif" -c -s
Harald Hoyer bb31e7
+    write_fcoemon_cfg
Harald Hoyer bb31e7
+    fcoemon --syslog
Harald Hoyer bb31e7
 elif [ "$netdriver" = "bnx2x" ]; then
Harald Hoyer bb31e7
     # If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan
Harald Hoyer bb31e7
     modprobe 8021q
Harald Hoyer bb31e7
@@ -64,7 +88,9 @@ elif [ "$netdriver" = "bnx2x" ]; then
Harald Hoyer bb31e7
     sleep 3
Harald Hoyer bb31e7
     fipvlan "$netif" -c -s
Harald Hoyer bb31e7
 else
Harald Hoyer bb31e7
-    printf '%s' "$netif" > /sys/module/fcoe/parameters/create
Harald Hoyer bb31e7
+    vlan="no"
Harald Hoyer bb31e7
+    write_fcoemon_cfg
Harald Hoyer bb31e7
+    fcoemon --syslog
Harald Hoyer bb31e7
 fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 need_shutdown
Harald Hoyer bb31e7
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
Harald Hoyer bb31e7
index 9c67f17..ae606aa 100755
Harald Hoyer bb31e7
--- a/modules.d/95fcoe/module-setup.sh
Harald Hoyer bb31e7
+++ b/modules.d/95fcoe/module-setup.sh
Harald Hoyer bb31e7
@@ -10,8 +10,7 @@ check() {
Harald Hoyer bb31e7
         [ -z "$fcoe_ctlr" ] && return 255
Harald Hoyer bb31e7
     }
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-    require_binaries dcbtool fipvlan lldpad ip readlink || return 1
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
+    require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1
Harald Hoyer bb31e7
     return 0
Harald Hoyer bb31e7
 }
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
@@ -67,9 +66,12 @@ cmdline() {
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 # called by dracut
Harald Hoyer bb31e7
 install() {
Harald Hoyer bb31e7
-    inst_multiple ip dcbtool fipvlan lldpad readlink lldptool
Harald Hoyer bb31e7
+    inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
Harald Hoyer bb31e7
+    inst_libdir_file 'libhbalinux.so*'
Harald Hoyer bb31e7
+    inst "/etc/hba.conf" "/etc/hba.conf"
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
     mkdir -m 0755 -p "$initdir/var/lib/lldpad"
Harald Hoyer bb31e7
+    mkdir -m 0755 -p "$initdir/etc/fcoe"
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
     if [[ $hostonly_cmdline == "yes" ]] ; then
Harald Hoyer bb31e7
         local _fcoeconf=$(cmdline)
Harald Hoyer bb31e7
diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh
Harald Hoyer bb31e7
index a214007..9f47184 100755
Harald Hoyer bb31e7
--- a/modules.d/95fcoe/parse-fcoe.sh
Harald Hoyer bb31e7
+++ b/modules.d/95fcoe/parse-fcoe.sh
Harald Hoyer bb31e7
@@ -18,12 +18,9 @@
Harald Hoyer bb31e7
 # If it's not set we don't continue
Harald Hoyer bb31e7
 [ -z "$fcoe" ] && return
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
-# BRCM: Later, should check whether bnx2x is loaded first before loading bnx2fc so do not load bnx2fc when there are no Broadcom adapters
Harald Hoyer bb31e7
-[ -d /sys/module/fcoe ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
Harald Hoyer bb31e7
+[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 initqueue --onetime modprobe -b -q bnx2fc
Harald Hoyer bb31e7
-udevadm settle --timeout=30
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 parse_fcoe_opts() {
Harald Hoyer bb31e7
     local OLDIFS="$IFS"