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

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