Hello community, here is the log from the commit of package smc-tools for openSUSE:Factory checked in at 2020-09-22 21:12:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/smc-tools (Old) and /work/SRC/openSUSE:Factory/.smc-tools.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "smc-tools" Tue Sep 22 21:12:48 2020 rev:8 rq:835903 version:1.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/smc-tools/smc-tools.changes 2019-12-03 12:43:11.466119307 +0100 +++ /work/SRC/openSUSE:Factory/.smc-tools.new.4249/smc-tools.changes 2020-09-22 21:13:19.820042218 +0200 @@ -1,0 +2,25 @@ +Wed Sep 16 16:37:51 UTC 2020 - Mark Post <[email protected]> + +- Upgraded to version 1.3.1 (jsc#SLE-14630, jsc#SLE-14470) + * Version 1.3.1 + Changes: + smcss: Add further error codes to man page + Bug fixes: + smcss: Display more than 321 connections + smc_rnics: Suppress any unknown non-networking device unless + option -r is specified + * Version 1.3.0 + Changes: + smcss: Add description of Linux error codes to man page + smc_rnics: + * Sort output by PCHID + * Replace spaces in output by underscores for easier parsing + * Add new option --IB-dev to display IB-specific attributes + Bug fixes: + smc_rnics: + * FIDs can have up to 4 digits and are planned to be extended + to a total of 8 digits - adjusting output format accordingly + * Do not display port attribute for RoCE Express2 devices + unless we have an accurate value + +------------------------------------------------------------------- Old: ---- smc-tools-1.2.2.tar.gz New: ---- smc-tools-1.3.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ smc-tools.spec ++++++ --- /var/tmp/diff_new_pack.LLUkX5/_old 2020-09-22 21:13:21.164043394 +0200 +++ /var/tmp/diff_new_pack.LLUkX5/_new 2020-09-22 21:13:21.168043398 +0200 @@ -1,7 +1,7 @@ # # spec file for package smc-tools # -# Copyright (c) 2018, 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018-2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: smc-tools -Version: 1.2.2 +Version: 1.3.1 Release: 0 Summary: Shared Memory Communication via RDMA License: EPL-1.0 ++++++ smc-tools-1.2.2.tar.gz -> smc-tools-1.3.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/Makefile new/smc-tools-1.3.1/Makefile --- old/smc-tools-1.2.2/Makefile 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/Makefile 2020-09-16 09:53:16.000000000 +0200 @@ -10,7 +10,7 @@ # http://www.eclipse.org/legal/epl-v10.html # -SMC_TOOLS_RELEASE = 1.2.2 +SMC_TOOLS_RELEASE = 1.3.1 VER_MAJOR = $(shell echo $(SMC_TOOLS_RELEASE) | cut -d '.' -f 1) ARCHTYPE = $(shell uname -m) @@ -102,7 +102,7 @@ SMC_PNET_LFLAGS = -lnl-genl-3 -lnl-3 endif -smc_pnet: smc_pnet.c smc.h smctools_common.h +smc_pnet: smc_pnet.c smctools_common.h @if [ ! -e /usr/include/libnl3/netlink/netlink.h ]; then \ printf "**************************************************************\n" >&2; \ printf "* Missing build requirement for: %-45s\n" $@ >&2; \ @@ -115,7 +115,7 @@ fi ${CCC} ${ALL_CFLAGS} ${SMC_PNET_CFLAGS} ${LDFLAGS} -o $@ $< ${SMC_PNET_LFLAGS} -smcss: smcss.c smc_diag.h smctools_common.h +smcss: smcss.c smctools_common.h ${CCC} ${ALL_CFLAGS} ${LDFLAGS} $< -o $@ install: all @@ -147,6 +147,22 @@ ln -sfr $(DESTDIR)$(BASH_AUTODIR)/smc-tools $(DESTDIR)$(BASH_AUTODIR)/smc_pnet endif +check: + if which cppcheck >/dev/null; then \ + echo "Running cppcheck"; \ + cppcheck . 2>&1; \ + else \ + echo "cppcheck not available"; \ + fi + @echo; + if which valgrind >/dev/null; then \ + echo "Running valgrind"; \ + valgrind --leak-check=full --show-leak-kinds=all ./smcss 2>&1; \ + valgrind --leak-check=full --show-leak-kinds=all ./smc_pnet 2>&1; \ + else \ + echo "valgrind not available"; \ + fi + @echo; clean: echo " CLEAN" rm -f *.o *.so smcss smc_pnet diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/README.smctools new/smc-tools-1.3.1/README.smctools --- old/smc-tools-1.2.2/README.smctools 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/README.smctools 2020-09-16 09:53:16.000000000 +0200 @@ -1,5 +1,5 @@ -SMC Tools (1.2.2) -=================== +SMC Tools (1.3.1) +================= The SMC Tools provided in this package allow execution of existing TCP applications over RoCE network without need to make changes in them. @@ -46,9 +46,34 @@ Release History: ================ +1.3.1 (2020-09-14) + Changes: + - smcss: Add further error codes to man page + + Bug fixes: + - smcss: Display more than 321 connections + - smc_rnics: Suppress any unknown non-networking device unless + option -r is specified + +1.3.0 (2020-06-16) + Changes: + - smcss: Add description of Linux error codes to man page + - smc_rnics: + * Sort output by PCHID + * Replace spaces in output by underscores for easier parsing + * Add new option --IB-dev to display IB-specific attributes + + Bug fixes: + - smc_rnics: + * FIDs can have up to 4 digits and are planned to be extended + to a total of 8 digits - adjusting output format accordingly + * Do not display port attribute for RoCE Express2 devices + unless we have an accurate value + 1.2.2 (2019-10-24) Changes: - Add bash autocompletion support + - Makefile: Drop 31 Bit install due to rpmbuild conflict Bug fixes: - smcss: Do not show connection mode for already closed sockets @@ -105,8 +130,6 @@ smc_pnet.c PNET Table handling source code smcss.c SMC socket display source code smctools_common.h common definitions for smctools -smc.h include file from kernel include/uapi/linux/smc.h -smc_diag.h include file from kernel include/uapi/linux/smc_diag.h af_smc.7 manpage for AF_SMC sockets smc_pnet.8 manpage for smc_pnet smcss.8 manpage for smcss diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smc.h new/smc-tools-1.3.1/smc.h --- old/smc-tools-1.2.2/smc.h 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smc.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -/* - * Shared Memory Communications over RDMA (SMC-R) and RoCE - * - * Definitions for generic netlink based configuration of an SMC-R PNET table - * - * Copyright IBM Corp. 2017 - * - * Author(s): Thomas Richter <[email protected]> - */ - -#ifndef _UAPI_LINUX_SMC_H_ -#define _UAPI_LINUX_SMC_H_ - -/* Netlink SMC_PNETID attributes */ -enum { - SMC_PNETID_UNSPEC, - SMC_PNETID_NAME, - SMC_PNETID_ETHNAME, - SMC_PNETID_IBNAME, - SMC_PNETID_IBPORT, - __SMC_PNETID_MAX, - SMC_PNETID_MAX = __SMC_PNETID_MAX - 1 -}; - -enum { /* SMC PNET Table commands */ - SMC_PNETID_GET = 1, - SMC_PNETID_ADD, - SMC_PNETID_DEL, - SMC_PNETID_FLUSH -}; - -#define SMCR_GENL_FAMILY_NAME "SMC_PNETID" -#define SMCR_GENL_FAMILY_VERSION 1 - -#endif /* _UAPI_LINUX_SMC_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smc_dbg new/smc-tools-1.3.1/smc_dbg --- old/smc-tools-1.2.2/smc_dbg 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smc_dbg 2020-09-16 09:53:16.000000000 +0200 @@ -36,7 +36,7 @@ "-t" | "--tgz" ) tgz="on";; "-v" | "--version" ) - echo "smc_dbg utility, smc-tools-1.2.2 (4335826)"; + echo "smc_dbg utility, smc-tools-1.3.1 (3d7eead)"; exit 0;; * ) esac diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smc_diag.h new/smc-tools-1.3.1/smc_diag.h --- old/smc-tools-1.2.2/smc_diag.h 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smc_diag.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,110 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_SMC_DIAG_H_ -#define _UAPI_SMC_DIAG_H_ - -#include <linux/types.h> -#include <linux/inet_diag.h> -#include <rdma/ib_user_verbs.h> - -/* Request structure */ -struct smc_diag_req { - __u8 diag_family; - __u8 pad[2]; - __u8 diag_ext; /* Query extended information */ - struct inet_diag_sockid id; -}; - -/* Base info structure. It contains socket identity (addrs/ports/cookie) based - * on the internal clcsock, and more SMC-related socket data - */ -struct smc_diag_msg { - __u8 diag_family; - __u8 diag_state; - __u8 diag_mode; - __u8 diag_shutdown; - struct inet_diag_sockid id; - - __u32 diag_uid; - __u64 diag_inode; -}; - -/* Mode of a connection */ -enum { - SMC_DIAG_MODE_SMCR, - SMC_DIAG_MODE_FALLBACK_TCP, - SMC_DIAG_MODE_SMCD, -}; - -/* Extensions */ - -enum { - SMC_DIAG_NONE, - SMC_DIAG_CONNINFO, - SMC_DIAG_LGRINFO, - SMC_DIAG_SHUTDOWN, - SMC_DIAG_DMBINFO, - SMC_DIAG_FALLBACK, - __SMC_DIAG_MAX, -}; - -#define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) - -/* SMC_DIAG_CONNINFO */ - -struct smc_diag_cursor { - __u16 reserved; - __u16 wrap; - __u32 count; -}; - -struct smc_diag_conninfo { - __u32 token; /* unique connection id */ - __u32 sndbuf_size; /* size of send buffer */ - __u32 rmbe_size; /* size of RMB element */ - __u32 peer_rmbe_size; /* size of peer RMB element */ - /* local RMB element cursors */ - struct smc_diag_cursor rx_prod; /* received producer cursor */ - struct smc_diag_cursor rx_cons; /* received consumer cursor */ - /* peer RMB element cursors */ - struct smc_diag_cursor tx_prod; /* sent producer cursor */ - struct smc_diag_cursor tx_cons; /* sent consumer cursor */ - __u8 rx_prod_flags; /* received producer flags */ - __u8 rx_conn_state_flags; /* recvd connection flags*/ - __u8 tx_prod_flags; /* sent producer flags */ - __u8 tx_conn_state_flags; /* sent connection flags*/ - /* send buffer cursors */ - struct smc_diag_cursor tx_prep; /* prepared to be sent cursor */ - struct smc_diag_cursor tx_sent; /* sent cursor */ - struct smc_diag_cursor tx_fin; /* confirmed sent cursor */ -}; - -/* SMC_DIAG_LINKINFO */ -#define IB_DEVICE_NAME_MAX 64 - -struct smc_diag_linkinfo { - __u8 link_id; /* link identifier */ - __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ - __u8 ibport; /* RDMA device port number */ - __u8 gid[40]; /* local GID */ - __u8 peer_gid[40]; /* peer GID */ -}; - -struct smc_diag_lgrinfo { - struct smc_diag_linkinfo lnk[1]; - __u8 role; -}; - -struct smc_diag_fallback { - __u32 reason; - __u32 peer_diagnosis; -}; - -struct smcd_diag_dmbinfo { /* SMC-D Socket internals */ - __u32 linkid; /* Link identifier */ - __u64 peer_gid; /* Peer GID */ - __u64 my_gid; /* My GID */ - __u64 token; /* Token of DMB */ - __u64 peer_token; /* Token of remote DMBE */ -}; - -#endif /* _UAPI_SMC_DIAG_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smc_pnet.c new/smc-tools-1.3.1/smc_pnet.c --- old/smc-tools-1.2.2/smc_pnet.c 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smc_pnet.c 2020-09-16 09:53:16.000000000 +0200 @@ -33,7 +33,6 @@ #include <netlink/genl/ctrl.h> #include "smctools_common.h" -#include "smc.h" static char *progname; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smc_rnics new/smc-tools-1.3.1/smc_rnics --- old/smc-tools-1.2.2/smc_rnics 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smc_rnics 2020-09-16 09:53:16.000000000 +0200 @@ -12,21 +12,146 @@ echo " -d, --disable <FID> disable the specified FID"; echo " -e, --enable <FID> enable the specified FID"; echo " -h, --help display this message"; + echo " -I, --IB-dev display IB-dev instead of netdev attributes"; echo " -r, --rawids display 'type' as raw vendor/device IDs"; echo " -v, --version display version info"; echo; } -function print_rnic() { - if [ $header -eq 0 ]; then - printf "FID Power PCI ID PCHID Type Port PNET ID Interface\n"; - echo '------------------------------------------------------------------------------------'; - header=1; +function print_header() { + if [ $IBdev -eq 0 ]; then + printf " FID Power PCI_ID PCHID Type PPrt PNET_ID Net-Dev\n"; + else + printf " FID Power PCI_ID PCHID Type IPrt PNET_ID IB-Dev\n"; fi - printf "%3x %-5s %-12s %-4s %-14s %-4s %-16s %s\n" "$((16#$fid))" "$power" "$addr" "$pchid" "$dev_type" "$port" "$pnet" "$int"; + echo '-----------------------------------------------------------------------------------------'; +} + +function get_pnet_from_port() { + local idx; + local end; + local lport=$port; + + if [ "$lport" == "n/a" ] || [ "$dev_type" == "RoCE_Express2" ]; then + if [ $IBdev -eq 0 ]; then + lport=0; + else + lport=1; + fi + fi + [ $IBdev -ne 0 ] && let lport=$lport-1; + (( idx=16*$lport+1 )) + (( end=$idx+15 )) + echo "$pnetids" | cut -c $idx-$end; +} + +function print_rnic() { + printf "%8x %-5s %-12s %-4s %-14s %-4s %-16s %s\n" "$((16#$fid))" "$power" "$addr" "$pchid" "$dev_type" "$port" "`get_pnet_from_port`" "$int"; (( printed++ )); } +function print_rnics() { + # iterate over slots, as powered-off devices won't show elsewhere + for fid in `ls -1 /sys/bus/pci/slots`; do + cd /sys/bus/pci/slots/$fid; + fid="$fid"; + if [ "$target" != "" ] && [ "$fid" != "$target" ]; then + continue; + fi + power=`cat power`; + interfaces=""; + port="n/a"; + addr=""; + int=""; + if [ $power -eq 0 ]; then + # device not yet hotplugged + dev_type=""; + pchid=""; + pnet=""; + print_rnic; + continue; + fi + # device is hotplugged - locate it + for dev in `ls -1 /sys/bus/pci/devices`; do + cd /sys/bus/pci/devices/$dev; + if [ "`cat function_id`" == "0x$fid" ]; then + addr=$dev; + break; + fi + done + if [ "$addr" == "" ]; then + echo "Error: No matching device found for FID $fid" >&2; + continue; + fi + cd /sys/bus/pci/devices/$addr; + id=`cat device`; + vend=`cat vendor`; + dev_type="${vend#0x}:${id#0x}"; + if [ $rawIDs -eq 0 ]; then + # suppress all output except the devices we know + case "$vend" in + "0x1014" ) # IBM + case "$id" in + "0x04ed") dev_type="ISM"; + int="n/a";; + *) + continue; + esac;; + "0x15b3" ) # Mellanox + case "$id" in + "0x1003" | \ + "0x1004") dev_type="RoCE_Express";; + "0x1016") dev_type="RoCE_Express2"; + if [ -e port ]; then + port=`cat port`; + if [ $IBdev -eq 0 ]; then + let port=$port-1; + else + port=1; + fi + fi;; + *) + continue; + esac;; + *) + continue; + esac + fi + pchid="`cat pchid | sed 's/^0x//'`"; + pnetids="`cat util_string | tr -d '\000' | iconv -f IBM-1047 -t ASCII`"; + if [ $IBdev -eq 0 ]; then + if [ -d "net" ]; then + interfaces="`ls -1 net`"; + else + int="n/a"; + print_rnic; + continue; + fi + # one device can have multiple interfaces (one per port) + for int in $interfaces; do + cd /sys/bus/pci/devices/$addr/net/$int; + if [ "$dev_type" == "RoCE_Express" ] && [ -e dev_port ]; then + port=`cat dev_port`; + fi + print_rnic; + done + else + if [ -d "infiniband" ]; then + int="`ls -1 infiniband`"; + else + int="n/a"; + print_rnic; + continue; + fi + # only one IB interface per card + cd /sys/bus/pci/devices/$addr/infiniband/$int + for port in `ls -1 ports`; do + print_rnic; + done + fi + done +} + function format_fid() { res="${1#0x}"; @@ -43,12 +168,13 @@ exit 1; fi -args=`getopt -u -o hrve:d: -l enable:,disable:,help,rawids,version -- $*`; +args=`getopt -u -o hIrve:d: -l enable:,disable:,help,IB-dev,rawids,version -- $*`; [ $? -ne 0 ] && exit 2; set -- $args; action="print"; rawIDs=0; target=""; +IBdev=0; printed=0; while [ $# -gt 0 ]; do case $1 in @@ -63,10 +189,12 @@ "-h" | "--help" ) usage; exit 0;; + "-I" | "--IB-dev" ) + IBdev=1;; "-r" | "--rawids" ) rawIDs=1;; "-v" | "--version" ) - echo "smc_rnics utility, smc-tools-1.2.2 (4335826)"; + echo "smc_rnics utility, smc-tools-1.3.1 (3d7eead)"; exit 0;; "--" ) ;; * ) format_fid "$1"; @@ -102,82 +230,8 @@ exit 0; fi -header=0; -# iterate over slots, as powered-off devices won't show elsewhere -for fid in `ls -1 /sys/bus/pci/slots`; do - cd /sys/bus/pci/slots/$fid; - fid="$fid"; - if [ "$target" != "" ] && [ "$fid" != "$target" ]; then - continue; - fi - power=`cat power`; - interfaces=""; - port=""; - addr=""; - int=""; - if [ $power -eq 0 ]; then - # device not yet hotplugged - dev_type=""; - pchid=""; - pnet=""; - print_rnic; - continue; - fi - # device is hotplugged - locate it - for dev in `ls -1 /sys/bus/pci/devices`; do - cd /sys/bus/pci/devices/$dev; - if [ "`cat function_id`" == "0x$fid" ]; then - addr=$dev; - break; - fi - done - if [ "$addr" == "" ]; then - echo "Error: No matching device found for FID $fid" >&2; - continue; - fi - cd /sys/bus/pci/devices/$addr; - id=`cat device`; - vend=`cat vendor`; - dev_type="${vend#0x}:${id#0x}"; - if [ $rawIDs -eq 0 ]; then - case "$vend" in - "0x1014" ) # IBM - case "$id" in - "0x04ed") dev_type="ISM"; - port="n/a"; - int="n/a";; - "0x044b") continue;; # zEDC - esac;; - "0x15b3" ) # Mellanox - case "$id" in - "0x1003" | \ - "0x1004") dev_type="RoCE Express";; - "0x1016") dev_type="RoCE Express2";; - esac;; - esac - fi - pchid="`cat pchid | sed 's/^0x//'`"; - pnet="`cat util_string | tr -d '\000' | iconv -f IBM-1047 -t ASCII`"; - if [ -d net ]; then - interfaces="`ls -1 net`"; - fi - # one device can have multiple interfaces (one per port) - if [ "$interfaces" != "" ]; then - pnetids="$pnet"; - for int in $interfaces; do - cd /sys/bus/pci/devices/$addr/net/$int; - if [ -e dev_port ]; then - port=`cat dev_port`; - (( idx=16*$port+1 )) - (( end=$idx+15 )) - pnet=`echo "$pnetids" | cut -c $idx-$end`; - fi - print_rnic; - done - continue; - fi - print_rnic; -done +print_header; +print_rnics | sort -k 4; if [ "$target" != "" ] && [ $printed -eq 0 ]; then exit 8; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smc_rnics.8 new/smc-tools-1.3.1/smc_rnics.8 --- old/smc-tools-1.2.2/smc_rnics.8 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smc_rnics.8 2020-09-16 09:53:16.000000000 +0200 @@ -48,8 +48,12 @@ .B smc_rnics usage information. .TP +.BR "\-I, \-\-IB-dev" +Display IB device information. +.TP .BR "\-r, \-\-rawids" -Display raw PCI vendor and device codes in column +Display raw PCI vendor and device codes in column. Note that this will +also toggle display of non-networking realted devices. .I Type . . .TP @@ -66,7 +70,7 @@ .B -d on how to enable a device that is offline. -.SS "PCI ID" +.SS "PCI_ID" PCI ID in BDF (Bus:Device.Function) notation. .SS "PCHID" @@ -78,15 +82,21 @@ .B -r to switch to display of PCI vendor and device instead. -.SS "Port" -Corresponding port of an RNIC, if applicable. +.SS "PPrt" +Corresponding physical port of an RNIC, if applicable. Starts counting at 0. + +.SS "IPrt" +Corresponding Infiniband port of an RNIC, if applicable. Starts counting at 1. -.SS "PNET ID" +.SS "PNET_ID" Physical network ID, if defined in IOCDS. -.SS "Interface" +.SS "Net-Dev" Network interface in Linux, if applicable. +.SS "IB-Dev" +Infiniband interface in Linux, if applicable. + .SH RETURN CODES On success, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smcss.8 new/smc-tools-1.3.1/smcss.8 --- old/smc-tools-1.2.2/smcss.8 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smcss.8 2020-09-16 09:53:16.000000000 +0200 @@ -169,6 +169,116 @@ TCP The SMC socket uses the TCP protocol for data exchange, because an SMC connection could not be established. +.TP +In case of an error during connection setup, respective error codes will be displayed in the format <local>/<remote>. +.HP +Linux error codes: +.TP 13 +.I +0x01010000 +Out of memory +.TP 13 +.I +0x02010000 +Timeout while waiting for confirm link message over RDMA device +.TP +.I +0x02020000 +Timeout while waiting for RDMA device to be added +.TP +.I +0x03000000 +Configuration error +.TP +.I +0x03010000 +Peer does not support SMC +.TP +.I +0x03020000 +Connection uses IPsec +.TP +.I +0x03030000 +No SMC devices found (R and D) +.TP +.I +0x03030001 +No ISM device for SMC-D found +.TP +.I +0x03030002 +No RDMA device for SMC-R found +.TP +.I +0x03030003 +Peer not reachable through ISM device +.TP +.I +0x03040000 +SMC modes mismatch (R or D) +.TP +.I +0x03050000 +Peer has eyecatcher in RMBE +.TP +.I +0x03060000 +Fastopen sockopt not supported +.TP +.I +0x03070000 +IP prefix / subnet mismatch +.TP +.I +0x03080000 +Error retrieving VLAN ID of IP device +.TP +.I +0x03090000 +Error while registering VLAN ID on ISM device +.TP +.I +0x030a0000 +No active SMC-R link in link group +.TP +.I +0x030b0000 +SMC-R link from server not found +.TP +.I +0x030c0000 +SMC version mismatch +.TP +.I +.I +0x030d0000 +SMC-D connection limit reached +.TP +.I +0x04000000 +Synchronization error +.TP +.I +0x05000000 +Peer declined during handshake +.TP +.I +0x09990000 +Internal error +.TP +.I +0x09990001 +rtoken handling failed +.TP +.I +0x09990002 +RDMA link failed +.TP +.I +0x09990003 +RMB registration failed + .SS "ShutD" .TP .I diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smcss.c new/smc-tools-1.3.1/smcss.c --- old/smc-tools-1.2.2/smcss.c 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smcss.c 2020-09-16 09:53:16.000000000 +0200 @@ -30,7 +30,6 @@ #include <arpa/inet.h> #include "smctools_common.h" -#include "smc_diag.h" #define MAGIC_SEQ 123456 #define ADDR_LEN_SHORT 23 @@ -253,8 +252,7 @@ static void addr_format(char *buf, size_t buf_len, size_t short_len, __be32 addr[4], int port) { - char *errmsg = "(inet_ntop error)"; /* very unlikely */ - char addr_buf[64], port_buf[16]; + char addr_buf[INET6_ADDRSTRLEN + 1], port_buf[16]; int addr_len, port_len; int af; @@ -272,22 +270,33 @@ else af = AF_INET6; + if (buf_len < 20) + return; /* no space for errmsg */ + if (!inet_ntop(af, addr, addr_buf, sizeof(addr_buf))) { - strcpy(buf, errmsg); + strcpy(buf, "(inet_ntop error)"); return; } sprintf(port_buf, "%d", port); addr_len = strlen(addr_buf); port_len = strlen(port_buf); if (!show_wide && (addr_len + 1 + port_len > short_len)) { + if (buf_len < short_len + 1) { + strcpy(buf, "(buf to small)"); + return; + } /* truncate addr string */ addr_len = short_len - 1 - port_len - 2; strncpy(buf, addr_buf, addr_len); buf[addr_len] = '\0'; strcat(buf, ".."); /* indicate truncation */ strcat(buf, ":"); - strncat(buf, port_buf, port_len); + strcat(buf, port_buf); } else { + if (buf_len < addr_len + 1 + port_len + 1) { + strcpy(buf, "(buf to small)"); + return; + } snprintf(buf, buf_len, "%s:%s", addr_buf, port_buf); } } @@ -424,6 +433,7 @@ static int rtnl_dump(struct rtnl_handle *rth) { + int msglen, found_done = 0; struct sockaddr_nl nladdr; struct iovec iov; struct msghdr msg = { @@ -433,7 +443,6 @@ .msg_iovlen = 1, }; char buf[32768]; - int msglen; struct nlmsghdr *h = (struct nlmsghdr *)buf; memset(buf, 0, sizeof(buf)); @@ -456,8 +465,10 @@ while(NLMSG_OK(h, msglen)) { if (h->nlmsg_flags & NLM_F_DUMP_INTR) fprintf(stderr, "Dump interrupted\n"); - if (h->nlmsg_type == NLMSG_DONE) - break; /* process next */ + if (h->nlmsg_type == NLMSG_DONE) { + found_done = 1; + break; + } if (h->nlmsg_type == NLMSG_ERROR) { if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) { fprintf(stderr, "ERROR truncated\n"); @@ -473,6 +484,10 @@ fprintf(stderr, "Message truncated\n"); goto again; } + if (!found_done) { + h = (struct nlmsghdr *)buf; + goto again; + } return EXIT_SUCCESS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.2.2/smctools_common.h new/smc-tools-1.3.1/smctools_common.h --- old/smc-tools-1.2.2/smctools_common.h 2019-10-24 15:00:32.000000000 +0200 +++ new/smc-tools-1.3.1/smctools_common.h 2020-09-16 09:53:16.000000000 +0200 @@ -20,8 +20,142 @@ #define STRINGIFY(x) STRINGIFY_1(x) #define RELEASE_STRING STRINGIFY (SMC_TOOLS_RELEASE) -#define RELEASE_LEVEL "4335826" +#define RELEASE_LEVEL "3d7eead" #define PF_SMC 43 +/*********************************************************** + * Mimic definitions in kernel/include/uapi/linux/smc.h + ***********************************************************/ + +/* Netlink SMC_PNETID attributes */ +enum { + SMC_PNETID_UNSPEC, + SMC_PNETID_NAME, + SMC_PNETID_ETHNAME, + SMC_PNETID_IBNAME, + SMC_PNETID_IBPORT, + __SMC_PNETID_MAX, + SMC_PNETID_MAX = __SMC_PNETID_MAX - 1 +}; + +enum { /* SMC PNET Table commands */ + SMC_PNETID_GET = 1, + SMC_PNETID_ADD, + SMC_PNETID_DEL, + SMC_PNETID_FLUSH +}; + +#define SMCR_GENL_FAMILY_NAME "SMC_PNETID" +#define SMCR_GENL_FAMILY_VERSION 1 + +/*********************************************************** + * Mimic definitions in kernel/include/uapi/linux/smc_diag.h + ***********************************************************/ + +#include <linux/types.h> +#include <linux/inet_diag.h> +#include <rdma/ib_user_verbs.h> + +/* Request structure */ +struct smc_diag_req { + __u8 diag_family; + __u8 pad[2]; + __u8 diag_ext; /* Query extended information */ + struct inet_diag_sockid id; +}; + +/* Base info structure. It contains socket identity (addrs/ports/cookie) based + * on the internal clcsock, and more SMC-related socket data + */ +struct smc_diag_msg { + __u8 diag_family; + __u8 diag_state; + __u8 diag_mode; + __u8 diag_shutdown; + struct inet_diag_sockid id; + + __u32 diag_uid; + __u64 diag_inode; +}; + +/* Mode of a connection */ +enum { + SMC_DIAG_MODE_SMCR, + SMC_DIAG_MODE_FALLBACK_TCP, + SMC_DIAG_MODE_SMCD, +}; + +/* Extensions */ + +enum { + SMC_DIAG_NONE, + SMC_DIAG_CONNINFO, + SMC_DIAG_LGRINFO, + SMC_DIAG_SHUTDOWN, + SMC_DIAG_DMBINFO, + SMC_DIAG_FALLBACK, + __SMC_DIAG_MAX, +}; + +#define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) + +/* SMC_DIAG_CONNINFO */ + +struct smc_diag_cursor { + __u16 reserved; + __u16 wrap; + __u32 count; +}; + +struct smc_diag_conninfo { + __u32 token; /* unique connection id */ + __u32 sndbuf_size; /* size of send buffer */ + __u32 rmbe_size; /* size of RMB element */ + __u32 peer_rmbe_size; /* size of peer RMB element */ + /* local RMB element cursors */ + struct smc_diag_cursor rx_prod; /* received producer cursor */ + struct smc_diag_cursor rx_cons; /* received consumer cursor */ + /* peer RMB element cursors */ + struct smc_diag_cursor tx_prod; /* sent producer cursor */ + struct smc_diag_cursor tx_cons; /* sent consumer cursor */ + __u8 rx_prod_flags; /* received producer flags */ + __u8 rx_conn_state_flags; /* recvd connection flags*/ + __u8 tx_prod_flags; /* sent producer flags */ + __u8 tx_conn_state_flags; /* sent connection flags*/ + /* send buffer cursors */ + struct smc_diag_cursor tx_prep; /* prepared to be sent cursor */ + struct smc_diag_cursor tx_sent; /* sent cursor */ + struct smc_diag_cursor tx_fin; /* confirmed sent cursor */ +}; + +/* SMC_DIAG_LINKINFO */ +#define IB_DEVICE_NAME_MAX 64 + +struct smc_diag_linkinfo { + __u8 link_id; /* link identifier */ + __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ + __u8 ibport; /* RDMA device port number */ + __u8 gid[40]; /* local GID */ + __u8 peer_gid[40]; /* peer GID */ +}; + +struct smc_diag_lgrinfo { + struct smc_diag_linkinfo lnk[1]; + __u8 role; +}; + +struct smc_diag_fallback { + __u32 reason; + __u32 peer_diagnosis; +}; + +struct smcd_diag_dmbinfo { /* SMC-D Socket internals */ + __u32 linkid; /* Link identifier */ + __u64 peer_gid; /* Peer GID */ + __u64 my_gid; /* My GID */ + __u64 token; /* Token of DMB */ + __u64 peer_token; /* Token of remote DMBE */ +}; + #endif /* SMCTOOLS_COMMON_H */
