"Fossies" - the Fresh Open Source Software Archive

Member "open-fcoe-3.19/fcoe-utils/debug/fcoedump.sh" (15 Apr 2015, 5267 Bytes) of package /linux/misc/open-fcoe-3.19.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 ###############################################################################
    3 #
    4 # fcoe_debug: print debugging information for fcoe
    5 #         $1: interface
    6 ###############################################################################
    7 
    8 if [ -z $1 ]; then
    9     echo "Usage: `basename $0` eth[0-9]"
   10     exit 1;
   11 fi
   12 
   13 DEVICE=$1
   14 
   15 if [ -r /proc/net/vlan/$DEVICE ] ; then
   16     PHYSDEV=$(grep '^Device:' /proc/net/vlan/$DEVICE | awk '{print $2}')
   17 else
   18     PHYSDEV=$DEVICE
   19 fi
   20 
   21 kernel_info()
   22 {
   23     echo -e "\n###KERNEL INFO###"
   24     uname -a
   25 
   26     if [ -f "/proc/config.gz" ]
   27     then
   28         echo -e "\nzcat /proc/config.gz"
   29         zcat /proc/config.gz
   30     else
   31         echo -e "\n/proc/config.gz does not exist."
   32     fi
   33 }
   34 
   35 system_info()
   36 {
   37     echo -e "\n###System Info###"
   38 
   39     echo -e "#date"
   40     date
   41 
   42     echo -e "#ps axf"
   43     ps axf
   44 
   45     echo -e "#lsscsi"
   46     lsscsi
   47 
   48     echo -e "#lspci"
   49     lspci
   50 
   51     echo -e "#grep dcbnl_init /proc/kallsyms"
   52     grep dcbnl_init /proc/kallsyms
   53 
   54     echo -e "#grep scsi_transport_fc /proc/kallsyms"
   55     grep scsi_transport_fc /proc/kallsyms
   56 
   57     echo -e "#grep libfc /proc/kallsyms"
   58     grep libfc /proc/kallsyms | grep -v libfcoe
   59 
   60     echo -e "#grep libfcoe /proc/kallsyms"
   61     grep libfcoe /proc/kallsyms
   62 
   63     echo -e "#grep fcoe /proc/kallsyms"
   64     grep fcoe /proc/kallsyms | grep -v libfcoe
   65 
   66     echo -e "#lsmod"
   67     lsmod
   68 }
   69 
   70 adapter_info()
   71 {
   72     if [ $DEVICE != $PHYSDEV ]
   73     then
   74         echo -e "\n###Adapter INFO VLAN $DEVICE"
   75         echo -e "#ethtool:"
   76         ethtool $DEVICE
   77         echo -e "#ethtool interface:"
   78         ethtool -i $DEVICE
   79         echo -e "#ethtool offloads:"
   80         ethtool -k $DEVICE
   81         echo -e "#ifconfig:"
   82         ifconfig $DEVICE
   83     fi
   84 
   85     echo -e "\n###Adapter INFO $PHYSDEV"
   86     echo -e "#ethtool:"
   87     ethtool $PHYSDEV
   88     echo -e "#ethtool interface:"
   89     ethtool -i $PHYSDEV
   90     echo -e "#ethtool pause:"
   91     ethtool -a $PHYSDEV
   92     echo -e "#ethtool offloads:"
   93     ethtool -k $PHYSDEV
   94     echo -e "#ethtool stats:"
   95     ethtool -S $PHYSDEV
   96     echo -e "#ifconfig:"
   97     ifconfig $PHYSDEV
   98 }
   99 
  100 dcbtool_info()
  101 {
  102     echo -e "\n#### Showing dcbtool info for $PHYSDEV"
  103     dcbtool -v
  104     dcbtool gc $PHYSDEV dcb
  105     echo -e "\n########## Getting dcb config for $PHYSDEV"
  106     dcbtool gc $PHYSDEV pg
  107     echo
  108     dcbtool gc $PHYSDEV pfc
  109     echo
  110     dcbtool gc $PHYSDEV app:0
  111     echo
  112     dcbtool gc $PHYSDEV ll:0
  113     echo -e "\n########## Getting dcb oper for $PHYSDEV"
  114     dcbtool go $PHYSDEV pg
  115     echo
  116     dcbtool go $PHYSDEV pfc
  117     echo
  118     dcbtool go $PHYSDEV app:0
  119     echo
  120     dcbtool go $PHYSDEV ll:0
  121     echo -e "\n########## Getting dcb peer for $PHYSDEV"
  122     dcbtool gp $PHYSDEV pg
  123     echo
  124     dcbtool gp $PHYSDEV pfc
  125     echo
  126     dcbtool gp $PHYSDEV app:0
  127     echo
  128     dcbtool gp $PHYSDEV ll:0
  129 }
  130 
  131 lldptool_info()
  132 {
  133     echo -e "\n#### Showing lldptool info for $PHYSDEV"
  134     lldptool -v
  135 
  136     echo -e "\n########## Showing last received TLV for $PHYSDEV"
  137     lldptool -t -i $PHYSDEV -n
  138 
  139     echo -e "\n########## Showing last sent TLV for $PHYSDEV"
  140     lldptool -t -i $PHYSDEV
  141 
  142     echo -e "\n########## Showing configured APP TLV for $PHYSDEV"
  143     lldptool -t -i $PHYSDEV -V APP -c
  144 
  145     echo -e "\n########## Showing configured PFC TLV for $PHYSDEV"
  146     lldptool -t -i $PHYSDEV -V PFC -c
  147 
  148     echo -e "\n########## Showing configured ETS-CFG TLV for $PHYSDEV"
  149     lldptool -t -i $PHYSDEV -V ETS-CFG -c
  150 
  151     echo -e "\n########## Showing configured ETS-REC TLV for $PHYSDEV"
  152     lldptool -t -i $PHYSDEV -V ETS-REC -c
  153 }
  154 
  155 dcb_info()
  156 {
  157     echo -e "\n###DCB INFO"
  158     echo -e "#tc config"
  159     tc qdisc
  160     tc filter show dev $PHYSDEV | grep -v filter
  161 
  162     ## Intentionally allow both services status to show
  163     ## even though they should be mutually exclusive. If
  164     ## you see both in a dump you know there's a problem.
  165     [ -f /etc/init.d/boot.lldpad ] &&
  166     echo -e "#service boot.lldpad status:" &&
  167     service boot.lldpad status
  168     [ -f /etc/init.d/lldpad ] &&
  169     echo -e "#service lldpad status:" &&
  170     service lldpad status
  171 
  172     which dcbtool 2>&1 > /dev/null
  173     [ $? -eq 0 ] && dcbtool_info
  174 
  175     which lldptool 2>&1 > /dev/null
  176     [ $? -eq 0 ] && lldptool_info
  177 }
  178 
  179 fcoe_info()
  180 {
  181     echo -e "\n###FCOE Info"
  182 
  183     ## Intentionally allow both services status to show
  184     ## even though they should be mutually exclusive. If
  185     ## you see both in a dump you know there's a problem.
  186     [ -f /etc/init.d/boot.fcoe ] &&
  187     echo -e "#service boot.fcoe status" &&
  188     service boot.fcoe status
  189     [ -f /etc/init.d/fcoe ] &&
  190     echo -e "#service fcoe status" &&
  191     service fcoe status
  192 
  193     echo -e "#fcoeadm output "
  194     fcoeadm -v
  195     echo -e "#fcoeadm -i "
  196     fcoeadm -i
  197     echo -e "#fcoeadm -t "
  198     fcoeadm -t
  199 
  200     # Trigger fcoemon to dump its internal structures
  201     # to the log file that we will capture later in
  202     # this script.
  203     kill -10 `pidof fcoemon`
  204 }
  205 
  206 bsg_info()
  207 {
  208     echo -e "\n###BSG Info"
  209     echo -e "#find /dev/bsg/"
  210     find /dev/bsg/ 2>&1
  211 }
  212 
  213 sysfs_dump()
  214 {
  215     echo -e "\n###SYSFS dump"
  216     echo -e "#sysfs fc_host dump"
  217     find /sys/class/fc_host/host*/ -type f -print -exec cat '{}' \;
  218     echo -e "#sysfs fc_transport dump"
  219     find /sys/class/fc_transport/target*/ -type f -print -exec cat '{}' \;
  220     echo -e "#sysfs fc_remote_ports dump"
  221     find /sys/class/fc_remote_ports/*/ -type f -print -exec cat '{}' \;
  222     echo -e "#sysfs fc_vport dump"
  223     find /sys/class/fc_vports/*/ -type f -print -exec cat '{}' \;
  224 }
  225 
  226 logfile_dump()
  227 {
  228     echo "###LOGFILES"
  229     echo "#/var/log/messages"
  230     cat /var/log/messages
  231     echo
  232     echo "#dmesg"
  233     dmesg
  234 }
  235 
  236 fcoe_debug()
  237 {
  238     kernel_info
  239     system_info
  240     adapter_info
  241     dcb_info
  242     fcoe_info
  243     bsg_info
  244     sysfs_dump
  245     logfile_dump
  246 }
  247 
  248 fcoe_debug
  249 
  250