Blame SOURCES/0545-fcoe-handle-CNAs-with-DCB-firmware-support.patch

0903d0
From f055e5126f7d28553c3886a865e5f13fdc4c18d2 Mon Sep 17 00:00:00 2001
0903d0
From: Xunlei Pang <xlpang@redhat.com>
0903d0
Date: Mon, 25 Sep 2017 11:18:06 +0800
0903d0
Subject: [PATCH] fcoe: handle CNAs with DCB firmware support
0903d0
0903d0
Some Combined Network Adapters(CNAs) implement DCB protocol
0903d0
in firmware, it is recommended that do not run software-based
0903d0
DCB or LLDP on CNAs that implement DCB, but we have to start
0903d0
the lldpad service anyway(there might be other software DCB).
0903d0
0903d0
If the network interface provides hardware DCB/DCBX capabilities,
0903d0
the field DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to
0903d0
be set to "no".
0903d0
0903d0
We met an issue on "QLogic BCM57810" with DCB firmware support,
0903d0
and found dracut still generated "fcoe=<mac>:dcb" which caused
0903d0
kdump boot failure when using that fcoe dump target.
0903d0
0903d0
This patch parses /etc/fcoe/cfg-xxx to detect DCB_REQUIRED="no",
0903d0
and force "nodcb" if it is the case.
0903d0
0903d0
Also improved some coding style in passing.
0903d0
0903d0
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
0903d0
0903d0
Cherry-picked from: 795256bbb
0903d0
Resolves: #1442663
0903d0
---
0903d0
 modules.d/95fcoe/module-setup.sh | 26 ++++++++++++++++++++------
0903d0
 1 file changed, 20 insertions(+), 6 deletions(-)
0903d0
0903d0
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
0903d0
index 4bab0c7d..ac27c76a 100755
0903d0
--- a/modules.d/95fcoe/module-setup.sh
0903d0
+++ b/modules.d/95fcoe/module-setup.sh
0903d0
@@ -51,16 +51,30 @@ cmdline() {
0903d0
         read mac < ${i}/address
0903d0
         s=$(dcbtool gc ${i##*/} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
0903d0
         if [ -z "$s" ] ; then
0903d0
-	    p=$(get_vlan_parent ${i})
0903d0
-	    if [ "$p" ] ; then
0903d0
-	        s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
0903d0
-	    fi
0903d0
+            p=$(get_vlan_parent ${i})
0903d0
+            if [ "$p" ] ; then
0903d0
+                s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
0903d0
+            fi
0903d0
         fi
0903d0
         if [ "$s" = "on" ] ; then
0903d0
-	    dcb="dcb"
0903d0
+            dcb="dcb"
0903d0
         else
0903d0
-	    dcb="nodcb"
0903d0
+            dcb="nodcb"
0903d0
         fi
0903d0
+
0903d0
+        # Some Combined Network Adapters(CNAs) implement DCB in firmware.
0903d0
+        # Do not run software-based DCB or LLDP on CNAs that implement DCB.
0903d0
+        # If the network interface provides hardware DCB/DCBX capabilities,
0903d0
+        # DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to set to "no".
0903d0
+        #
0903d0
+        # Force "nodcb" if there's any DCB_REQUIRED="no"(child or vlan parent).
0903d0
+        grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${i##*/} &>/dev/null
0903d0
+        [ $? -eq 0 ] && dcb="nodcb"
0903d0
+        if [ "$p" ] ; then
0903d0
+            grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${p} &>/dev/null
0903d0
+            [ $? -eq 0 ] && dcb="nodcb"
0903d0
+        fi
0903d0
+
0903d0
         echo "fcoe=${mac}:${dcb}"
0903d0
     done
0903d0
 }