drivers/net/wireless/intel/iwlwifi/mvm/power.c

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

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlwifi/mvm/power.c
Extension
.c
Size
29330 bytes
Lines
992
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_allow_uapsd_iface_iterator_data {
	struct ieee80211_vif *current_vif;
	bool allow_uapsd;
};

static void iwl_mvm_allow_uapsd_iterator(void *_data, u8 *mac,
					 struct ieee80211_vif *vif)
{
	struct iwl_allow_uapsd_iface_iterator_data *data = _data;
	struct iwl_mvm_vif *other_mvmvif = iwl_mvm_vif_from_mac80211(vif);
	struct iwl_mvm_vif *curr_mvmvif =
		iwl_mvm_vif_from_mac80211(data->current_vif);

	/* exclude the given vif */
	if (vif == data->current_vif)
		return;

	switch (vif->type) {
	case NL80211_IFTYPE_AP:
	case NL80211_IFTYPE_ADHOC:
		data->allow_uapsd = false;
		break;
	case NL80211_IFTYPE_STATION:
		/* allow UAPSD if P2P interface and BSS station interface share
		 * the same channel.
		 */
		if (vif->cfg.assoc && other_mvmvif->deflink.phy_ctxt &&
		    curr_mvmvif->deflink.phy_ctxt &&
		    other_mvmvif->deflink.phy_ctxt->id != curr_mvmvif->deflink.phy_ctxt->id)
			data->allow_uapsd = false;
		break;

	default:
		break;
	}
}

static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm,
				       struct ieee80211_vif *vif)
{
	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
	struct iwl_allow_uapsd_iface_iterator_data data = {
		.current_vif = vif,
		.allow_uapsd = true,
	};

	if (ether_addr_equal(mvmvif->uapsd_misbehaving_ap_addr,
			     vif->cfg.ap_addr))
		return false;

	/*
	 * Avoid using uAPSD if P2P client is associated to GO that uses
	 * opportunistic power save. This is due to current FW limitation.
	 */
	if (vif->p2p &&
	    (vif->bss_conf.p2p_noa_attr.oppps_ctwindow &
	    IEEE80211_P2P_OPPPS_ENABLE_BIT))
		return false;

	if (vif->p2p && !iwl_mvm_is_p2p_scm_uapsd_supported(mvm))
		return false;

	ieee80211_iterate_active_interfaces_atomic(mvm->hw,
				IEEE80211_IFACE_ITER_NORMAL,
				iwl_mvm_allow_uapsd_iterator,
				&data);

	return data.allow_uapsd;
}

static bool iwl_mvm_power_is_radar(struct ieee80211_bss_conf *link_conf)
{
	struct ieee80211_chanctx_conf *chanctx_conf;

	chanctx_conf = rcu_dereference(link_conf->chanctx_conf);

	/* this happens on link switching, just ignore inactive ones */
	if (!chanctx_conf)
		return false;

	return chanctx_conf->def.chan->flags & IEEE80211_CHAN_RADAR;
}

static void iwl_mvm_power_config_skip_dtim(struct iwl_mvm *mvm,
					   struct ieee80211_vif *vif,
					   struct iwl_mac_power_cmd_v2 *cmd)
{
	struct ieee80211_bss_conf *link_conf;
	unsigned int min_link_skip = ~0;
	unsigned int link_id;

Annotation

Implementation Notes