linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ksmbd-tools: add support for smb2 max credits parameter
@ 2021-12-29 14:15 Namjae Jeon
  0 siblings, 0 replies; only message in thread
From: Namjae Jeon @ 2021-12-29 14:15 UTC (permalink / raw)
  To: linux-cifs; +Cc: Namjae Jeon

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

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 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(+)

diff --git a/Documentation/configuration.txt b/Documentation/configuration.txt
index 5a15ce6..9580bf1 100644
--- a/Documentation/configuration.txt
+++ b/Documentation/configuration.txt
@@ -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:
diff --git a/include/ksmbdtools.h b/include/ksmbdtools.h
index 5a12368..c51673e 100644
--- a/include/ksmbdtools.h
+++ b/include/ksmbdtools.h
@@ -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;
diff --git a/include/linux/ksmbd_server.h b/include/linux/ksmbd_server.h
index b1c5e63..647cfee 100644
--- a/include/linux/ksmbd_server.h
+++ b/include/linux/ksmbd_server.h
@@ -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[];
 };
diff --git a/lib/config_parser.c b/lib/config_parser.c
index ebbe2dd..aa1dbf2 100644
--- a/lib/config_parser.c
+++ b/lib/config_parser.c
@@ -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)
diff --git a/mountd/ipc.c b/mountd/ipc.c
index 15c59f5..eded431 100644
--- a/mountd/ipc.c
+++ b/mountd/ipc.c
@@ -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,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-29 14:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-29 14:15 [PATCH] ksmbd-tools: add support for smb2 max credits parameter Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).