diff mbox series

ksmbd-tools: add smbd max io size parameter

Message ID 20220516074223.28589-1-linkinjeon@kernel.org (mailing list archive)
State New, archived
Headers show
Series ksmbd-tools: add smbd max io size parameter | expand

Commit Message

Namjae Jeon May 16, 2022, 7:42 a.m. UTC
Add 'smbd max io size' parameter in ksmbd configuration to adjust
smbd-direct max read/write size.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 Documentation/configuration.txt | 2 ++
 include/ksmbdtools.h            | 1 +
 include/linux/ksmbd_server.h    | 3 ++-
 lib/config_parser.c             | 5 +++++
 mountd/ipc.c                    | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Documentation/configuration.txt b/Documentation/configuration.txt
index 9580bf1..47d5f9b 100644
--- a/Documentation/configuration.txt
+++ b/Documentation/configuration.txt
@@ -112,6 +112,8 @@  Define ksmbd configuration parameters list.
 	- smb2 max credits (default: 8192)
 		This option controls the maximum number of outstanding
 		simultaneous SMB2 operations.
+	- smbd io size (default: 8MB)
+		This option controls the maximum read/write size of smb-direct.
 
 
 * Supported [share] level parameters list:
diff --git a/include/ksmbdtools.h b/include/ksmbdtools.h
index c51673e..a46bdbc 100644
--- a/include/ksmbdtools.h
+++ b/include/ksmbdtools.h
@@ -53,6 +53,7 @@  struct smbconf_global {
 	unsigned int		smb2_max_write;
 	unsigned int		smb2_max_trans;
 	unsigned int		smb2_max_credits;
+	unsigned int		smbd_max_io_size;
 	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 78ae6e7..6705dac 100644
--- a/include/linux/ksmbd_server.h
+++ b/include/linux/ksmbd_server.h
@@ -47,7 +47,8 @@  struct ksmbd_startup_request {
 	__u32	share_fake_fscaps;
 	__u32	sub_auth[3];
 	__u32	smb2_max_credits;
-	__u32   reserved[128];		/* Reserved room */
+	__u32	smbd_max_io_size;	/* smbd read write size */
+	__u32   reserved[127];		/* Reserved room */
 	__u32	ifc_list_sz;
 	__s8	____payload[];
 };
diff --git a/lib/config_parser.c b/lib/config_parser.c
index 9ce730c..e9d0a7e 100644
--- a/lib/config_parser.c
+++ b/lib/config_parser.c
@@ -555,6 +555,11 @@  static gboolean global_group_kv(gpointer _k, gpointer _v, gpointer user_data)
 		return TRUE;
 	}
 
+	if (!cp_key_cmp(_k, "smbd max io size")) {
+		global_conf.smbd_max_io_size = memparse(_v);
+		return TRUE;
+	}
+
 	/* At this point, this is an option that must be applied to all shares */
 	return FALSE;
 }
diff --git a/mountd/ipc.c b/mountd/ipc.c
index eded431..015268d 100644
--- a/mountd/ipc.c
+++ b/mountd/ipc.c
@@ -171,6 +171,7 @@  static int ipc_ksmbd_starting_up(void)
 	ev->smb2_max_read = global_conf.smb2_max_read;
 	ev->smb2_max_write = global_conf.smb2_max_write;
 	ev->smb2_max_trans = global_conf.smb2_max_trans;
+	ev->smbd_max_io_size = global_conf.smbd_max_io_size;
 	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;