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-28 17:05:07 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/* Shared Memory Communications Direct over ISM devices (SMC-D)
|
|
|
|
*
|
|
|
|
* SMC-D ISM device structure definitions.
|
|
|
|
*
|
|
|
|
* Copyright IBM Corp. 2018
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SMCD_ISM_H
|
|
|
|
#define SMCD_ISM_H
|
|
|
|
|
|
|
|
#include <linux/uio.h>
|
2020-12-01 19:20:42 +00:00
|
|
|
#include <linux/types.h>
|
2020-07-08 15:05:14 +00: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-28 17:05:07 +00:00
|
|
|
|
|
|
|
#include "smc.h"
|
|
|
|
|
2024-02-05 03:33:17 +00:00
|
|
|
#define SMC_EMULATED_ISM_CHID_MASK 0xFF00
|
2023-12-19 14:26:16 +00:00
|
|
|
#define SMC_ISM_IDENT_MASK 0x00FFFF
|
2023-12-19 14:26:12 +00:00
|
|
|
|
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-28 17:05:07 +00:00
|
|
|
struct smcd_dev_list { /* List of SMCD devices */
|
|
|
|
struct list_head list;
|
2020-07-08 15:05:14 +00:00
|
|
|
struct mutex mutex; /* Protects list of devices */
|
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-28 17:05:07 +00:00
|
|
|
};
|
|
|
|
|
2020-09-26 10:44:24 +00:00
|
|
|
extern struct smcd_dev_list smcd_dev_list; /* list of smcd devices */
|
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-28 17:05:07 +00:00
|
|
|
|
|
|
|
struct smc_ism_vlanid { /* VLAN id set on ISM device */
|
|
|
|
struct list_head list;
|
|
|
|
unsigned short vlanid; /* Vlan id */
|
|
|
|
refcount_t refcnt; /* Reference count */
|
|
|
|
};
|
|
|
|
|
2023-12-19 14:26:16 +00:00
|
|
|
struct smc_ism_seid {
|
|
|
|
u8 seid_string[24];
|
|
|
|
u8 serial_number[4];
|
|
|
|
u8 type[4];
|
|
|
|
};
|
|
|
|
|
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-28 17:05:07 +00:00
|
|
|
struct smcd_dev;
|
|
|
|
|
2023-12-19 14:26:13 +00:00
|
|
|
int smc_ism_cantalk(struct smcd_gid *peer_gid, unsigned short vlan_id,
|
|
|
|
struct smcd_dev *dev);
|
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-28 17:05:07 +00:00
|
|
|
void smc_ism_set_conn(struct smc_connection *conn);
|
|
|
|
void smc_ism_unset_conn(struct smc_connection *conn);
|
|
|
|
int smc_ism_get_vlan(struct smcd_dev *dev, unsigned short vlan_id);
|
|
|
|
int smc_ism_put_vlan(struct smcd_dev *dev, unsigned short vlan_id);
|
|
|
|
int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size,
|
|
|
|
struct smc_buf_desc *dmb_desc);
|
|
|
|
int smc_ism_unregister_dmb(struct smcd_dev *dev, struct smc_buf_desc *dmb_desc);
|
2018-11-20 15:46:41 +00:00
|
|
|
int smc_ism_signal_shutdown(struct smc_link_group *lgr);
|
2021-09-14 08:35:06 +00:00
|
|
|
void smc_ism_get_system_eid(u8 **eid);
|
2020-09-26 10:44:25 +00:00
|
|
|
u16 smc_ism_get_chid(struct smcd_dev *dev);
|
2020-12-01 19:20:42 +00:00
|
|
|
bool smc_ism_is_v2_capable(void);
|
2023-01-23 18:17:49 +00:00
|
|
|
int smc_ism_init(void);
|
|
|
|
void smc_ism_exit(void);
|
2020-12-01 19:20:48 +00:00
|
|
|
int smcd_nl_get_device(struct sk_buff *skb, struct netlink_callback *cb);
|
2022-07-25 14:09:57 +00:00
|
|
|
|
|
|
|
static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok,
|
|
|
|
unsigned int idx, bool sf, unsigned int offset,
|
|
|
|
void *data, size_t len)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = smcd->ops->move_data(smcd, dmb_tok, idx, sf, offset, data, len);
|
|
|
|
return rc < 0 ? rc : 0;
|
|
|
|
}
|
|
|
|
|
2024-02-05 03:33:17 +00:00
|
|
|
static inline bool __smc_ism_is_emulated(u16 chid)
|
2023-12-19 14:26:12 +00:00
|
|
|
{
|
|
|
|
/* CHIDs in range of 0xFF00 to 0xFFFF are reserved
|
2024-02-05 03:33:17 +00:00
|
|
|
* for Emulated-ISM device.
|
2023-12-19 14:26:12 +00:00
|
|
|
*
|
|
|
|
* loopback-ism: 0xFFFF
|
|
|
|
* virtio-ism: 0xFF00 ~ 0xFFFE
|
|
|
|
*/
|
|
|
|
return ((chid & 0xFF00) == 0xFF00);
|
|
|
|
}
|
|
|
|
|
2024-02-05 03:33:17 +00:00
|
|
|
static inline bool smc_ism_is_emulated(struct smcd_dev *smcd)
|
2023-12-19 14:26:12 +00:00
|
|
|
{
|
|
|
|
u16 chid = smcd->ops->get_chid(smcd);
|
|
|
|
|
2024-02-05 03:33:17 +00:00
|
|
|
return __smc_ism_is_emulated(chid);
|
2023-12-19 14:26:12 +00:00
|
|
|
}
|
|
|
|
|
2024-04-28 06:07:33 +00:00
|
|
|
static inline bool smc_ism_is_loopback(struct smcd_dev *smcd)
|
|
|
|
{
|
|
|
|
return (smcd->ops->get_chid(smcd) == 0xFFFF);
|
|
|
|
}
|
|
|
|
|
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-28 17:05:07 +00:00
|
|
|
#endif
|