Commit | Line | Data |
---|---|---|
c6ba7c9b HW |
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> | |
49407ae2 | 13 | #include <linux/types.h> |
82087c03 | 14 | #include <linux/mutex.h> |
c6ba7c9b HW |
15 | |
16 | #include "smc.h" | |
17 | ||
18 | struct smcd_dev_list { /* List of SMCD devices */ | |
19 | struct list_head list; | |
82087c03 | 20 | struct mutex mutex; /* Protects list of devices */ |
c6ba7c9b HW |
21 | }; |
22 | ||
201091eb | 23 | extern struct smcd_dev_list smcd_dev_list; /* list of smcd devices */ |
c6ba7c9b HW |
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 | ||
c6ba7c9b HW |
31 | struct smcd_dev; |
32 | ||
33 | int smc_ism_cantalk(u64 peer_gid, unsigned short vlan_id, struct smcd_dev *dev); | |
34 | void smc_ism_set_conn(struct smc_connection *conn); | |
35 | void smc_ism_unset_conn(struct smc_connection *conn); | |
36 | int smc_ism_get_vlan(struct smcd_dev *dev, unsigned short vlan_id); | |
37 | int smc_ism_put_vlan(struct smcd_dev *dev, unsigned short vlan_id); | |
38 | int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size, | |
39 | struct smc_buf_desc *dmb_desc); | |
40 | int smc_ism_unregister_dmb(struct smcd_dev *dev, struct smc_buf_desc *dmb_desc); | |
0512f69e | 41 | int smc_ism_signal_shutdown(struct smc_link_group *lgr); |
11a26c59 | 42 | void smc_ism_get_system_eid(u8 **eid); |
8caaccf5 | 43 | u16 smc_ism_get_chid(struct smcd_dev *dev); |
49407ae2 | 44 | bool smc_ism_is_v2_capable(void); |
8747716f SR |
45 | int smc_ism_init(void); |
46 | void smc_ism_exit(void); | |
aaf95523 | 47 | int smcd_nl_get_device(struct sk_buff *skb, struct netlink_callback *cb); |
eb481b02 HC |
48 | |
49 | static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok, | |
50 | unsigned int idx, bool sf, unsigned int offset, | |
51 | void *data, size_t len) | |
52 | { | |
53 | int rc; | |
54 | ||
55 | rc = smcd->ops->move_data(smcd, dmb_tok, idx, sf, offset, data, len); | |
56 | return rc < 0 ? rc : 0; | |
57 | } | |
58 | ||
c6ba7c9b | 59 | #endif |