Thread (55 messages) flat view 55 messages, 6 authors, 2021-10-12

Re: [PATCH v6 06/24] rtw89: add files to download and communicate with firmware

From: Kalle Valo <hidden>
Date: 2021-10-01 15:55:46

Ping-Ke Shih [off-list ref] writes:
The firmware must be downloaded right after HCI basic initialization, and
then we can obtain hardware capabilities that are used to do mac80211
register hw.

To download firmware, we need to parse the header to know how many sections
the firmware has, and then download each section to proper location.

We introduce H2C and C2H to do bi-direction communication with firmware,
and both support packet-based and register-based methods.
Normally, we use packet-based H2C/C2H, because it has no number and size
limits. In contrast, register-based H2C/C2H has only one message and
fix-four-dword in size.

Header size of packet-based H2C/C2H is eight bytes (two dwords), which uses
a hierarchical IDs, containing type, category, class and function, to
classify a H2C or C2H command.

When a C2H is received in interrupt context, we don't process it right
there, but queue the skb and wake up a ieee80211 work to handle the skb.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
[...]
+static __always_inline void RTW89_SET_FWCMD(u8 *cmd, u32 val, u8 offset, u32 mask)
+{
+	u32 *cmd32 = (u32 *)cmd;
+
+	le32p_replace_bits((__le32 *)(cmd32 + offset), val, mask);
+}
+
+static __always_inline void RTW89_SET_FWCMD_UA8(u8 *cmd, u8 val, u8 offset, u32 mask)
+{
+	u8p_replace_bits(cmd + offset, val, mask);
+}
+
+static __always_inline void RTW89_SET_FWCMD_UA16(u8 *cmd, u16 val, u8
offset, u32 mask)
+{
+	le16p_replace_bits((__le16 *)(cmd + offset), val, mask);
+}
+
+static __always_inline void RTW89_SET_FWCMD_UA32(u8 *cmd, u32 val, u8
offset, u32 mask)
+{
+	le32p_replace_bits((__le32 *)(cmd + offset), val, mask);
+}
Is __always_inline really necessary? I would say just use the regular
inline keyword and let the compiler optimise as it sees fit.

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help