blob: 81cc4537efd38592cf26e01c809f1752e48489bf [file] [log] [blame]
Hans Wippelc6ba7c92018-06-28 19:05:07 +02001/* 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>
Ursula Braun82087c02020-07-08 17:05:14 +020013#include <linux/mutex.h>
Hans Wippelc6ba7c92018-06-28 19:05:07 +020014
15#include "smc.h"
16
17struct smcd_dev_list { /* List of SMCD devices */
18 struct list_head list;
Ursula Braun82087c02020-07-08 17:05:14 +020019 struct mutex mutex; /* Protects list of devices */
Hans Wippelc6ba7c92018-06-28 19:05:07 +020020};
21
22extern struct smcd_dev_list smcd_dev_list; /* list of smcd devices */
23
24struct smc_ism_vlanid { /* VLAN id set on ISM device */
25 struct list_head list;
26 unsigned short vlanid; /* Vlan id */
27 refcount_t refcnt; /* Reference count */
28};
29
30struct smc_ism_position { /* ISM device position to write to */
31 u64 token; /* Token of DMB */
32 u32 offset; /* Offset into DMBE */
33 u8 index; /* Index of DMBE */
34 u8 signal; /* Generate interrupt on owner side */
35};
36
37struct smcd_dev;
38
39int smc_ism_cantalk(u64 peer_gid, unsigned short vlan_id, struct smcd_dev *dev);
40void smc_ism_set_conn(struct smc_connection *conn);
41void smc_ism_unset_conn(struct smc_connection *conn);
42int smc_ism_get_vlan(struct smcd_dev *dev, unsigned short vlan_id);
43int smc_ism_put_vlan(struct smcd_dev *dev, unsigned short vlan_id);
44int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size,
45 struct smc_buf_desc *dmb_desc);
46int smc_ism_unregister_dmb(struct smcd_dev *dev, struct smc_buf_desc *dmb_desc);
47int smc_ism_write(struct smcd_dev *dev, const struct smc_ism_position *pos,
48 void *data, size_t len);
Hans Wippel0512f692018-11-20 16:46:41 +010049int smc_ism_signal_shutdown(struct smc_link_group *lgr);
Hans Wippelc6ba7c92018-06-28 19:05:07 +020050#endif