Skip to contentSkip to conversation

ksmbd-tools: add smbd max io size parameter

PATCH New Namjae Jeon 1 participant 1 message May 16, 2022

Subsystems (4)
lore
Share & tools
lore

Namjae Jeon

author maintainer
#0 lore raw

PATCH 1/1 ksmbd-tools: add smbd max io size parameter

Add 'smbd max io size' parameter in ksmbd configuration to adjust smbd-direct max read/write size.

---
 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(-)
Documentation/configuration.txt +2 -0
index 9580bf1..47d5f9b 100644
@@ -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:
include/ksmbdtools.h +1 -0
index c51673e..a46bdbc 100644
@@ -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;
include/linux/ksmbd_server.h +2 -1
index 78ae6e7..6705dac 100644
@@ -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[];
 };
lib/config_parser.c +5 -0
index 9ce730c..e9d0a7e 100644
@@ -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;
 }
mountd/ipc.c +1 -0
index eded431..015268d 100644
@@ -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;
Signature · 1 line
2.25.1