Merge tag 'defconfig-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / fs / ksmbd / transport_rdma.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *   Copyright (C) 2017, Microsoft Corporation.
4  *   Copyright (C) 2018, LG Electronics.
5  */
6
7 #ifndef __KSMBD_TRANSPORT_RDMA_H__
8 #define __KSMBD_TRANSPORT_RDMA_H__
9
10 #define SMB_DIRECT_PORT 5445
11
12 /* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */
13 struct smb_direct_negotiate_req {
14         __le16 min_version;
15         __le16 max_version;
16         __le16 reserved;
17         __le16 credits_requested;
18         __le32 preferred_send_size;
19         __le32 max_receive_size;
20         __le32 max_fragmented_size;
21 } __packed;
22
23 /* SMB DIRECT negotiation response packet [MS-SMBD] 2.2.2 */
24 struct smb_direct_negotiate_resp {
25         __le16 min_version;
26         __le16 max_version;
27         __le16 negotiated_version;
28         __le16 reserved;
29         __le16 credits_requested;
30         __le16 credits_granted;
31         __le32 status;
32         __le32 max_readwrite_size;
33         __le32 preferred_send_size;
34         __le32 max_receive_size;
35         __le32 max_fragmented_size;
36 } __packed;
37
38 #define SMB_DIRECT_RESPONSE_REQUESTED 0x0001
39
40 /* SMB DIRECT data transfer packet with payload [MS-SMBD] 2.2.3 */
41 struct smb_direct_data_transfer {
42         __le16 credits_requested;
43         __le16 credits_granted;
44         __le16 flags;
45         __le16 reserved;
46         __le32 remaining_data_length;
47         __le32 data_offset;
48         __le32 data_length;
49         __le32 padding;
50         __u8 buffer[];
51 } __packed;
52
53 #ifdef CONFIG_SMB_SERVER_SMBDIRECT
54 int ksmbd_rdma_init(void);
55 int ksmbd_rdma_destroy(void);
56 bool ksmbd_rdma_capable_netdev(struct net_device *netdev);
57 #else
58 static inline int ksmbd_rdma_init(void) { return 0; }
59 static inline int ksmbd_rdma_destroy(void) { return 0; }
60 static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { return false; }
61 #endif
62
63 #endif /* __KSMBD_TRANSPORT_RDMA_H__ */