[Open-FCoE] [PATCH] fcoe-utils: Add debug/ directory and dcbcheck.sh script

Love, Robert W robert.w.love at intel.com
Mon Apr 13 22:41:24 UTC 2009


Joe Eykholt wrote:
> 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 <robert.w.love at intel.com> ---
>> 
>>  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?
> 
Sounds good, I like these improvements. 

>> +
>> +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?
> 
No, I guess not. I was really just whipping up something for myself when
I was installing on a new system. I was focusing more on the output than
the return value.

I'm hoping that we can start adding various debug scripts and whatnot to
this debug/ directory. We have a fcoedump.sh script that dumps system
information to a log file. We'll post that soon too.

> Feel free to ignore any of these suggestions without comment for now.
> The patch is fine. 
> 
I'll make them and resubmit.

> 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.
> 
I just went through this and my only real problem was with hbaapi_build.
You need to extract the hbaapi_2.2 tarball from sourceforge into the
root of the hbaapi_build repo before building. Initially it wasn't clear
to me that I had to do so. The intent of the hbaapi_build repo was to
help the distros and wasn't intended for developer builds, so it might
be OK the way it is.

Other than that everything was './build.sh && ./configure && make &&
make install'. I did end up with some files in /usr/local/, for exmaple
I had /usr/loca/etc/cfg-ethX, but I was mucking with the --prefix=xxx
option to ./configure when I installed DCB so I chalked it up to user
error.



More information about the devel mailing list