Blame 0040-95iscsi-Fixup-bnx2i-offload-booting.patch

Harald Hoyer b94732
From 2e34f3809524d5a69e06a51e13bb3f41b300b4ed Mon Sep 17 00:00:00 2001
Harald Hoyer b94732
From: Hannes Reinecke <hare@suse.de>
Harald Hoyer b94732
Date: Thu, 11 Dec 2014 15:46:01 +0100
Harald Hoyer b94732
Subject: [PATCH] 95iscsi: Fixup bnx2i offload booting
Harald Hoyer b94732
Harald Hoyer b94732
bnx2i is using a separate iSCSI offload engine with a separate
Harald Hoyer b94732
MAC address. As a result, the iBFT information is displaying
Harald Hoyer b94732
a MAC address which does not relate to any MAC address from
Harald Hoyer b94732
the network interfaces.
Harald Hoyer b94732
In addition, the iSCSI offload engine works independently on
Harald Hoyer b94732
the NIC, so we do not need to enable the NIC for iSCSI offload
Harald Hoyer b94732
to work.
Harald Hoyer b94732
This patch modifies the automatic iBFT detection to not set
Harald Hoyer b94732
the 'ip=ibft' flag when bnx2i offload is detected.
Harald Hoyer b94732
Harald Hoyer b94732
References: bnc#855747
Harald Hoyer b94732
Harald Hoyer b94732
Signed-off-by: Hannes Reinecke <hare@suse.de>
Harald Hoyer b94732
Signed-off-by: Thomas Renninger <trenn@suse.de>
Harald Hoyer b94732
---
Harald Hoyer b94732
 modules.d/95iscsi/module-setup.sh | 26 +++++++++++++++++++++++++-
Harald Hoyer b94732
 1 file changed, 25 insertions(+), 1 deletion(-)
Harald Hoyer b94732
Harald Hoyer b94732
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
Harald Hoyer b94732
index 3641fb8..d30e64f 100755
Harald Hoyer b94732
--- a/modules.d/95iscsi/module-setup.sh
Harald Hoyer b94732
+++ b/modules.d/95iscsi/module-setup.sh
Harald Hoyer b94732
@@ -28,14 +28,38 @@ check() {
Harald Hoyer b94732
     return 0
Harald Hoyer b94732
 }
Harald Hoyer b94732
 
Harald Hoyer b94732
+get_ibft_mod() {
Harald Hoyer b94732
+    local ibft_mac=$1
Harald Hoyer b94732
+    # Return the iSCSI offload module for a given MAC address
Harald Hoyer b94732
+    iscsiadm -m iface | while read iface_name iface_desc ; do
Harald Hoyer b94732
+        IFS=$','
Harald Hoyer b94732
+        set -- $iface_desc
Harald Hoyer b94732
+        if [ "$ibft_mac" = "$2" ] ; then
Harald Hoyer b94732
+            echo $1
Harald Hoyer b94732
+            return 0
Harald Hoyer b94732
+        fi
Harald Hoyer b94732
+        unset IFS
Harald Hoyer b94732
+    done
Harald Hoyer b94732
+}
Harald Hoyer b94732
+
Harald Hoyer b94732
 install_ibft() {
Harald Hoyer b94732
     # When iBFT / iscsi_boot is detected:
Harald Hoyer b94732
     # - Use 'ip=ibft' to set up iBFT network interface
Harald Hoyer b94732
+    #   Note: bnx2i is using a different MAC address of iSCSI offloading
Harald Hoyer b94732
+    #         so the 'ip=ibft' parameter must not be set
Harald Hoyer b94732
     # - specify firmware booting cmdline parameter
Harald Hoyer b94732
 
Harald Hoyer b94732
     for d in /sys/firmware/* ; do
Harald Hoyer b94732
+        if [ -d ${d}/ethernet0 ] ; then
Harald Hoyer b94732
+            read ibft_mac < ${d}/ethernet0/mac
Harald Hoyer b94732
+            ibft_mod=$(get_ibft_mod $ibft_mac)
Harald Hoyer b94732
+        fi
Harald Hoyer b94732
+        if [ -z "$ibft_mod" ] && [ -d ${d}/ethernet1 ] ; then
Harald Hoyer b94732
+            read ibft_mac < ${d}/ethernet1/mac
Harald Hoyer b94732
+            ibft_mod=$(get_ibft_mod $ibft_mac)
Harald Hoyer b94732
+        fi
Harald Hoyer b94732
         if [ -d ${d}/initiator ] ; then
Harald Hoyer b94732
-            if [ ${d##*/} = "ibft" ] ; then
Harald Hoyer b94732
+            if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
Harald Hoyer b94732
                 echo -n "ip=ibft "
Harald Hoyer b94732
             fi
Harald Hoyer b94732
             echo -n "rd.iscsi.firmware=1"