smc_ism.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #ifndef SMCD_ISM_H
  9. #define SMCD_ISM_H
  10. #include <linux/uio.h>
  11. #include <linux/mutex.h>
  12. #include "smc.h"
  13. struct smcd_dev_list { /* List of SMCD devices */
  14. struct list_head list;
  15. struct mutex mutex; /* Protects list of devices */
  16. };
  17. extern struct smcd_dev_list smcd_dev_list; /* list of smcd devices */
  18. extern bool smc_ism_v2_capable; /* HW supports ISM V2 and thus
  19. * System EID is defined
  20. */
  21. struct smc_ism_vlanid { /* VLAN id set on ISM device */
  22. struct list_head list;
  23. unsigned short vlanid; /* Vlan id */
  24. refcount_t refcnt; /* Reference count */
  25. };
  26. struct smc_ism_position { /* ISM device position to write to */
  27. u64 token; /* Token of DMB */
  28. u32 offset; /* Offset into DMBE */
  29. u8 index; /* Index of DMBE */
  30. u8 signal; /* Generate interrupt on owner side */
  31. };
  32. struct smcd_dev;
  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);
  41. int smc_ism_write(struct smcd_dev *dev, const struct smc_ism_position *pos,
  42. void *data, size_t len);
  43. int smc_ism_signal_shutdown(struct smc_link_group *lgr);
  44. void smc_ism_get_system_eid(struct smcd_dev *dev, u8 **eid);
  45. u16 smc_ism_get_chid(struct smcd_dev *dev);
  46. void smc_ism_init(void);
  47. #endif