Blame SOURCES/0375-95iscsi-Fixup-bnx2i-offload-booting.patch

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