net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/* Shared Memory Communications Direct over ISM devices (SMC-D)
|
|
|
|
*
|
|
|
|
* Functions for ISM device.
|
|
|
|
*
|
|
|
|
* Copyright IBM Corp. 2018
|
|
|
|
*/
|
|
|
|
|
2021-12-29 08:49:13 +08:00
|
|
|
#include <linux/if_vlan.h>
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
#include <linux/spinlock.h>
|
2020-07-08 23:05:14 +08:00
|
|
|
#include <linux/mutex.h>
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
|
|
|
|
#include "smc.h"
|
|
|
|
#include "smc_core.h"
|
|
|
|
#include "smc_ism.h"
|
2018-06-29 01:05:08 +08:00
|
|
|
#include "smc_pnet.h"
|
2020-12-02 03:20:48 +08:00
|
|
|
#include "smc_netlink.h"
|
2023-01-24 02:17:49 +08:00
|
|
|
#include "linux/ism.h"
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
|
|
|
|
struct smcd_dev_list smcd_dev_list = {
|
|
|
|
.list = LIST_HEAD_INIT(smcd_dev_list.list),
|
2020-07-08 23:05:14 +08:00
|
|
|
.mutex = __MUTEX_INITIALIZER(smcd_dev_list.mutex)
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
};
|
|
|
|
|
2020-12-02 03:20:42 +08:00
|
|
|
static bool smc_ism_v2_capable;
|
2021-09-14 16:35:06 +08:00
|
|
|
static u8 smc_ism_v2_system_eid[SMC_MAX_EID_LEN];
|
2020-09-26 18:44:24 +08:00
|
|
|
|
2023-01-24 02:17:51 +08:00
|
|
|
#if IS_ENABLED(CONFIG_ISM)
|
2023-01-24 02:17:49 +08:00
|
|
|
static void smcd_register_dev(struct ism_dev *ism);
|
|
|
|
static void smcd_unregister_dev(struct ism_dev *ism);
|
|
|
|
static void smcd_handle_event(struct ism_dev *ism, struct ism_event *event);
|
|
|
|
static void smcd_handle_irq(struct ism_dev *ism, unsigned int dmbno,
|
|
|
|
u16 dmbemask);
|
|
|
|
|
|
|
|
static struct ism_client smc_ism_client = {
|
|
|
|
.name = "SMC-D",
|
|
|
|
.add = smcd_register_dev,
|
|
|
|
.remove = smcd_unregister_dev,
|
|
|
|
.handle_event = smcd_handle_event,
|
|
|
|
.handle_irq = smcd_handle_irq,
|
|
|
|
};
|
2023-01-24 02:17:51 +08:00
|
|
|
#endif
|
2023-01-24 02:17:49 +08:00
|
|
|
|
2020-09-26 18:44:24 +08:00
|
|
|
/* Test if an ISM communication is possible - same CPC */
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
int smc_ism_cantalk(u64 peer_gid, unsigned short vlan_id, struct smcd_dev *smcd)
|
|
|
|
{
|
|
|
|
return smcd->ops->query_remote_gid(smcd, peer_gid, vlan_id ? 1 : 0,
|
|
|
|
vlan_id);
|
|
|
|
}
|
|
|
|
|
2021-09-14 16:35:06 +08:00
|
|
|
void smc_ism_get_system_eid(u8 **eid)
|
2020-09-26 18:44:24 +08:00
|
|
|
{
|
2021-09-14 16:35:06 +08:00
|
|
|
if (!smc_ism_v2_capable)
|
|
|
|
*eid = NULL;
|
|
|
|
else
|
|
|
|
*eid = smc_ism_v2_system_eid;
|
2020-09-26 18:44:24 +08:00
|
|
|
}
|
|
|
|
|
2020-09-26 18:44:25 +08:00
|
|
|
u16 smc_ism_get_chid(struct smcd_dev *smcd)
|
|
|
|
{
|
|
|
|
return smcd->ops->get_chid(smcd);
|
|
|
|
}
|
|
|
|
|
2020-12-02 03:20:42 +08:00
|
|
|
/* HW supports ISM V2 and thus System EID is defined */
|
|
|
|
bool smc_ism_is_v2_capable(void)
|
|
|
|
{
|
|
|
|
return smc_ism_v2_capable;
|
|
|
|
}
|
|
|
|
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
/* Set a connection using this DMBE. */
|
|
|
|
void smc_ism_set_conn(struct smc_connection *conn)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&conn->lgr->smcd->lock, flags);
|
|
|
|
conn->lgr->smcd->conn[conn->rmb_desc->sba_idx] = conn;
|
|
|
|
spin_unlock_irqrestore(&conn->lgr->smcd->lock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Unset a connection using this DMBE. */
|
|
|
|
void smc_ism_unset_conn(struct smc_connection *conn)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
if (!conn->rmb_desc)
|
|
|
|
return;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&conn->lgr->smcd->lock, flags);
|
|
|
|
conn->lgr->smcd->conn[conn->rmb_desc->sba_idx] = NULL;
|
|
|
|
spin_unlock_irqrestore(&conn->lgr->smcd->lock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Register a VLAN identifier with the ISM device. Use a reference count
|
|
|
|
* and add a VLAN identifier only when the first DMB using this VLAN is
|
|
|
|
* registered.
|
|
|
|
*/
|
|
|
|
int smc_ism_get_vlan(struct smcd_dev *smcd, unsigned short vlanid)
|
|
|
|
{
|
|
|
|
struct smc_ism_vlanid *new_vlan, *vlan;
|
|
|
|
unsigned long flags;
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
if (!vlanid) /* No valid vlan id */
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* create new vlan entry, in case we need it */
|
|
|
|
new_vlan = kzalloc(sizeof(*new_vlan), GFP_KERNEL);
|
|
|
|
if (!new_vlan)
|
|
|
|
return -ENOMEM;
|
|
|
|
new_vlan->vlanid = vlanid;
|
|
|
|
refcount_set(&new_vlan->refcnt, 1);
|
|
|
|
|
|
|
|
/* if there is an existing entry, increase count and return */
|
|
|
|
spin_lock_irqsave(&smcd->lock, flags);
|
|
|
|
list_for_each_entry(vlan, &smcd->vlan, list) {
|
|
|
|
if (vlan->vlanid == vlanid) {
|
|
|
|
refcount_inc(&vlan->refcnt);
|
|
|
|
kfree(new_vlan);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no existing entry found.
|
|
|
|
* add new entry to device; might fail, e.g., if HW limit reached
|
|
|
|
*/
|
|
|
|
if (smcd->ops->add_vlan_id(smcd, vlanid)) {
|
|
|
|
kfree(new_vlan);
|
|
|
|
rc = -EIO;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
list_add_tail(&new_vlan->list, &smcd->vlan);
|
|
|
|
out:
|
|
|
|
spin_unlock_irqrestore(&smcd->lock, flags);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Unregister a VLAN identifier with the ISM device. Use a reference count
|
|
|
|
* and remove a VLAN identifier only when the last DMB using this VLAN is
|
|
|
|
* unregistered.
|
|
|
|
*/
|
|
|
|
int smc_ism_put_vlan(struct smcd_dev *smcd, unsigned short vlanid)
|
|
|
|
{
|
|
|
|
struct smc_ism_vlanid *vlan;
|
|
|
|
unsigned long flags;
|
|
|
|
bool found = false;
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
if (!vlanid) /* No valid vlan id */
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&smcd->lock, flags);
|
|
|
|
list_for_each_entry(vlan, &smcd->vlan, list) {
|
|
|
|
if (vlan->vlanid == vlanid) {
|
|
|
|
if (!refcount_dec_and_test(&vlan->refcnt))
|
|
|
|
goto out;
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
rc = -ENOENT;
|
|
|
|
goto out; /* VLAN id not in table */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Found and the last reference just gone */
|
|
|
|
if (smcd->ops->del_vlan_id(smcd, vlanid))
|
|
|
|
rc = -EIO;
|
|
|
|
list_del(&vlan->list);
|
|
|
|
kfree(vlan);
|
|
|
|
out:
|
|
|
|
spin_unlock_irqrestore(&smcd->lock, flags);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int smc_ism_unregister_dmb(struct smcd_dev *smcd, struct smc_buf_desc *dmb_desc)
|
|
|
|
{
|
|
|
|
struct smcd_dmb dmb;
|
2019-11-14 20:02:41 +08:00
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
if (!dmb_desc->dma_addr)
|
|
|
|
return rc;
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
|
|
|
|
memset(&dmb, 0, sizeof(dmb));
|
|
|
|
dmb.dmb_tok = dmb_desc->token;
|
|
|
|
dmb.sba_idx = dmb_desc->sba_idx;
|
|
|
|
dmb.cpu_addr = dmb_desc->cpu_addr;
|
|
|
|
dmb.dma_addr = dmb_desc->dma_addr;
|
|
|
|
dmb.dmb_len = dmb_desc->len;
|
2019-11-14 20:02:41 +08:00
|
|
|
rc = smcd->ops->unregister_dmb(smcd, &dmb);
|
|
|
|
if (!rc || rc == ISM_ERROR) {
|
|
|
|
dmb_desc->cpu_addr = NULL;
|
|
|
|
dmb_desc->dma_addr = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len,
|
|
|
|
struct smc_buf_desc *dmb_desc)
|
|
|
|
{
|
2023-01-24 02:17:51 +08:00
|
|
|
#if IS_ENABLED(CONFIG_ISM)
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
struct smcd_dmb dmb;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
memset(&dmb, 0, sizeof(dmb));
|
|
|
|
dmb.dmb_len = dmb_len;
|
|
|
|
dmb.sba_idx = dmb_desc->sba_idx;
|
|
|
|
dmb.vlan_id = lgr->vlan_id;
|
|
|
|
dmb.rgid = lgr->peer_gid;
|
2023-01-24 02:17:51 +08:00
|
|
|
rc = lgr->smcd->ops->register_dmb(lgr->smcd, &dmb, &smc_ism_client);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
if (!rc) {
|
|
|
|
dmb_desc->sba_idx = dmb.sba_idx;
|
|
|
|
dmb_desc->token = dmb.dmb_tok;
|
|
|
|
dmb_desc->cpu_addr = dmb.cpu_addr;
|
|
|
|
dmb_desc->dma_addr = dmb.dma_addr;
|
|
|
|
dmb_desc->len = dmb.dmb_len;
|
|
|
|
}
|
|
|
|
return rc;
|
2023-01-24 02:17:51 +08:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
}
|
|
|
|
|
2020-12-02 03:20:48 +08:00
|
|
|
static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
struct netlink_callback *cb)
|
|
|
|
{
|
|
|
|
char smc_pnet[SMC_MAX_PNETID_LEN + 1];
|
|
|
|
struct smc_pci_dev smc_pci_dev;
|
|
|
|
struct nlattr *port_attrs;
|
|
|
|
struct nlattr *attrs;
|
2023-01-24 02:17:52 +08:00
|
|
|
struct ism_dev *ism;
|
2020-12-02 03:20:48 +08:00
|
|
|
int use_cnt = 0;
|
|
|
|
void *nlh;
|
|
|
|
|
2023-01-24 02:17:52 +08:00
|
|
|
ism = smcd->priv;
|
2020-12-02 03:20:48 +08:00
|
|
|
nlh = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
|
|
|
|
&smc_gen_nl_family, NLM_F_MULTI,
|
|
|
|
SMC_NETLINK_GET_DEV_SMCD);
|
|
|
|
if (!nlh)
|
|
|
|
goto errmsg;
|
|
|
|
attrs = nla_nest_start(skb, SMC_GEN_DEV_SMCD);
|
|
|
|
if (!attrs)
|
|
|
|
goto errout;
|
|
|
|
use_cnt = atomic_read(&smcd->lgr_cnt);
|
|
|
|
if (nla_put_u32(skb, SMC_NLA_DEV_USE_CNT, use_cnt))
|
|
|
|
goto errattr;
|
|
|
|
if (nla_put_u8(skb, SMC_NLA_DEV_IS_CRIT, use_cnt > 0))
|
|
|
|
goto errattr;
|
|
|
|
memset(&smc_pci_dev, 0, sizeof(smc_pci_dev));
|
2023-01-24 02:17:52 +08:00
|
|
|
smc_set_pci_values(to_pci_dev(ism->dev.parent), &smc_pci_dev);
|
2020-12-02 03:20:48 +08:00
|
|
|
if (nla_put_u32(skb, SMC_NLA_DEV_PCI_FID, smc_pci_dev.pci_fid))
|
|
|
|
goto errattr;
|
|
|
|
if (nla_put_u16(skb, SMC_NLA_DEV_PCI_CHID, smc_pci_dev.pci_pchid))
|
|
|
|
goto errattr;
|
|
|
|
if (nla_put_u16(skb, SMC_NLA_DEV_PCI_VENDOR, smc_pci_dev.pci_vendor))
|
|
|
|
goto errattr;
|
|
|
|
if (nla_put_u16(skb, SMC_NLA_DEV_PCI_DEVICE, smc_pci_dev.pci_device))
|
|
|
|
goto errattr;
|
|
|
|
if (nla_put_string(skb, SMC_NLA_DEV_PCI_ID, smc_pci_dev.pci_id))
|
|
|
|
goto errattr;
|
|
|
|
|
|
|
|
port_attrs = nla_nest_start(skb, SMC_NLA_DEV_PORT);
|
|
|
|
if (!port_attrs)
|
|
|
|
goto errattr;
|
|
|
|
if (nla_put_u8(skb, SMC_NLA_DEV_PORT_PNET_USR, smcd->pnetid_by_user))
|
|
|
|
goto errportattr;
|
2021-01-13 00:21:22 +08:00
|
|
|
memcpy(smc_pnet, smcd->pnetid, SMC_MAX_PNETID_LEN);
|
|
|
|
smc_pnet[SMC_MAX_PNETID_LEN] = 0;
|
2020-12-02 03:20:48 +08:00
|
|
|
if (nla_put_string(skb, SMC_NLA_DEV_PORT_PNETID, smc_pnet))
|
|
|
|
goto errportattr;
|
|
|
|
|
|
|
|
nla_nest_end(skb, port_attrs);
|
|
|
|
nla_nest_end(skb, attrs);
|
|
|
|
genlmsg_end(skb, nlh);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
errportattr:
|
|
|
|
nla_nest_cancel(skb, port_attrs);
|
|
|
|
errattr:
|
|
|
|
nla_nest_cancel(skb, attrs);
|
|
|
|
errout:
|
|
|
|
nlmsg_cancel(skb, nlh);
|
|
|
|
errmsg:
|
|
|
|
return -EMSGSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void smc_nl_prep_smcd_dev(struct smcd_dev_list *dev_list,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
struct netlink_callback *cb)
|
|
|
|
{
|
|
|
|
struct smc_nl_dmp_ctx *cb_ctx = smc_nl_dmp_ctx(cb);
|
|
|
|
int snum = cb_ctx->pos[0];
|
|
|
|
struct smcd_dev *smcd;
|
|
|
|
int num = 0;
|
|
|
|
|
|
|
|
mutex_lock(&dev_list->mutex);
|
|
|
|
list_for_each_entry(smcd, &dev_list->list, list) {
|
|
|
|
if (num < snum)
|
|
|
|
goto next;
|
|
|
|
if (smc_nl_handle_smcd_dev(smcd, skb, cb))
|
|
|
|
goto errout;
|
|
|
|
next:
|
|
|
|
num++;
|
|
|
|
}
|
|
|
|
errout:
|
|
|
|
mutex_unlock(&dev_list->mutex);
|
|
|
|
cb_ctx->pos[0] = num;
|
|
|
|
}
|
|
|
|
|
|
|
|
int smcd_nl_get_device(struct sk_buff *skb, struct netlink_callback *cb)
|
|
|
|
{
|
|
|
|
smc_nl_prep_smcd_dev(&smcd_dev_list, skb, cb);
|
|
|
|
return skb->len;
|
|
|
|
}
|
|
|
|
|
2023-01-24 02:17:51 +08:00
|
|
|
#if IS_ENABLED(CONFIG_ISM)
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
struct smc_ism_event_work {
|
|
|
|
struct work_struct work;
|
|
|
|
struct smcd_dev *smcd;
|
2023-01-24 02:17:48 +08:00
|
|
|
struct ism_event event;
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
};
|
|
|
|
|
2018-08-10 23:45:11 +08:00
|
|
|
#define ISM_EVENT_REQUEST 0x0001
|
|
|
|
#define ISM_EVENT_RESPONSE 0x0002
|
|
|
|
#define ISM_EVENT_REQUEST_IR 0x00000001
|
2018-11-20 23:46:41 +08:00
|
|
|
#define ISM_EVENT_CODE_SHUTDOWN 0x80
|
2018-08-10 23:45:11 +08:00
|
|
|
#define ISM_EVENT_CODE_TESTLINK 0x83
|
|
|
|
|
2018-11-20 23:46:41 +08:00
|
|
|
union smcd_sw_event_info {
|
|
|
|
u64 info;
|
|
|
|
struct {
|
|
|
|
u8 uid[SMC_LGR_ID_SIZE];
|
|
|
|
unsigned short vlan_id;
|
|
|
|
u16 code;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-08-10 23:45:11 +08:00
|
|
|
static void smcd_handle_sw_event(struct smc_ism_event_work *wrk)
|
|
|
|
{
|
2018-11-20 23:46:41 +08:00
|
|
|
union smcd_sw_event_info ev_info;
|
2018-08-10 23:45:11 +08:00
|
|
|
|
2018-11-20 23:46:41 +08:00
|
|
|
ev_info.info = wrk->event.info;
|
2018-08-10 23:45:11 +08:00
|
|
|
switch (wrk->event.code) {
|
2018-11-20 23:46:41 +08:00
|
|
|
case ISM_EVENT_CODE_SHUTDOWN: /* Peer shut down DMBs */
|
|
|
|
smc_smcd_terminate(wrk->smcd, wrk->event.tok, ev_info.vlan_id);
|
|
|
|
break;
|
2018-08-10 23:45:11 +08:00
|
|
|
case ISM_EVENT_CODE_TESTLINK: /* Activity timer */
|
|
|
|
if (ev_info.code == ISM_EVENT_REQUEST) {
|
|
|
|
ev_info.code = ISM_EVENT_RESPONSE;
|
|
|
|
wrk->smcd->ops->signal_event(wrk->smcd,
|
|
|
|
wrk->event.tok,
|
|
|
|
ISM_EVENT_REQUEST_IR,
|
|
|
|
ISM_EVENT_CODE_TESTLINK,
|
|
|
|
ev_info.info);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
/* worker for SMC-D events */
|
|
|
|
static void smc_ism_event_work(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct smc_ism_event_work *wrk =
|
|
|
|
container_of(work, struct smc_ism_event_work, work);
|
|
|
|
|
|
|
|
switch (wrk->event.type) {
|
|
|
|
case ISM_EVENT_GID: /* GID event, token is peer GID */
|
2018-11-20 23:46:41 +08:00
|
|
|
smc_smcd_terminate(wrk->smcd, wrk->event.tok, VLAN_VID_MASK);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
break;
|
|
|
|
case ISM_EVENT_DMB:
|
|
|
|
break;
|
2018-08-10 23:45:11 +08:00
|
|
|
case ISM_EVENT_SWR: /* Software defined event */
|
|
|
|
smcd_handle_sw_event(wrk);
|
|
|
|
break;
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
}
|
|
|
|
kfree(wrk);
|
|
|
|
}
|
|
|
|
|
2023-01-24 02:17:52 +08:00
|
|
|
static struct smcd_dev *smcd_alloc_dev(struct device *parent, const char *name,
|
|
|
|
const struct smcd_ops *ops, int max_dmbs)
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
{
|
|
|
|
struct smcd_dev *smcd;
|
|
|
|
|
2023-01-24 02:17:52 +08:00
|
|
|
smcd = devm_kzalloc(parent, sizeof(*smcd), GFP_KERNEL);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
if (!smcd)
|
|
|
|
return NULL;
|
2023-01-24 02:17:52 +08:00
|
|
|
smcd->conn = devm_kcalloc(parent, max_dmbs,
|
|
|
|
sizeof(struct smc_connection *), GFP_KERNEL);
|
|
|
|
if (!smcd->conn)
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
return NULL;
|
|
|
|
|
2021-05-03 19:56:44 +08:00
|
|
|
smcd->event_wq = alloc_ordered_workqueue("ism_evt_wq-%s)",
|
|
|
|
WQ_MEM_RECLAIM, name);
|
2023-01-24 02:17:52 +08:00
|
|
|
if (!smcd->event_wq)
|
2021-05-03 19:56:44 +08:00
|
|
|
return NULL;
|
|
|
|
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
smcd->ops = ops;
|
|
|
|
|
|
|
|
spin_lock_init(&smcd->lock);
|
2019-10-09 16:07:44 +08:00
|
|
|
spin_lock_init(&smcd->lgr_lock);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
INIT_LIST_HEAD(&smcd->vlan);
|
2019-10-09 16:07:43 +08:00
|
|
|
INIT_LIST_HEAD(&smcd->lgr_list);
|
2019-11-14 20:02:43 +08:00
|
|
|
init_waitqueue_head(&smcd->lgrs_deleted);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
return smcd;
|
|
|
|
}
|
2023-01-24 02:17:49 +08:00
|
|
|
|
|
|
|
static void smcd_register_dev(struct ism_dev *ism)
|
|
|
|
{
|
2023-01-24 02:17:51 +08:00
|
|
|
const struct smcd_ops *ops = ism_get_smcd_ops();
|
2023-01-24 02:17:49 +08:00
|
|
|
struct smcd_dev *smcd;
|
|
|
|
|
2023-01-24 02:17:51 +08:00
|
|
|
if (!ops)
|
|
|
|
return;
|
|
|
|
|
2023-01-24 02:17:49 +08:00
|
|
|
smcd = smcd_alloc_dev(&ism->pdev->dev, dev_name(&ism->pdev->dev), ops,
|
|
|
|
ISM_NR_DMBS);
|
|
|
|
if (!smcd)
|
|
|
|
return;
|
|
|
|
smcd->priv = ism;
|
|
|
|
ism_set_priv(ism, &smc_ism_client, smcd);
|
|
|
|
if (smc_pnetid_by_dev_port(&ism->pdev->dev, 0, smcd->pnetid))
|
|
|
|
smc_pnetid_by_table_smcd(smcd);
|
2021-05-17 16:47:06 +08:00
|
|
|
|
2020-07-08 23:05:14 +08:00
|
|
|
mutex_lock(&smcd_dev_list.mutex);
|
2020-09-26 18:44:24 +08:00
|
|
|
if (list_empty(&smcd_dev_list.list)) {
|
|
|
|
u8 *system_eid = NULL;
|
|
|
|
|
2022-07-25 22:09:58 +08:00
|
|
|
system_eid = smcd->ops->get_system_eid();
|
2021-09-14 16:35:06 +08:00
|
|
|
if (system_eid[24] != '0' || system_eid[28] != '0') {
|
2020-09-26 18:44:24 +08:00
|
|
|
smc_ism_v2_capable = true;
|
2021-09-14 16:35:06 +08:00
|
|
|
memcpy(smc_ism_v2_system_eid, system_eid,
|
|
|
|
SMC_MAX_EID_LEN);
|
|
|
|
}
|
2020-09-26 18:44:24 +08:00
|
|
|
}
|
2020-09-26 18:44:27 +08:00
|
|
|
/* sort list: devices without pnetid before devices with pnetid */
|
|
|
|
if (smcd->pnetid[0])
|
|
|
|
list_add_tail(&smcd->list, &smcd_dev_list.list);
|
|
|
|
else
|
|
|
|
list_add(&smcd->list, &smcd_dev_list.list);
|
2020-07-08 23:05:14 +08:00
|
|
|
mutex_unlock(&smcd_dev_list.mutex);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
|
2020-05-05 21:01:20 +08:00
|
|
|
pr_warn_ratelimited("smc: adding smcd device %s with pnetid %.16s%s\n",
|
2023-01-24 02:17:52 +08:00
|
|
|
dev_name(&ism->dev), smcd->pnetid,
|
2020-05-05 21:01:20 +08:00
|
|
|
smcd->pnetid_by_user ? " (user defined)" : "");
|
|
|
|
|
2023-01-24 02:17:49 +08:00
|
|
|
return;
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
}
|
|
|
|
|
2023-01-24 02:17:49 +08:00
|
|
|
static void smcd_unregister_dev(struct ism_dev *ism)
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
{
|
2023-01-24 02:17:49 +08:00
|
|
|
struct smcd_dev *smcd = ism_get_priv(ism, &smc_ism_client);
|
|
|
|
|
2020-05-05 21:01:20 +08:00
|
|
|
pr_warn_ratelimited("smc: removing smcd device %s\n",
|
2023-01-24 02:17:52 +08:00
|
|
|
dev_name(&ism->dev));
|
2023-01-24 02:17:45 +08:00
|
|
|
smcd->going_away = 1;
|
|
|
|
smc_smcd_terminate_all(smcd);
|
2020-07-08 23:05:14 +08:00
|
|
|
mutex_lock(&smcd_dev_list.mutex);
|
2019-11-14 20:02:40 +08:00
|
|
|
list_del_init(&smcd->list);
|
2020-07-08 23:05:14 +08:00
|
|
|
mutex_unlock(&smcd_dev_list.mutex);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
destroy_workqueue(smcd->event_wq);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SMCD Device event handler. Called from ISM device interrupt handler.
|
2023-01-24 02:17:49 +08:00
|
|
|
* Parameters are ism device pointer,
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
* - event->type (0 --> DMB, 1 --> GID),
|
|
|
|
* - event->code (event code),
|
|
|
|
* - event->tok (either DMB token when event type 0, or GID when event type 1)
|
|
|
|
* - event->time (time of day)
|
|
|
|
* - event->info (debug info).
|
|
|
|
*
|
|
|
|
* Context:
|
|
|
|
* - Function called in IRQ context from ISM device driver event handler.
|
|
|
|
*/
|
2023-01-24 02:17:49 +08:00
|
|
|
static void smcd_handle_event(struct ism_dev *ism, struct ism_event *event)
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
{
|
2023-01-24 02:17:49 +08:00
|
|
|
struct smcd_dev *smcd = ism_get_priv(ism, &smc_ism_client);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
struct smc_ism_event_work *wrk;
|
|
|
|
|
2019-10-09 16:07:46 +08:00
|
|
|
if (smcd->going_away)
|
|
|
|
return;
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
/* copy event to event work queue, and let it be handled there */
|
|
|
|
wrk = kmalloc(sizeof(*wrk), GFP_ATOMIC);
|
|
|
|
if (!wrk)
|
|
|
|
return;
|
|
|
|
INIT_WORK(&wrk->work, smc_ism_event_work);
|
|
|
|
wrk->smcd = smcd;
|
|
|
|
wrk->event = *event;
|
|
|
|
queue_work(smcd->event_wq, &wrk->work);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SMCD Device interrupt handler. Called from ISM device interrupt handler.
|
2023-01-24 02:17:49 +08:00
|
|
|
* Parameters are the ism device pointer, DMB number, and the DMBE bitmask.
|
2022-07-25 22:09:59 +08:00
|
|
|
* Find the connection and schedule the tasklet for this connection.
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
*
|
|
|
|
* Context:
|
|
|
|
* - Function called in IRQ context from ISM device driver IRQ handler.
|
|
|
|
*/
|
2023-01-24 02:17:49 +08:00
|
|
|
static void smcd_handle_irq(struct ism_dev *ism, unsigned int dmbno,
|
|
|
|
u16 dmbemask)
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
{
|
2023-01-24 02:17:49 +08:00
|
|
|
struct smcd_dev *smcd = ism_get_priv(ism, &smc_ism_client);
|
2018-06-29 01:05:10 +08:00
|
|
|
struct smc_connection *conn = NULL;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&smcd->lock, flags);
|
|
|
|
conn = smcd->conn[dmbno];
|
2019-11-14 20:02:41 +08:00
|
|
|
if (conn && !conn->killed)
|
2018-06-29 01:05:10 +08:00
|
|
|
tasklet_schedule(&conn->rx_tsklet);
|
|
|
|
spin_unlock_irqrestore(&smcd->lock, flags);
|
net/smc: add base infrastructure for SMC-D and ISM
SMC supports two variants: SMC-R and SMC-D. For data transport, SMC-R
uses RDMA devices, SMC-D uses so-called Internal Shared Memory (ISM)
devices. An ISM device only allows shared memory communication between
SMC instances on the same machine. For example, this allows virtual
machines on the same host to communicate via SMC without RDMA devices.
This patch adds the base infrastructure for SMC-D and ISM devices to
the existing SMC code. It contains the following:
* ISM driver interface:
This interface allows an ISM driver to register ISM devices in SMC. In
the process, the driver provides a set of device ops for each device.
SMC uses these ops to execute SMC specific operations on or transfer
data over the device.
* Core SMC-D link group, connection, and buffer support:
Link groups, SMC connections and SMC buffers (in smc_core) are
extended to support SMC-D.
* SMC type checks:
Some type checks are added to prevent using SMC-R specific code for
SMC-D and vice versa.
To actually use SMC-D, additional changes to pnetid, CLC, CDC, etc. are
required. These are added in follow-up patches.
Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-29 01:05:07 +08:00
|
|
|
}
|
2023-01-24 02:17:51 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
int smc_ism_signal_shutdown(struct smc_link_group *lgr)
|
|
|
|
{
|
|
|
|
int rc = 0;
|
|
|
|
#if IS_ENABLED(CONFIG_ISM)
|
|
|
|
union smcd_sw_event_info ev_info;
|
|
|
|
|
|
|
|
if (lgr->peer_shutdown)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
memcpy(ev_info.uid, lgr->id, SMC_LGR_ID_SIZE);
|
|
|
|
ev_info.vlan_id = lgr->vlan_id;
|
|
|
|
ev_info.code = ISM_EVENT_REQUEST;
|
|
|
|
rc = lgr->smcd->ops->signal_event(lgr->smcd, lgr->peer_gid,
|
|
|
|
ISM_EVENT_REQUEST_IR,
|
|
|
|
ISM_EVENT_CODE_SHUTDOWN,
|
|
|
|
ev_info.info);
|
|
|
|
#endif
|
|
|
|
return rc;
|
|
|
|
}
|
2020-09-26 18:44:24 +08:00
|
|
|
|
2023-01-24 02:17:49 +08:00
|
|
|
int smc_ism_init(void)
|
2020-09-26 18:44:24 +08:00
|
|
|
{
|
2023-01-24 02:17:51 +08:00
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
#if IS_ENABLED(CONFIG_ISM)
|
2020-09-26 18:44:24 +08:00
|
|
|
smc_ism_v2_capable = false;
|
2021-09-14 16:35:06 +08:00
|
|
|
memset(smc_ism_v2_system_eid, 0, SMC_MAX_EID_LEN);
|
2023-01-24 02:17:51 +08:00
|
|
|
|
|
|
|
rc = ism_register_client(&smc_ism_client);
|
2023-01-24 02:17:49 +08:00
|
|
|
#endif
|
2023-01-24 02:17:51 +08:00
|
|
|
return rc;
|
2023-01-24 02:17:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void smc_ism_exit(void)
|
|
|
|
{
|
|
|
|
#if IS_ENABLED(CONFIG_ISM)
|
|
|
|
ism_unregister_client(&smc_ism_client);
|
|
|
|
#endif
|
2020-09-26 18:44:24 +08:00
|
|
|
}
|