Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Shared Memory Communications Direct over ISM devices (SMC-D)
0003  *
0004  * SMC-D ISM device structure definitions.
0005  *
0006  * Copyright IBM Corp. 2018
0007  */
0008 
0009 #ifndef SMCD_ISM_H
0010 #define SMCD_ISM_H
0011 
0012 #include <linux/uio.h>
0013 #include <linux/types.h>
0014 #include <linux/mutex.h>
0015 
0016 #include "smc.h"
0017 
0018 struct smcd_dev_list {  /* List of SMCD devices */
0019     struct list_head list;
0020     struct mutex mutex; /* Protects list of devices */
0021 };
0022 
0023 extern struct smcd_dev_list smcd_dev_list;  /* list of smcd devices */
0024 
0025 struct smc_ism_vlanid {         /* VLAN id set on ISM device */
0026     struct list_head list;
0027     unsigned short vlanid;      /* Vlan id */
0028     refcount_t refcnt;      /* Reference count */
0029 };
0030 
0031 struct smcd_dev;
0032 
0033 int smc_ism_cantalk(u64 peer_gid, unsigned short vlan_id, struct smcd_dev *dev);
0034 void smc_ism_set_conn(struct smc_connection *conn);
0035 void smc_ism_unset_conn(struct smc_connection *conn);
0036 int smc_ism_get_vlan(struct smcd_dev *dev, unsigned short vlan_id);
0037 int smc_ism_put_vlan(struct smcd_dev *dev, unsigned short vlan_id);
0038 int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size,
0039              struct smc_buf_desc *dmb_desc);
0040 int smc_ism_unregister_dmb(struct smcd_dev *dev, struct smc_buf_desc *dmb_desc);
0041 int smc_ism_signal_shutdown(struct smc_link_group *lgr);
0042 void smc_ism_get_system_eid(u8 **eid);
0043 u16 smc_ism_get_chid(struct smcd_dev *dev);
0044 bool smc_ism_is_v2_capable(void);
0045 void smc_ism_init(void);
0046 int smcd_nl_get_device(struct sk_buff *skb, struct netlink_callback *cb);
0047 
0048 static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok,
0049                 unsigned int idx, bool sf, unsigned int offset,
0050                 void *data, size_t len)
0051 {
0052     int rc;
0053 
0054     rc = smcd->ops->move_data(smcd, dmb_tok, idx, sf, offset, data, len);
0055     return rc < 0 ? rc : 0;
0056 }
0057 
0058 #endif