Hans Wippel | c6ba7c9 | 2018-06-28 19:05:07 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Shared Memory Communications Direct over ISM devices (SMC-D) |
| 3 | * |
| 4 | * SMC-D ISM device structure definitions. |
| 5 | * |
| 6 | * Copyright IBM Corp. 2018 |
| 7 | */ |
| 8 | |
| 9 | #ifndef SMCD_ISM_H |
| 10 | #define SMCD_ISM_H |
| 11 | |
| 12 | #include <linux/uio.h> |
Guvenc Gulce | 49407ae | 2020-12-01 20:20:42 +0100 | [diff] [blame] | 13 | #include <linux/types.h> |
Ursula Braun | 82087c0 | 2020-07-08 17:05:14 +0200 | [diff] [blame] | 14 | #include <linux/mutex.h> |
Hans Wippel | c6ba7c9 | 2018-06-28 19:05:07 +0200 | [diff] [blame] | 15 | |
| 16 | #include "smc.h" |
| 17 | |
| 18 | struct smcd_dev_list { /* List of SMCD devices */ |
| 19 | struct list_head list; |
Ursula Braun | 82087c0 | 2020-07-08 17:05:14 +0200 | [diff] [blame] | 20 | struct mutex mutex; /* Protects list of devices */ |
Hans Wippel | c6ba7c9 | 2018-06-28 19:05:07 +0200 | [diff] [blame] | 21 | }; |
| 22 | |
Ursula Braun | 201091e | 2020-09-26 12:44:24 +0200 | [diff] [blame] | 23 | extern struct smcd_dev_list smcd_dev_list; /* list of smcd devices */ |
Hans Wippel | c6ba7c9 | 2018-06-28 19:05:07 +0200 | [diff] [blame] | 24 | |
| 25 | struct smc_ism_vlanid { /* VLAN id set on ISM device */ |
| 26 | struct list_head list; |
| 27 | unsigned short vlanid; /* Vlan id */ |
| 28 | refcount_t refcnt; /* Reference count */ |
| 29 | }; |
| 30 | |
| 31 | struct smc_ism_position { /* ISM device position to write to */ |
| 32 | u64 token; /* Token of DMB */ |
| 33 | u32 offset; /* Offset into DMBE */ |
| 34 | u8 index; /* Index of DMBE */ |
| 35 | u8 signal; /* Generate interrupt on owner side */ |
| 36 | }; |
| 37 | |
| 38 | struct smcd_dev; |
| 39 | |
| 40 | int smc_ism_cantalk(u64 peer_gid, unsigned short vlan_id, struct smcd_dev *dev); |
| 41 | void smc_ism_set_conn(struct smc_connection *conn); |
| 42 | void smc_ism_unset_conn(struct smc_connection *conn); |
| 43 | int smc_ism_get_vlan(struct smcd_dev *dev, unsigned short vlan_id); |
| 44 | int smc_ism_put_vlan(struct smcd_dev *dev, unsigned short vlan_id); |
| 45 | int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size, |
| 46 | struct smc_buf_desc *dmb_desc); |
| 47 | int smc_ism_unregister_dmb(struct smcd_dev *dev, struct smc_buf_desc *dmb_desc); |
| 48 | int smc_ism_write(struct smcd_dev *dev, const struct smc_ism_position *pos, |
| 49 | void *data, size_t len); |
Hans Wippel | 0512f69 | 2018-11-20 16:46:41 +0100 | [diff] [blame] | 50 | int smc_ism_signal_shutdown(struct smc_link_group *lgr); |
Ursula Braun | 201091e | 2020-09-26 12:44:24 +0200 | [diff] [blame] | 51 | void smc_ism_get_system_eid(struct smcd_dev *dev, u8 **eid); |
Ursula Braun | 8caaccf | 2020-09-26 12:44:25 +0200 | [diff] [blame] | 52 | u16 smc_ism_get_chid(struct smcd_dev *dev); |
Guvenc Gulce | 49407ae | 2020-12-01 20:20:42 +0100 | [diff] [blame] | 53 | bool smc_ism_is_v2_capable(void); |
Ursula Braun | 201091e | 2020-09-26 12:44:24 +0200 | [diff] [blame] | 54 | void smc_ism_init(void); |
Guvenc Gulce | aaf9552 | 2020-12-01 20:20:48 +0100 | [diff] [blame] | 55 | int smcd_nl_get_device(struct sk_buff *skb, struct netlink_callback *cb); |
Hans Wippel | c6ba7c9 | 2018-06-28 19:05:07 +0200 | [diff] [blame] | 56 | #endif |