Long Li | 03bee01 | 2017-11-07 01:54:56 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2017, Microsoft Corporation. |
| 3 | * |
| 4 | * Author(s): Long Li <longli@microsoft.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 14 | * the GNU General Public License for more details. |
| 15 | */ |
| 16 | #include "smbdirect.h" |
| 17 | |
| 18 | /* SMBD version number */ |
| 19 | #define SMBD_V1 0x0100 |
| 20 | |
| 21 | /* Port numbers for SMBD transport */ |
| 22 | #define SMB_PORT 445 |
| 23 | #define SMBD_PORT 5445 |
| 24 | |
| 25 | /* Address lookup and resolve timeout in ms */ |
| 26 | #define RDMA_RESOLVE_TIMEOUT 5000 |
| 27 | |
| 28 | /* SMBD negotiation timeout in seconds */ |
| 29 | #define SMBD_NEGOTIATE_TIMEOUT 120 |
| 30 | |
| 31 | /* SMBD minimum receive size and fragmented sized defined in [MS-SMBD] */ |
| 32 | #define SMBD_MIN_RECEIVE_SIZE 128 |
| 33 | #define SMBD_MIN_FRAGMENTED_SIZE 131072 |
| 34 | |
| 35 | /* |
| 36 | * Default maximum number of RDMA read/write outstanding on this connection |
| 37 | * This value is possibly decreased during QP creation on hardware limit |
| 38 | */ |
| 39 | #define SMBD_CM_RESPONDER_RESOURCES 32 |
| 40 | |
| 41 | /* Maximum number of retries on data transfer operations */ |
| 42 | #define SMBD_CM_RETRY 6 |
| 43 | /* No need to retry on Receiver Not Ready since SMBD manages credits */ |
| 44 | #define SMBD_CM_RNR_RETRY 0 |
| 45 | |
| 46 | /* |
| 47 | * User configurable initial values per SMBD transport connection |
| 48 | * as defined in [MS-SMBD] 3.1.1.1 |
| 49 | * Those may change after a SMBD negotiation |
| 50 | */ |
| 51 | /* The local peer's maximum number of credits to grant to the peer */ |
| 52 | int smbd_receive_credit_max = 255; |
| 53 | |
| 54 | /* The remote peer's credit request of local peer */ |
| 55 | int smbd_send_credit_target = 255; |
| 56 | |
| 57 | /* The maximum single message size can be sent to remote peer */ |
| 58 | int smbd_max_send_size = 1364; |
| 59 | |
| 60 | /* The maximum fragmented upper-layer payload receive size supported */ |
| 61 | int smbd_max_fragmented_recv_size = 1024 * 1024; |
| 62 | |
| 63 | /* The maximum single-message size which can be received */ |
| 64 | int smbd_max_receive_size = 8192; |
| 65 | |
| 66 | /* The timeout to initiate send of a keepalive message on idle */ |
| 67 | int smbd_keep_alive_interval = 120; |
| 68 | |
| 69 | /* |
| 70 | * User configurable initial values for RDMA transport |
| 71 | * The actual values used may be lower and are limited to hardware capabilities |
| 72 | */ |
| 73 | /* Default maximum number of SGEs in a RDMA write/read */ |
| 74 | int smbd_max_frmr_depth = 2048; |
| 75 | |
| 76 | /* If payload is less than this byte, use RDMA send/recv not read/write */ |
| 77 | int rdma_readwrite_threshold = 4096; |