Skip to content

Commit e3e5c20

Browse files
author
Stefan Raspl
committed
Release: Prepare v1.2.1
Signed-off-by: Stefan Raspl <raspl@linux.ibm.com>
1 parent 9466828 commit e3e5c20

8 files changed

Lines changed: 117 additions & 59 deletions

File tree

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# http://www.eclipse.org/legal/epl-v10.html
1010
#
1111

12-
SMC_TOOLS_RELEASE = 1.2.0
12+
SMC_TOOLS_RELEASE = 1.2.1
1313
VER_MAJOR = $(shell echo $(SMC_TOOLS_RELEASE) | cut -d '.' -f 1)
1414

1515
ARCHTYPE = $(shell uname -m)
@@ -41,7 +41,7 @@ STUFF_32BIT = 0
4141
#
4242
ifeq ($(ARCH),64)
4343
ifeq ($(DISTRO),Ubuntu)
44-
LIBDIR = ${PREFIX}/lib/s390x-linux-gnu
44+
LIBDIR = ${PREFIX}/lib/${ARCHTYPE}-linux-gnu
4545
else
4646
LIBDIR = ${PREFIX}/lib64
4747
endif
@@ -129,10 +129,10 @@ endif
129129
install $(INSTALL_FLAGS_BIN) smc_dbg $(DESTDIR)$(BINDIR)
130130
ifeq ($(shell uname -m | cut -c1-4),s390)
131131
install $(INSTALL_FLAGS_BIN) smc_rnics $(DESTDIR)$(BINDIR)
132+
install $(INSTALL_FLAGS_MAN) smc_rnics.8 $(DESTDIR)$(MANDIR)/man8
132133
endif
133134
install $(INSTALL_FLAGS_MAN) af_smc.7 $(DESTDIR)$(MANDIR)/man7
134135
install $(INSTALL_FLAGS_MAN) smc_run.8 $(DESTDIR)$(MANDIR)/man8
135-
install $(INSTALL_FLAGS_MAN) smc_rnics.8 $(DESTDIR)$(MANDIR)/man8
136136
install $(INSTALL_FLAGS_MAN) smc_pnet.8 $(DESTDIR)$(MANDIR)/man8
137137
install $(INSTALL_FLAGS_MAN) smcss.8 $(DESTDIR)$(MANDIR)/man8
138138

README.smctools

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SMC Tools (1.2.0)
1+
SMC Tools (1.2.1)
22
===================
33

44
The SMC Tools provided in this package allow execution of existing TCP
@@ -46,12 +46,19 @@ For enhancements, please describe the proposed change and its benefits.
4646
Release History:
4747
================
4848

49+
1.2.1 (2019-04-15)
50+
Bug fixes:
51+
- smc_rnics: Install man page on s390 only
52+
- smc-preload: Handle behavior flags in type argument to socket() call
53+
- Makefile: Fixed install target on Ubuntu for platforms other than s390
54+
- smc_pnet: changes in support of kernel 5.1
55+
4956
1.2.0 (2019-02-08)
5057
Changes:
5158
- smc_rnics: Initial version added
5259
- smc_dbg: Initial version added
5360

54-
Bug fixes:
61+
Bug fixes:
5562
- smcss: Parse address family of ip address
5663

5764
1.1.0 (2018-06-29)

smc-preload.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ int socket(int domain, int type, int protocol)
7979

8080
/* check if socket is eligible for AF_SMC */
8181
if ((domain == AF_INET || domain == AF_INET6) &&
82-
type == SOCK_STREAM &&
82+
// see kernel code, include/linux/net.h, SOCK_TYPE_MASK
83+
(type & 0xf) == SOCK_STREAM &&
8384
(protocol == IPPROTO_IP || protocol == IPPROTO_TCP)) {
8485
dbg_msg(stderr, "libsmc-preload: map sock to AF_SMC\n");
8586
if (domain == AF_INET)

smc_dbg

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ while [ $# -gt 0 ]; do
3636
"-t" | "--tgz" )
3737
tgz="on";;
3838
"-v" | "--version" )
39-
echo "smc_dbg utility, smc-tools-1.2.0 (8a2dae6)";
39+
echo "smc_dbg utility, smc-tools-1.2.1 (5ad3088)";
4040
exit 0;;
4141
* )
4242
esac
@@ -60,7 +60,11 @@ if [ "$ARCH" == "s390" ]; then
6060
echo " -------------------------------------------";
6161
for device in `ls -1 /sys/bus/ccwgroup/devices`; do
6262
chpid=`cat /sys/bus/ccwgroup/devices/$device/chpid | tr [A-F] [a-f]`;
63-
pnetid="`cat /sys/devices/css0/chp0.$chpid/util_string | iconv -f IBM-1047 -t ASCII 2>/dev/null | tr -d '\000' | sed 's/^/ /'`";
63+
if [ -e /sys/devices/css0/chp0.$chpid/util_string ]; then
64+
pnetid="`cat /sys/devices/css0/chp0.$chpid/util_string | iconv -f IBM-1047 -t ASCII 2>/dev/null | tr -d '\000' | sed 's/^/ /'`";
65+
else
66+
pnetid="";
67+
fi
6468
printf " %8s %4s %s\n" $device 0x$chpid $pnetid;
6569
done
6670
echo;

smc_pnet.8

Lines changed: 71 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" smc_pnet.8
22
.\"
33
.\"
4-
.\" Copyright IBM Corp. 2017
4+
.\" Copyright IBM Corp. 2017, 2019
55
.\" Author(s): Thomas Richter <tmricht@linux.ibm.com>
66
.\" Ursula Braun <ubraun@linux.ibm.com>
77
.\" ----------------------------------------------------------------------
@@ -15,30 +15,46 @@ smc_pnet \- create, destroy, and change the SMC PNET table.
1515
.SH SYNOPSIS
1616

1717
.B smc_pnet
18-
.RB { \-\-add | \-a "} {" \-\-interface | \-I "} <ethernet-interface> {" \-\-ibdevice | \-D "} <infiniband-device> [ {" \-\-ibport | \-P "<infiniband-port> ] } <pnetid>"
18+
{ \fB\-a\fR | \fB\-\-add\fR \fI<pnetid>\fR }
19+
{ \fB\-I\fR | \fB\-\-interface\fR <ethernet-interface> }
1920
.P
2021
.B smc_pnet
21-
.RB { \-\-show | -s } <pnetid>
22+
{ \fB\-a\fR | \fB\-\-add\fR \fI<pnetid>\fR }
23+
{ \fB\-D\fR | \fB\-\-ibdevice\fR <infiniband-or-ISM-device> }
24+
[ \fB\-P\fR | \fB\-\-ibport\fR <infiniband-port> ]
2225
.P
2326
.B smc_pnet
24-
.RB { \-\-delete | \-d } <pnetid>
27+
{ \fB\-a\fR | \fB\-\-add\fR \fI<pnetid>\fR }
28+
{ \fB\-I\fR | \fB\-\-interface\fR <ethernet-interface> }
29+
{ \fB\-D\fR | \fB\-\-ibdevice\fR <infiniband-or-ISM-device> }
30+
[ \fB\-P\fR | \fB\-\-ibport\fR <infiniband-port> ]
2531
.P
2632
.B smc_pnet
27-
.RB { \-\-flush | \-f }
33+
{ \fB\-s\fR | \fB\-\-show\fR \fI<pnetid>\fR }
2834
.P
2935
.B smc_pnet
30-
.RB { \-\-version | \-v }
36+
{ \fB\-d\fR | \fB\-\-delete\fR \fI<pnetid>\fR }
3137
.P
3238
.B smc_pnet
33-
.RB { \-\-help | \-h }
39+
{ \fB\-f\fR | \fB\-\-flush\fR }
40+
.P
41+
.B smc_pnet
42+
{ \fB\-v\fR | \fB\-\-version\fR }
43+
.P
44+
.B smc_pnet
45+
{ \fB\-h\fR | \fB\-\-help\fR }
3446

3547
.SH DESCRIPTION
36-
The SMC protocol requires grouping of standard Ethernet and RoCE networks.
48+
The SMC protocol requires grouping of standard Ethernet and RoCE networks or ISM
49+
devices.
3750
Such groups are called \fIPhysical Networks\fR (PNETs). The mapping is configured
3851
within a table called \fIpnet table\fR. Any available Ethernet interface can be
39-
combined with an available RDMA-capable network interface card (RNIC), if they
52+
combined with an available RDMA-capable network interface card (RNIC) or a
53+
DMA-capable ISM device, if they
4054
belong to the same Converged Ethernet fabric. To configure mapping of a RoCE Adapter
41-
port to a standard Ethernet interface, an entry in the pnet table must be created.
55+
port or an ISM device to a standard Ethernet interface, both devices need to have
56+
the same pnetid; either hardware-defined or user-defined using the pnet table.
57+
Hardware-defined pnetids cannot be overwritten.
4258
.P
4359
The
4460
.B smc_pnet
@@ -49,16 +65,15 @@ By default,
4965
.B smc_pnet
5066
shows all entries of the pnet table.
5167
.TP
52-
.BR <pnetid>
53-
defines a name for a grouping of Ethernet interface and RNIC.
68+
.IR <pnetid>
69+
defines a name for a grouping of Ethernet interface and RNICs or ISM devices.
5470
A pnetid name consists of up to 16 alphanumeric uppercase characters without blanks.
5571
.TP
5672
.BR "\-a, \-\-add"
5773
creates a new pnetid definition to the pnet table (if it does not already exist).
5874
Only one pnetid can be defined for a certain
59-
Ethernet interface and for a certain infiniband device port.
60-
Adding an ethernet interface or an infiniband device port more than once
61-
fails.
75+
Ethernet interface, a certain InfiniBand device port or a certain ISM device.
76+
Adding more than one pnetid fails. Hardware defined pnetids cannot be overwritten.
6277
.TP
6378
.BR "\-s, \-\-show"
6479
shows a certain pnetid definition in the pnet table.
@@ -73,11 +88,11 @@ removes all pnetid definitions from the pnet table.
7388
specifies the name of the Ethernet interface to be added for a certain pnetid
7489
definition.
7590
.TP
76-
.BR "\-D, \-\-ibdevice <infiniband-device>"
77-
specifies the name of the Infiniband device.
91+
.BR "\-D, \-\-ibdevice <infiniband-or-ISM-device>"
92+
specifies the ID of the InfiniBand device or ISM device.
7893
.TP
7994
.BR "\-P, \-\-ibport <infiniband-port>"
80-
specifies the port number of the Infiniband device port. Valid numbers are
95+
specifies the port number of the InfiniBand device port. Valid numbers are
8196
1 or 2.
8297
The default value is 1.
8398
.TP
@@ -88,31 +103,57 @@ displays smc_pnet program version.
88103
displays a brief smc_pnet usage information.
89104

90105
.SH EXAMPLES
91-
.B Create a pnetid ABC with ethernet interface name encf500, infiniband
92-
.B device name mlx4_0 and port number 2:
106+
.B Define pnetid ABC for the ethernet device names encf500 and bond0, and define
107+
.B pnetid ABC for the InfiniBand device ID 0001:00:00.0 (port 2) and the ISM
108+
.B device ID 0004:00:00.0:
93109
.RS 4
94110
.PP
95-
$ smc_pnet \-a ABC \-I encf500 \-D mlx4_0 \-P 2
111+
.nf
112+
$ smc_pnet \-a ABC \-I encf500
113+
$ smc_pnet \-a ABC \-I bond0
114+
$ smc_pnet \-a ABC \-D 0001:00:00:00.0 \-P 2
115+
$ smc_pnet \-a ABC \-D 0004:00:00:00.0
96116
.RE
97117
.PP
98118
.
99-
.B Delete a pnet table entry with pnetid named ABC:
119+
.B Show all pnet table entries:
100120
.RS 4
101121
.PP
102-
$ smc_pnet \-d ABC
122+
.nf
123+
$ smc_pnet
124+
ABC encf500 n/a 255
125+
ABC bond0 n/a 255
126+
ABC n/a 0001:00:00.0 2
127+
ABC n/a 0004:00:00.0 1
128+
.RE
129+
.PP
130+
.
131+
.B Define pnetid XYZ for the ethernet interface name vlan0201 and the InfiniBand
132+
.B device ID 0001:00:00.0 (port 1):
133+
.RS 4
134+
.PP
135+
$ smc_pnet \-a XYZ \-I vlan0201 \-D 0001:00:00.0 \-P 1
103136
.RE
104137
.PP
105138
.
106-
.B Show the mapping of ethernet interface name and infiniband device port for pnetid ABC:
139+
.B Show all entries for pnetid XYZ:
107140
.RS 4
108141
.PP
109142
.nf
110-
$ smc_pnet \-s ABC
111-
ABC encf500 mlx4_0 2
143+
$ smc_pnet \-s XYZ
144+
XYZ vlan0201 n/a 255
145+
XYZ n/a 0001:00:00.0 1
146+
.RE
147+
.PP
148+
.
149+
.B Delete all pnet table entries with pnetid named ABC:
150+
.RS 4
151+
.PP
152+
$ smc_pnet \-d ABC
112153
.RE
113154
.PP
114155
.
115-
.B Delete all entries in the pnet table
156+
.B Delete all entries in the pnet table:
116157
.RS 4
117158
.PP
118159
$ smc_pnet \-f
@@ -121,13 +162,9 @@ $ smc_pnet \-f
121162
.
122163
.
123164
.SH RETURN CODES
124-
Successful
125-
.IR smc_pnet
126-
commands return 0.
127-
If an error occurs,
128-
.IR smc_pnet
129-
writes a message to stderr and completes with a return code
130-
other than 0.
165+
Successful \fBsmc_pnet\fR commands return 0.
166+
If an error occurs, \fBsmc_pnet\fR writes a message to stderr and
167+
completes with a return code other than 0.
131168
.P
132169
.SH SEE ALSO
133170
.BR af_smc (7),

smc_pnet.c

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static char *progname;
4040
static struct pnetentry {
4141
char *pnetid; /* Pnetid */
4242
char *ethname; /* Ethernet device name */
43-
char *ibname; /* Infiniband device name */
43+
char *ibname; /* Infiniband/ISM device name */
4444
int ibport; /* Infiniband device port number */
4545
unsigned char cmd; /* Command to execute */
4646
} pnetcmd;
@@ -51,12 +51,12 @@ static void _usage(FILE *dest)
5151
"Usage: %s [ OPTIONS ] [pnetid]\n"
5252
"\t-h, --help this message\n"
5353
"\t-V, --version show version information\n"
54-
"\t-a, --add add a pnetid entry, requires interface and ibdevice\n"
54+
"\t-a, --add add a pnetid entry, requires interface or ib/ism device\n"
5555
"\t-d, --delete delete a pnetid entry\n"
5656
"\t-s, --show show a pnetid entry\n"
5757
"\t-f, --flush flush the complete pnet table\n"
5858
"\t-I, --interface Ethernet interface name of a pnetid entry\n"
59-
"\t-D, --ibdevice Infiniband device name of a pnetid entry\n"
59+
"\t-D, --ibdevice Infiniband/ISM device name of a pnetid entry\n"
6060
"\t-P, --ibport Infiniband device port (default: 1)\n"
6161
"\t\n"
6262
"\tno OPTIONS show complete pnet table\n",
@@ -106,7 +106,7 @@ static const struct option long_opts[] = {
106106
static struct nla_policy smc_pnet_policy[SMC_PNETID_MAX + 1] = {
107107
[SMC_PNETID_NAME] = {
108108
.type = NLA_STRING,
109-
.maxlen = 16
109+
.maxlen = 17
110110
},
111111
[SMC_PNETID_ETHNAME] = {
112112
.type = NLA_STRING,
@@ -164,7 +164,7 @@ static int genl_command(void)
164164
if (id < 0) {
165165
rc = EXIT_FAILURE;
166166
if (id == -NLE_OBJ_NOTFOUND)
167-
fprintf(stderr, "%s: SMC-R module not loaded\n",
167+
fprintf(stderr, "%s: SMC module not loaded\n",
168168
progname);
169169
else
170170
nl_perror(id, progname);
@@ -193,21 +193,26 @@ static int genl_command(void)
193193

194194
switch (pnetcmd.cmd) { /* Start message construction */
195195
case SMC_PNETID_ADD:
196-
rc = nla_put_string(msg, SMC_PNETID_ETHNAME, pnetcmd.ethname);
196+
if (pnetcmd.ethname)
197+
rc = nla_put_string(msg, SMC_PNETID_ETHNAME,
198+
pnetcmd.ethname);
197199
if (rc < 0) {
198200
nl_perror(rc, progname);
199201
rc = EXIT_FAILURE;
200202
goto out3;
201203
}
202204

203-
rc = nla_put_string(msg, SMC_PNETID_IBNAME, pnetcmd.ibname);
205+
if (pnetcmd.ibname)
206+
rc = nla_put_string(msg, SMC_PNETID_IBNAME,
207+
pnetcmd.ibname);
204208
if (rc < 0) {
205209
nl_perror(rc, progname);
206210
rc = EXIT_FAILURE;
207211
goto out3;
208212
}
209213

210-
rc = nla_put_u8(msg, SMC_PNETID_IBPORT, pnetcmd.ibport);
214+
if (pnetcmd.ibname)
215+
rc = nla_put_u8(msg, SMC_PNETID_IBPORT, pnetcmd.ibport);
211216
if (rc < 0) {
212217
nl_perror(rc, progname);
213218
rc = EXIT_FAILURE;
@@ -236,6 +241,13 @@ static int genl_command(void)
236241

237242
/* Receive reply message, returns number of cb invocations. */
238243
rc = nl_recvmsgs_default(sk);
244+
/* Kernel commit a9d8b0b1e3d689346b016316bd91980d60c6885d
245+
* introduced a misbehavior that a FLUSH of an empty table
246+
* returned -ENOENT. Fix it in smc-tools as long as kernel patch did'nt
247+
* land in the distros.
248+
*/
249+
if (pnetcmd.cmd == SMC_PNETID_FLUSH && rc != -NLE_OBJ_NOTFOUND)
250+
rc = 0;
239251
if (rc < 0) {
240252
nl_perror(rc, progname);
241253
rc = EXIT_FAILURE;
@@ -328,12 +340,9 @@ int main(int argc, char **argv)
328340
}
329341

330342
if (pnetcmd.cmd == SMC_PNETID_ADD) {
331-
if (!pnetcmd.ethname) {
332-
fprintf(stderr, "%s: interface missing\n", progname);
333-
usage();
334-
}
335-
if (!pnetcmd.ibname) {
336-
fprintf(stderr, "%s: ibdevice missing\n", progname);
343+
if (!pnetcmd.ethname && !pnetcmd.ibname) {
344+
fprintf(stderr, "%s: interface or device missing\n",
345+
progname);
337346
usage();
338347
}
339348
if (!pnetcmd.ibport)
@@ -347,7 +356,7 @@ int main(int argc, char **argv)
347356
pnetcmd.ethname = NULL;
348357
}
349358
if (pnetcmd.ibname) {
350-
fprintf(stderr, "%s: ibdevice %s ignored\n", progname,
359+
fprintf(stderr, "%s: device %s ignored\n", progname,
351360
pnetcmd.ibname);
352361
pnetcmd.ibname = NULL;
353362
}

smc_rnics

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ while [ $# -gt 0 ]; do
6666
"-r" | "--rawids" )
6767
rawIDs=1;;
6868
"-v" | "--version" )
69-
echo "smc_rnics utility, smc-tools-1.2.0 (8a2dae6)";
69+
echo "smc_rnics utility, smc-tools-1.2.1 (5ad3088)";
7070
exit 0;;
7171
"--" ) ;;
7272
* ) format_fid "$1";

0 commit comments

Comments
 (0)