smc_diag.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_SMC_DIAG_H_
  3. #define _UAPI_SMC_DIAG_H_
  4. #include <linux/types.h>
  5. #include <linux/inet_diag.h>
  6. #include <rdma/ib_user_verbs.h>
  7. /* Request structure */
  8. struct smc_diag_req {
  9. __u8 diag_family;
  10. __u8 pad[2];
  11. __u8 diag_ext; /* Query extended information */
  12. struct inet_diag_sockid id;
  13. };
  14. /* Base info structure. It contains socket identity (addrs/ports/cookie) based
  15. * on the internal clcsock, and more SMC-related socket data
  16. */
  17. struct smc_diag_msg {
  18. __u8 diag_family;
  19. __u8 diag_state;
  20. union {
  21. __u8 diag_mode;
  22. __u8 diag_fallback; /* the old name of the field */
  23. };
  24. __u8 diag_shutdown;
  25. struct inet_diag_sockid id;
  26. __u32 diag_uid;
  27. __aligned_u64 diag_inode;
  28. };
  29. /* Mode of a connection */
  30. enum {
  31. SMC_DIAG_MODE_SMCR,
  32. SMC_DIAG_MODE_FALLBACK_TCP,
  33. SMC_DIAG_MODE_SMCD,
  34. };
  35. /* Extensions */
  36. enum {
  37. SMC_DIAG_NONE,
  38. SMC_DIAG_CONNINFO,
  39. SMC_DIAG_LGRINFO,
  40. SMC_DIAG_SHUTDOWN,
  41. SMC_DIAG_DMBINFO,
  42. SMC_DIAG_FALLBACK,
  43. __SMC_DIAG_MAX,
  44. };
  45. #define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1)
  46. /* SMC_DIAG_CONNINFO */
  47. struct smc_diag_cursor {
  48. __u16 reserved;
  49. __u16 wrap;
  50. __u32 count;
  51. };
  52. struct smc_diag_conninfo {
  53. __u32 token; /* unique connection id */
  54. __u32 sndbuf_size; /* size of send buffer */
  55. __u32 rmbe_size; /* size of RMB element */
  56. __u32 peer_rmbe_size; /* size of peer RMB element */
  57. /* local RMB element cursors */
  58. struct smc_diag_cursor rx_prod; /* received producer cursor */
  59. struct smc_diag_cursor rx_cons; /* received consumer cursor */
  60. /* peer RMB element cursors */
  61. struct smc_diag_cursor tx_prod; /* sent producer cursor */
  62. struct smc_diag_cursor tx_cons; /* sent consumer cursor */
  63. __u8 rx_prod_flags; /* received producer flags */
  64. __u8 rx_conn_state_flags; /* recvd connection flags*/
  65. __u8 tx_prod_flags; /* sent producer flags */
  66. __u8 tx_conn_state_flags; /* sent connection flags*/
  67. /* send buffer cursors */
  68. struct smc_diag_cursor tx_prep; /* prepared to be sent cursor */
  69. struct smc_diag_cursor tx_sent; /* sent cursor */
  70. struct smc_diag_cursor tx_fin; /* confirmed sent cursor */
  71. };
  72. /* SMC_DIAG_LINKINFO */
  73. struct smc_diag_linkinfo {
  74. __u8 link_id; /* link identifier */
  75. __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */
  76. __u8 ibport; /* RDMA device port number */
  77. __u8 gid[40]; /* local GID */
  78. __u8 peer_gid[40]; /* peer GID */
  79. };
  80. struct smc_diag_lgrinfo {
  81. struct smc_diag_linkinfo lnk[1];
  82. __u8 role;
  83. };
  84. struct smc_diag_fallback {
  85. __u32 reason;
  86. __u32 peer_diagnosis;
  87. };
  88. struct smcd_diag_dmbinfo { /* SMC-D Socket internals */
  89. __u32 linkid; /* Link identifier */
  90. __aligned_u64 peer_gid; /* Peer GID */
  91. __aligned_u64 my_gid; /* My GID */
  92. __aligned_u64 token; /* Token of DMB */
  93. __aligned_u64 peer_token; /* Token of remote DMBE */
  94. };
  95. #endif /* _UAPI_SMC_DIAG_H_ */