xref: /linux-6.15/include/uapi/linux/smc_diag.h (revision bb7e5ce7)
1 #ifndef _UAPI_SMC_DIAG_H_
2 #define _UAPI_SMC_DIAG_H_
3 
4 #include <linux/types.h>
5 #include <linux/inet_diag.h>
6 #include <rdma/ib_user_verbs.h>
7 
8 /* Request structure */
9 struct smc_diag_req {
10 	__u8	diag_family;
11 	__u8	pad[2];
12 	__u8	diag_ext;		/* Query extended information */
13 	struct inet_diag_sockid	id;
14 };
15 
16 /* Base info structure. It contains socket identity (addrs/ports/cookie) based
17  * on the internal clcsock, and more SMC-related socket data
18  */
19 struct smc_diag_msg {
20 	__u8	diag_family;
21 	__u8	diag_state;
22 	__u8	diag_fallback;
23 	__u8	diag_shutdown;
24 	struct inet_diag_sockid id;
25 
26 	__u32	diag_uid;
27 	__u64	diag_inode;
28 };
29 
30 /* Extensions */
31 
32 enum {
33 	SMC_DIAG_NONE,
34 	SMC_DIAG_CONNINFO,
35 	SMC_DIAG_LGRINFO,
36 	SMC_DIAG_SHUTDOWN,
37 	__SMC_DIAG_MAX,
38 };
39 
40 #define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1)
41 
42 /* SMC_DIAG_CONNINFO */
43 
44 struct smc_diag_cursor {
45 	__u16	reserved;
46 	__u16	wrap;
47 	__u32	count;
48 };
49 
50 struct smc_diag_conninfo {
51 	__u32			token;		/* unique connection id */
52 	__u32			sndbuf_size;	/* size of send buffer */
53 	__u32			rmbe_size;	/* size of RMB element */
54 	__u32			peer_rmbe_size;	/* size of peer RMB element */
55 	/* local RMB element cursors */
56 	struct smc_diag_cursor	rx_prod;	/* received producer cursor */
57 	struct smc_diag_cursor	rx_cons;	/* received consumer cursor */
58 	/* peer RMB element cursors */
59 	struct smc_diag_cursor	tx_prod;	/* sent producer cursor */
60 	struct smc_diag_cursor	tx_cons;	/* sent consumer cursor */
61 	__u8			rx_prod_flags;	/* received producer flags */
62 	__u8			rx_conn_state_flags; /* recvd connection flags*/
63 	__u8			tx_prod_flags;	/* sent producer flags */
64 	__u8			tx_conn_state_flags; /* sent connection flags*/
65 	/* send buffer cursors */
66 	struct smc_diag_cursor	tx_prep;	/* prepared to be sent cursor */
67 	struct smc_diag_cursor	tx_sent;	/* sent cursor */
68 	struct smc_diag_cursor	tx_fin;		/* confirmed sent cursor */
69 };
70 
71 /* SMC_DIAG_LINKINFO */
72 
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 
81 struct smc_diag_lgrinfo {
82 	struct smc_diag_linkinfo	lnk[1];
83 	__u8				role;
84 };
85 #endif /* _UAPI_SMC_DIAG_H_ */
86