smb:common: introduce and use common smb_direct headers (step1)
Subsystems (3)
Stefan Metzmacher
reviewercover smb:common: introduce and use common smb_direct headers (step1)
Hi,
in preparation of a having a common smb_direct layer I started to move things into common header files.
I'll work on this the next few months in order to
unify the in kernel client and server layers
and expose the result to userspace too.
So that Samba can also use it.
Stefan Metzmacher (5):
smb: common: split out smb_direct related header files
smb: client: make use of common smb_direct headers
smb: common: add smb_direct_buffer_descriptor_v1
smb: client: make use of common smb_direct_buffer_descriptor_v1
smb: server: make use of common smb_direct_buffer_descriptor_v1
fs/smb/client/smb2pdu.c | 16 +++---- fs/smb/client/smbdirect.c | 22 ++++----- fs/smb/client/smbdirect.h | 50 +------------------ fs/smb/common/smb_direct/smb_direct.h | 11 +++++ fs/smb/common/smb_direct/smb_direct_pdu.h | 58 +++++++++++++++++++++++ fs/smb/server/connection.c | 4 +- fs/smb/server/connection.h | 8 ++-- fs/smb/server/smb2pdu.c | 10 ++-- fs/smb/server/smb2pdu.h | 8 +--- fs/smb/server/transport_rdma.c | 6 +-- fs/smb/server/transport_rdma.h | 41 ---------------- 11 files changed, 106 insertions(+), 128 deletions(-) create mode 100644 fs/smb/common/smb_direct/smb_direct.h create mode 100644 fs/smb/common/smb_direct/smb_direct_pdu.h
Signature · 1 line
2.34.1
Stefan Metzmacher
reviewerPATCH 1/5 smb: common: split out smb_direct related header files
This is just a start moving into a common smb_direct layer.
--- fs/smb/common/smb_direct/smb_direct.h | 11 +++++ fs/smb/common/smb_direct/smb_direct_pdu.h | 51 +++++++++++++++++++++++ fs/smb/server/transport_rdma.h | 43 +------------------ 3 files changed, 64 insertions(+), 41 deletions(-) create mode 100644 fs/smb/common/smb_direct/smb_direct.h create mode 100644 fs/smb/common/smb_direct/smb_direct_pdu.h
fs/smb/common/smb_direct/smb_direct.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (C) 2025, Stefan Metzmacher <[email protected]> +*/ + +#ifndef __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_H__ +#define __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_H__ + +#include "smb_direct_pdu.h" + +#endif /* __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_H__ */
fs/smb/common/smb_direct/smb_direct_pdu.h new file +51 -0
51 lines not on this page · raw message
fs/smb/server/transport_rdma.h +2 -41
53 lines not on this page · raw message
Signature · 1 line
2.34.1
Stefan Metzmacher
reviewerPATCH 2/5 smb: client: make use of common smb_direct headers
In reply to Stefan Metzmacher--- fs/smb/client/smbdirect.c | 22 ++++++++++---------- fs/smb/client/smbdirect.h | 43 ++------------------------------------- 2 files changed, 13 insertions(+), 52 deletions(-)
fs/smb/client/smbdirect.c +11 -11
@@ -299,7 +299,7 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)mempool_free (request, request->info->request_mempool); } -static void dump_smbd_negotiate_resp (struct smbd_negotiate_resp *resp) +static void dump_smb_direct_negotiate_resp (struct smb_direct_negotiate_resp *resp) { log_rdma_event(INFO, "resp message min_version %u max_version %u negotiated_version %u credits_requested %u credits_granted %u status %u max_readwrite_size %u preferred_send_size %u max_receive_size %u max_fragmented_size %u\n", resp->min_version, resp->max_version,
@@ -318,9 +318,9 @@ static bool process_negotiation_response( struct smbd_response *response, int packet_length) {struct smbd_connection *info = response->info; -struct smbd_negotiate_resp *packet =smbd_response_payload (response); +struct smb_direct_negotiate_resp *packet =smbd_response_payload (response); -if (packet_length <sizeof (struct smbd_negotiate_resp )) { +if (packet_length <sizeof (struct smb_direct_negotiate_resp )) {log_rdma_event (ERR ,"error: packet_length=%d\n" , packet_length);return false;
@@ -448,7 +448,7 @@ static void smbd_post_send_credits(struct work_struct *work)/* Called from softirq, when recv is done */ static void recv_done (struct ib_cq *cq,struct ib_wc *wc) { -struct smbd_data_transfer *data_transfer; +struct smb_direct_data_transfer *data_transfer;struct smbd_response *response = container_of(wc->wr_cqe, struct smbd_response, cqe);struct smbd_connection *info = response->info;
@@ -474,7 +474,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)switch (response->type) {/* SMBD negotiation response */ case SMBD_NEGOTIATE_RESP : -dump_smbd_negotiate_resp (smbd_response_payload (response)); +dump_smb_direct_negotiate_resp (smbd_response_payload (response)); info->full_packet_received = true; info->negotiate_done =process_negotiation_response (response, wc->byte_len);
@@ -686,7 +686,7 @@ static int smbd_post_send_negotiate_req(struct smbd_connection *info)struct ib_send_wr send_wr;int rc = -ENOMEM ;struct smbd_request *request; -struct smbd_negotiate_req *packet; +struct smb_direct_negotiate_req *packet; request =mempool_alloc (info->request_mempool,GFP_KERNEL );if (!request)
@@ -837,7 +837,7 @@ static int smbd_post_send_iter(struct smbd_connection *info,int header_length;int data_length;struct smbd_request *request; -struct smbd_data_transfer *packet; +struct smb_direct_data_transfer *packet;int new_credits =0 ; wait_credit:
@@ -938,10 +938,10 @@ static int smbd_post_send_iter(struct smbd_connection *info, le32_to_cpu(packet->remaining_data_length));/* Map the packet to DMA */ - header_length =sizeof (struct smbd_data_transfer ); + header_length =sizeof (struct smb_direct_data_transfer );/* If this is a packet without payload, don't send padding */ if (!data_length) - header_length = offsetof(struct smbd_data_transfer , padding); + header_length = offsetof(struct smb_direct_data_transfer , padding); request->sge[0].addr = ib_dma_map_single(info->id->device, (void *)packet,
@@ -1432,7 +1432,7 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info)kmem_cache_create ( name,sizeof (struct smbd_request ) + -sizeof (struct smbd_data_transfer ), +sizeof (struct smb_direct_data_transfer ),0 ,SLAB_HWCACHE_ALIGN ,NULL );if (!info->request_cache)return -ENOMEM ;
@@ -1735,7 +1735,7 @@ static int smbd_recv_buf(struct smbd_connection *info, char *buf, unsigned int size) {struct smbd_response *response; -struct smbd_data_transfer *data_transfer; +struct smb_direct_data_transfer *data_transfer;int to_copy, to_read, data_read, offset;u32 data_length, remaining_data_length, data_offset;int rc;
fs/smb/client/smbdirect.h +2 -41
55 lines not on this page · raw message
Signature · 1 line
2.34.1
Stefan Metzmacher
reviewerPATCH 3/5 smb: common: add smb_direct_buffer_descriptor_v1
In reply to Stefan MetzmacherWill be used in client and server in the next commits.
--- fs/smb/common/smb_direct/smb_direct_pdu.h | 7 +++++++ 1 file changed, 7 insertions(+)
fs/smb/common/smb_direct/smb_direct_pdu.h +7 -0
@@ -48,4 +48,11 @@ struct smb_direct_data_transfer { __u8 buffer[]; } __packed; +/* SMB DIRECT buffer descriptor V1 structure [MS-SMBD] 2.2.3.1 */ +struct smb_direct_buffer_descriptor_v1 { +__le64 offset; +__le32 token; +__le32 length; +} __packed; +#endif /* __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_PDU_H__ */
Signature · 1 line
2.34.1
Stefan Metzmacher
reviewerPATCH 4/5 smb: client: make use of common smb_direct_buffer_descriptor_v1
In reply to Stefan Metzmacher--- fs/smb/client/smb2pdu.c | 16 ++++++++-------- fs/smb/client/smbdirect.h | 7 ------- 2 files changed, 8 insertions(+), 15 deletions(-)
fs/smb/client/smb2pdu.c +8 -8
@@ -4442,10 +4442,10 @@ smb2_new_read_req(void **buf, unsigned int *total_len,#ifdef CONFIG_CIFS_SMB_DIRECT /* * If we want to do a RDMA write, fill in and append -* smbd_buffer_descriptor_v1 to the end of read request +* smb_direct_buffer_descriptor_v1 to the end of read request */ if (rdata &&smb3_use_rdma_offload (io_parms)) { -struct smbd_buffer_descriptor_v1 *v1; +struct smb_direct_buffer_descriptor_v1 *v1;bool need_invalidate = server->dialect ==SMB30_PROT_ID ; rdata->mr = smbd_register_mr(server->smbd_conn, &rdata->subreq.io_iter,
@@ -4459,8 +4459,8 @@ smb2_new_read_req(void **buf, unsigned int *total_len, req->ReadChannelInfoOffset =cpu_to_le16 (offsetof(struct smb2_read_req , Buffer)); req->ReadChannelInfoLength = -cpu_to_le16 (sizeof (struct smbd_buffer_descriptor_v1 )); - v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0 ]; +cpu_to_le16 (sizeof (struct smb_direct_buffer_descriptor_v1 )); + v1 = (struct smb_direct_buffer_descriptor_v1 *) &req->Buffer[0 ]; v1->offset =cpu_to_le64 (rdata->mr->mr->iova); v1->token =cpu_to_le32 (rdata->mr->mr->rkey); v1->length =cpu_to_le32 (rdata->mr->mr->length);
@@ -4968,10 +4968,10 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)#ifdef CONFIG_CIFS_SMB_DIRECT /* * If we want to do a server RDMA read, fill in and append -* smbd_buffer_descriptor_v1 to the end of write request +* smb_direct_buffer_descriptor_v1 to the end of write request */ if (smb3_use_rdma_offload (io_parms)) { -struct smbd_buffer_descriptor_v1 *v1; +struct smb_direct_buffer_descriptor_v1 *v1;bool need_invalidate = server->dialect ==SMB30_PROT_ID ; wdata->mr = smbd_register_mr(server->smbd_conn, &wdata->subreq.io_iter,
@@ -4990,8 +4990,8 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) req->WriteChannelInfoOffset =cpu_to_le16 (offsetof(struct smb2_write_req , Buffer)); req->WriteChannelInfoLength = -cpu_to_le16 (sizeof (struct smbd_buffer_descriptor_v1 )); - v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0 ]; +cpu_to_le16 (sizeof (struct smb_direct_buffer_descriptor_v1 )); + v1 = (struct smb_direct_buffer_descriptor_v1 *) &req->Buffer[0 ]; v1->offset =cpu_to_le64 (wdata->mr->mr->iova); v1->token =cpu_to_le32 (wdata->mr->mr->rkey); v1->length =cpu_to_le32 (wdata->mr->mr->length);
fs/smb/client/smbdirect.h +0 -7
@@ -179,13 +179,6 @@ enum smbd_message_type { SMBD_TRANSFER_DATA, }; -/* The packet fields for a registered RDMA buffer */ -struct smbd_buffer_descriptor_v1 { -__le64 offset; -__le32 token; -__le32 length; -} __packed; -/* Maximum number of SGEs used by smbdirect.c in any send work request */ #define SMBDIRECT_MAX_SEND_SGE 6
Signature · 1 line
2.34.1
Stefan Metzmacher
reviewerPATCH 5/5 smb: server: make use of common smb_direct_buffer_descriptor_v1
In reply to Stefan Metzmacher--- fs/smb/server/connection.c | 4 ++-- fs/smb/server/connection.h | 8 ++++---- fs/smb/server/smb2pdu.c | 10 +++++----- fs/smb/server/smb2pdu.h | 8 ++------ fs/smb/server/transport_rdma.c | 6 +++--- fs/smb/server/transport_rdma.h | 2 -- 6 files changed, 16 insertions(+), 22 deletions(-)
fs/smb/server/connection.c +2 -2
@@ -243,7 +243,7 @@ int ksmbd_conn_write(struct ksmbd_work *work)int ksmbd_conn_rdma_read (struct ksmbd_conn *conn,void *buf,unsigned int buflen, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len) {int ret = -EINVAL ;
@@ -257,7 +257,7 @@ int ksmbd_conn_rdma_read(struct ksmbd_conn *conn,int ksmbd_conn_rdma_write (struct ksmbd_conn *conn,void *buf,unsigned int buflen, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len) {int ret = -EINVAL ;
fs/smb/server/connection.h +4 -4
@@ -126,11 +126,11 @@ struct ksmbd_transport_ops { unsigned int remote_key);int (*rdma_read)(struct ksmbd_transport *t,void *buf,unsigned int len, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len);int (*rdma_write)(struct ksmbd_transport *t,void *buf,unsigned int len, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len); };
@@ -155,11 +155,11 @@ bool ksmbd_conn_lookup_dialect(struct ksmbd_conn *c);int ksmbd_conn_write (struct ksmbd_work *work);int ksmbd_conn_rdma_read (struct ksmbd_conn *conn,void *buf,unsigned int buflen, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len);int ksmbd_conn_rdma_write (struct ksmbd_conn *conn,void *buf,unsigned int buflen, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len);void ksmbd_conn_enqueue_request (struct ksmbd_work *work);void ksmbd_conn_try_dequeue_request (struct ksmbd_work *work);
fs/smb/server/smb2pdu.c +5 -5
@@ -6617,7 +6617,7 @@ static noinline int smb2_read_pipe(struct ksmbd_work *work) }static int smb2_set_remote_key_for_rdma (struct ksmbd_work *work, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,__le32 Channel,__le16 ChannelInfoLength) {
@@ -6653,7 +6653,7 @@ static ssize_t smb2_read_rdma_channel(struct ksmbd_work *work,int err; err =ksmbd_conn_rdma_write (work->conn, data_buf, length, - (struct smb2_buffer_desc_v1 *) + (struct smb_direct_buffer_descriptor_v1 *) ((char *)req +le16_to_cpu (req->ReadChannelInfoOffset)),le16_to_cpu (req->ReadChannelInfoLength));if (err)
@@ -6724,7 +6724,7 @@ int smb2_read(struct ksmbd_work *work) goto out; } err =smb2_set_remote_key_for_rdma (work, - (struct smb2_buffer_desc_v1 *) + (struct smb_direct_buffer_descriptor_v1 *) ((char *)req + ch_offset), req->Channel, req->ReadChannelInfoLength);
@@ -6919,7 +6919,7 @@ static ssize_t smb2_write_rdma_channel(struct ksmbd_work *work,return -ENOMEM ; ret =ksmbd_conn_rdma_read (work->conn, data_buf, length, - (struct smb2_buffer_desc_v1 *) + (struct smb_direct_buffer_descriptor_v1 *) ((char *)req +le16_to_cpu (req->WriteChannelInfoOffset)),le16_to_cpu (req->WriteChannelInfoLength));if (ret <0 ) {
@@ -6984,7 +6984,7 @@ int smb2_write(struct ksmbd_work *work) goto out; } err =smb2_set_remote_key_for_rdma (work, - (struct smb2_buffer_desc_v1 *) + (struct smb_direct_buffer_descriptor_v1 *) ((char *)req + ch_offset), req->Channel, req->WriteChannelInfoLength);
fs/smb/server/smb2pdu.h +2 -6
@@ -10,6 +10,8 @@#include "ntlmssp.h" #include "smbacl.h" +#include "../common/smb_direct/smb_direct.h" +/*Create Action Flags*/ #define FILE_SUPERSEDED 0x00000000#define FILE_OPENED 0x00000001
@@ -133,12 +135,6 @@ struct create_posix_rsp {u8 SidBuffer[44 ]; } __packed; -struct smb2_buffer_desc_v1 { -__le64 offset; -__le32 token; -__le32 length; -} __packed; -#define SMB2_0_IOCTL_IS_FSCTL 0x00000001struct smb_sockaddr_in {
fs/smb/server/transport_rdma.c +3 -3
@@ -1354,7 +1354,7 @@ static void write_done(struct ib_cq *cq, struct ib_wc *wc)static int smb_direct_rdma_xmit (struct smb_direct_transport *t,void *buf,int buf_len, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len,bool is_read) {
@@ -1484,7 +1484,7 @@ static int smb_direct_rdma_xmit(struct smb_direct_transport *t,static int smb_direct_rdma_write (struct ksmbd_transport *t,void *buf,unsigned int buflen, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len) { return smb_direct_rdma_xmit(smb_trans_direct_transfort(t), buf, buflen,
@@ -1493,7 +1493,7 @@ static int smb_direct_rdma_write(struct ksmbd_transport *t,static int smb_direct_rdma_read (struct ksmbd_transport *t,void *buf,unsigned int buflen, -struct smb2_buffer_desc_v1 *desc, +struct smb_direct_buffer_descriptor_v1 *desc,unsigned int desc_len) { return smb_direct_rdma_xmit(smb_trans_direct_transfort(t), buf, buflen,
fs/smb/server/transport_rdma.h +0 -2
@@ -7,8 +7,6 @@#ifndef __KSMBD_TRANSPORT_RDMA_H__#define __KSMBD_TRANSPORT_RDMA_H__ -#include "../common/smb_direct/smb_direct.h" -#define SMBD_DEFAULT_IOSIZE (8 * 1024 * 1024)#define SMBD_MIN_IOSIZE (512 * 1024)#define SMBD_MAX_IOSIZE (16 * 1024 * 1024)
Signature · 1 line
2.34.1
Tom Talpey
reviewerRe: [PATCH 1/5] smb: common: split out smb_direct related header files
In reply to Stefan MetzmacherI love the idea. Couple of questions on the pathnames...
Quoted 10 lines · Stefan Metzmacher
This is just a start moving into a common
smb_directlayer.Cc Steve French <[email protected]>Cc Tom Talpey <[email protected]>Cc Long Li <[email protected]>Cc Namjae Jeon <[email protected]>Cc Hyunchul Lee <[email protected]>Signed-off-by Stefan Metzmacher <[email protected]>
Quoted 3 lines
--- fs/smb/common/smb_direct/smb_direct.h | 11 +++++ fs/smb/common/smb_direct/smb_direct_pdu.h | 51 +++++++++++++++++++++++
Why the underscore in "smb_direct", in both components? The protocol doesn't use this, and it seems awkward and search-unfriendly.
Quoted 11 lines
fs/smb/server/transport_rdma.h | 43 +------------------ 3 files changed, 64 insertions(+), 41 deletions(-)create mode 100644
fs/smb/common/smb_direct/smb_direct.hcreate mode 100644fs/smb/common/smb_direct/smb_direct_pdu.hfs/smb/common/smb_direct/smb_direct.h new file +0
-0
fs/smb/common/smb_direct/smb_direct.h line 9
Quoted 9 lines
fs/smb/common/smb_direct/smb_direct.h new file +9
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (C) 2025, Stefan Metzmacher <[email protected]> +*/ + +#ifndef __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_H__ +#define __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_H__ + +#include "smb_direct_pdu.h"
And, why the empty redirection? It seems unnecessary, do I assume it will later contain API signatures for the planned common layer? Perhaps it should say this, to avoid confusion while that work is being done.
I'll review more later, but a first pass looks good!
Tom.
Quoted 117 lines
fs/smb/common/smb_direct/smb_direct.h new file +2
-0+ +#endif /* __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_H__ */ fs/smb/common/smb_direct/smb_direct_pdu.h new file +51
-0@@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (C) 2017, Microsoft Corporation. +* Copyright (C) 2018, LG Electronics. +*/ + +#ifndef __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_PDU_H__ +#define __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_PDU_H__ + +/* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */ +struct smb_direct_negotiate_req { +__le16 min_version; +__le16 max_version; +__le16 reserved; +__le16 credits_requested; +__le32 preferred_send_size; +__le32 max_receive_size; +__le32 max_fragmented_size; +} __packed; + +/* SMB DIRECT negotiation response packet [MS-SMBD] 2.2.2 */ +struct smb_direct_negotiate_resp { +__le16 min_version; +__le16 max_version; +__le16 negotiated_version; +__le16 reserved; +__le16 credits_requested; +__le16 credits_granted; +__le32 status; +__le32 max_readwrite_size; +__le32 preferred_send_size; +__le32 max_receive_size; +__le32 max_fragmented_size; +} __packed; + +#define SMB_DIRECT_RESPONSE_REQUESTED 0x0001 + +/* SMB DIRECT data transfer packet with payload [MS-SMBD] 2.2.3 */ +struct smb_direct_data_transfer { +__le16 credits_requested; +__le16 credits_granted; +__le16 flags; +__le16 reserved; +__le32 remaining_data_length; +__le32 data_offset; +__le32 data_length; +__le32 padding; +__u8 buffer[]; +} __packed; + +#endif /* __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_PDU_H__ */ fs/smb/server/transport_rdma.h +2
-41@@ -7,51 +7,12 @@#ifndef __KSMBD_TRANSPORT_RDMA_H__#define __KSMBD_TRANSPORT_RDMA_H__ +#include "../common/smb_direct/smb_direct.h" +#define SMBD_DEFAULT_IOSIZE (8 * 1024 * 1024)#define SMBD_MIN_IOSIZE (512 * 1024)#define SMBD_MAX_IOSIZE (16 * 1024 * 1024) -/* SMB DIRECT negotiation request packet [MS-SMBD] 2.2.1 */ -struct smb_direct_negotiate_req { -__le16 min_version; -__le16 max_version; -__le16 reserved; -__le16 credits_requested; -__le32 preferred_send_size; -__le32 max_receive_size; -__le32 max_fragmented_size; -} __packed; - -/* SMB DIRECT negotiation response packet [MS-SMBD] 2.2.2 */ -struct smb_direct_negotiate_resp { -__le16 min_version; -__le16 max_version; -__le16 negotiated_version; -__le16 reserved; -__le16 credits_requested; -__le16 credits_granted; -__le32 status; -__le32 max_readwrite_size; -__le32 preferred_send_size; -__le32 max_receive_size; -__le32 max_fragmented_size; -} __packed; - -#define SMB_DIRECT_RESPONSE_REQUESTED 0x0001 - -/* SMB DIRECT data transfer packet with payload [MS-SMBD] 2.2.3 */ -struct smb_direct_data_transfer { -__le16 credits_requested; -__le16 credits_granted; -__le16 flags; -__le16 reserved; -__le32 remaining_data_length; -__le32 data_offset; -__le32 data_length; -__le32 padding; -__u8 buffer[]; -} __packed; -#ifdef CONFIG_SMB_SERVER_SMBDIRECT int ksmbd_rdma_init (void );void ksmbd_rdma_destroy (void );
Re: [PATCH 1/5] smb: common: split out smb_direct related header files
Quoted 18 lines · Tom Talpey
I love the idea. Couple of questions on the pathnames...
Quoted 10 lines · Stefan Metzmacher
This is just a start moving into a common
smb_directlayer.Cc Steve French <[email protected]>Cc Tom Talpey <[email protected]>Cc Long Li <[email protected]>Cc Namjae Jeon <[email protected]>Cc Hyunchul Lee <[email protected]>Signed-off-by Stefan Metzmacher <[email protected]>Quoted 3 lines
--- fs/smb/common/smb_direct/smb_direct.h | 11 +++++ fs/smb/common/smb_direct/smb_direct_pdu.h | 51 +++++++++++++++++++++++
Quoted 2 lines
Why the underscore in "
smb_direct", in both components? The protocol doesn't use this, and it seems awkward and search-unfriendly.
I agree that it would be less confusing if smbdirect instead of smb_direct in the file/directory names
Stefan Metzmacher
reviewerRe: [PATCH 1/5] smb: common: split out smb_direct related header files
In reply to Tom TalpeyAm 27.05.25 um 20:50 schrieb Tom Talpey:
Quoted 17 lines
I love the idea. Couple of questions on the pathnames...
Quoted 10 lines · Stefan Metzmacher
This is just a start moving into a common
smb_directlayer.Cc Steve French <[email protected]>Cc Tom Talpey <[email protected]>Cc Long Li <[email protected]>Cc Namjae Jeon <[email protected]>Cc Hyunchul Lee <[email protected]>Signed-off-by Stefan Metzmacher <[email protected]>Quoted 3 lines
---
fs/smb/common/smb_direct/smb_direct.h | 11 +++++fs/smb/common/smb_direct/smb_direct_pdu.h| 51 +++++++++++++++++++++++
Quoted 2 lines
Why the underscore in "
smb_direct", in both components? The protocol doesn't use this, and it seems awkward and search-unfriendly.
Yes, I'd also prefer smbdirect and I just used it because I had my existing wip driver under that name, but that should not matter.
The other reason was that the existing structures used smb_direct_ as prefix, but I'll also change that.
Quoted 16 lines
Quoted 16 lines
fs/smb/server/transport_rdma.h | 43 +------------------
3 files changed, 64 insertions(+), 41 deletions(-)create mode 100644
fs/smb/common/smb_direct/smb_direct.hcreate mode 100644fs/smb/common/smb_direct/smb_direct_pdu.hfs/smb/common/smb_direct/smb_direct.h new file +5
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (C) 2025, Stefan Metzmacher <[email protected]> +*/ +
Quoted 8 lines
fs/smb/common/smb_direct/smb_direct.h line 9
Quoted 4 lines
fs/smb/common/smb_direct/smb_direct.h new file +4
-0+#ifndef __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_H__ +#define __FS_SMB_COMMON_SMB_DIRECT_SMB_DIRECT_H__ + +#include "smb_direct_pdu.h" And, why the empty redirection? It seems unnecessary, do I assume it will later contain API signatures for the planned common layer? Perhaps it should say this, to avoid confusion while that work is being done.
I'll think about it maybe I'll remove the redirection.
In the end the pdu definitions belong only in a single common .c files, but it will take a lot of steps to get there.
I'll post a v2 tomorrow or next week.
Thanks!
metze