smb: smbdirect: introduce the basic smbdirect.ko

This exports the functions needed by cifs.ko and ksmbd.ko.

It doesn't yet provide a generic socket layer, but it
is a good start to introduce that on top.
It will be much easier after Davids refactoring
using MSG_SPLICE_PAGES, will make it easier to
use the socket layer without an additional copy.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: David Howells <dhowells@redhat.com>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Stefan Metzmacher 2025-07-18 18:44:15 +02:00 committed by Steve French
parent dc691b91ad
commit f9a804da47
6 changed files with 77 additions and 0 deletions

View File

@ -4,6 +4,7 @@
source "fs/smb/client/Kconfig"
source "fs/smb/server/Kconfig"
source "fs/smb/common/smbdirect/Kconfig"
config SMBFS
tristate

View File

@ -4,3 +4,4 @@
#
obj-$(CONFIG_SMBFS) += cifs_md4.o
obj-$(CONFIG_SMB_COMMON_SMBDIRECT) += smbdirect/

View File

@ -0,0 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# smbdirect configuration
config SMB_COMMON_SMBDIRECT
def_tristate n
depends on INFINIBAND && INFINIBAND_ADDR_TRANS
depends on m || INFINIBAND=y
select SG_POOL

View File

@ -0,0 +1,17 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Makefile for smbdirect support
#
obj-$(CONFIG_SMB_COMMON_SMBDIRECT) += smbdirect.o
smbdirect-y := \
smbdirect_socket.o \
smbdirect_connection.o \
smbdirect_mr.o \
smbdirect_rw.o \
smbdirect_debug.o \
smbdirect_connect.o \
smbdirect_listen.o \
smbdirect_accept.o \
smbdirect_main.o

View File

@ -13,6 +13,15 @@
#include "smbdirect.h"
#include "smbdirect_pdu.h"
#include "smbdirect_public.h"
#include <linux/mutex.h>
struct smbdirect_module_state {
struct mutex mutex;
};
extern struct smbdirect_module_state smbdirect_globals;
#include "smbdirect_socket.h"
#ifdef SMBDIRECT_USE_INLINE_C_FILES

View File

@ -0,0 +1,40 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2025, Stefan Metzmacher
*/
#include "smbdirect_internal.h"
#include <linux/module.h>
struct smbdirect_module_state smbdirect_globals = {
.mutex = __MUTEX_INITIALIZER(smbdirect_globals.mutex),
};
static __init int smbdirect_module_init(void)
{
pr_notice("subsystem loading...\n");
mutex_lock(&smbdirect_globals.mutex);
/* TODO... */
mutex_unlock(&smbdirect_globals.mutex);
pr_notice("subsystem loaded\n");
return 0;
}
static __exit void smbdirect_module_exit(void)
{
pr_notice("subsystem unloading...\n");
mutex_lock(&smbdirect_globals.mutex);
/* TODO... */
mutex_unlock(&smbdirect_globals.mutex);
pr_notice("subsystem unloaded\n");
}
module_init(smbdirect_module_init);
module_exit(smbdirect_module_exit);
MODULE_DESCRIPTION("smbdirect subsystem");
MODULE_LICENSE("GPL");