Robert Love wrote:
> Adds a debug/ directory in the source tree intended to contain
> debugging tools.
> 
> The first debugging tool, that this patch also adds, is
> dcbcheck.sh. This script will use 'dcbtool' to check if
> DCB is configured correctly for FCoE traffic. If some
> criteria is not met the script will suggest commands to
> run to get to the user to a correctly configured state.
> 
> Signed-off-by: Robert Love <[email protected]>
> ---
> 
>  debug/dcbcheck.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 48 insertions(+), 0 deletions(-)
>  create mode 100755 debug/dcbcheck.sh
> 
> diff --git a/debug/dcbcheck.sh b/debug/dcbcheck.sh
> new file mode 100755
> index 0000000..b05bf2f
> --- /dev/null
> +++ b/debug/dcbcheck.sh
> @@ -0,0 +1,48 @@
> +#!/bin/bash
> +# $1 = ethX
> +IFNAME=${1}
> +
> +failure=0
> +
> +# Ensure that a value was passed in for the interface name
> +if [ "${IFNAME}" == "" ] ; then
> +    echo "Please provide the interface name to check."
> +    exit
> +fi
> +
> +# Ensure that the interface name provided is valid
> +if [ `ifconfig ${IFNAME} 2>&1 | grep -c "Device not found"` -eq 1 ] ; then
> +    echo "Please provide a valid interface name."
> +    exit
> +fi
> +
> +# Determine if we can communicate with DCBD
> +if [ `dcbtool gc ${IFNAME} dcb | grep Status | grep -c Successful` -lt 1 ] ; 
> then
> +    echo "Unable to communicate with the dcb daemon or DCB capable driver."
> +    exit
> +fi
> +
> +# Determine if DCB is on
> +if [ `dcbtool gc ${IFNAME} dcb | grep 'DCB State' | grep -c on` -ne 1 ] ; 
> then
> +    echo "DCB is not on, exectue the following to turn it on"
> +    echo "dcbtool sc ${IFNAME} dcb on"
> +    failure=1
> +fi
> +
> +# Determine if PFC is enabled
> +if [ `dcbtool gc ${IFNAME} pfc | grep Enable | grep -c true` -ne 1 ] ; then
> +    echo "PFC is not enabled, exectue the following to turn it on"
> +    echo "dcbtool sc ${IFNAME} pfc e:1"
> +    failure=1
> +fi
> +
> +# Determine if the FCoE APP TLV is enabled 
> +if [ `dcbtool gc ${IFNAME} app:0 | grep Enable | grep -c true` -ne 1 ] ; then
> +    echo "The FCoE APP TLV is not enabled, exectue the following to turn it 
> on"
> +    echo "dcbtool sc ${IFNAME} app:0 e:1"
> +    failure=1
> +fi


Test app:fcoe instead of app:0?  I guess they must be equivalent.

BTW, you could use grep -q instead of grep -c.

Instead of:

        if [ `dcbtool gc ${IFNAME} app:0 | grep Enable | grep -c true` -ne 1 ] 
; then

do:
        if dcbtool gc ${IFNAME} app:0 | grep Enable | grep -q true ; then : ; 
else
                echo ...

To further simplify (but possibly obscure):

        dcbtool gc ${IFNAME} app:0 | grep Enable | grep -q true || echo "not 
enabled ..."

Perhaps the messages should go to stderr?

> +
> +if [ ${failure} -eq 0 ] ; then
> +    echo "DCB is correctly configured for FCoE"
> +fi

Should the exit code be 1 if there is a problem found?

Feel free to ignore any of these suggestions without comment for now.  The 
patch is fine.

This is a good thing to have.  We could also add checks for the correct 'tc' 
setup,
but I can see difficulties there, as there might be a lot of right ways set up 
tc,
and a lot of ways to make it not work.

I think we should make it somehow that fcoe marks the sk_buff such that it goes
to a non-drop class without needing to set up a filter in tc.

I've been trying to set up a new machine with iproute2, libhba, libfcoehba, 
fcoe_tools, etc.
and it's not much fun.  An up-to-date cookbook would help, or a script to do it 
all
for me would be nice.  Something better ... eliminating the need for some of 
these steps
would be nice.



        Joe
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to