1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2017, Microsoft Corporation.
4 * Copyright (C) 2018, LG Electronics.
7 #ifndef __KSMBD_TRANSPORT_RDMA_H__
8 #define __KSMBD_TRANSPORT_RDMA_H__
10 #define SMBD_DEFAULT_IOSIZE (8 * 1024 * 1024)
11 #define SMBD_MIN_IOSIZE (512 * 1024)
12 #define SMBD_MAX_IOSIZE (16 * 1024 * 1024)
14 /* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */
15 struct smb_direct_negotiate_req {
19 __le16 credits_requested;
20 __le32 preferred_send_size;
21 __le32 max_receive_size;
22 __le32 max_fragmented_size;
25 /* SMB DIRECT negotiation response packet [MS-SMBD] 2.2.2 */
26 struct smb_direct_negotiate_resp {
29 __le16 negotiated_version;
31 __le16 credits_requested;
32 __le16 credits_granted;
34 __le32 max_readwrite_size;
35 __le32 preferred_send_size;
36 __le32 max_receive_size;
37 __le32 max_fragmented_size;
40 #define SMB_DIRECT_RESPONSE_REQUESTED 0x0001
42 /* SMB DIRECT data transfer packet with payload [MS-SMBD] 2.2.3 */
43 struct smb_direct_data_transfer {
44 __le16 credits_requested;
45 __le16 credits_granted;
48 __le32 remaining_data_length;
55 #ifdef CONFIG_SMB_SERVER_SMBDIRECT
56 int ksmbd_rdma_init(void);
57 void ksmbd_rdma_destroy(void);
58 bool ksmbd_rdma_capable_netdev(struct net_device *netdev);
59 void init_smbd_max_io_size(unsigned int sz);
60 unsigned int get_smbd_max_read_write_size(void);
62 static inline int ksmbd_rdma_init(void) { return 0; }
63 static inline int ksmbd_rdma_destroy(void) { return 0; }
64 static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { return false; }
65 static inline void init_smbd_max_io_size(unsigned int sz) { }
66 static inline unsigned int get_smbd_max_read_write_size(void) { return 0; }
69 #endif /* __KSMBD_TRANSPORT_RDMA_H__ */