drivers/net/wireless/intel/iwlwifi/mld/iface.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mld/iface.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlwifi/mld/iface.c
Extension
.c
Size
24625 bytes
Lines
875
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source 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 iwl_mld_mac_wifi_gen_sta_iter_data {
	struct ieee80211_vif *vif;
	struct iwl_mac_wifi_gen_support *support;
};

static void iwl_mld_mac_wifi_gen_sta_iter(void *_data,
					  struct ieee80211_sta *sta)
{
	struct iwl_mld_sta *mld_sta = iwl_mld_sta_from_mac80211(sta);
	struct iwl_mld_mac_wifi_gen_sta_iter_data *data = _data;
	struct ieee80211_link_sta *link_sta;
	unsigned int link_id;

	if (mld_sta->vif != data->vif)
		return;

	for_each_sta_active_link(data->vif, sta, link_sta, link_id) {
		if (link_sta->he_cap.has_he)
			data->support->he_support = 1;
		if (link_sta->eht_cap.has_eht)
			data->support->eht_support = 1;
	}
}

static void iwl_mld_set_wifi_gen(struct iwl_mld *mld,
				 struct ieee80211_vif *vif,
				 struct iwl_mac_wifi_gen_support *support)
{
	struct iwl_mld_mac_wifi_gen_sta_iter_data sta_iter_data = {
		.vif = vif,
		.support = support,
	};
	struct ieee80211_bss_conf *link_conf;
	unsigned int link_id;

	switch (vif->type) {
	case NL80211_IFTYPE_MONITOR:
		/* for sniffer, set to HW capabilities */
		support->he_support = 1;
		support->eht_support = mld->trans->cfg->eht_supported;
		break;
	case NL80211_IFTYPE_AP:
		/* for AP set according to the link configs */
		for_each_vif_active_link(vif, link_conf, link_id) {
			support->he_ap_support |= link_conf->he_support;
			support->eht_support |= link_conf->eht_support;
		}
		break;
	default:
		/*
		 * If we have MLO enabled, then the firmware needs to enable
		 * address translation for the station(s) we add. That depends
		 * on having EHT enabled in firmware, which in turn depends on
		 * mac80211 in the iteration below.
		 * However, mac80211 doesn't enable capabilities on the AP STA
		 * until it has parsed the association response successfully,
		 * so set EHT (and HE as a pre-requisite for EHT) when the vif
		 * is an MLD.
		 */
		if (ieee80211_vif_is_mld(vif)) {
			support->he_support = 1;
			support->eht_support = 1;
		}

		ieee80211_iterate_stations_mtx(mld->hw,
					       iwl_mld_mac_wifi_gen_sta_iter,
					       &sta_iter_data);
		break;
	}
}

/* fill the common part for all interface types */
static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld,
					struct ieee80211_vif *vif,
					struct iwl_mac_config_cmd *cmd,
					u32 action)
{
	struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);

	lockdep_assert_wiphy(mld->wiphy);

	cmd->id_and_color = cpu_to_le32(mld_vif->fw_id);
	cmd->action = cpu_to_le32(action);

	cmd->mac_type =
		cpu_to_le32(iwl_mld_mac80211_iftype_to_fw(vif));

	memcpy(cmd->local_mld_addr, vif->addr, ETH_ALEN);

	if (iwlwifi_mod_params.disable_11ax)

Annotation

Implementation Notes