Skip to content

Commit 6812baa

Browse files
Thomas Richterdavem330
authored andcommitted
smc: establish pnet table management
Connection creation with SMC-R starts through an internal TCP-connection. The Ethernet interface for this TCP-connection is not restricted to the Ethernet interface of a RoCE device. Any existing Ethernet interface belonging to the same physical net can be used, as long as there is a defined relation between the Ethernet interface and some RoCE devices. This relation is defined with the help of an identification string called "Physical Net ID" or short "pnet ID". Information about defined pnet IDs and their related Ethernet interfaces and RoCE devices is stored in the SMC-R pnet table. A pnet table entry consists of the identifying pnet ID and the associated network and IB device. This patch adds pnet table configuration support using the generic netlink message interface referring to network and IB device by their names. Commands exist to add, delete, and display pnet table entries, and to flush or display the entire pnet table. There are cross-checks to verify whether the ethernet interfaces or infiniband devices really exist in the system. If either device is not available, the pnet ID entry is not created. Loss of network devices and IB devices is also monitored; a pnet ID entry is removed when an associated network or IB device is removed. Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a4cf044 commit 6812baa

File tree

6 files changed

+604
-3
lines changed

6 files changed

+604
-3
lines changed

include/uapi/linux/smc.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Shared Memory Communications over RDMA (SMC-R) and RoCE
3+
*
4+
* Definitions for generic netlink based configuration of an SMC-R PNET table
5+
*
6+
* Copyright IBM Corp. 2016
7+
*
8+
* Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com>
9+
*/
10+
11+
#ifndef _UAPI_LINUX_SMC_H_
12+
#define _UAPI_LINUX_SMC_H_
13+
14+
/* Netlink SMC_PNETID attributes */
15+
enum {
16+
SMC_PNETID_UNSPEC,
17+
SMC_PNETID_NAME,
18+
SMC_PNETID_ETHNAME,
19+
SMC_PNETID_IBNAME,
20+
SMC_PNETID_IBPORT,
21+
__SMC_PNETID_MAX,
22+
SMC_PNETID_MAX = __SMC_PNETID_MAX - 1
23+
};
24+
25+
enum { /* SMC PNET Table commands */
26+
SMC_PNETID_GET = 1,
27+
SMC_PNETID_ADD,
28+
SMC_PNETID_DEL,
29+
SMC_PNETID_FLUSH
30+
};
31+
32+
#define SMCR_GENL_FAMILY_NAME "SMC_PNETID"
33+
#define SMCR_GENL_FAMILY_VERSION 1
34+
35+
#endif /* _UAPI_LINUX_SMC_H */

net/smc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
obj-$(CONFIG_SMC) += smc.o
2-
smc-y := af_smc.o smc_ib.o
2+
smc-y := af_smc.o smc_pnet.o smc_ib.o

net/smc/af_smc.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "smc.h"
2323
#include "smc_ib.h"
24+
#include "smc_pnet.h"
2425

2526
static void smc_set_keepalive(struct sock *sk, int val)
2627
{
@@ -586,10 +587,14 @@ static int __init smc_init(void)
586587
{
587588
int rc;
588589

590+
rc = smc_pnet_init();
591+
if (rc)
592+
return rc;
593+
589594
rc = proto_register(&smc_proto, 1);
590595
if (rc) {
591596
pr_err("%s: proto_register fails with %d\n", __func__, rc);
592-
goto out;
597+
goto out_pnet;
593598
}
594599

595600
rc = sock_register(&smc_sock_family_ops);
@@ -610,7 +615,8 @@ static int __init smc_init(void)
610615
sock_unregister(PF_SMC);
611616
out_proto:
612617
proto_unregister(&smc_proto);
613-
out:
618+
out_pnet:
619+
smc_pnet_exit();
614620
return rc;
615621
}
616622

@@ -619,6 +625,7 @@ static void __exit smc_exit(void)
619625
smc_ib_unregister_client();
620626
sock_unregister(PF_SMC);
621627
proto_unregister(&smc_proto);
628+
smc_pnet_exit();
622629
}
623630

624631
module_init(smc_init);

net/smc/smc_ib.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/random.h>
1515
#include <rdma/ib_verbs.h>
1616

17+
#include "smc_pnet.h"
1718
#include "smc_ib.h"
1819
#include "smc.h"
1920

@@ -123,6 +124,7 @@ static void smc_ib_remove_dev(struct ib_device *ibdev, void *client_data)
123124
spin_lock(&smc_ib_devices.lock);
124125
list_del_init(&smcibdev->list); /* remove from smc_ib_devices */
125126
spin_unlock(&smc_ib_devices.lock);
127+
smc_pnet_remove_by_ibdev(smcibdev);
126128
kfree(smcibdev);
127129
}
128130

0 commit comments

Comments
 (0)