^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* Shared Memory Communications Direct over ISM devices (SMC-D)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * SMC-D ISM device structure definitions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright IBM Corp. 2018
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef SMCD_ISM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define SMCD_ISM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/uio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "smc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct smcd_dev_list { /* List of SMCD devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct mutex mutex; /* Protects list of devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) extern struct smcd_dev_list smcd_dev_list; /* list of smcd devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) extern bool smc_ism_v2_capable; /* HW supports ISM V2 and thus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * System EID is defined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct smc_ism_vlanid { /* VLAN id set on ISM device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned short vlanid; /* Vlan id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) refcount_t refcnt; /* Reference count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct smc_ism_position { /* ISM device position to write to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) u64 token; /* Token of DMB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u32 offset; /* Offset into DMBE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u8 index; /* Index of DMBE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u8 signal; /* Generate interrupt on owner side */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct smcd_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int smc_ism_cantalk(u64 peer_gid, unsigned short vlan_id, struct smcd_dev *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void smc_ism_set_conn(struct smc_connection *conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void smc_ism_unset_conn(struct smc_connection *conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int smc_ism_get_vlan(struct smcd_dev *dev, unsigned short vlan_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int smc_ism_put_vlan(struct smcd_dev *dev, unsigned short vlan_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct smc_buf_desc *dmb_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int smc_ism_unregister_dmb(struct smcd_dev *dev, struct smc_buf_desc *dmb_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int smc_ism_write(struct smcd_dev *dev, const struct smc_ism_position *pos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) void *data, size_t len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int smc_ism_signal_shutdown(struct smc_link_group *lgr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void smc_ism_get_system_eid(struct smcd_dev *dev, u8 **eid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) u16 smc_ism_get_chid(struct smcd_dev *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) void smc_ism_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #endif