From patchwork Thu Jan 25 05:18:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10183625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 06F7F60233 for ; Thu, 25 Jan 2018 05:19:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFF0C289E6 for ; Thu, 25 Jan 2018 05:19:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2986289E9; Thu, 25 Jan 2018 05:19:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_TVD_MIME_EPI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A460E289E6 for ; Thu, 25 Jan 2018 05:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750769AbeAYFTW (ORCPT ); Thu, 25 Jan 2018 00:19:22 -0500 Received: from mail-pf0-f173.google.com ([209.85.192.173]:45504 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbeAYFTV (ORCPT ); Thu, 25 Jan 2018 00:19:21 -0500 Received: by mail-pf0-f173.google.com with SMTP id a88so4989970pfe.12 for ; Wed, 24 Jan 2018 21:19:21 -0800 (PST) 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=zj+Yil6UU1kHudXi/jR735IvAQzZTuMAyL5Jtvi5/vg=; b=n45oy4o615NEcZXVQRrJmdXkpFPXmpcClDj6zKCVEElZKvveV5sguxdPZ2031ALDZU IizQDxKNR4ByLqrwKCMlx29HoCTI/19KUx0j+vhFErirtFvGlLvbaaC0GMrCqAqySuIU q2h5foql9BmtxX0eVHeefTEBuxJKSCDCgK6WebWXLMxSG7TGOi+tat732VFwlpwAl4O0 p0BMtUdOPF7JahNZyJUgowArD8sitnTBQrnDOJ3bXM0WYcISwgfDG6pk/UeLBNfLzayQ tvOTPEqqEcnPl6NPWiZH0aQBL/S36ditjq0dq9zsYoEzKlpPpnxhm5rjIASRO4jZKkSY OhoA== 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=zj+Yil6UU1kHudXi/jR735IvAQzZTuMAyL5Jtvi5/vg=; b=V44F8BnmlquqLXaewKIsFGKbR6BRk8Rvbf3oA1aaW1xVG1a2PuMes4Csjsz7FbtaTo c3DCLm4Dxuy3P5IHCTGQ+eVKgeWk5zGICvSnmXI5n7XgR/bWkvHaOmatZKqEqVa1/+ZD saNUUK7uM2rjvRziIUTIifp9SiXmAQikRvk5DqQSsD5J6s3r+nz/1LFPa7IRBNe1B1ZI /LQVIZQslJWVTtNbYRDqyI6j5xUQPXYjzXuXeSpfBQ8H0UcOrpa6S2H/8+ctS3Bd9Na6 Ek3q4j+z3TZYskWA5HTj9NbuK384HZz4VmzQrMwso5xZ6uzsb8D7HCoPLpow3UVYfn0J pCKw== X-Gm-Message-State: AKwxytcyQ8khg90u3TyNyStZ23ffUOjEzezZHjY7ECGZO6O90PBl2FP+ eXQsbYbjVejkXmYYZbgSWKaTAzoJABnVJNAwCUJV+g== X-Google-Smtp-Source: AH8x225NeP/lQNpk8PY0xRed3oXhP93g7kUfWlUkchn1EqIRCDi9x9yUXwAmUDFKOY/q5g+FivJesJGMeyl+LAtS83o= X-Received: by 10.99.109.129 with SMTP id i123mr11853961pgc.346.1516857560823; Wed, 24 Jan 2018 21:19:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.172.15 with HTTP; Wed, 24 Jan 2018 21:18:59 -0800 (PST) From: Steve French Date: Wed, 24 Jan 2018 23:18:59 -0600 Message-ID: Subject: [SMB3][PATCH] cleanup some minor endian warnings in smbdirect (SMB3 RDMA) code. To: CIFS , Long Li Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleans up various minor warnings that sparse endian checking showed in the recent SMB3 RDMA patch series Reviewed-by: Ronnie Sahlberg From 6964f19660775953392cb01b56d7465ede1acd5e Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 24 Jan 2018 23:07:41 -0600 Subject: [PATCH] [SMB3] Cleanup some minor endian issues in smb3 rdma Minor cleanup of some sparse warnings (including a few misc endian fixes for the new smb3 rdma code) Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 22 +++++++++++----------- fs/cifs/smb2pdu.h | 14 +++++++------- fs/cifs/smbdirect.c | 5 +++-- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 17b7f3aed195..63778ac22fd9 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2463,13 +2463,13 @@ smb2_new_read_req(void **buf, unsigned int *total_len, if (need_invalidate) req->Channel = SMB2_CHANNEL_RDMA_V1; req->ReadChannelInfoOffset = - offsetof(struct smb2_read_plain_req, Buffer); + cpu_to_le16(offsetof(struct smb2_read_plain_req, Buffer)); req->ReadChannelInfoLength = - sizeof(struct smbd_buffer_descriptor_v1); + cpu_to_le16(sizeof(struct smbd_buffer_descriptor_v1)); v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0]; - v1->offset = rdata->mr->mr->iova; - v1->token = rdata->mr->mr->rkey; - v1->length = rdata->mr->mr->length; + 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); *total_len += sizeof(*v1) - 1; } @@ -2840,18 +2840,18 @@ smb2_async_writev(struct cifs_writedata *wdata, req->Length = 0; req->DataOffset = 0; req->RemainingBytes = - (wdata->nr_pages-1)*PAGE_SIZE + wdata->tailsz; + cpu_to_le32((wdata->nr_pages-1)*PAGE_SIZE + wdata->tailsz); req->Channel = SMB2_CHANNEL_RDMA_V1_INVALIDATE; if (need_invalidate) req->Channel = SMB2_CHANNEL_RDMA_V1; req->WriteChannelInfoOffset = - offsetof(struct smb2_write_req, Buffer); + cpu_to_le16(offsetof(struct smb2_write_req, Buffer)); req->WriteChannelInfoLength = - sizeof(struct smbd_buffer_descriptor_v1); + cpu_to_le16(sizeof(struct smbd_buffer_descriptor_v1)); v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0]; - v1->offset = wdata->mr->mr->iova; - v1->token = wdata->mr->mr->rkey; - v1->length = wdata->mr->mr->length; + 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); } #endif /* 4 for rfc1002 length field and 1 for Buffer */ diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 19d34881815f..6eb9f9691ed4 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h @@ -830,9 +830,9 @@ struct smb2_flush_rsp { #define SMB2_READFLAG_READ_UNBUFFERED 0x01 /* Channel field for read and write: exactly one of following flags can be set*/ -#define SMB2_CHANNEL_NONE 0x00000000 -#define SMB2_CHANNEL_RDMA_V1 0x00000001 /* SMB3 or later */ -#define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000002 /* SMB3.02 or later */ +#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 */ /* SMB2 read request without RFC1001 length at the beginning */ struct smb2_read_plain_req { @@ -847,8 +847,8 @@ struct smb2_read_plain_req { __le32 MinimumCount; __le32 Channel; /* MBZ except for SMB3 or later */ __le32 RemainingBytes; - __le16 ReadChannelInfoOffset; /* Reserved MBZ */ - __le16 ReadChannelInfoLength; /* Reserved MBZ */ + __le16 ReadChannelInfoOffset; + __le16 ReadChannelInfoLength; __u8 Buffer[1]; } __packed; @@ -877,8 +877,8 @@ struct smb2_write_req { __u64 VolatileFileId; /* opaque endianness */ __le32 Channel; /* Reserved MBZ */ __le32 RemainingBytes; - __le16 WriteChannelInfoOffset; /* Reserved MBZ */ - __le16 WriteChannelInfoLength; /* Reserved MBZ */ + __le16 WriteChannelInfoOffset; + __le16 WriteChannelInfoLength; __le32 Flags; __u8 Buffer[1]; } __packed; diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index f9234ed83a60..5130492847eb 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1855,7 +1855,8 @@ struct smbd_connection *smbd_get_connection( * consumed. But this will require more changes to upper layer code, and also * need to consider packet boundaries while they still being reassembled. */ -int smbd_recv_buf(struct smbd_connection *info, char *buf, unsigned int size) +static int smbd_recv_buf(struct smbd_connection *info, char *buf, + unsigned int size) { struct smbd_response *response; struct smbd_data_transfer *data_transfer; @@ -1992,7 +1993,7 @@ int smbd_recv_buf(struct smbd_connection *info, char *buf, unsigned int size) * to_read: the length of data to read * return value: actual data read */ -int smbd_recv_page(struct smbd_connection *info, +static int smbd_recv_page(struct smbd_connection *info, struct page *page, unsigned int to_read) { int ret; -- 2.14.3