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

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