From bada26263c36a8be07aece7e9f4986ee31e4d97f Mon Sep 17 00:00:00 2001 From: Harald Hoyer <harald@hoyer.xyz> Date: Mon, 9 Oct 2017 11:47:08 +0200 Subject: [PATCH] Merge pull request #287 from xlpang/master fcoe: handle CNAs with DCB firmware support --- modules.d/95fcoe/module-setup.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh index e14a0ebb..eabb21c7 100755 --- a/modules.d/95fcoe/module-setup.sh +++ b/modules.d/95fcoe/module-setup.sh @@ -51,16 +51,30 @@ cmdline() { read mac < ${i}/address s=$(dcbtool gc ${i##*/} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p') if [ -z "$s" ] ; then - p=$(get_vlan_parent ${i}) - if [ "$p" ] ; then - s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p') - fi + p=$(get_vlan_parent ${i}) + if [ "$p" ] ; then + s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p') + fi fi if [ "$s" = "on" ] ; then - dcb="dcb" + dcb="dcb" else - dcb="nodcb" + dcb="nodcb" fi + + # Some Combined Network Adapters(CNAs) implement DCB in firmware. + # Do not run software-based DCB or LLDP on CNAs that implement DCB. + # If the network interface provides hardware DCB/DCBX capabilities, + # DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to set to "no". + # + # Force "nodcb" if there's any DCB_REQUIRED="no"(child or vlan parent). + grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${i##*/} &>/dev/null + [ $? -eq 0 ] && dcb="nodcb" + if [ "$p" ] ; then + grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${p} &>/dev/null + [ $? -eq 0 ] && dcb="nodcb" + fi + echo "fcoe=${mac}:${dcb}" done }