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