Hello community, here is the log from the commit of package smc-tools for openSUSE:Factory checked in at 2019-09-07 11:55:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/smc-tools (Old) and /work/SRC/openSUSE:Factory/.smc-tools.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "smc-tools" Sat Sep 7 11:55:36 2019 rev:6 rq:729044 version:1.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/smc-tools/smc-tools.changes 2018-12-03 10:10:36.011697380 +0100 +++ /work/SRC/openSUSE:Factory/.smc-tools.new.7948/smc-tools.changes 2019-09-07 11:55:37.870255430 +0200 @@ -1,0 +2,17 @@ +Tue Sep 3 21:39:07 UTC 2019 - Mark Post <[email protected]> + +- Upgraded to version 1.2.1 (Fate#327839) + * Version 1.2.1 + Bug fixes: + smc_rnics: Install man page on s390 only + smc-preload: Handle behavior flags in type argument to socket() call + Makefile: Fixed install target on Ubuntu for platforms other than s390 + smc_pnet: changes in support of kernel 5.1 + * Version 1.2.0 + Changes: + smc_rnics: Initial version added + smc_dbg: Initial version added + Bug fixes: + smcss: Parse address family of ip address + +------------------------------------------------------------------- Old: ---- smc-tools-1.1.0.tar.gz New: ---- smc-tools-1.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ smc-tools.spec ++++++ --- /var/tmp/diff_new_pack.I2Wa2D/_old 2019-09-07 11:55:38.290255370 +0200 +++ /var/tmp/diff_new_pack.I2Wa2D/_new 2019-09-07 11:55:38.294255370 +0200 @@ -1,7 +1,7 @@ # # spec file for package smc-tools # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018, 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,7 +31,7 @@ %endif Name: smc-tools -Version: 1.1.0 +Version: 1.2.1 Release: 0 Summary: Shared Memory Communication via RDMA License: EPL-1.0 @@ -75,11 +75,14 @@ %set_permissions %{_libdir}/libsmc-preload.so %files -%defattr(-,root,root) %license LICENSE %doc README.smctools +%{_bindir}/smc_dbg %{_bindir}/smc_pnet %{_bindir}/smc_run +%ifarch s390 s390x +%{_bindir}/smc_rnics +%endif %{_bindir}/smcss %{_libdir}/libsmc-preload.so %if 0%{?have_32bit} @@ -87,6 +90,9 @@ %endif %{_mandir}/man7/af_smc.7%{?ext_man} %{_mandir}/man8/smc_pnet.8%{?ext_man} +%ifarch s390 s390x +%{_mandir}/man8/smc_rnics.8%{?ext_man} +%endif %{_mandir}/man8/smc_run.8%{?ext_man} %{_mandir}/man8/smcss.8%{?ext_man} ++++++ smc-tools-1.1.0.tar.gz -> smc-tools-1.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/Makefile new/smc-tools-1.2.1/Makefile --- old/smc-tools-1.1.0/Makefile 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/Makefile 2019-04-16 09:01:08.000000000 +0200 @@ -9,11 +9,12 @@ # http://www.eclipse.org/legal/epl-v10.html # -SMC_TOOLS_RELEASE = 1.1.0 +SMC_TOOLS_RELEASE = 1.2.1 VER_MAJOR = $(shell echo $(SMC_TOOLS_RELEASE) | cut -d '.' -f 1) ARCHTYPE = $(shell uname -m) ARCH := $(shell getconf LONG_BIT) +DISTRO := $(shell lsb_release -si 2>/dev/null) ifneq ("${V}","1") MAKEFLAGS += --quiet @@ -39,14 +40,22 @@ # Check that 31/32-bit build tools are available. # ifeq ($(ARCH),64) +ifeq ($(DISTRO),Ubuntu) +LIBDIR = ${PREFIX}/lib/${ARCHTYPE}-linux-gnu +else LIBDIR = ${PREFIX}/lib64 +endif ifneq ("$(wildcard ${PREFIX}/include/gnu/stubs-32.h)","") STUFF_32BIT = 1 LIBDIR32 = ${PREFIX}/lib endif else +ifeq ($(DISTRO),Ubuntu) +LIBDIR = ${PREFIX}/lib/s390-linux-gnu +else LIBDIR = ${PREFIX}/lib endif +endif all: libsmc-preload.so libsmc-preload32.so smcss smc_pnet @@ -59,6 +68,9 @@ MACHINE_OPT32="-m32" endif +%: %.in + $(GEN) -e "s#x.x.x#$(SMC_TOOLS_RELEASE)#g" < $< > $@ + smc-preload.o: smc-preload.c ${CCC} ${CFLAGS} -fPIC -c smc-preload.c @@ -114,6 +126,11 @@ install $(INSTALL_FLAGS_BIN) smc_run $(DESTDIR)$(BINDIR) install $(INSTALL_FLAGS_BIN) smcss $(DESTDIR)$(BINDIR) install $(INSTALL_FLAGS_BIN) smc_pnet $(DESTDIR)$(BINDIR) + install $(INSTALL_FLAGS_BIN) smc_dbg $(DESTDIR)$(BINDIR) +ifeq ($(shell uname -m | cut -c1-4),s390) + install $(INSTALL_FLAGS_BIN) smc_rnics $(DESTDIR)$(BINDIR) + install $(INSTALL_FLAGS_MAN) smc_rnics.8 $(DESTDIR)$(MANDIR)/man8 +endif install $(INSTALL_FLAGS_MAN) af_smc.7 $(DESTDIR)$(MANDIR)/man7 install $(INSTALL_FLAGS_MAN) smc_run.8 $(DESTDIR)$(MANDIR)/man8 install $(INSTALL_FLAGS_MAN) smc_pnet.8 $(DESTDIR)$(MANDIR)/man8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/README.smctools new/smc-tools-1.2.1/README.smctools --- old/smc-tools-1.1.0/README.smctools 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/README.smctools 2019-04-16 09:01:08.000000000 +0200 @@ -1,4 +1,4 @@ -SMC Tools (1.1.0) +SMC Tools (1.2.1) =================== The SMC Tools provided in this package allow execution of existing TCP @@ -12,6 +12,7 @@ - smc_pnet : C program for PNET Table handling - smcss : C program for displaying the information about active SMC sockets. +- smc_rnics : List available RDMA NICs The preload shared library libsmc-preload.so provides mapping of TCP socket operations to SMC sockets. @@ -45,6 +46,21 @@ Release History: ================ +1.2.1 (2019-04-15) + Bug fixes: + - smc_rnics: Install man page on s390 only + - smc-preload: Handle behavior flags in type argument to socket() call + - Makefile: Fixed install target on Ubuntu for platforms other than s390 + - smc_pnet: changes in support of kernel 5.1 + +1.2.0 (2019-02-08) + Changes: + - smc_rnics: Initial version added + - smc_dbg: Initial version added + + Bug fixes: + - smcss: Parse address family of ip address + 1.1.0 (2018-06-29) Changes: - smcss: Add IPv6 support @@ -87,6 +103,7 @@ smc_pnet.8 manpage for smc_pnet smcss.8 manpage for smcss smc_run.8 manpage for preload library usage +smc_dbg collect debugging data Requirements: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/af_smc.7 new/smc-tools-1.2.1/af_smc.7 --- old/smc-tools-1.1.0/af_smc.7 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/af_smc.7 2019-04-16 09:01:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" .\" Copyright IBM Corp. 2016, 2018 -.\" Author(s): Ursula Braun <[email protected]> -.\" Thomas Richter <[email protected]> +.\" Author(s): Ursula Braun <[email protected]> +.\" Thomas Richter <[email protected]> .\" ---------------------------------------------------------------------- .TH AF_SMC 7 "January 2017" "smc-tools" "Linux Programmer's Manual" .SH NAME @@ -129,14 +129,6 @@ announces this MTU size to the peer during connection start, and chooses the minimum MTU size of both peers. -.SH "AUTHOR" -.nf -Copyright IBM Corp. 2016, 2018 - -Published under the terms and conditions of the EPL -(Eclipse Public License). -.fi - .SH "SEE ALSO" .BR socket (2), .BR ip (7), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smc-preload.c new/smc-tools-1.2.1/smc-preload.c --- old/smc-tools-1.1.0/smc-preload.c 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/smc-preload.c 2019-04-16 09:01:08.000000000 +0200 @@ -1,7 +1,7 @@ /* * SMC Tools - Shared Memory Communication Tools * - * Copyright (c) IBM Corp. 2016, 2018 + * Copyright IBM Corp. 2016, 2018 * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -79,7 +79,8 @@ /* check if socket is eligible for AF_SMC */ if ((domain == AF_INET || domain == AF_INET6) && - type == SOCK_STREAM && + // see kernel code, include/linux/net.h, SOCK_TYPE_MASK + (type & 0xf) == SOCK_STREAM && (protocol == IPPROTO_IP || protocol == IPPROTO_TCP)) { dbg_msg(stderr, "libsmc-preload: map sock to AF_SMC\n"); if (domain == AF_INET) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smc.h new/smc-tools-1.2.1/smc.h --- old/smc-tools-1.1.0/smc.h 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/smc.h 2019-04-16 09:01:08.000000000 +0200 @@ -5,7 +5,7 @@ * * Copyright IBM Corp. 2017 * - * Author(s): Thomas Richter <[email protected]> + * Author(s): Thomas Richter <[email protected]> */ #ifndef _UAPI_LINUX_SMC_H_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smc_dbg new/smc-tools-1.2.1/smc_dbg --- old/smc-tools-1.1.0/smc_dbg 1970-01-01 01:00:00.000000000 +0100 +++ new/smc-tools-1.2.1/smc_dbg 2019-04-16 09:01:08.000000000 +0200 @@ -0,0 +1,95 @@ +#!/bin/bash + +# Copyright IBM Corp. 2019 + +function usage() { + echo; + echo "Usage: smc_dbg [ OPTIONS ]"; + echo; + echo "Collect debug information"; + echo; + echo " -h, --help display this message"; + echo " -t, --tgz generate .tgz file"; + echo " -v, --version display version info"; + echo; +} + + +function redirect() { + if [ "$tgz" == "on" ]; then + exec &>$tmpdir/$1; + else + echo; + fi +} + +tgz="off"; +ARCH=`uname -m | cut -c1-4`; +args=`getopt -u -o hvt -l help,version,tgz -- $*`; +[ $? -ne 0 ] && exit 1; +set -- $args; +while [ $# -gt 0 ]; do + case $1 in + "-h" | "--help" ) + usage; + exit 0;; + "-t" | "--tgz" ) + tgz="on";; + "-v" | "--version" ) + echo "smc_dbg utility, smc-tools-1.2.1 (5ad3088)"; + exit 0;; + * ) + esac + shift; +done +if [ "$tgz" == "on" ]; then + exec 3>&1 4>&2 + tmpdir=`mktemp -d /tmp/smc_dbg-XXXXXX`; +fi + +redirect version.txt; +smcss -v +smc_dbg -v +smc_pnet -v +smc_rnics -v + +if [ "$ARCH" == "s390" ]; then + redirect devices.txt; + echo "CCW Devices:" + printf " Device CHPID PNET ID\n"; + echo " -------------------------------------------"; + for device in `ls -1 /sys/bus/ccwgroup/devices`; do + chpid=`cat /sys/bus/ccwgroup/devices/$device/chpid | tr [A-F] [a-f]`; + if [ -e /sys/devices/css0/chp0.$chpid/util_string ]; then + pnetid="`cat /sys/devices/css0/chp0.$chpid/util_string | iconv -f IBM-1047 -t ASCII 2>/dev/null | tr -d '\000' | sed 's/^/ /'`"; + else + pnetid=""; + fi + printf " %8s %4s %s\n" $device 0x$chpid $pnetid; + done + echo; + + echo "PCI Devices:" + smc_rnics | sed 's/^/ /'; + + redirect smcss_smcd; + smcss --smcd; +fi + +redirect smcss_all.txt; +smcss --all --debug; + +redirect smcss_smcr; +smcss --smcr; + +redirect pnet_table.txt; +smc_pnet --show; + +if [ "$tgz" == "on" ]; then + exec >&3 2>&4 + cd /tmp; + tar cvfz $tmpdir.tgz `basename $tmpdir` >/dev/null 2>&1; + rm -rf $tmpdir; + echo "Debug output written to $tmpdir.tgz"; +fi +exit 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smc_pnet.8 new/smc-tools-1.2.1/smc_pnet.8 --- old/smc-tools-1.1.0/smc_pnet.8 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/smc_pnet.8 2019-04-16 09:01:08.000000000 +0200 @@ -1,9 +1,9 @@ .\" smc_pnet.8 .\" .\" -.\" Copyright IBM Corp. 2017 -.\" Author(s): Thomas Richter <[email protected]> -.\" Ursula Braun <[email protected]> +.\" Copyright IBM Corp. 2017, 2019 +.\" Author(s): Thomas Richter <[email protected]> +.\" Ursula Braun <[email protected]> .\" ---------------------------------------------------------------------- .\" @@ -15,30 +15,46 @@ .SH SYNOPSIS .B smc_pnet -.RB { \-\-add | \-a "} {" \-\-interface | \-I "} <ethernet-interface> {" \-\-ibdevice | \-D "} <infiniband-device> [ {" \-\-ibport | \-P "<infiniband-port> ] } <pnetid>" +{ \fB\-a\fR | \fB\-\-add\fR \fI<pnetid>\fR } +{ \fB\-I\fR | \fB\-\-interface\fR <ethernet-interface> } .P .B smc_pnet -.RB { \-\-show | -s } <pnetid> +{ \fB\-a\fR | \fB\-\-add\fR \fI<pnetid>\fR } +{ \fB\-D\fR | \fB\-\-ibdevice\fR <infiniband-or-ISM-device> } +[ \fB\-P\fR | \fB\-\-ibport\fR <infiniband-port> ] .P .B smc_pnet -.RB { \-\-delete | \-d } <pnetid> +{ \fB\-a\fR | \fB\-\-add\fR \fI<pnetid>\fR } +{ \fB\-I\fR | \fB\-\-interface\fR <ethernet-interface> } +{ \fB\-D\fR | \fB\-\-ibdevice\fR <infiniband-or-ISM-device> } +[ \fB\-P\fR | \fB\-\-ibport\fR <infiniband-port> ] .P .B smc_pnet -.RB { \-\-flush | \-f } +{ \fB\-s\fR | \fB\-\-show\fR \fI<pnetid>\fR } .P .B smc_pnet -.RB { \-\-version | \-v } +{ \fB\-d\fR | \fB\-\-delete\fR \fI<pnetid>\fR } .P .B smc_pnet -.RB { \-\-help | \-h } +{ \fB\-f\fR | \fB\-\-flush\fR } +.P +.B smc_pnet +{ \fB\-v\fR | \fB\-\-version\fR } +.P +.B smc_pnet +{ \fB\-h\fR | \fB\-\-help\fR } .SH DESCRIPTION -The SMC protocol requires grouping of standard Ethernet and RoCE networks. +The SMC protocol requires grouping of standard Ethernet and RoCE networks or ISM +devices. Such groups are called \fIPhysical Networks\fR (PNETs). The mapping is configured within a table called \fIpnet table\fR. Any available Ethernet interface can be -combined with an available RDMA-capable network interface card (RNIC), if they +combined with an available RDMA-capable network interface card (RNIC) or a +DMA-capable ISM device, if they belong to the same Converged Ethernet fabric. To configure mapping of a RoCE Adapter -port to a standard Ethernet interface, an entry in the pnet table must be created. +port or an ISM device to a standard Ethernet interface, both devices need to have +the same pnetid; either hardware-defined or user-defined using the pnet table. +Hardware-defined pnetids cannot be overwritten. .P The .B smc_pnet @@ -49,16 +65,15 @@ .B smc_pnet shows all entries of the pnet table. .TP -.BR <pnetid> -defines a name for a grouping of Ethernet interface and RNIC. +.IR <pnetid> +defines a name for a grouping of Ethernet interface and RNICs or ISM devices. A pnetid name consists of up to 16 alphanumeric uppercase characters without blanks. .TP .BR "\-a, \-\-add" creates a new pnetid definition to the pnet table (if it does not already exist). Only one pnetid can be defined for a certain -Ethernet interface and for a certain infiniband device port. -Adding an ethernet interface or an infiniband device port more than once -fails. +Ethernet interface, a certain InfiniBand device port or a certain ISM device. +Adding more than one pnetid fails. Hardware defined pnetids cannot be overwritten. .TP .BR "\-s, \-\-show" shows a certain pnetid definition in the pnet table. @@ -73,11 +88,11 @@ specifies the name of the Ethernet interface to be added for a certain pnetid definition. .TP -.BR "\-D, \-\-ibdevice <infiniband-device>" -specifies the name of the Infiniband device. +.BR "\-D, \-\-ibdevice <infiniband-or-ISM-device>" +specifies the ID of the InfiniBand device or ISM device. .TP .BR "\-P, \-\-ibport <infiniband-port>" -specifies the port number of the Infiniband device port. Valid numbers are +specifies the port number of the InfiniBand device port. Valid numbers are 1 or 2. The default value is 1. .TP @@ -88,31 +103,57 @@ displays a brief smc_pnet usage information. .SH EXAMPLES -.B Create a pnetid ABC with ethernet interface name encf500, infiniband -.B device name mlx4_0 and port number 2: +.B Define pnetid ABC for the ethernet device names encf500 and bond0, and define +.B pnetid ABC for the InfiniBand device ID 0001:00:00.0 (port 2) and the ISM +.B device ID 0004:00:00.0: .RS 4 .PP -$ smc_pnet \-a ABC \-I encf500 \-D mlx4_0 \-P 2 +.nf +$ smc_pnet \-a ABC \-I encf500 +$ smc_pnet \-a ABC \-I bond0 +$ smc_pnet \-a ABC \-D 0001:00:00:00.0 \-P 2 +$ smc_pnet \-a ABC \-D 0004:00:00:00.0 .RE .PP . -.B Delete a pnet table entry with pnetid named ABC: +.B Show all pnet table entries: .RS 4 .PP -$ smc_pnet \-d ABC +.nf +$ smc_pnet +ABC encf500 n/a 255 +ABC bond0 n/a 255 +ABC n/a 0001:00:00.0 2 +ABC n/a 0004:00:00.0 1 +.RE +.PP +. +.B Define pnetid XYZ for the ethernet interface name vlan0201 and the InfiniBand +.B device ID 0001:00:00.0 (port 1): +.RS 4 +.PP +$ smc_pnet \-a XYZ \-I vlan0201 \-D 0001:00:00.0 \-P 1 .RE .PP . -.B Show the mapping of ethernet interface name and infiniband device port for pnetid ABC: +.B Show all entries for pnetid XYZ: .RS 4 .PP .nf -$ smc_pnet \-s ABC -ABC encf500 mlx4_0 2 +$ smc_pnet \-s XYZ +XYZ vlan0201 n/a 255 +XYZ n/a 0001:00:00.0 1 .RE .PP . -.B Delete all entries in the pnet table +.B Delete all pnet table entries with pnetid named ABC: +.RS 4 +.PP +$ smc_pnet \-d ABC +.RE +.PP +. +.B Delete all entries in the pnet table: .RS 4 .PP $ smc_pnet \-f @@ -121,26 +162,12 @@ . . .SH RETURN CODES -Successful -.IR smc_pnet -commands return 0. -If an error occurs, -.IR smc_pnet -writes a message to stderr and completes with a return code -other than 0. +Successful \fBsmc_pnet\fR commands return 0. +If an error occurs, \fBsmc_pnet\fR writes a message to stderr and +completes with a return code other than 0. .P -.SH AUTHOR -.nf -This man page was written by -Ursula Braun <[email protected]> - -Copyright (c) IBM Corp. 2017 - -Published under the terms and conditions of the EPL -(Eclipse Public License). -.fi - .SH SEE ALSO .BR af_smc (7), -.BR smc_run (8) +.BR smc_rnics (8), +.BR smc_run (8), .BR smcss (8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smc_pnet.c new/smc-tools-1.2.1/smc_pnet.c --- old/smc-tools-1.1.0/smc_pnet.c 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/smc_pnet.c 2019-04-16 09:01:08.000000000 +0200 @@ -3,7 +3,7 @@ * * Copyright IBM Corp. 2017 * - * Author(s): Thomas Richter <[email protected]> + * Author(s): Thomas Richter <[email protected]> * * User space program for SMC-R PNET Table manipulation with generic netlink. * @@ -40,7 +40,7 @@ static struct pnetentry { char *pnetid; /* Pnetid */ char *ethname; /* Ethernet device name */ - char *ibname; /* Infiniband device name */ + char *ibname; /* Infiniband/ISM device name */ int ibport; /* Infiniband device port number */ unsigned char cmd; /* Command to execute */ } pnetcmd; @@ -51,12 +51,12 @@ "Usage: %s [ OPTIONS ] [pnetid]\n" "\t-h, --help this message\n" "\t-V, --version show version information\n" -"\t-a, --add add a pnetid entry, requires interface and ibdevice\n" +"\t-a, --add add a pnetid entry, requires interface or ib/ism device\n" "\t-d, --delete delete a pnetid entry\n" "\t-s, --show show a pnetid entry\n" "\t-f, --flush flush the complete pnet table\n" "\t-I, --interface Ethernet interface name of a pnetid entry\n" -"\t-D, --ibdevice Infiniband device name of a pnetid entry\n" +"\t-D, --ibdevice Infiniband/ISM device name of a pnetid entry\n" "\t-P, --ibport Infiniband device port (default: 1)\n" "\t\n" "\tno OPTIONS show complete pnet table\n", @@ -106,7 +106,7 @@ static struct nla_policy smc_pnet_policy[SMC_PNETID_MAX + 1] = { [SMC_PNETID_NAME] = { .type = NLA_STRING, - .maxlen = 16 + .maxlen = 17 }, [SMC_PNETID_ETHNAME] = { .type = NLA_STRING, @@ -164,7 +164,7 @@ if (id < 0) { rc = EXIT_FAILURE; if (id == -NLE_OBJ_NOTFOUND) - fprintf(stderr, "%s: SMC-R module not loaded\n", + fprintf(stderr, "%s: SMC module not loaded\n", progname); else nl_perror(id, progname); @@ -193,21 +193,26 @@ switch (pnetcmd.cmd) { /* Start message construction */ case SMC_PNETID_ADD: - rc = nla_put_string(msg, SMC_PNETID_ETHNAME, pnetcmd.ethname); + if (pnetcmd.ethname) + rc = nla_put_string(msg, SMC_PNETID_ETHNAME, + pnetcmd.ethname); if (rc < 0) { nl_perror(rc, progname); rc = EXIT_FAILURE; goto out3; } - rc = nla_put_string(msg, SMC_PNETID_IBNAME, pnetcmd.ibname); + if (pnetcmd.ibname) + rc = nla_put_string(msg, SMC_PNETID_IBNAME, + pnetcmd.ibname); if (rc < 0) { nl_perror(rc, progname); rc = EXIT_FAILURE; goto out3; } - rc = nla_put_u8(msg, SMC_PNETID_IBPORT, pnetcmd.ibport); + if (pnetcmd.ibname) + rc = nla_put_u8(msg, SMC_PNETID_IBPORT, pnetcmd.ibport); if (rc < 0) { nl_perror(rc, progname); rc = EXIT_FAILURE; @@ -236,6 +241,13 @@ /* Receive reply message, returns number of cb invocations. */ rc = nl_recvmsgs_default(sk); + /* Kernel commit a9d8b0b1e3d689346b016316bd91980d60c6885d + * introduced a misbehavior that a FLUSH of an empty table + * returned -ENOENT. Fix it in smc-tools as long as kernel patch did'nt + * land in the distros. + */ + if (pnetcmd.cmd == SMC_PNETID_FLUSH && rc != -NLE_OBJ_NOTFOUND) + rc = 0; if (rc < 0) { nl_perror(rc, progname); rc = EXIT_FAILURE; @@ -328,12 +340,9 @@ } if (pnetcmd.cmd == SMC_PNETID_ADD) { - if (!pnetcmd.ethname) { - fprintf(stderr, "%s: interface missing\n", progname); - usage(); - } - if (!pnetcmd.ibname) { - fprintf(stderr, "%s: ibdevice missing\n", progname); + if (!pnetcmd.ethname && !pnetcmd.ibname) { + fprintf(stderr, "%s: interface or device missing\n", + progname); usage(); } if (!pnetcmd.ibport) @@ -347,7 +356,7 @@ pnetcmd.ethname = NULL; } if (pnetcmd.ibname) { - fprintf(stderr, "%s: ibdevice %s ignored\n", progname, + fprintf(stderr, "%s: device %s ignored\n", progname, pnetcmd.ibname); pnetcmd.ibname = NULL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smc_rnics new/smc-tools-1.2.1/smc_rnics --- old/smc-tools-1.1.0/smc_rnics 1970-01-01 01:00:00.000000000 +0100 +++ new/smc-tools-1.2.1/smc_rnics 2019-04-16 09:01:08.000000000 +0200 @@ -0,0 +1,185 @@ +#!/bin/bash + +# Copyright IBM Corp. 2018 + + +function usage() { + echo; + echo "Usage: smc_rnics [ OPTIONS ] [ FID ]"; + echo; + echo "List all available RNICs"; + echo; + echo " -d, --disable <FID> disable the specified FID"; + echo " -e, --enable <FID> enable the specified FID"; + echo " -h, --help display this message"; + 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; + fi + printf "%3x %-5s %-12s %-4s %-14s %-4s %-16s %s\n" "$((16#$fid))" "$power" "$addr" "$pchid" "$dev_type" "$port" "$pnet" "$int"; + (( printed++ )); +} + +function format_fid() { + res="${1#0x}"; + + if [[ "$res" =~ ^([:xdigit:])+ ]]; then + printf "Error: '%s' is not a valid FID\n" "$res" >&2; + exit 3; + fi + + res="`printf "%08x" $((16#$res))`"; +} + +if [ "`uname -m`" != "s390x" ] && [ "`uname -m`" != "s390" ]; then + printf "Error: s390/s390x supported only\n" >&2; + exit 1; +fi + +args=`getopt -u -o hrve:d: -l enable:,disable:,help,rawids,version -- $*`; +[ $? -ne 0 ] && exit 2; +set -- $args; +action="print"; +rawIDs=0; +target=""; +printed=0; +while [ $# -gt 0 ]; do + case $1 in + "-e" | "--enable" ) + action="enable"; + fid=$2; + shift;; + "-d" | "--disable" ) + action="disable"; + fid=$2; + shift;; + "-h" | "--help" ) + usage; + exit 0;; + "-r" | "--rawids" ) + rawIDs=1;; + "-v" | "--version" ) + echo "smc_rnics utility, smc-tools-1.2.1 (5ad3088)"; + exit 0;; + "--" ) ;; + * ) format_fid "$1"; + target="$res"; + esac + shift; +done + +if [ "$action" != "print" ]; then + if [ "$target" != "" ]; then + usage; + exit 4; + fi + format_fid "$fid"; + fid="$res"; + ufid=`printf "%x" $((16#$fid))`; # representation without leading zeros + if [ ! -d /sys/bus/pci/slots/$fid ]; then + echo "Error: FID $ufid does not exist" >&2; + exit 5; + fi + power=`cat /sys/bus/pci/slots/$fid/power 2>/dev/null`; + val=0; + [ "$action" == "enable" ] && val=1; + if [ $power -eq $val ]; then + echo "Error: FID $ufid is already ${action}d" >&2; + exit 6; + fi + echo $val > /sys/bus/pci/slots/$fid/power 2>/dev/null; + if [ $? -ne 0 ]; then + echo "Error: Failed to $action FID $ufid" >&2; + exit 7; + fi + 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";; + "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 + +if [ "$target" != "" ] && [ $printed -eq 0 ]; then + exit 8; +fi + +exit 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smc_rnics.8 new/smc-tools-1.2.1/smc_rnics.8 --- old/smc-tools-1.1.0/smc_rnics.8 1970-01-01 01:00:00.000000000 +0100 +++ new/smc-tools-1.2.1/smc_rnics.8 2019-04-16 09:01:08.000000000 +0200 @@ -0,0 +1,111 @@ +.\" Copyright IBM Corp. 2018 + +.TH SMC_RNICS 8 "October 2018" "smc-tools" "Linux Programmer's Manual" + + +.SH NAME +smc_rnics \- list, enable and disable (R)NICS as used by SMC-R and SMC-D. + + +.SH SYNOPSIS +.B smc_rnics +.RB [ \-hrv ] +.RB [ \-d +.IR FID ] +.RB [ \-e +.IR FID ] +.RI [ FID ] + + +.SH DESCRIPTION +The SMC protocol requires an (R)NIC for the (R)DMA traffic. +Use +.B smc_rnics +to handle, and to identify hotplugged (R)NICs. + + +.SH OPTIONS +By default, +.B smc_rnics +shows all available (R)NICs in the system. +.TP +.I FID +Limit output to the specified function ID +.RI ( FID ). +.TP +.BR "\-d, \-\-disable " \fIFID +Set (R)NIC +.I FID +offline. +.TP +.BR "\-e, \-\-enable " \fIFID +Set (R)NIC +.I FID +online. +.TP +.BR "\-h, \-\-help" +Display a brief +.B smc_rnics +usage information. +.TP +.BR "\-r, \-\-rawids" +Display raw PCI vendor and device codes in column +.I Type +. . +.TP +.BR "\-v, \-\-version" +Display version information. + + +.SH OUTPUT +.SS "FID" +Function ID. + +.SS "Power" +Indicates whether the PCI slot is on (1) or off (0). See option +.B -d +on how to enable a device that is offline. + +.SS "PCI ID" +PCI ID in BDF (Bus:Device.Function) notation. + +.SS "PCHID" +Physical channel identifier. + +.SS "Type" +Device type in human readable form. See option +.B -r +to switch to display of PCI vendor and device instead. + +.SS "Port" +Corresponding port of an RNIC, if applicable. + +.SS "PNET ID" +Physical network ID, if defined in IOCDS. + +.SS "Interface" +Network interface in Linux, if applicable. + + +.SH RETURN CODES +On success, +.B smc_rnics +returns 0. +If an error occurs, a return code other than 0 is returned. +.P + + +.SH AUTHOR +.nf +Copyright IBM Corp. 2018 + +Published under the terms and conditions of the EPL +(Eclipse Public License). +.fi + + +.SH SEE ALSO +.BR af_smc (7), +.BR smc_pnet (8), +.BR smc_run (8), +.BR smcss (8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smc_run.8 new/smc-tools-1.2.1/smc_run.8 --- old/smc-tools-1.1.0/smc_run.8 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/smc_run.8 2019-04-16 09:01:08.000000000 +0200 @@ -2,7 +2,7 @@ .\" .\" .\" Copyright IBM Corp. 2017 -.\" Author(s): Ursula Braun <[email protected]> +.\" Author(s): Ursula Braun <[email protected]> .\" ---------------------------------------------------------------------- .\" .TH SMC_RUN 8 "January 2017" "smc-tools" "Linux Programmer's Manual " @@ -47,15 +47,9 @@ .B 1 An invalid option was specified. .P -.SH AUTHOR -.nf -Copyright (c) IBM Corp. 2017 - -Published under the terms and conditions of the EPL -(Eclipse Public License). -.fi .SH SEE ALSO .BR af_smc (7), .BR smc_pnet (8), +.BR smc_rnics (8), .BR smcss (8), .BR tcp (7) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smcss.8 new/smc-tools-1.2.1/smcss.8 --- old/smc-tools-1.1.0/smcss.8 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/smcss.8 2019-04-16 09:01:08.000000000 +0200 @@ -2,7 +2,7 @@ .\" .\" .\" Copyright IBM Corp. 2017, 2018 -.\" Author(s): Ursula Braun <[email protected]> +.\" Author(s): Ursula Braun <[email protected]> .\" ---------------------------------------------------------------------- .\" @@ -212,14 +212,14 @@ SMC socket connection flags set locally and sent to the peer. .SS "txprep-Cursor" Describes the current cursor location of the "Sndbuf" for data to be sent. -The data is to be moved to the "Peerbuf" by using RDMA-write. +The data is to be moved to the "Peerbuf". .SS "txsent-Cursor" Describes the current cursor location of the "Sndbuf" for data sent. -The data was moved to the "Peerbuf" by using RDMA-write. +The data was moved to the "Peerbuf". .SS "txfin-Cursor" Describes the current cursor location of the "Sndbuf" for data sent and send completion confirmed. -The data was moved to the "Peerbuf" by using RDMA-write and completion was confirmed. +The data was moved to the "Peerbuf" and completion was confirmed. .SS "Role" .TP .I @@ -250,18 +250,8 @@ .IR smcss writes a message to stderr and completes with a return code other than 0. .P -.SH AUTHOR -.nf -This man page was written by -Ursula Braun <[email protected]> - -Copyright (c) IBM Corp. 2017, 2018 - -Published under the terms and conditions of the EPL -(Eclipse Public License). -.fi - .SH SEE ALSO .BR af_smc (7), -.BR smc_run (8) +.BR smc_rnics (8), +.BR smc_run (8), .BR smc_pnet (8) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smcss.c new/smc-tools-1.2.1/smcss.c --- old/smc-tools-1.1.0/smcss.c 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/smcss.c 2019-04-16 09:01:08.000000000 +0200 @@ -1,9 +1,9 @@ /* * SMC Tools - Shared Memory Communication Tools * - * Copyright (c) IBM Corp. 2017, 2018 + * Copyright IBM Corp. 2017, 2018 * - * Author(s): Ursula Braun <[email protected]> + * Author(s): Ursula Braun <[email protected]> * * User space program for SMC Socket display * @@ -251,11 +251,26 @@ /* format one sockaddr / port */ static void addr_format(char *buf, size_t buf_len, size_t short_len, - int af, void *addr, int port) + __be32 addr[4], int port) { char *errmsg = "(inet_ntop error)"; /* very unlikely */ char addr_buf[64], port_buf[16]; int addr_len, port_len; + int af; + + /* There was an upstream discussion about the content of the + * diag_family field. Originally it was AF_SMC, but was changed with + * IPv6 support to indicate AF_INET or AF_INET6. Upstream complained + * later that there is no way to separate AF_INET from AF_SMC diag msgs. + * We now change back the value of the diag_family field to be always + * AF_SMC. We now 'parse' the IP address type. + * Note that smc_diag.c in kernel always clears the whole addr field + * before the ip address is copied into and we can rely on that here. + */ + if (addr[1] == 0 && addr[2] == 0 && addr[3] == 0) + af = AF_INET; + else + af = AF_INET6; if (!inet_ntop(af, addr, addr_buf, sizeof(addr_buf))) { strcpy(buf, errmsg); @@ -307,13 +322,13 @@ goto newline; addr_format(txtbuf, sizeof(txtbuf), ADDR_LEN_SHORT, - r->diag_family, r->id.idiag_src, ntohs(r->id.idiag_sport)); + r->id.idiag_src, ntohs(r->id.idiag_sport)); printf("%-*s ", (int)MAX(ADDR_LEN_SHORT, strlen(txtbuf)), txtbuf); if (r->diag_state == 10) /* LISTEN state */ goto newline; addr_format(txtbuf, sizeof(txtbuf), ADDR_LEN_SHORT, - r->diag_family, r->id.idiag_dst, ntohs(r->id.idiag_dport)); + r->id.idiag_dst, ntohs(r->id.idiag_dport)); printf("%-*s ", (int)MAX(ADDR_LEN_SHORT, strlen(txtbuf)), txtbuf); printf("%04x ", r->id.idiag_if); if (r->diag_mode == SMC_DIAG_MODE_FALLBACK_TCP) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smc-tools-1.1.0/smctools_common.h new/smc-tools-1.2.1/smctools_common.h --- old/smc-tools-1.1.0/smctools_common.h 2018-06-29 14:20:40.000000000 +0200 +++ new/smc-tools-1.2.1/smctools_common.h 2019-04-16 09:01:08.000000000 +0200 @@ -3,9 +3,9 @@ * * Copyright IBM Corp. 2017 * - * Author(s): Ursula Braun ([email protected]) + * Author(s): Ursula Braun ([email protected]) * - * Copyright (c) IBM Corp. 2017 + * Copyright IBM Corp. 2017 * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -20,7 +20,7 @@ #define STRINGIFY(x) STRINGIFY_1(x) #define RELEASE_STRING STRINGIFY (SMC_TOOLS_RELEASE) -#define RELEASE_LEVEL "e0052e3" +#define RELEASE_LEVEL "5ad3088" #define PF_SMC 43
