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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB044C4332F for ; Thu, 3 Nov 2022 22:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231670AbiKCWJd (ORCPT ); Thu, 3 Nov 2022 18:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231319AbiKCWJ3 (ORCPT ); Thu, 3 Nov 2022 18:09:29 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C10C20BD1; Thu, 3 Nov 2022 15:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1667513368; x=1699049368; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=0Q4UYJo0r4CAvLo84TRF+qOpG8p4iPvKnthKy/ejt7k=; b=qwtuK/tBxQxh2U3gqsPoTJchQYr7OIwpIZ+HladWMYgbVyLH93GYNJNH /jFxkQunMlwTB+UjZLrFe4mvA6lcysZj4Yxw0CuNES6IHbe8qj6mKeNOY /IrHa0p+aWcbrgTQzcsc9GkD1RfMQMqo+i2HZGvhataVUCl2jxi4qiMN4 Q=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-01.qualcomm.com with ESMTP; 03 Nov 2022 15:09:27 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2022 15:09:27 -0700 Received: from [10.110.42.219] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 3 Nov 2022 15:09:26 -0700 Message-ID: Date: Thu, 3 Nov 2022 15:09:25 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v6 10/21] gunyah: rsc_mgr: Add resource manager RPC core To: Greg Kroah-Hartman CC: Jassi Brar , Bjorn Andersson , Murali Nalajala , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Prakruthi Deepak Heragu , Andy Gross , Dmitry Baryshkov , , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , "Will Deacon" , Catalin Marinas , "Arnd Bergmann" , Srinivas Kandagatla , Amol Maheshwari , Kalle Valo , , , , References: <20221026185846.3983888-1-quic_eberman@quicinc.com> <20221026185846.3983888-11-quic_eberman@quicinc.com> <3d2858fe-ea3e-159c-faff-5052cba1e08c@quicinc.com> <28eaa4bd-a9ee-c415-57c4-a9a56ffeef18@quicinc.com> Content-Language: en-US From: Elliot Berman In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/2/2022 5:22 PM, Greg Kroah-Hartman wrote: > On Wed, Nov 02, 2022 at 11:04:45AM -0700, Elliot Berman wrote: >>>>>> +/* Resource Manager Header */ >>>>>> +struct gh_rm_rpc_hdr { >>>>>> + u8 version : 4, hdr_words : 4; >>>>>> + u8 type : 2, fragments : 6; >>>>> >>>>> Ick, that's hard to read. One variable per line please? >>>> >>>> Ack. >>>> >>>>> And why the bit packed stuff? Are you sure this is the way to do this? >>>>> Why not use a bitmask instead? >>>>> >>>> >>>> I felt bit packed implementation is cleaner and easier to map to >>>> understanding what the fields are used for. >>> >>> Ah, so this isn't what is on the "wire", then don't use a bitfield like >>> this, use a real variable and that will be faster and simpler to >>> understand. >>> >> >> This is what's on the "wire". Whether I use bitfield or bit packed would be >> functionally the same and is just a cosmetic change IMO. > > Ah, that wasn't obvious at all. > > Usually using bitfields like this for "wire" protocols is not a good > idea (endian issues and all of that.) Please use a bitmask instead, as > that way you know exactly what is happening, and the compiler can > usually generate much better code overall. > > And as this is on the wire, please specify the endian values, _AND_ use > the proper kernel types for stuff that goes between user/kernel or > kernel/hardware, as you are not doing that here. Ack