Namjae Jeon | 0626e66 | 2021-03-16 13:07:11 +0900 | [diff] [blame] | 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 | |
Namjae Jeon | 9223958 | 2021-07-16 17:16:11 +0900 | [diff] [blame] | 10 | /* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */ |
Namjae Jeon | 0626e66 | 2021-03-16 13:07:11 +0900 | [diff] [blame] | 11 | struct smb_direct_negotiate_req { |
| 12 | __le16 min_version; |
| 13 | __le16 max_version; |
| 14 | __le16 reserved; |
| 15 | __le16 credits_requested; |
| 16 | __le32 preferred_send_size; |
| 17 | __le32 max_receive_size; |
| 18 | __le32 max_fragmented_size; |
| 19 | } __packed; |
| 20 | |
Namjae Jeon | 9223958 | 2021-07-16 17:16:11 +0900 | [diff] [blame] | 21 | /* SMB DIRECT negotiation response packet [MS-SMBD] 2.2.2 */ |
Namjae Jeon | 0626e66 | 2021-03-16 13:07:11 +0900 | [diff] [blame] | 22 | struct smb_direct_negotiate_resp { |
| 23 | __le16 min_version; |
| 24 | __le16 max_version; |
| 25 | __le16 negotiated_version; |
| 26 | __le16 reserved; |
| 27 | __le16 credits_requested; |
| 28 | __le16 credits_granted; |
| 29 | __le32 status; |
| 30 | __le32 max_readwrite_size; |
| 31 | __le32 preferred_send_size; |
| 32 | __le32 max_receive_size; |
| 33 | __le32 max_fragmented_size; |
| 34 | } __packed; |
| 35 | |
| 36 | #define SMB_DIRECT_RESPONSE_REQUESTED 0x0001 |
| 37 | |
Namjae Jeon | 9223958 | 2021-07-16 17:16:11 +0900 | [diff] [blame] | 38 | /* SMB DIRECT data transfer packet with payload [MS-SMBD] 2.2.3 */ |
Namjae Jeon | 0626e66 | 2021-03-16 13:07:11 +0900 | [diff] [blame] | 39 | struct smb_direct_data_transfer { |
| 40 | __le16 credits_requested; |
| 41 | __le16 credits_granted; |
| 42 | __le16 flags; |
| 43 | __le16 reserved; |
| 44 | __le32 remaining_data_length; |
| 45 | __le32 data_offset; |
| 46 | __le32 data_length; |
| 47 | __le32 padding; |
| 48 | __u8 buffer[]; |
| 49 | } __packed; |
| 50 | |
| 51 | #ifdef CONFIG_SMB_SERVER_SMBDIRECT |
| 52 | int ksmbd_rdma_init(void); |
Hyunchul Lee | 31928a0 | 2021-12-29 23:02:15 +0900 | [diff] [blame] | 53 | void ksmbd_rdma_destroy(void); |
Hyunchul Lee | 03d8d4f | 2021-07-13 16:09:34 +0900 | [diff] [blame] | 54 | bool ksmbd_rdma_capable_netdev(struct net_device *netdev); |
Namjae Jeon | 0626e66 | 2021-03-16 13:07:11 +0900 | [diff] [blame] | 55 | #else |
| 56 | static inline int ksmbd_rdma_init(void) { return 0; } |
| 57 | static inline int ksmbd_rdma_destroy(void) { return 0; } |
Hyunchul Lee | 03d8d4f | 2021-07-13 16:09:34 +0900 | [diff] [blame] | 58 | static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { return false; } |
Namjae Jeon | 0626e66 | 2021-03-16 13:07:11 +0900 | [diff] [blame] | 59 | #endif |
| 60 | |
| 61 | #endif /* __KSMBD_TRANSPORT_RDMA_H__ */ |