From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35C67C04AAC for ; Mon, 20 May 2019 20:12:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1218620815 for ; Mon, 20 May 2019 20:12:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YU8JxaWH"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="aK3eCG3Z"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="aK3eCG3Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1218620815 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HLtjUTLE8vhh6lLa3ATKLqca5zzmvo4KidU115Uq6gM=; b=YU8JxaWHpKe2h6Mqn7CiIXlCR pX+p3BVQXSyfj+xraUqZFy4X/nWOgKYj806dt+HkJBcPkreDtYfzZKdWQ9/RLsEsJT1DG2Eu1cOLT tCleiZa6WJV+w3hvd+wHyf+ZcWLndZFzDIGzVWq2HBqoQPJz2LFCxdO3w+8Jsvx2j6bBlOiGQ65Fn R3gpk9G5a5UwKXbrIr3YqqEHWZmi4QvoniMzW8D4QvLhSHZDJkhjNVS1t75Vi2I0xIfbHVSs7exS2 22l+omKkVwkrteuseGO847oDZ6tRWx1IBVyBiZTwCxIEnc4jW3uQLU4w7qJS5DS2n6PMPL/a7b+xf q200hk+rA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSodc-0006jD-BS; Mon, 20 May 2019 20:12:00 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSodY-0006it-FZ for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 20:11:58 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B67CC608D4; Mon, 20 May 2019 20:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1558383115; bh=apvzPomu1xSc+1mrdcgyoLfkXvPIEgcA1K8kh3yrRGo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aK3eCG3ZTRwKIyMF1zLEDfYHaNUdlEL6R2Jj5MbBoZlpAsxVxYs39InfNOhOrgGSR /QEC1YieTnLxZG8eZoLuxGuQVugx98JMstIzBJGFfCIMmr+oSX50g6SjyoHCZlb0qQ 5Hm+5dyBW6SlsV6BqQJbwGL2y0gQFfHPoJxOVAEs= Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 3DA5F60274; Mon, 20 May 2019 20:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1558383115; bh=apvzPomu1xSc+1mrdcgyoLfkXvPIEgcA1K8kh3yrRGo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aK3eCG3ZTRwKIyMF1zLEDfYHaNUdlEL6R2Jj5MbBoZlpAsxVxYs39InfNOhOrgGSR /QEC1YieTnLxZG8eZoLuxGuQVugx98JMstIzBJGFfCIMmr+oSX50g6SjyoHCZlb0qQ 5Hm+5dyBW6SlsV6BqQJbwGL2y0gQFfHPoJxOVAEs= MIME-Version: 1.0 Date: Mon, 20 May 2019 14:11:55 -0600 From: Subash Abhinov Kasiviswanathan To: Alex Elder Subject: Re: [PATCH 1/8] net: qualcomm: rmnet: fix struct rmnet_map_header In-Reply-To: <20190520135354.18628-2-elder@linaro.org> References: <20190520135354.18628-1-elder@linaro.org> <20190520135354.18628-2-elder@linaro.org> Message-ID: X-Sender: subashab@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_131156_557758_A9136BA5 X-CRM114-Status: GOOD ( 17.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: syadagir@codeaurora.org, ejcaruso@google.com, arnd@arndb.de, netdev@vger.kernel.org, ilias.apalodimas@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, david.brown@linaro.org, agross@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, davem@davemloft.net, cpratapa@codeaurora.org, benchan@google.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2019-05-20 07:53, Alex Elder wrote: > The C bit-fields in the first byte of the rmnet_map_header structure > are defined in the wrong order. The first byte should be formatted > this way: > +------- reserved_bit > | +----- cd_bit > | | > v v > +-----------+-+-+ > | pad_len |R|C| > +-----------+-+-+ > 7 6 5 4 3 2 1 0 <-- bit position > > But the C bit-fields that define the first byte are defined this way: > u8 pad_len:6; > u8 reserved_bit:1; > u8 cd_bit:1; > If the above illustration is supposed to be in network byte order, then it is wrong. The documentation has the definition for the MAP packet. Packet format - Bit 0 1 2-7 8 - 15 16 - 31 Function Command / Data Reserved Pad Multiplexer ID Payload length Bit 32 - x Function Raw Bytes The driver was written assuming that the host was running ARM64, so the structs are little endian. (I should have made it compatible with big and little endian earlier so that is my fault). In any case, this patch on its own will break the data operation on ARM64, so it needs to be folded with other patches. > And although this isn't portable, I can state that when I build it > the result puts the bit-fields in the wrong location (e.g., the > cd_bit is in bit position 7, when it should be position 0). > > Fix this by reordering the definitions of these struct members. > Upcoming patches will reimplement these definitions portably. > > Signed-off-by: Alex Elder > --- > drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h > b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h > index 884f1f52dcc2..b1ae9499c0b2 100644 > --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h > +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h > @@ -40,9 +40,9 @@ enum rmnet_map_commands { > }; > > struct rmnet_map_header { > - u8 pad_len:6; > - u8 reserved_bit:1; > u8 cd_bit:1; > + u8 reserved_bit:1; > + u8 pad_len:6; > u8 mux_id; > __be16 pkt_len; > } __aligned(1); -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel