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

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