Commit 6812baab authored by Thomas Richter's avatar Thomas Richter Committed by David S. Miller

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: default avatarThomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a4cf0443
/*
* Shared Memory Communications over RDMA (SMC-R) and RoCE
*
* Definitions for generic netlink based configuration of an SMC-R PNET table
*
* Copyright IBM Corp. 2016
*
* Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com>
*/
#ifndef _UAPI_LINUX_SMC_H_
#define _UAPI_LINUX_SMC_H_
/* Netlink SMC_PNETID attributes */
enum {
SMC_PNETID_UNSPEC,
SMC_PNETID_NAME,
SMC_PNETID_ETHNAME,
SMC_PNETID_IBNAME,
SMC_PNETID_IBPORT,
__SMC_PNETID_MAX,
SMC_PNETID_MAX = __SMC_PNETID_MAX - 1
};
enum { /* SMC PNET Table commands */
SMC_PNETID_GET = 1,
SMC_PNETID_ADD,
SMC_PNETID_DEL,
SMC_PNETID_FLUSH
};
#define SMCR_GENL_FAMILY_NAME "SMC_PNETID"
#define SMCR_GENL_FAMILY_VERSION 1
#endif /* _UAPI_LINUX_SMC_H */
obj-$(CONFIG_SMC) += smc.o
smc-y := af_smc.o smc_ib.o
smc-y := af_smc.o smc_pnet.o smc_ib.o
......@@ -21,6 +21,7 @@
#include "smc.h"
#include "smc_ib.h"
#include "smc_pnet.h"
static void smc_set_keepalive(struct sock *sk, int val)
{
......@@ -586,10 +587,14 @@ static int __init smc_init(void)
{
int rc;
rc = smc_pnet_init();
if (rc)
return rc;
rc = proto_register(&smc_proto, 1);
if (rc) {
pr_err("%s: proto_register fails with %d\n", __func__, rc);
goto out;
goto out_pnet;
}
rc = sock_register(&smc_sock_family_ops);
......@@ -610,7 +615,8 @@ static int __init smc_init(void)
sock_unregister(PF_SMC);
out_proto:
proto_unregister(&smc_proto);
out:
out_pnet:
smc_pnet_exit();
return rc;
}
......@@ -619,6 +625,7 @@ static void __exit smc_exit(void)
smc_ib_unregister_client();
sock_unregister(PF_SMC);
proto_unregister(&smc_proto);
smc_pnet_exit();
}
module_init(smc_init);
......
......@@ -14,6 +14,7 @@
#include <linux/random.h>
#include <rdma/ib_verbs.h>
#include "smc_pnet.h"
#include "smc_ib.h"
#include "smc.h"
......@@ -123,6 +124,7 @@ static void smc_ib_remove_dev(struct ib_device *ibdev, void *client_data)
spin_lock(&smc_ib_devices.lock);
list_del_init(&smcibdev->list); /* remove from smc_ib_devices */
spin_unlock(&smc_ib_devices.lock);
smc_pnet_remove_by_ibdev(smcibdev);
kfree(smcibdev);
}
......
This diff is collapsed.
/*
* Shared Memory Communications over RDMA (SMC-R) and RoCE
*
* PNET table queries
*
* Copyright IBM Corp. 2016
*
* Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com>
*/
#ifndef _SMC_PNET_H
#define _SMC_PNET_H
struct smc_ib_device;
int smc_pnet_init(void) __init;
void smc_pnet_exit(void);
int smc_pnet_remove_by_ibdev(struct smc_ib_device *ibdev);
struct smc_ib_device *smc_pnet_find_ib(char *ib_name);
void smc_pnet_find_roce_resource(struct sock *sk,
struct smc_ib_device **smcibdev, u8 *ibport);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment