[PATCH v2 01/12] smb: smbdirect: add smbdirect_pdu.h with protocol definitions
Namjae Jeon
linkinjeon at kernel.org
Wed May 28 23:28:53 UTC 2025
On Thu, May 29, 2025 at 1:02 AM Stefan Metzmacher <metze at samba.org> wrote:
>
> This is just a start moving into a common smbdirect layer.
>
> It will be used in the next commits...
>
> Cc: Steve French <smfrench at gmail.com>
> Cc: Tom Talpey <tom at talpey.com>
> Cc: Long Li <longli at microsoft.com>
> Cc: Namjae Jeon <linkinjeon at kernel.org>
> Cc: Hyunchul Lee <hyc.lee at gmail.com>
> Cc: Meetakshi Setiya <meetakshisetiyaoss at gmail.com>
> Cc: linux-cifs at vger.kernel.org
> Cc: samba-technical at lists.samba.org
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
> fs/smb/common/smbdirect/smbdirect_pdu.h | 55 +++++++++++++++++++++++++
> 1 file changed, 55 insertions(+)
> create mode 100644 fs/smb/common/smbdirect/smbdirect_pdu.h
>
> diff --git a/fs/smb/common/smbdirect/smbdirect_pdu.h b/fs/smb/common/smbdirect/smbdirect_pdu.h
> new file mode 100644
> index 000000000000..ae9fdb05ce23
> --- /dev/null
> +++ b/fs/smb/common/smbdirect/smbdirect_pdu.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Copyright (c) 2017 Stefan Metzmacher
Isn't it 2025? It looks like a typo.
And why do you split the existing one into multiple header
files(smbdirect_pdu.h, smbdirect_socket.h, smbdirect.h)?
> + */
> +
> +#ifndef __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_PDU_H__
> +#define __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_PDU_H__
> +
> +#define SMBDIRECT_V1 0x0100
> +
> +/* SMBD negotiation request packet [MS-SMBD] 2.2.1 */
> +struct smbdirect_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;
> +
> +/* SMBD negotiation response packet [MS-SMBD] 2.2.2 */
> +struct smbdirect_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 SMBDIRECT_DATA_MIN_HDR_SIZE 0x14
> +#define SMBDIRECT_DATA_OFFSET 0x18
> +
> +#define SMBDIRECT_FLAG_RESPONSE_REQUESTED 0x0001
> +
> +/* SMBD data transfer packet with payload [MS-SMBD] 2.2.3 */
> +struct smbdirect_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_SMBDIRECT_SMBDIRECT_PDU_H__ */
> --
> 2.34.1
>
>
More information about the samba-technical
mailing list