Skip to content

Commit 8a976a0

Browse files
author
Stefan Raspl
committed
Release: Prepare v1.1.0
Signed-off-by: Stefan Raspl <raspl@linux.ibm.com>
1 parent b97d281 commit 8a976a0

File tree

11 files changed

+395
-225
lines changed

11 files changed

+395
-225
lines changed

Makefile

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#
22
# SMC Tools - Shared Memory Communication Tools
33
#
4-
# Copyright IBM Corp. 2016, 2017
4+
# Copyright IBM Corp. 2016, 2018
55
#
66
# All rights reserved. This program and the accompanying materials
77
# are made available under the terms of the Eclipse Public License v1.0
88
# which accompanies this distribution, and is available at
99
# http://www.eclipse.org/legal/epl-v10.html
1010
#
1111

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

1515
ARCHTYPE = $(shell uname -m)
@@ -32,6 +32,7 @@ OWNER = $(shell id -un)
3232
GROUP = $(shell id -gn)
3333
INSTALL_FLAGS_BIN = -g $(GROUP) -o $(OWNER) -m755
3434
INSTALL_FLAGS_MAN = -g $(GROUP) -o $(OWNER) -m644
35+
INSTALL_FLAGS_LIB = -g $(GROUP) -o $(OWNER) -m4755
3536

3637
STUFF_32BIT = 0
3738
#
@@ -47,7 +48,7 @@ else
4748
LIBDIR = ${PREFIX}/lib
4849
endif
4950

50-
all: ld_pre_smc.so ld_pre_smc32.so smcss smc_pnet smc_run
51+
all: libsmc-preload.so libsmc-preload32.so smcss smc_pnet
5152

5253
CFLAGS ?= -Wall -O3 -g
5354
ALL_CFLAGS = -DSMC_TOOLS_RELEASE=$(SMC_TOOLS_RELEASE) $(CFLAGS)
@@ -58,21 +59,19 @@ else
5859
MACHINE_OPT32="-m32"
5960
endif
6061

61-
smc_run: smc_run.in
62-
my_installdir=${PREFIX} $(GEN) -e "s#@install_dir@#$$my_installdir#g" < $< > $@
63-
chmod a+x $@
62+
smc-preload.o: smc-preload.c
63+
${CCC} ${CFLAGS} -fPIC -c smc-preload.c
6464

65-
ld_pre_smc.o: ld_pre_smc.c
66-
${CCC} ${CFLAGS} -fPIC -c ld_pre_smc.c
65+
libsmc-preload.so: smc-preload.o
66+
${LINK} ${LDFLAGS} -shared smc-preload.o -ldl -Wl,-z,defs,-soname,$@.$(VER_MAJOR) -o $@
67+
chmod u+s $@
6768

68-
ld_pre_smc.so: ld_pre_smc.o
69-
${LINK} ${LDFLAGS} -shared ld_pre_smc.o -ldl -Wl,-z,defs,-soname,$@.$(VER_MAJOR) -o $@
70-
71-
ld_pre_smc32.so: ld_pre_smc.c
69+
libsmc-preload32.so: smc-preload.c
7270
ifeq ($(ARCH),64)
7371
ifeq ($(STUFF_32BIT),1)
74-
${CCC} ${CFLAGS} -fPIC -c ${MACHINE_OPT32} $< -o ld_pre_smc32.o
75-
${LINK} ${LDFLAGS} -shared ld_pre_smc32.o ${MACHINE_OPT32} -ldl -Wl,-soname,$@.$(VER_MAJOR) -o $@
72+
${CCC} ${CFLAGS} -fPIC -c ${MACHINE_OPT32} $< -o smc-preload32.o
73+
${LINK} ${LDFLAGS} -shared smc-preload32.o ${MACHINE_OPT32} -ldl -Wl,-soname,$@.$(VER_MAJOR) -o $@
74+
chmod u+s $@
7675
else
7776
$(warning "Warning: Skipping 31/32-bit library build because 31/32-bit build tools")
7877
$(warning " are unavailable. SMC will not support 31/32 bit applications")
@@ -107,19 +106,19 @@ smcss: smcss.c smc_diag.h smctools_common.h
107106
install: all
108107
echo " INSTALL"
109108
install -d -m755 $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man7 $(DESTDIR)$(MANDIR)/man8
110-
install $(INSTALL_FLAGS_BIN) ld_pre_smc.so $(DESTDIR)$(LIBDIR)
109+
install $(INSTALL_FLAGS_LIB) libsmc-preload.so $(DESTDIR)$(LIBDIR)
111110
ifeq ($(STUFF_32BIT),1)
112111
install -d -m755 $(DESTDIR)$(LIBDIR32)
113-
install $(INSTALL_FLAGS_BIN) ld_pre_smc32.so $(DESTDIR)$(LIBDIR32)/ld_pre_smc.so
112+
install $(INSTALL_FLAGS_LIB) libsmc-preload32.so $(DESTDIR)$(LIBDIR32)/libsmc-preload.so
114113
endif
115114
install $(INSTALL_FLAGS_BIN) smc_run $(DESTDIR)$(BINDIR)
116115
install $(INSTALL_FLAGS_BIN) smcss $(DESTDIR)$(BINDIR)
117116
install $(INSTALL_FLAGS_BIN) smc_pnet $(DESTDIR)$(BINDIR)
118-
install $(INSTALL_FLAGS_MAN) $(DESTDIR)$(MANDIR)/man7
117+
install $(INSTALL_FLAGS_MAN) af_smc.7 $(DESTDIR)$(MANDIR)/man7
119118
install $(INSTALL_FLAGS_MAN) smc_run.8 $(DESTDIR)$(MANDIR)/man8
120119
install $(INSTALL_FLAGS_MAN) smc_pnet.8 $(DESTDIR)$(MANDIR)/man8
121120
install $(INSTALL_FLAGS_MAN) smcss.8 $(DESTDIR)$(MANDIR)/man8
122121

123122
clean:
124123
echo " CLEAN"
125-
rm -f *.o *.so smc_run smcss smc_pnet
124+
rm -f *.o *.so smcss smc_pnet

README.smctools

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SMC Tools (1.0.1)
1+
SMC Tools (1.1.0)
22
===================
33

44
The SMC Tools provided in this package allow execution of existing TCP
@@ -7,16 +7,16 @@ In addition tools are provided to display SMC socket information.
77

88
This package consists of the tools:
99

10-
- ld_preload_smc.so : preload library.
10+
- libsmc-preload.so : preload library.
1111
- smc_run : preload library environment setup script.
1212
- smc_pnet : C program for PNET Table handling
1313
- smcss : C program for displaying the information about active
1414
SMC sockets.
1515

16-
The preload shared library ld_pre_smc.so provides mapping of TCP socket
16+
The preload shared library libsmc-preload.so provides mapping of TCP socket
1717
operations to SMC sockets.
1818
The environment setup script smc_run sets up the preload environment
19-
for the ld_pre_smc.so shared library before starting application.
19+
for the libsmc-preload.so shared library before starting application.
2020
The smcss program is used to gather and display information about the
2121
SMC sockets.
2222
The smc_pnet program is used to create, destroy, and change the SMC-R PNET
@@ -45,19 +45,26 @@ For enhancements, please describe the proposed change and its benefits.
4545
Release History:
4646
================
4747

48-
1.0.1 (2018-01-12)
48+
1.1.0 (2018-06-29)
4949
Changes:
50+
- smcss: Add IPv6 support
51+
- preload: Add IPv6 support
52+
- smcss: Output format changed
53+
- preload: Rename preload library into libsmc-preload.so
5054
- Makefile: Improve distro compatibility
5155
- Makefile: Add SONAME to shared libraries
5256
- Makefile: Do not strip binaries on install
5357
- Makefile: Use LDFLAGS to allow addition of externally set link flags
54-
- ld_pre..: Remove hardcoded reference to libc
58+
- libsmc..: Remove hardcoded reference to libc
5559
- Manpages: Formatting changes
5660

5761
Bug fixes:
5862
- Makefile: Fix target 'install' dependencies
5963
- smcss: Fix "--version" output
6064
- smc_pnet: Fix "--version" output
65+
- smc_run: Append preload library to LD_PRELOAD instead of potentially
66+
overwriting pre-set values
67+
- preload: Set suid flag to work with suid executables
6168

6269
1.0.0 (2017-02-13)
6370
The initial version
@@ -69,7 +76,7 @@ Parts:
6976
The SMC Tools package includes the following files:
7077

7178
Makefile smctools Makefile
72-
ld_pre_smc.c ld_pre_smc.so, SMC preload library source code
79+
smc-preload.c libsmc-preload.so, SMC preload library source code
7380
smc_run SMC preload library environment setup script
7481
smc_pnet.c PNET Table handling source code
7582
smcss.c SMC socket display source code

af_smc.7

Lines changed: 67 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
.\" af_smc.7
21
.\"
3-
.\"
4-
.\" Copyright IBM Corp. 2016, 2017
2+
.\" Copyright IBM Corp. 2016, 2018
53
.\" Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com>
64
.\" Thomas Richter <tmricht@linux.vnet.ibm.com>
75
.\" ----------------------------------------------------------------------
@@ -10,10 +8,16 @@
108
AF_SMC - Sockets for SMC communication
119
.SH SYNOPSIS
1210
.B #include <sys/socket.h>
13-
.br
11+
.sp
1412
.B "#define AF_SMC 43"
13+
.sp
14+
.B "#define SMCPROTO_SMC 0"
15+
.sp
16+
.B "#define SMCPROTO_SMC6 1"
1517
.PP
16-
.I "tcp_socket = socket(AF_SMC, SOCK_STREAM, 0);"
18+
.IB tcp_sockfd " = socket(" AF_SMC ", " SOCK_STREAM ", " SMCPROTO_SMC );
19+
.sp
20+
.IB tcp_sockfd " = socket(" AF_SMC ", " SOCK_STREAM ", " SMCPROTO_SMC6 );
1721
.SH DESCRIPTION
1822
.I Shared Memory Communication via RDMA
1923
(SMC) is a socket over the RDMA
@@ -27,23 +31,45 @@ host-to-host direct memory access without traditional TCP/IP
2731
processing overhead.
2832
SMC offers preservation of existing IP topology and IP security, and
2933
introduces minimal administrative and operational changes.
30-
The exploitation of SMC is transparent to TCP sockets applications.
34+
The exploitation of SMC is transparent to TCP socket applications.
3135
.PP
3236
The new address family
3337
.B AF_SMC
3438
supports the SMC protocol on Linux.
35-
It keeps the address format of AF_INET sockets and supports streaming
36-
socket types only.
39+
It keeps the address format of
40+
.B AF_INET
41+
and
42+
.B AF_INET6
43+
sockets and supports streaming socket types only.
3744
.SS Usage modes
3845
Two usage modes are possible:
3946
.IP "AF_SMC native usage"
40-
exploits the socket domain AF_SMC instead of
41-
AF_INET.
42-
.IP "usage of AF_INET socket applications with SMC preload library"
43-
converts AF_INET sockets to AF_SMC sockets.
47+
uses the socket domain
48+
.B AF_SMC
49+
instead of
50+
.B AF_INET
51+
and
52+
.BR AF_INET6 .
53+
Specify
54+
.B SMCPROTO_SMC
55+
for
56+
.B AF_INET
57+
compatible socket semantics, and
58+
.B SMC_PROTO_SMC6
59+
for
60+
.B AF_INET6
61+
respectively.
62+
.IP "Usage of AF_INET socket applications with SMC preload library"
63+
converts
64+
.B AF_INET
65+
and
66+
.B AF_INET6
67+
sockets to
68+
.B AF_SMC
69+
sockets.
4470
The SMC preload library is part of the SMC tools package.
4571
.PP
46-
SMC capability of sockets is negotiated during connection setup. If
72+
SMC socket capabilities are negotiated at connection setup. If
4773
one peer is not SMC capable, further socket processing falls
4874
back to TCP usage automatically.
4975
.SS Implementation details: Links and Link Groups
@@ -53,44 +79,47 @@ is established between
5379
a local RoCE card and a remote RoCE card. To enhance availability, you can
5480
configure alternate links with automatic fail over.
5581
Primary and backup links to a certain peer are combined in a so-called
56-
.I link group.
57-
To guarantee untroubled RDMA traffic, the number of connections
58-
per link group and the number of send requests in flight per link are limited.
59-
.SS Enabling SMC
60-
To enable SMC, smc-code must be active: If smc is not part of the
61-
kernel image, load the separate smc module (use "modprobe smc").
82+
.I link
83+
.IR group .
6284
.SS RoCE adapter mapping: Creation of a pnet table
6385
The SMC protocol requires grouping of multiple physical networks -
6486
standard Ethernet and RoCE networks. Such groups are called
6587
.I Physical Networks
66-
(PNets). For SMC, RoCE Adapter mapping is configured within a table called
88+
(PNets). For SMC, RoCE adapter mapping is configured within a table called
6789
.BR "pnet table" .
6890
Any available Ethernet interface can be combined with available
6991
.I RDMA-capable network interface cards
7092
(RNICs),
7193
if they belong to the same Converged Ethernet fabric.
7294
To configure RoCE Adapter mapping, you must create a pnet table.
7395
Modify the table with the smc-tools command
74-
.I smc_pnet.
96+
.IR smc_pnet .
7597
.PP
76-
For details call "man smc_pnet".
77-
.SS Important sysctl settings
78-
SMC-R supports IPv4 only. Use this sysctl setting:
79-
.IR net.ipv6.bindv6only=1
98+
For details see
99+
.BR smc_pnet (8).
80100
.SS Displaying SMC socket state information
81101
SMC socket state information can be obtained with the smc-tools command
82-
.I smcss.
83-
For details call "man smcss".
84-
.SS Starting a TCP application to work over SMC
85-
To start an existing TCP application to work through SMC, use the SMC
102+
.IR smcss .
103+
For details see
104+
.BR smcss (8).
105+
.SS Starting a TCP application to work with SMC
106+
To use an existing TCP application to work with SMC, use the SMC
86107
preload library.
87-
The SMC Tools package provides a script called "smc_run"
88-
to convert AF_INET socket calls to AF_SMC socket calls by means of the preload
89-
technique.
108+
The SMC Tools package provides the command
109+
.I smc_run
110+
to convert
111+
.B AF_INET
112+
and
113+
.B AF_INET6
114+
socket calls to
115+
.B AF_SMC
116+
socket calls by means of the preload technique.
117+
For more information about the preload mechanism, see also
118+
.BR ld.so (8).
90119
.PP
91120
Example:
92121
.IP
93-
smc_run ftp
122+
.B smc_run ftp
94123
.PP
95124
This command-line example starts an FTP client over SMC.
96125
.PP
@@ -102,7 +131,7 @@ the minimum MTU size of both peers.
102131

103132
.SH "AUTHOR"
104133
.nf
105-
Copyright IBM Corp. 2016, 2017
134+
Copyright IBM Corp. 2016, 2018
106135

107136
Published under the terms and conditions of the EPL
108137
(Eclipse Public License).
@@ -112,13 +141,13 @@ Published under the terms and conditions of the EPL
112141
.BR socket (2),
113142
.BR ip (7),
114143
.BR tcp (7),
115-
.BR socket (7)
116-
.BR smc_run (8)
117-
.BR smcss (8)
144+
.BR socket (7),
145+
.BR smc_run (8),
146+
.BR smcss (8),
118147
.BR smc_pnet (8)
119148
.SH "HISTORY"
120149
.TP
121-
.B AF_SMC, version 1.0.1
150+
.B AF_SMC, version 1.0.0
122151
.RS 4
123152
.IP "\bu" 2
124153
Initial version.

ld_pre_smc.c renamed to smc-preload.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* SMC Tools - Shared Memory Communication Tools
33
*
4-
* Copyright (c) IBM Corp. 2016, 2017
4+
* Copyright (c) IBM Corp. 2016, 2018
55
*
66
* All rights reserved. This program and the accompanying materials
77
* are made available under the terms of the Eclipse Public License v1.0
@@ -28,6 +28,11 @@
2828
#define AF_SMC 43
2929
#endif
3030

31+
#ifndef SMCPROTO_SMC
32+
#define SMCPROTO_SMC 0 /* SMC protocol, IPv4 */
33+
#define SMCPROTO_SMC6 1 /* SMC protocol, IPv6 */
34+
#endif
35+
3136
int (*orig_socket)(int domain, int type, int protocol);
3237
static void *dl_handle = NULL;
3338

@@ -72,14 +77,21 @@ int socket(int domain, int type, int protocol)
7277
if (!dl_handle)
7378
initialize();
7479

75-
if ((domain == AF_INET) && (type == SOCK_STREAM)) {
76-
dbg_msg(stderr, "ld_pre_smc: map sock AF_INET/SOCK_STREAM ");
77-
dbg_msg(stderr, "to AF_SMC\n");
80+
/* check if socket is eligible for AF_SMC */
81+
if ((domain == AF_INET || domain == AF_INET6) &&
82+
type == SOCK_STREAM &&
83+
(protocol == IPPROTO_IP || protocol == IPPROTO_TCP)) {
84+
dbg_msg(stderr, "libsmc-preload: map sock to AF_SMC\n");
85+
if (domain == AF_INET)
86+
protocol = SMCPROTO_SMC;
87+
else /* AF_INET6 */
88+
protocol = SMCPROTO_SMC6;
89+
7890
domain = AF_SMC;
79-
rc = (*orig_socket)(domain, type, protocol);
80-
} else {
81-
rc = (*orig_socket)(domain, type, protocol);
8291
}
92+
93+
rc = (*orig_socket)(domain, type, protocol);
94+
8395
return rc;
8496
}
8597

0 commit comments

Comments
 (0)