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

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

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlwifi/mld/nan.c
Extension
.c
Size
27938 bytes
Lines
1008
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

for_each_station(sta, mld->hw) {
			struct iwl_mld_sta *mld_sta = iwl_mld_sta_from_mac80211(sta);

			if (mld_sta->sta_type == STATION_TYPE_NAN_PEER_NDI)
				iwl_mld_config_tlc(mld, mld_sta->vif, sta);
		}
	}

	nan_link->active = active;

	iwl_mld_nan_link_prep_cmd(mld, nan_link, &cmd,
				  LINK_CONTEXT_MODIFY_ACTIVE);

	ret = iwl_mld_send_link_cmd(mld, &cmd, FW_CTXT_ACTION_MODIFY);
	if (ret) {
		nan_link->active = !nan_link->active;
		return ret;
	}

	if (!active) {
		nan_link->chanctx = NULL;
		/* TODO: when FW is ready, Update phy in TLC to invalid after */
	}

	return 0;
}

static void iwl_mld_nan_link_remove(struct iwl_mld *mld,
				    struct iwl_mld_nan_link *nan_link,
				    u32 link_id)
{
	struct iwl_link_config_cmd cmd = {
		.link_id = cpu_to_le32(link_id),
		.phy_id = cpu_to_le32(FW_CTXT_ID_INVALID),
	};

	iwl_mld_send_link_cmd(mld, &cmd, FW_CTXT_ACTION_REMOVE);

	RCU_INIT_POINTER(mld->fw_id_to_bss_conf[link_id], NULL);
	nan_link->fw_id = FW_CTXT_ID_INVALID;
	nan_link->active = false;
	nan_link->chanctx = NULL;
}

static bool iwl_mld_nan_have_links(struct iwl_mld_vif *mld_vif)
{
	struct iwl_mld_nan_link *nan_link;

	for_each_mld_nan_valid_link(mld_vif, nan_link)
		return true;

	return false;
}

static struct iwl_mld_nan_link *
iwl_mld_nan_find_link(struct iwl_mld_vif *mld_vif,
		      struct ieee80211_chanctx_conf *chanctx)
{
	struct iwl_mld_nan_link *nan_link;

	for_each_mld_nan_valid_link(mld_vif, nan_link) {
		if (nan_link->chanctx == chanctx)
			return nan_link;
	}

	return NULL;
}

static void iwl_mld_nan_set_mcast_data_links(struct ieee80211_vif *vif)
{
	struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);

	if (vif->type != NL80211_IFTYPE_NAN_DATA)
		return;

	/* Note that all errors are handled internally so nothing to do
	 * with the return value (used only to silence compilation warnings)
	 */
	iwl_mld_update_nan_mcast_data_sta(mld_vif->mld, vif->addr,
					  &mld_vif->nan.mcast_data_sta);
}

void iwl_mld_nan_vif_cfg_changed(struct iwl_mld *mld,
				 struct ieee80211_vif *vif,
				 u64 changes)
{
	struct iwl_nan_schedule_cmd cmd = {};
	struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
	bool previously_empty_schedule = !iwl_mld_nan_have_links(mld_vif);
	struct ieee80211_nan_sched_cfg *sched_cfg = &vif->cfg.nan_sched;

Annotation

Implementation Notes