drivers/net/wireless/intel/iwlwifi/mld/ftm-initiator.c

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

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlwifi/mld/ftm-initiator.c
Extension
.c
Size
13508 bytes
Lines
462
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

if (req->peers[i].report_ap_tsf) {
				struct iwl_mld_vif *mld_vif =
					iwl_mld_vif_from_mac80211(vif);

				cmd->tsf_mac_id = cpu_to_le32(mld_vif->fw_id);
				return;
			}
		}
	} else {
		eth_broadcast_addr(cmd->range_req_bssid);
	}

	/* Don't report AP's TSF */
	cmd->tsf_mac_id = cpu_to_le32(0xff);
}

static int
iwl_mld_ftm_set_target_chandef(struct iwl_mld *mld,
			       struct cfg80211_pmsr_request_peer *peer,
			       struct iwl_tof_range_req_ap_entry *target)
{
	u32 freq = peer->chandef.chan->center_freq;

	target->channel_num = ieee80211_frequency_to_channel(freq);

	switch (peer->chandef.width) {
	case NL80211_CHAN_WIDTH_20_NOHT:
		target->format_bw = u8_encode_bits(IWL_LOCATION_FRAME_FORMAT_LEGACY,
						   IWL_LOCATION_FMT_BW_FORMAT);
		target->format_bw |= u8_encode_bits(IWL_LOCATION_BW_20MHZ,
						    IWL_LOCATION_FMT_BW_BANDWIDTH);
		break;
	case NL80211_CHAN_WIDTH_20:
		target->format_bw = u8_encode_bits(IWL_LOCATION_FRAME_FORMAT_HT,
						   IWL_LOCATION_FMT_BW_FORMAT);
		target->format_bw |= u8_encode_bits(IWL_LOCATION_BW_20MHZ,
						    IWL_LOCATION_FMT_BW_BANDWIDTH);
		break;
	case NL80211_CHAN_WIDTH_40:
		target->format_bw = u8_encode_bits(IWL_LOCATION_FRAME_FORMAT_HT,
						   IWL_LOCATION_FMT_BW_FORMAT);
		target->format_bw |= u8_encode_bits(IWL_LOCATION_BW_40MHZ,
						    IWL_LOCATION_FMT_BW_BANDWIDTH);
		break;
	case NL80211_CHAN_WIDTH_80:
		target->format_bw = u8_encode_bits(IWL_LOCATION_FRAME_FORMAT_VHT,
						   IWL_LOCATION_FMT_BW_FORMAT);
		target->format_bw |= u8_encode_bits(IWL_LOCATION_BW_80MHZ,
						    IWL_LOCATION_FMT_BW_BANDWIDTH);
		break;
	case NL80211_CHAN_WIDTH_160:
		target->format_bw = u8_encode_bits(IWL_LOCATION_FRAME_FORMAT_HE,
						   IWL_LOCATION_FMT_BW_FORMAT);
		target->format_bw |= u8_encode_bits(IWL_LOCATION_BW_160MHZ,
						    IWL_LOCATION_FMT_BW_BANDWIDTH);
		break;
	default:
		IWL_ERR(mld, "Unsupported BW in FTM request (%d)\n",
			peer->chandef.width);
		return -EINVAL;
	}

	/* non EDCA based measurement must use HE preamble */
	if (peer->ftm.trigger_based || peer->ftm.non_trigger_based)
		target->format_bw |= IWL_LOCATION_FRAME_FORMAT_HE;

	target->ctrl_ch_position =
		(peer->chandef.width > NL80211_CHAN_WIDTH_20) ?
		iwl_mld_get_fw_ctrl_pos(&peer->chandef) : 0;

	target->band = iwl_mld_nl80211_band_to_fw(peer->chandef.chan->band);
	return 0;
}

#define FTM_SET_FLAG(flag) (target->initiator_ap_flags |= \
			    cpu_to_le32(IWL_INITIATOR_AP_FLAGS_##flag))

static void
iwl_mld_ftm_set_target_flags(struct iwl_mld *mld,
			     struct cfg80211_pmsr_request_peer *peer,
			     struct iwl_tof_range_req_ap_entry *target)
{
	target->initiator_ap_flags = cpu_to_le32(0);

	if (peer->ftm.asap)
		FTM_SET_FLAG(ASAP);

	if (peer->ftm.request_lci)
		FTM_SET_FLAG(LCI_REQUEST);

Annotation

Implementation Notes