xref: /linux/fs/smb/common/smbdirect/smbdirect.h (revision 3cd8b194bf3428dfa53120fee47e827a7c495815)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *   Copyright (C) 2025 Stefan Metzmacher
4  */
5 
6 #ifndef __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_H__
7 #define __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_H__
8 
9 #include <linux/types.h>
10 
11 /* SMB-DIRECT buffer descriptor V1 structure [MS-SMBD] 2.2.3.1 */
12 struct smbdirect_buffer_descriptor_v1 {
13 	__le64 offset;
14 	__le32 token;
15 	__le32 length;
16 } __packed;
17 
18 /*
19  * Connection parameters mostly from [MS-SMBD] 3.1.1.1
20  *
21  * These are setup and negotiated at the beginning of a
22  * connection and remain constant unless explicitly changed.
23  *
24  * Some values are important for the upper layer.
25  */
26 struct smbdirect_socket_parameters {
27 	__u64 flags;
28 #define SMBDIRECT_FLAG_PORT_RANGE_ONLY_IB ((__u64)0x1)
29 #define SMBDIRECT_FLAG_PORT_RANGE_ONLY_IW ((__u64)0x2)
30 	__u32 resolve_addr_timeout_msec;
31 	__u32 resolve_route_timeout_msec;
32 	__u32 rdma_connect_timeout_msec;
33 	__u32 negotiate_timeout_msec;
34 	__u16 initiator_depth;     /* limited to U8_MAX */
35 	__u16 responder_resources; /* limited to U8_MAX */
36 	__u16 recv_credit_max;
37 	__u16 send_credit_target;
38 	__u32 max_send_size;
39 	__u32 max_fragmented_send_size;
40 	__u32 max_recv_size;
41 	__u32 max_fragmented_recv_size;
42 	__u32 max_read_write_size;
43 	__u32 max_frmr_depth;
44 	__u32 keepalive_interval_msec;
45 	__u32 keepalive_timeout_msec;
46 } __packed;
47 
48 #define SMBDIRECT_FLAG_PORT_RANGE_MASK ( \
49 		SMBDIRECT_FLAG_PORT_RANGE_ONLY_IB | \
50 		SMBDIRECT_FLAG_PORT_RANGE_ONLY_IW)
51 
52 #endif /* __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_H__ */
53