Skip to contentSkip to conversation

ksmbd-tools: add support for smb2 max credits parameter

PATCH New Namjae Jeon 1 participant 1 message Dec 29, 2021

Subsystems (4)
lore
Share & tools
lore

Namjae Jeon

author maintainer
#0 lore raw

PATCH 1/1 ksmbd-tools: add support for smb2 max credits parameter

Add smb2 max credits parameter to adjust maximum credits value to limit number of outstanding requests.

---
 Documentation/configuration.txt | 3 +++
 include/ksmbdtools.h            | 1 +
 include/linux/ksmbd_server.h    | 1 +
 lib/config_parser.c             | 5 +++++
 mountd/ipc.c                    | 1 +
 5 files changed, 11 insertions(+)
Documentation/configuration.txt +3 -0
index 5a15ce6..9580bf1 100644
@@ -109,6 +109,9 @@ Define ksmbd configuration parameters list.
 		This boolean parameter controls whether ksmbd will support
 		SMB3 multi-channel. Warn that this is experimental feature
 		which means data can be corrupted under race conditions.
+	- smb2 max credits (default: 8192)
+		This option controls the maximum number of outstanding
+		simultaneous SMB2 operations.
 
 
 * Supported [share] level parameters list:
include/ksmbdtools.h +1 -0
index 5a12368..c51673e 100644
@@ -52,6 +52,7 @@ struct smbconf_global {
 	unsigned int		smb2_max_read;
 	unsigned int		smb2_max_write;
 	unsigned int		smb2_max_trans;
+	unsigned int		smb2_max_credits;
 	unsigned int		share_fake_fscaps;
 	unsigned int		gen_subauth[3];
 	char			*krb5_keytab_file;
include/linux/ksmbd_server.h +1 -0
index b1c5e63..647cfee 100644
@@ -46,6 +46,7 @@ struct ksmbd_startup_request {
 	__u32	smb2_max_trans;
 	__u32	share_fake_fscaps;
 	__u32	sub_auth[3];
+	__u32	smb2_max_credits;
 	__u32	ifc_list_sz;
 	__s8	____payload[];
 };
lib/config_parser.c +5 -0
index ebbe2dd..aa1dbf2 100644
@@ -548,6 +548,11 @@ static void global_group_kv(gpointer _k, gpointer _v, gpointer user_data)
 
 		return;
 	}
+
+	if (!cp_key_cmp(_k, "smb2 max credits")) {
+		global_conf.smb2_max_credits = memparse(_v);
+		return;
+	}
 }
 
 static void fixup_missing_global_group(void)
mountd/ipc.c +1 -0
index 15c59f5..eded431 100644
@@ -173,6 +173,7 @@ static int ipc_ksmbd_starting_up(void)
 	ev->smb2_max_trans = global_conf.smb2_max_trans;
 	ev->share_fake_fscaps = global_conf.share_fake_fscaps;
 	memcpy(ev->sub_auth, global_conf.gen_subauth, sizeof(ev->sub_auth));
+	ev->smb2_max_credits = global_conf.smb2_max_credits;
 
 	if (global_conf.server_min_protocol) {
 		strncpy(ev->min_prot,
Signature · 1 line
2.25.1