Skip to content

Commit a29a194

Browse files
kaberdavem330
authored andcommitted
tipc: add InfiniBand media type
Add InfiniBand media type based on the ethernet media type. The only real difference is that in case of InfiniBand, we need the entire 20 bytes of space reserved for media addresses, so the TIPC media type ID is not explicitly stored in the packet payload. Sample output of tipc-config: # tipc-config -v -addr -netid -nt=all -p -m -b -n -ls node address: <10.1.4> current network id: 4711 Type Lower Upper Port Identity Publication Scope 0 167776257 167776257 <10.1.1:1855512577> 1855512578 cluster 167776260 167776260 <10.1.4:1216454657> 1216454658 zone 1 1 1 <10.1.4:1216479235> 1216479236 node Ports: 1216479235: bound to {1,1} 1216454657: bound to {0,167776260} Media: eth ib Bearers: ib:ib0 Nodes known: <10.1.1>: up Link <broadcast-link> Window:20 packets RX packets:0 fragments:0/0 bundles:0/0 TX packets:0 fragments:0/0 bundles:0/0 RX naks:0 defs:0 dups:0 TX naks:0 acks:0 dups:0 Congestion bearer:0 link:0 Send queue max:0 avg:0 Link <10.1.4:ib0-10.1.1:ib0> ACTIVE MTU:2044 Priority:10 Tolerance:1500 ms Window:50 packets RX packets:80 fragments:0/0 bundles:0/0 TX packets:40 fragments:0/0 bundles:0/0 TX profile sample:22 packets average:54 octets 0-64:100% -256:0% -1024:0% -4096:0% -16384:0% -32768:0% -66000:0% RX states:410 probes:213 naks:0 defs:0 dups:0 TX states:410 probes:197 naks:0 acks:0 dups:0 Congestion bearer:0 link:0 Send queue max:1 avg:0 Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 76f5c6f commit a29a194

File tree

6 files changed

+416
-3
lines changed

6 files changed

+416
-3
lines changed

net/tipc/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ config TIPC_PORTS
3131

3232
Setting this to a smaller value saves some memory,
3333
setting it to higher allows for more ports.
34+
35+
config TIPC_MEDIA_IB
36+
bool "InfiniBand media type support"
37+
depends on TIPC && INFINIBAND_IPOIB
38+
help
39+
Saying Y here will enable support for running TIPC on
40+
IP-over-InfiniBand devices.

net/tipc/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ tipc-y += addr.o bcast.o bearer.o config.o \
99
name_distr.o subscr.o name_table.o net.o \
1010
netlink.o node.o node_subscr.o port.o ref.o \
1111
socket.o log.o eth_media.o
12+
13+
tipc-$(CONFIG_TIPC_MEDIA_IB) += ib_media.o

net/tipc/bearer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "bearer.h"
4040
#include "discover.h"
4141

42-
#define MAX_ADDR_STR 32
42+
#define MAX_ADDR_STR 60
4343

4444
static struct tipc_media *media_list[MAX_MEDIA];
4545
static u32 media_count;

net/tipc/bearer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* Identifiers of supported TIPC media types
5757
*/
5858
#define TIPC_MEDIA_TYPE_ETH 1
59+
#define TIPC_MEDIA_TYPE_IB 2
5960

6061
/**
6162
* struct tipc_media_addr - destination address used by TIPC bearers
@@ -174,6 +175,14 @@ int tipc_disable_bearer(const char *name);
174175
int tipc_eth_media_start(void);
175176
void tipc_eth_media_stop(void);
176177

178+
#ifdef CONFIG_TIPC_MEDIA_IB
179+
int tipc_ib_media_start(void);
180+
void tipc_ib_media_stop(void);
181+
#else
182+
static inline int tipc_ib_media_start(void) { return 0; }
183+
static inline void tipc_ib_media_stop(void) { return; }
184+
#endif
185+
177186
int tipc_media_set_priority(const char *name, u32 new_value);
178187
int tipc_media_set_window(const char *name, u32 new_value);
179188
void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a);

net/tipc/core.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static void tipc_core_stop_net(void)
8282
{
8383
tipc_net_stop();
8484
tipc_eth_media_stop();
85+
tipc_ib_media_stop();
8586
}
8687

8788
/**
@@ -93,8 +94,15 @@ int tipc_core_start_net(unsigned long addr)
9394

9495
tipc_net_start(addr);
9596
res = tipc_eth_media_start();
96-
if (res)
97-
tipc_core_stop_net();
97+
if (res < 0)
98+
goto err;
99+
res = tipc_ib_media_start();
100+
if (res < 0)
101+
goto err;
102+
return res;
103+
104+
err:
105+
tipc_core_stop_net();
98106
return res;
99107
}
100108

0 commit comments

Comments
 (0)