drivers/net/wireless/realtek/rtw89/fw.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/fw.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/realtek/rtw89/fw.c
Extension
.c
Size
336376 bytes
Lines
11839
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rtw89_eapol_2_of_2 {
	u8 gtkbody[14];
	u8 key_des_ver;
	u8 rsvd[92];
} __packed;

struct rtw89_sa_query {
	u8 category;
	u8 action;
} __packed;

struct rtw89_arp_rsp {
	u8 llc_hdr[sizeof(rfc1042_header)];
	__be16 llc_type;
	struct arphdr arp_hdr;
	u8 sender_hw[ETH_ALEN];
	__be32 sender_ip;
	u8 target_hw[ETH_ALEN];
	__be32 target_ip;
} __packed;

static const u8 mss_signature[] = {0x4D, 0x53, 0x53, 0x4B, 0x50, 0x4F, 0x4F, 0x4C};

const struct rtw89_fw_blacklist rtw89_fw_blacklist_default = {
	.ver = 0x00,
	.list = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
		 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
		 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
		 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
	},
};
EXPORT_SYMBOL(rtw89_fw_blacklist_default);

union rtw89_fw_element_arg {
	size_t offset;
	enum rtw89_rf_path rf_path;
	enum rtw89_fw_type fw_type;
};

struct rtw89_fw_element_handler {
	int (*fn)(struct rtw89_dev *rtwdev,
		  const struct rtw89_fw_element_hdr *elm,
		  const union rtw89_fw_element_arg arg);
	const union rtw89_fw_element_arg arg;
	const char *name;
};

static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev,
				    struct sk_buff *skb);
static int rtw89_h2c_tx_and_wait(struct rtw89_dev *rtwdev, struct sk_buff *skb,
				 struct rtw89_wait_info *wait, unsigned int cond);
static int __parse_security_section(struct rtw89_dev *rtwdev,
				    struct rtw89_fw_bin_info *info,
				    struct rtw89_fw_hdr_section_info *section_info,
				    const void *content,
				    u32 *mssc_len);

static struct sk_buff *rtw89_fw_h2c_alloc_skb(struct rtw89_dev *rtwdev, u32 len,
					      bool header)
{
	struct sk_buff *skb;
	u32 header_len = 0;
	u32 h2c_desc_size = rtwdev->chip->h2c_desc_size;

	if (header)
		header_len = H2C_HEADER_LEN;

	skb = dev_alloc_skb(len + header_len + h2c_desc_size);
	if (!skb)
		return NULL;
	skb_reserve(skb, header_len + h2c_desc_size);
	memset(skb->data, 0, len);

	return skb;
}

struct sk_buff *rtw89_fw_h2c_alloc_skb_with_hdr(struct rtw89_dev *rtwdev, u32 len)
{
	return rtw89_fw_h2c_alloc_skb(rtwdev, len, true);
}

struct sk_buff *rtw89_fw_h2c_alloc_skb_no_hdr(struct rtw89_dev *rtwdev, u32 len)
{
	return rtw89_fw_h2c_alloc_skb(rtwdev, len, false);
}

int rtw89_fw_check_rdy(struct rtw89_dev *rtwdev, enum rtw89_fwdl_check_type type)
{
	const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
	u8 val;

Annotation

Implementation Notes