Skip to content

Commit d8ec913

Browse files
longlimsftsmfrench
authored andcommitted
CIFS: SMBD: export protocol initial values
For use-configurable SMB Direct protocol values, export them to /proc/fs/cifs. Signed-off-by: Long Li <[email protected]> Signed-off-by: Steve French <[email protected]> Acked-by: Ronnie Sahlberg <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]>
1 parent 399f953 commit d8ec913

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

fs/cifs/cifs_debug.c

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
#include "cifsproto.h"
3131
#include "cifs_debug.h"
3232
#include "cifsfs.h"
33+
#ifdef CONFIG_CIFS_SMB_DIRECT
34+
#include "smbdirect.h"
35+
#endif
3336

3437
void
3538
cifs_dump_mem(char *label, void *data, int length)
@@ -376,6 +379,54 @@ static const struct file_operations cifs_stats_proc_fops = {
376379
};
377380
#endif /* STATS */
378381

382+
#ifdef CONFIG_CIFS_SMB_DIRECT
383+
#define PROC_FILE_DEFINE(name) \
384+
static ssize_t name##_write(struct file *file, const char __user *buffer, \
385+
size_t count, loff_t *ppos) \
386+
{ \
387+
int rc; \
388+
rc = kstrtoint_from_user(buffer, count, 10, & name); \
389+
if (rc) \
390+
return rc; \
391+
return count; \
392+
} \
393+
static int name##_proc_show(struct seq_file *m, void *v) \
394+
{ \
395+
seq_printf(m, "%d\n", name ); \
396+
return 0; \
397+
} \
398+
static int name##_open(struct inode *inode, struct file *file) \
399+
{ \
400+
return single_open(file, name##_proc_show, NULL); \
401+
} \
402+
\
403+
static const struct file_operations cifs_##name##_proc_fops = { \
404+
.open = name##_open, \
405+
.read = seq_read, \
406+
.llseek = seq_lseek, \
407+
.release = single_release, \
408+
.write = name##_write, \
409+
}
410+
411+
extern int rdma_readwrite_threshold;
412+
extern int smbd_max_frmr_depth;
413+
extern int smbd_keep_alive_interval;
414+
extern int smbd_max_receive_size;
415+
extern int smbd_max_fragmented_recv_size;
416+
extern int smbd_max_send_size;
417+
extern int smbd_send_credit_target;
418+
extern int smbd_receive_credit_max;
419+
420+
PROC_FILE_DEFINE(rdma_readwrite_threshold);
421+
PROC_FILE_DEFINE(smbd_max_frmr_depth);
422+
PROC_FILE_DEFINE(smbd_keep_alive_interval);
423+
PROC_FILE_DEFINE(smbd_max_receive_size);
424+
PROC_FILE_DEFINE(smbd_max_fragmented_recv_size);
425+
PROC_FILE_DEFINE(smbd_max_send_size);
426+
PROC_FILE_DEFINE(smbd_send_credit_target);
427+
PROC_FILE_DEFINE(smbd_receive_credit_max);
428+
#endif
429+
379430
static struct proc_dir_entry *proc_fs_cifs;
380431
static const struct file_operations cifsFYI_proc_fops;
381432
static const struct file_operations cifs_lookup_cache_proc_fops;
@@ -403,6 +454,24 @@ cifs_proc_init(void)
403454
&cifs_security_flags_proc_fops);
404455
proc_create("LookupCacheEnabled", 0, proc_fs_cifs,
405456
&cifs_lookup_cache_proc_fops);
457+
#ifdef CONFIG_CIFS_SMB_DIRECT
458+
proc_create("rdma_readwrite_threshold", 0, proc_fs_cifs,
459+
&cifs_rdma_readwrite_threshold_proc_fops);
460+
proc_create("smbd_max_frmr_depth", 0, proc_fs_cifs,
461+
&cifs_smbd_max_frmr_depth_proc_fops);
462+
proc_create("smbd_keep_alive_interval", 0, proc_fs_cifs,
463+
&cifs_smbd_keep_alive_interval_proc_fops);
464+
proc_create("smbd_max_receive_size", 0, proc_fs_cifs,
465+
&cifs_smbd_max_receive_size_proc_fops);
466+
proc_create("smbd_max_fragmented_recv_size", 0, proc_fs_cifs,
467+
&cifs_smbd_max_fragmented_recv_size_proc_fops);
468+
proc_create("smbd_max_send_size", 0, proc_fs_cifs,
469+
&cifs_smbd_max_send_size_proc_fops);
470+
proc_create("smbd_send_credit_target", 0, proc_fs_cifs,
471+
&cifs_smbd_send_credit_target_proc_fops);
472+
proc_create("smbd_receive_credit_max", 0, proc_fs_cifs,
473+
&cifs_smbd_receive_credit_max_proc_fops);
474+
#endif
406475
}
407476

408477
void
@@ -420,6 +489,16 @@ cifs_proc_clean(void)
420489
remove_proc_entry("SecurityFlags", proc_fs_cifs);
421490
remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
422491
remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
492+
#ifdef CONFIG_CIFS_SMB_DIRECT
493+
remove_proc_entry("rdma_readwrite_threshold", proc_fs_cifs);
494+
remove_proc_entry("smbd_max_frmr_depth", proc_fs_cifs);
495+
remove_proc_entry("smbd_keep_alive_interval", proc_fs_cifs);
496+
remove_proc_entry("smbd_max_receive_size", proc_fs_cifs);
497+
remove_proc_entry("smbd_max_fragmented_recv_size", proc_fs_cifs);
498+
remove_proc_entry("smbd_max_send_size", proc_fs_cifs);
499+
remove_proc_entry("smbd_send_credit_target", proc_fs_cifs);
500+
remove_proc_entry("smbd_receive_credit_max", proc_fs_cifs);
501+
#endif
423502
remove_proc_entry("fs/cifs", NULL);
424503
}
425504

0 commit comments

Comments
 (0)