drivers/net/wireless/ath/ath12k/mac.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/mac.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/ath/ath12k/mac.c
Extension
.c
Size
426001 bytes
Lines
15498
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 ath12k_mac_change_chanctx_arg {
	struct ieee80211_chanctx_conf *ctx;
	struct ieee80211_vif_chanctx_switch *vifs;
	int n_vifs;
	int next_vif;
	struct ath12k *ar;
};

static void
ath12k_mac_change_chanctx_cnt_iter(void *data, u8 *mac,
				   struct ieee80211_vif *vif)
{
	struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif);
	struct ath12k_mac_change_chanctx_arg *arg = data;
	struct ieee80211_bss_conf *link_conf;
	struct ath12k_link_vif *arvif;
	unsigned long links_map;
	u8 link_id;

	lockdep_assert_wiphy(ahvif->ah->hw->wiphy);

	links_map = ahvif->links_map;
	for_each_set_bit(link_id, &links_map, IEEE80211_MLD_MAX_NUM_LINKS) {
		arvif = wiphy_dereference(ahvif->ah->hw->wiphy, ahvif->link[link_id]);
		if (WARN_ON(!arvif))
			continue;

		if (!arvif->is_created || arvif->ar != arg->ar)
			continue;

		link_conf = wiphy_dereference(ahvif->ah->hw->wiphy,
					      vif->link_conf[link_id]);
		if (WARN_ON(!link_conf))
			continue;

		if (rcu_access_pointer(link_conf->chanctx_conf) != arg->ctx)
			continue;

		arg->n_vifs++;
	}
}

static void
ath12k_mac_change_chanctx_fill_iter(void *data, u8 *mac,
				    struct ieee80211_vif *vif)
{
	struct ath12k_vif *ahvif = ath12k_vif_to_ahvif(vif);
	struct ath12k_mac_change_chanctx_arg *arg = data;
	struct ieee80211_bss_conf *link_conf;
	struct ieee80211_chanctx_conf *ctx;
	struct ath12k_link_vif *arvif;
	unsigned long links_map;
	u8 link_id;

	lockdep_assert_wiphy(ahvif->ah->hw->wiphy);

	links_map = ahvif->links_map;
	for_each_set_bit(link_id, &links_map, IEEE80211_MLD_MAX_NUM_LINKS) {
		arvif = wiphy_dereference(ahvif->ah->hw->wiphy, ahvif->link[link_id]);
		if (WARN_ON(!arvif))
			continue;

		if (!arvif->is_created || arvif->ar != arg->ar)
			continue;

		link_conf = wiphy_dereference(ahvif->ah->hw->wiphy,
					      vif->link_conf[arvif->link_id]);
		if (WARN_ON(!link_conf))
			continue;

		ctx = rcu_access_pointer(link_conf->chanctx_conf);
		if (ctx != arg->ctx)
			continue;

		if (WARN_ON(arg->next_vif == arg->n_vifs))
			return;

		arg->vifs[arg->next_vif].vif = vif;
		arg->vifs[arg->next_vif].old_ctx = ctx;
		arg->vifs[arg->next_vif].new_ctx = ctx;
		arg->vifs[arg->next_vif].link_conf = link_conf;
		arg->next_vif++;
	}
}

static u32 ath12k_mac_nlwidth_to_wmiwidth(enum nl80211_chan_width width)
{
	switch (width) {
	case NL80211_CHAN_WIDTH_20:
		return WMI_CHAN_WIDTH_20;

Annotation

Implementation Notes