linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: "linux-wireless\@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 5/5] wifi: rtw89: use struct to access register-based H2C/C2H
Date: Fri, 26 May 2023 14:49:12 +0300	[thread overview]
Message-ID: <87y1lbjosn.fsf@kernel.org> (raw)
In-Reply-To: <709fd6a89f3f4a637410c0974b32154a8a1b89fe.camel@realtek.com> (Ping-Ke Shih's message of "Fri, 26 May 2023 11:46:21 +0000")

Ping-Ke Shih <pkshih@realtek.com> writes:

> On Thu, 2023-05-25 at 19:07 +0300, Kalle Valo wrote:
>
>> 
>> Ping-Ke Shih <pkshih@realtek.com> writes:
>> 
>> > The register-based H2C/C2H are used to exchange commands and events with
>> > firmware. The exchange data is limited, but it is relatively simple,
>> > because it can work before HCI initialization. To make these code clean,
>> > use struct to access them. This patch doesn't change logic at all.
>> > 
>> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
>> 
>> [...]
>> 
>> > --- a/drivers/net/wireless/realtek/rtw89/fw.h
>> > +++ b/drivers/net/wireless/realtek/rtw89/fw.h
>> > @@ -18,15 +18,51 @@ enum rtw89_fw_dl_status {
>> >       RTW89_FWDL_WCPU_FW_INIT_RDY = 7
>> >  };
>> > 
>> > -#define RTW89_GET_C2H_HDR_FUNC(info) \
>> > -     u32_get_bits(info, GENMASK(6, 0))
>> > -#define RTW89_GET_C2H_HDR_LEN(info) \
>> > -     u32_get_bits(info, GENMASK(11, 8))
>> > +struct rtw89_c2hreg_hdr {
>> > +     u32 w0;
>> > +};
>> 
>> Why this is u32? Shouldn't it be __le32?
>> 
>> > +#define RTW89_C2HREG_HDR_FUNC_MASK GENMASK(6, 0)
>> > +#define RTW89_C2HREG_HDR_ACK BIT(7)
>> > +#define RTW89_C2HREG_HDR_LEN_MASK GENMASK(11, 8)
>> > +#define RTW89_C2HREG_HDR_SEQ_MASK GENMASK(15, 12)
>> > +
>> > +struct rtw89_c2hreg_phycap {
>> > +     u32 w0;
>> > +     u32 w1;
>> > +     u32 w2;
>> > +     u32 w3;
>> > +} __packed;
>> 
>> Here as well? And I saw more in the patch.
>> 
>> Of course these were already there so isn't a problem introduced by this
>> patchset, but I started wondering if we are missing some little endian
>> types?
>> 
>
> I had the same question as yours when I did this conversion, but they
> are correct because we access these H2C commands/C2H events via registers
> which are CPU order.

Ah, thanks for the explanation.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

      reply	other threads:[~2023-05-26 11:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 12:25 [PATCH 0/5] wifi: rtw89: use struct to access register-based H2C/C2H and RX related info Ping-Ke Shih
2023-05-22 12:25 ` [PATCH 1/5] wifi: rtw89: add chip_ops::query_rxdesc() and rxd_len as helpers to support newer chips Ping-Ke Shih
2023-05-25 16:13   ` Kalle Valo
2023-05-22 12:25 ` [PATCH 2/5] wifi: rtw89: use struct and le32_get_bits to access RX info Ping-Ke Shih
2023-05-22 12:25 ` [PATCH 3/5] wifi: rtw89: use struct and le32_get_bits() to access received PHY status IEs Ping-Ke Shih
2023-05-22 12:25 ` [PATCH 4/5] wifi: rtw89: use struct and le32_get_bits() to access RX descriptor Ping-Ke Shih
2023-05-22 12:25 ` [PATCH 5/5] wifi: rtw89: use struct to access register-based H2C/C2H Ping-Ke Shih
2023-05-25 16:07   ` Kalle Valo
2023-05-26 11:46     ` Ping-Ke Shih
2023-05-26 11:49       ` Kalle Valo [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=87y1lbjosn.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /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).