libcli/smb/smb_direct.c define...
authorStefan Metzmacher <metze@samba.org>
Thu, 6 Oct 2016 11:11:15 +0000 (13:11 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:20 +0000 (14:35 +0200)
libcli/smb/smb_direct.c

index 59cf28edab1c6412f0216e251269c55bb833b088..c9dd0312e0cb2d908c30d10394a12b9242c14c19 100644 (file)
 
 #define SMB_DIRECT_LISTENER_BACKLOG 5
 
-//#define SMB_DIRECT_IO_MAX_DATA 8192
-#define SMB_DIRECT_IO_MAX_DATA 1364
+#define SMB_DIRECT_MAX_READ_WRITE_SIZE 1048576
+#define SMB_DIRECT_MAX_FRAGMENT_SIZE 1048576
+#define SMB_DIRECT_MAX_SEND_SIZE 1364
+#define SMB_DIRECT_MAX_RECEIVE_SIZE 8192
+#define SMB_DIRECT_MAX_SEND_CREDITS 255
+#define SMB_DIRECT_MAX_RECEIVE_CREDITS 255
+#define SMB_DIRECT_KEEPALIVE_INTERVAL 5
+
+#define SMB_DIRECT_IO_MAX_DATA NDR_ROUND(MAX(SMB_DIRECT_MAX_SEND_SIZE,SMB_DIRECT_MAX_RECEIVE_SIZE),16)
 #define SMB_DIRECT_DATA_MIN_HDR_SIZE 0x14
 #define SMB_DIRECT_DATA_OFFSET NDR_ROUND(SMB_DIRECT_DATA_MIN_HDR_SIZE, 8)
 
@@ -260,13 +267,13 @@ struct smb_direct_connection *smb_direct_connection_create(TALLOC_CTX *mem_ctx)
 //DEBUG(0,("%s:%s: here...\n", __location__, __func__));
        talloc_set_destructor(c, smb_direct_connection_destructor);
 
-       c->state.max_send_size       = 1364;
-       c->state.max_receive_size    = SMB_DIRECT_IO_MAX_DATA;
-       c->state.max_fragmented_size = 1048576;
-       c->state.max_read_write_size = 1048576;
-       c->state.receive_credit_max  = 10;//255;
-       c->state.send_credit_target  = 255;
-       c->state.keep_alive_internal = 5;
+       c->state.max_send_size       = SMB_DIRECT_MAX_SEND_SIZE;
+       c->state.max_receive_size    = SMB_DIRECT_MAX_RECEIVE_SIZE;
+       c->state.max_fragmented_size = SMB_DIRECT_MAX_FRAGMENT_SIZE;
+       c->state.max_read_write_size = SMB_DIRECT_MAX_READ_WRITE_SIZE;
+       c->state.receive_credit_max  = SMB_DIRECT_MAX_RECEIVE_CREDITS;
+       c->state.send_credit_target  = SMB_DIRECT_MAX_SEND_CREDITS;
+       c->state.keep_alive_internal = SMB_DIRECT_KEEPALIVE_INTERVAL;
 
        ret = socketpair(AF_UNIX, SOCK_STREAM, 0, sfd);
        if (ret == -1) {