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

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