Blame SOURCES/0267-fcoe-start-with-fcoemon-instead-of-fipvlan.patch

712866
From d02f522089863af2a802cef9e63965349bfcc819 Mon Sep 17 00:00:00 2001
712866
From: Chris Leech <cleech@redhat.com>
712866
Date: Fri, 3 Jul 2015 13:40:12 +0200
712866
Subject: [PATCH] fcoe: start with fcoemon instead of fipvlan
712866
712866
---
712866
 modules.d/95fcoe/fcoe-up.sh      | 30 ++++++++++++++++++++++++++++--
712866
 modules.d/95fcoe/module-setup.sh |  7 +++++--
712866
 modules.d/95fcoe/parse-fcoe.sh   |  4 ++--
712866
 3 files changed, 35 insertions(+), 6 deletions(-)
712866
712866
diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh
712866
index edbfcc8..823d7ac 100755
712866
--- a/modules.d/95fcoe/fcoe-up.sh
712866
+++ b/modules.d/95fcoe/fcoe-up.sh
712866
@@ -20,12 +20,28 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
712866
 
712866
 netif=$1
712866
 dcb=$2
712866
+vlan="yes"
712866
 
712866
 linkup "$netif"
712866
 
712866
 netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
712866
 netdriver=${netdriver##*/}
712866
 
712866
+write_fcoemon_cfg() {
712866
+    echo FCOE_ENABLE=\"yes\" > /etc/fcoe/cfg-$netif
712866
+    if [ "$dcb" = "dcb" ]; then
712866
+        echo DCB_REQUIRED=\"yes\" >> /etc/fcoe/cfg-$netif
712866
+    else
712866
+        echo DCB_REQUIRED=\"no\" >> /etc/fcoe/cfg-$netif
712866
+    fi
712866
+    if [ "$vlan" = "yes" ]; then
712866
+	    echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-$netif
712866
+    else
712866
+	    echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-$netif
712866
+    fi
712866
+    echo MODE=\"fabric\" >> /etc/fcoe/cfg-$netif
712866
+}
712866
+
712866
 if [ "$dcb" = "dcb" ]; then
712866
     # Note lldpad will stay running after switchroot, the system initscripts
712866
     # are to kill it and start a new lldpad to take over. Data is transfered
712866
@@ -52,6 +68,13 @@ if [ "$dcb" = "dcb" ]; then
712866
     done
712866
 
712866
     while [ $i -lt 60 ]; do
712866
+        dcbtool sc "$netif" pfc e:1 a:1 w:1 && break
712866
+        info "Retrying to turn dcb on"
712866
+        sleep 1
712866
+        i=$(($i+1))
712866
+    done
712866
+
712866
+    while [ $i -lt 60 ]; do
712866
         dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
712866
         info "Retrying to turn fcoe on"
712866
         sleep 1
712866
@@ -60,7 +83,8 @@ if [ "$dcb" = "dcb" ]; then
712866
 
712866
     sleep 1
712866
 
712866
-    fipvlan "$netif" -c -s
712866
+    write_fcoemon_cfg
712866
+    fcoemon --syslog
712866
 elif [ "$netdriver" = "bnx2x" ]; then
712866
     # If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan
712866
     modprobe 8021q
712866
@@ -69,7 +93,9 @@ elif [ "$netdriver" = "bnx2x" ]; then
712866
     sleep 3
712866
     fipvlan "$netif" -c -s
712866
 else
712866
-    echo -n "$netif" > /sys/module/fcoe/parameters/create
712866
+    vlan="no"
712866
+    write_fcoemon_cfg
712866
+    fcoemon --syslog
712866
 fi
712866
 
712866
 need_shutdown
712866
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
712866
index 8c6290d..ec573ea 100755
712866
--- a/modules.d/95fcoe/module-setup.sh
712866
+++ b/modules.d/95fcoe/module-setup.sh
712866
@@ -3,7 +3,7 @@
712866
 # ex: ts=8 sw=4 sts=4 et filetype=sh
712866
 
712866
 check() {
712866
-    require_binaries dcbtool fipvlan lldpad ip readlink || return 1
712866
+    require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1
712866
     return 0
712866
 }
712866
 
712866
@@ -17,9 +17,12 @@ installkernel() {
712866
 }
712866
 
712866
 install() {
712866
-    inst_multiple ip dcbtool fipvlan lldpad readlink lldptool
712866
+    inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
712866
+    inst_libdir_file 'libhbalinux.so*'
712866
+    inst "/etc/hba.conf" "/etc/hba.conf"
712866
 
712866
     mkdir -m 0755 -p "$initdir/var/lib/lldpad"
712866
+    mkdir -m 0755 -p "$initdir/etc/fcoe"
712866
 
712866
     inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
712866
     inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
712866
diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh
712866
index dc40c82..7eca0b6 100755
712866
--- a/modules.d/95fcoe/parse-fcoe.sh
712866
+++ b/modules.d/95fcoe/parse-fcoe.sh
712866
@@ -22,13 +22,13 @@
712866
 
712866
 
712866
 # BRCM: Later, should check whether bnx2x is loaded first before loading bnx2fc so do not load bnx2fc when there are no Broadcom adapters
712866
-[ -e /sys/module/fcoe/parameters/create ] || modprobe -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
712866
+[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
712866
 
712866
 modprobe bnx2fc >/dev/null 2>&1
712866
 udevadm settle --timeout=30
712866
 
712866
 # FCoE actually supported?
712866
-[ -e /sys/module/fcoe/parameters/create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
712866
+[ -e /sys/bus/fcoe/ctlr_create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
712866
 
712866
 parse_fcoe_opts() {
712866
     local IFS=: