File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ struct ksmbd_startup_request {
104104 */
105105 __u32 sub_auth [3 ]; /* Subauth value for Security ID */
106106 __u32 smb2_max_credits ; /* MAX credits */
107- __u32 reserved [128 ]; /* Reserved room */
107+ __u32 smbd_max_io_size ; /* smbd read write size */
108+ __u32 reserved [127 ]; /* Reserved room */
108109 __u32 ifc_list_sz ; /* interfaces list size */
109110 __s8 ____payload [];
110111};
Original file line number Diff line number Diff line change 2626#include "mgmt/ksmbd_ida.h"
2727#include "connection.h"
2828#include "transport_tcp.h"
29+ #include "transport_rdma.h"
2930
3031#define IPC_WAIT_TIMEOUT (2 * HZ)
3132
@@ -303,6 +304,8 @@ static int ipc_server_config_on_startup(struct ksmbd_startup_request *req)
303304 init_smb2_max_trans_size (req -> smb2_max_trans );
304305 if (req -> smb2_max_credits )
305306 init_smb2_max_credits (req -> smb2_max_credits );
307+ if (req -> smbd_max_io_size )
308+ init_smbd_max_io_size (req -> smbd_max_io_size );
306309
307310 ret = ksmbd_set_netbios_name (req -> netbios_name );
308311 ret |= ksmbd_set_server_string (req -> server_string );
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ static int smb_direct_max_fragmented_recv_size = 1024 * 1024;
8080/* The maximum single-message size which can be received */
8181static int smb_direct_max_receive_size = 8192 ;
8282
83- static int smb_direct_max_read_write_size = 8 * 1024 * 1024 ;
83+ static int smb_direct_max_read_write_size = SMBD_DEFAULT_IOSIZE ;
8484
8585static LIST_HEAD (smb_direct_device_list );
8686static DEFINE_RWLOCK (smb_direct_device_lock );
@@ -214,6 +214,12 @@ struct smb_direct_rdma_rw_msg {
214214 struct scatterlist sg_list [];
215215};
216216
217+ void init_smbd_max_io_size (unsigned int sz )
218+ {
219+ sz = clamp_val (sz , SMBD_MIN_IOSIZE , SMBD_MAX_IOSIZE );
220+ smb_direct_max_read_write_size = sz ;
221+ }
222+
217223static inline int get_buf_page_count (void * buf , int size )
218224{
219225 return DIV_ROUND_UP ((uintptr_t )buf + size , PAGE_SIZE ) -
Original file line number Diff line number Diff line change 77#ifndef __KSMBD_TRANSPORT_RDMA_H__
88#define __KSMBD_TRANSPORT_RDMA_H__
99
10+ #define SMBD_DEFAULT_IOSIZE (8 * 1024 * 1024)
11+ #define SMBD_MIN_IOSIZE (512 * 1024)
12+ #define SMBD_MAX_IOSIZE (16 * 1024 * 1024)
13+
1014/* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */
1115struct smb_direct_negotiate_req {
1216 __le16 min_version ;
@@ -52,10 +56,12 @@ struct smb_direct_data_transfer {
5256int ksmbd_rdma_init (void );
5357void ksmbd_rdma_destroy (void );
5458bool ksmbd_rdma_capable_netdev (struct net_device * netdev );
59+ void init_smbd_max_io_size (unsigned int sz );
5560#else
5661static inline int ksmbd_rdma_init (void ) { return 0 ; }
5762static inline int ksmbd_rdma_destroy (void ) { return 0 ; }
5863static inline bool ksmbd_rdma_capable_netdev (struct net_device * netdev ) { return false; }
64+ static inline void init_smbd_max_io_size (unsigned int sz ) { }
5965#endif
6066
6167#endif /* __KSMBD_TRANSPORT_RDMA_H__ */
You can’t perform that action at this time.
0 commit comments