From patchwork Sun Oct 4 22:47:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 11815959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 91852618 for ; Sun, 4 Oct 2020 22:48:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70384206B5 for ; Sun, 4 Oct 2020 22:48:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="juF7cN9M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725836AbgJDWsA (ORCPT ); Sun, 4 Oct 2020 18:48:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725834AbgJDWsA (ORCPT ); Sun, 4 Oct 2020 18:48:00 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23BECC0613CE for ; Sun, 4 Oct 2020 15:47:58 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id p15so1393889ljj.8 for ; Sun, 04 Oct 2020 15:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=pMnBbCePh/4+eo6N49GviXm6Kl/5L2NkhG4mqS3bcgw=; b=juF7cN9M7twL8wFpHKiKM4MW3h/lsEBYe9/2TexVS6b2bCYrwnYgRTn1g+q594CzHo Cxc7Y4ZoGUwKkihV9GuDsMbWRLqewvUTVsyVdh1M6w70TRc/KHBNf/8lZ6zs7sJbB/3p C1vs62gZQt5VbJiPNFqsL57kWikKnW3d1nGxDuFism8yBdy08azfw2+B3MqcUNKHxpAQ ZFhbZYD1UtOugKeWM15KdLE+w52V2Nvby3/cSoN3vlAPrt7e7JjcZDTInIopHlD2s9wI X5GasWhIKsAl4OThKMAZpOkVUEAq7q+h3eVt8v2EiKOc1ZHMmhOVhha6m8MatwUZXMrm oEng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=pMnBbCePh/4+eo6N49GviXm6Kl/5L2NkhG4mqS3bcgw=; b=rg+h6RCrIPm8LseTpiEri5JvLYVAzxBa5PloEN6953aqZU2hbOFP9TcYPP3sQ6cqwf LpoUdUoPQNoZPYsbNAjtoAsFNmy29XvH8TC3Qx3FXwLsxGMqitxvJ17W57oc+l7j889V VoPhz+8ixEGBnOMGsbVyjb4kSVAFCDMtjWwT7gekM/STr6Qq7gZaEnL2hrkqVEdikUWU MPLE7wVHMjBI4MW0X27Z3kBd+C4Rjt0OVAfGUDFteSoc6hwppGywOZ0HqNDDsIuCKaHp /xNkWQbZMIW0+09shKQuqtmI6F1GN+/4NTpVzd1uIx5O7JskVBTRgu//xNC5naosL7Ex rsMQ== X-Gm-Message-State: AOAM5314Mt4miFsVj3KGGkGVs1CePuXnGAGIoMZpnuHBFtzqFoxk5lUp Bl/8/wYfgI60LZquKdJUezvLxsGjfS8vMz9sDxAJN3lzgAk= X-Google-Smtp-Source: ABdhPJxB1itGCo0o2stYmcsKwCD12iy2+kIFvJgGA+1lHRaQCnOzkD0eME5IkYIDQCrZIA7jd0VdZ59GUi9vV1zpImw= X-Received: by 2002:a2e:a376:: with SMTP id i22mr1012152ljn.325.1601851676341; Sun, 04 Oct 2020 15:47:56 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Sun, 4 Oct 2020 17:47:45 -0500 Message-ID: Subject: [SMB3.1.1][PATCHES] update protocol definitions from recent MS-SMB2 To: CIFS Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Patches to updated smb2pdu.h to match the changes released in MS-SMB2 protocol documentation. From ac98c5642ff24c07ec98791b4a3253de23821449 Mon Sep 17 00:00:00 2001 From: Steve French Date: Sun, 4 Oct 2020 17:42:27 -0500 Subject: [PATCH 2/2] [smb3.1.1] update structure definitions from updated protocol documentation MS-SMB2 was updated recently to include new protocol definitions for updated compression payload header and new RDMA transform capabilities Update structure definitions in smb2pdu.h to match Signed-off-by: Steve French --- fs/cifs/smb2pdu.h | 64 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 7b6db162f516..56d983c8afad 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h @@ -153,10 +153,14 @@ struct smb2_compression_transform_hdr { } __packed; /* See MS-SMB2 2.2.42.1 */ +#define SMB2_COMPRESSION_FLAG_NONE 0x0000 +#define SMB2_COMPRESSION_FLAG_CHAINDED 0x0001 + struct compression_payload_header { - __le16 AlgorithmId; - __le16 Reserved; - __le32 Length; + __le16 CompressionAlgorithm; + __le16 Flags; + __le32 Length; /* length of compressed playload including field below if present */ + /* __le32 OriginalPayloadSize; */ /* optional */ } __packed; /* See MS-SMB2 2.2.42.2 */ @@ -167,6 +171,26 @@ struct compression_pattern_payload_v1 { __le32 Repetitions; } __packed; +/* See MS-SMB2 2.2.43 */ +struct smb2_rdma_transform { + __le16 RdmaDescriptorOffset; + __le16 RdmaDescriptorLength; + __le32 Channel; /* for values see channel description in smb2 read above */ + __le16 TransformCount; + __le16 Reserved1; + __le32 Reserved2; +} __packed; + +struct smb2_rdma_encryption_transform { + __le16 TransformType;; + __le16 SignatureLength; + __le16 NonceLength; + __u16 Reserved; + __u8 Signature[]; /* variable length */ + /* u8 Nonce[] */ + /* followed by padding */ +} __packed; + /* * SMB2 flag definitions */ @@ -297,6 +321,8 @@ struct smb2_negotiate_req { #define SMB2_ENCRYPTION_CAPABILITIES cpu_to_le16(2) #define SMB2_COMPRESSION_CAPABILITIES cpu_to_le16(3) #define SMB2_NETNAME_NEGOTIATE_CONTEXT_ID cpu_to_le16(5) +#define SMB2_TRANSPORT_CAPABILITIES cpu_to_le16(6) +#define SMB2_RDMA_TRANSFORM_CAPABILITIES cpu_to_le16(7) #define SMB2_POSIX_EXTENSIONS_AVAILABLE cpu_to_le16(0x100) struct smb2_neg_context { @@ -353,10 +379,10 @@ struct smb2_encryption_neg_context { struct smb2_compression_capabilities_context { __le16 ContextType; /* 3 */ __le16 DataLength; - __u32 Flags; + __u32 Reserved; __le16 CompressionAlgorithmCount; __u16 Padding; - __u32 Reserved1; + __u32 Flags; __le16 CompressionAlgorithms[3]; } __packed; @@ -365,12 +391,31 @@ struct smb2_compression_capabilities_context { * Its struct simply contains NetName, an array of Unicode characters */ struct smb2_netname_neg_context { - __le16 ContextType; /* 0x100 */ + __le16 ContextType; /* 5 */ __le16 DataLength; __le32 Reserved; __le16 NetName[]; /* hostname of target converted to UCS-2 */ } __packed; +/* + * For rdma transform capabilities context see MS-SMB2 2.2.3.1.6 + * and 2.2.4.1.5 + */ + +/* RDMA Transform IDs */ +#define SMB2_RDMA_TRANSFORM_NONE 0x0000 +#define SMB2_RDMA_TRANSFORM_ENCRYPTION 0x0001 + +struct smb2_rdma_transform_capabilities_context { + __le16 ContextType; /* 7 */ + __le16 DataLength; + __u32 Reserved; + __le16 TransformCount; + __u16 Reserved1; + __u32 Reserved2; + __le16 RDMATransformIds[1]; +} __packed; + #define POSIX_CTXT_DATA_LEN 16 struct smb2_posix_neg_context { __le16 ContextType; /* 0x100 */ @@ -1180,6 +1225,7 @@ struct smb2_flush_rsp { #define SMB2_CHANNEL_NONE cpu_to_le32(0x00000000) #define SMB2_CHANNEL_RDMA_V1 cpu_to_le32(0x00000001) /* SMB3 or later */ #define SMB2_CHANNEL_RDMA_V1_INVALIDATE cpu_to_le32(0x00000002) /* >= SMB3.02 */ +#define SMB2_CHANNEL_RDMA_TRANSFORM cpu_to_le32(0x00000003) /* >= SMB3.02, only used on write */ /* SMB2 read request without RFC1001 length at the beginning */ struct smb2_read_plain_req { @@ -1199,6 +1245,10 @@ struct smb2_read_plain_req { __u8 Buffer[1]; } __packed; +/* Read flags */ +#define SMB2_READFLAG_RESPONSE_NONE 0x00000000 +#define SMB2_READFLAG_RESPONSE_RDMA_TRANSFORM 0x00000001 + struct smb2_read_rsp { struct smb2_sync_hdr sync_hdr; __le16 StructureSize; /* Must be 17 */ @@ -1206,7 +1256,7 @@ struct smb2_read_rsp { __u8 Reserved; __le32 DataLength; __le32 DataRemaining; - __u32 Reserved2; + __u32 Flags; __u8 Buffer[1]; } __packed; -- 2.25.1