From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
To: Alex Elder <elder@linaro.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Arnd Bergmann <arnd@arndb.de>, David Miller <davem@davemloft.net>
Cc: Networking <netdev@vger.kernel.org>
Subject: Re: [PATCH RFC] net: qualcomm: rmnet: Move common struct definitions to include
Date: Tue, 21 May 2019 23:47:38 -0600 [thread overview]
Message-ID: <c9da7461c054f90d641db4a97b5ba2f5@codeaurora.org> (raw)
In-Reply-To: <e1b27721-19ff-2ae9-2885-90a7948f774f@linaro.org>
>>> I think I'd just duplicate the structure definitions then, to avoid
>>> having
>>> the bitfield definitions in a common header and using them in the new
>>> driver.
>>>
>>
>> Doing would allow each driver to represent the bits as suitable, at
>> the
>> cost of some duplication and confusion. Confusion, because it doesn't
>> resolve the question of what the right bit order actually is.
>
If we duplicate this definition, then it will be the third instance of
map header in kernel (1 in rmnet, 1 in qmi_wwan, 1 in ipa).
> Subash, if you don't mind, please acknowledge that again here
> so everyone knows.
>
>> Subash stated yesterday that bit 0 is "CD", which in the current
>> struct
>> is represented as the 8th bit, while Alex's patch changes the
>> definition
>> so that this bit is the lsb. I.e. I read Subash answer as confirming
>> that patch 1/8 from Alex is correct.
>
> I'm not sure about that but I don't want to confuse things further.
>
Data over the wire is always big endian a.k.a network byte order.
When looking at the bits in the order in which they are seen in the
network,
the command_data bit is the 0th bit. This is what is present in the
rmnet
documentation which I had shared.
The struct definitions which are in the rmnet_map.h headers
are in little endian because that is what my ARM64 devices are using.
In little endian, the bits in the byte are read in the opposite order
i.e. most significant bit (7th) is command_data.
The addition of definitions for big endian in if_rmnet.h should now
cover any host supporting big endian bit schemes in addition to little
endian systems like ARM64.
> I have exchanged a few private messages with Subash. He has said
> that it is the high-order bit that indicates whether a QMAP packet
> contains a command (1) or data (0). That bit might be extracted
> this way:
>
> u8 byte = *(u8 *)skb->data;
> bool command = !!(byte & 0x80);
>
!!(byte & 0x80) gives the correct value of command_data bit.
>> Subash, as we're not addressing individual bits in this machine, so
>> given a pointer map_hdr to a struct rmnet_map_header, which of the
>> following ways would give you the correct value of pad_len:
>>
>> u8 p = *(char*)map_hdr;
>> pad_len = p & 0x3f;
>>
p & 0x3f gives the correct value of pad_len.
>> or:
>>
>> u8 p = *(char*)map_hdr;
>> pad_len = p >> 2;
>
> My new understanding is it's the latter.
>
>> PS. I do prefer the two drivers share the definition of these
>> structures...
>
> I agree with you completely. I don't think it makes sense to
> have two definitions of the same structure. Subash wants to
> reduce the impact my changes have on the "rmnet" driver, but
> duplicating things makes things worse, not better. The IPA
> driver *assumes* it is talking to the rmnet driver; their
> interface definition should be common...
>
That is right. If David has no objections to this patch,
then Alex can just rebase the ipa changes over this instead of
his rmnet series.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
prev parent reply other threads:[~2019-05-22 5:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 19:35 [PATCH RFC] net: qualcomm: rmnet: Move common struct definitions to include Subash Abhinov Kasiviswanathan
2019-05-21 20:45 ` Arnd Bergmann
2019-05-21 21:08 ` Bjorn Andersson
2019-05-21 21:50 ` Alex Elder
2019-05-22 5:47 ` Subash Abhinov Kasiviswanathan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c9da7461c054f90d641db4a97b5ba2f5@codeaurora.org \
--to=subashab@codeaurora.org \
--cc=arnd@arndb.de \
--cc=bjorn.andersson@linaro.org \
--cc=davem@davemloft.net \
--cc=elder@linaro.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).