drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c- Extension
.c- Size
- 11340 bytes
- Lines
- 396
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/mac80211.hfw-api.hmvm.h
Detected Declarations
function Copyrightfunction positionfunction iwl_mvm_phy_ctxt_cmd_hdrfunction iwl_mvm_phy_ctxt_set_rxchainfunction iwl_mvm_phy_ctxt_cmd_data_v1function iwl_mvm_phy_ctxt_cmd_datafunction iwl_mvm_phy_send_rlcfunction iwl_mvm_phy_ctxt_applyfunction iwl_mvm_phy_ctxt_addfunction iwl_mvm_phy_ctxt_reffunction iwl_mvm_phy_ctxt_changedfunction iwl_mvm_phy_ctxt_unreffunction iwl_mvm_binding_iteratorfunction iwl_mvm_phy_ctx_count
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
* Copyright (C) 2012-2014, 2018-2025 Intel Corporation
* Copyright (C) 2013-2014 Intel Mobile Communications GmbH
* Copyright (C) 2017 Intel Deutschland GmbH
*/
#include <net/mac80211.h>
#include "fw-api.h"
#include "mvm.h"
/* Maps the driver specific channel width definition to the fw values */
u8 iwl_mvm_get_channel_width(const struct cfg80211_chan_def *chandef)
{
switch (chandef->width) {
case NL80211_CHAN_WIDTH_20_NOHT:
case NL80211_CHAN_WIDTH_20:
return IWL_PHY_CHANNEL_MODE20;
case NL80211_CHAN_WIDTH_40:
return IWL_PHY_CHANNEL_MODE40;
case NL80211_CHAN_WIDTH_80:
return IWL_PHY_CHANNEL_MODE80;
case NL80211_CHAN_WIDTH_160:
return IWL_PHY_CHANNEL_MODE160;
case NL80211_CHAN_WIDTH_320:
return IWL_PHY_CHANNEL_MODE320;
default:
WARN(1, "Invalid channel width=%u", chandef->width);
return IWL_PHY_CHANNEL_MODE20;
}
}
/*
* Maps the driver specific control channel position (relative to the center
* freq) definitions to the fw values
*/
u8 iwl_mvm_get_ctrl_pos(const struct cfg80211_chan_def *chandef)
{
int offs = chandef->chan->center_freq - chandef->center_freq1;
int abs_offs = abs(offs);
u8 ret;
if (offs == 0) {
/*
* The FW is expected to check the control channel position only
* when in HT/VHT and the channel width is not 20MHz. Return
* this value as the default one.
*/
return 0;
}
/* this results in a value 0-7, i.e. fitting into 0b0111 */
ret = (abs_offs - 10) / 20;
/*
* But we need the value to be in 0b1011 because 0b0100 is
* IWL_PHY_CTRL_POS_ABOVE, so shift bit 2 up to land in
* IWL_PHY_CTRL_POS_OFFS_EXT (0b1000)
*/
ret = (ret & IWL_PHY_CTRL_POS_OFFS_MSK) |
((ret & BIT(2)) << 1);
/* and add the above bit */
ret |= (offs > 0) * IWL_PHY_CTRL_POS_ABOVE;
return ret;
}
/*
* Construct the generic fields of the PHY context command
*/
static void iwl_mvm_phy_ctxt_cmd_hdr(struct iwl_mvm_phy_ctxt *ctxt,
struct iwl_phy_context_cmd *cmd,
u32 action)
{
cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(ctxt->id,
ctxt->color));
cmd->action = cpu_to_le32(action);
}
static void iwl_mvm_phy_ctxt_set_rxchain(struct iwl_mvm *mvm,
struct iwl_mvm_phy_ctxt *ctxt,
__le32 *rxchain_info,
u8 chains_static,
u8 chains_dynamic)
{
u8 active_cnt, idle_cnt;
/* Set rx the chains */
idle_cnt = chains_static;
active_cnt = chains_dynamic;
/* In scenarios where we only ever use a single-stream rates,
Annotation
- Immediate include surface: `net/mac80211.h`, `fw-api.h`, `mvm.h`.
- Detected declarations: `function Copyright`, `function position`, `function iwl_mvm_phy_ctxt_cmd_hdr`, `function iwl_mvm_phy_ctxt_set_rxchain`, `function iwl_mvm_phy_ctxt_cmd_data_v1`, `function iwl_mvm_phy_ctxt_cmd_data`, `function iwl_mvm_phy_send_rlc`, `function iwl_mvm_phy_ctxt_apply`, `function iwl_mvm_phy_ctxt_add`, `function iwl_mvm_phy_ctxt_ref`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.