drivers/net/wireless/intel/iwlwifi/mvm/rs.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/mvm/rs.c- Extension
.c- Size
- 121892 bytes
- Lines
- 4181
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/skbuff.hlinux/slab.hnet/mac80211.hlinux/netdevice.hlinux/etherdevice.hlinux/delay.hlinux/workqueue.hrs.hfw-api.hsta.hiwl-op-mode.hmvm.hdebugfs.h
Detected Declarations
struct rs_tx_columnstruct rs_tx_columnstruct rs_init_rate_infostruct rs_bfer_active_iter_dataenum rs_actionenum rs_column_modeenum tpc_actionfunction rs_ant_allowfunction rs_mimo_allowfunction rs_siso_allowfunction rs_sgi_allowfunction rs_extract_ratefunction iwl_hwrate_to_plcp_idxfunction rs_dump_ratefunction rs_rate_scale_clear_windowfunction rs_rate_scale_clear_tbl_windowsfunction rs_is_valid_antfunction rs_tl_turn_on_agg_for_tidfunction rs_tl_turn_on_aggfunction get_num_of_ant_from_ratefunction get_expected_tptfunction _rs_collect_tx_datafunction attemptfunction rs_collect_tpc_datafunction rs_update_tid_tpt_statsfunction rs_collect_tlc_datafunction ucode_rate_from_rs_ratefunction rs_rate_from_ucode_ratefunction rs_toggle_antennafunction rs_get_supported_ratesfunction rs_get_adjacent_ratefunction rs_rate_supportedfunction rs_get_lower_rate_in_columnfunction rs_get_lower_rate_down_columnfunction rs_rate_column_matchfunction rs_get_column_from_ratefunction rs_get_tidfunction rs_drv_mac80211_tx_statusfunction overallfunction rs_get_max_rate_from_maskfunction rs_get_max_allowed_ratefunction rs_set_expected_tpt_tablefunction tablefunction rs_get_best_ratefunction rs_bw_from_sta_bwfunction rs_stay_in_tablefunction tablefunction rs_set_amsdu_len
Annotated Snippet
static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
.write = rs_sta_dbgfs_scale_table_write,
.read = rs_sta_dbgfs_scale_table_read,
.open = simple_open,
.llseek = default_llseek,
};
static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{
char *buff;
int desc = 0;
int i, j;
ssize_t ret;
struct iwl_scale_tbl_info *tbl;
struct rs_rate *rate;
struct iwl_lq_sta *lq_sta = file->private_data;
buff = kmalloc(1024, GFP_KERNEL);
if (!buff)
return -ENOMEM;
for (i = 0; i < LQ_SIZE; i++) {
tbl = &(lq_sta->lq_info[i]);
rate = &tbl->rate;
desc += sprintf(buff+desc,
"%s type=%d SGI=%d BW=%s DUP=0\n"
"index=%d\n",
lq_sta->active_tbl == i ? "*" : "x",
rate->type,
rate->sgi,
is_ht20(rate) ? "20MHz" :
is_ht40(rate) ? "40MHz" :
is_ht80(rate) ? "80MHz" :
is_ht160(rate) ? "160MHz" : "ERR",
rate->index);
for (j = 0; j < IWL_RATE_COUNT; j++) {
desc += sprintf(buff+desc,
"counter=%d success=%d %%=%d\n",
tbl->win[j].counter,
tbl->win[j].success_counter,
tbl->win[j].success_ratio);
}
}
ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
kfree(buff);
return ret;
}
static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
.read = rs_sta_dbgfs_stats_table_read,
.open = simple_open,
.llseek = default_llseek,
};
static ssize_t rs_sta_dbgfs_drv_tx_stats_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
static const char * const column_name[] = {
[RS_COLUMN_LEGACY_ANT_A] = "LEGACY_ANT_A",
[RS_COLUMN_LEGACY_ANT_B] = "LEGACY_ANT_B",
[RS_COLUMN_SISO_ANT_A] = "SISO_ANT_A",
[RS_COLUMN_SISO_ANT_B] = "SISO_ANT_B",
[RS_COLUMN_SISO_ANT_A_SGI] = "SISO_ANT_A_SGI",
[RS_COLUMN_SISO_ANT_B_SGI] = "SISO_ANT_B_SGI",
[RS_COLUMN_MIMO2] = "MIMO2",
[RS_COLUMN_MIMO2_SGI] = "MIMO2_SGI",
};
static const char * const rate_name[] = {
[IWL_RATE_1M_INDEX] = "1M",
[IWL_RATE_2M_INDEX] = "2M",
[IWL_RATE_5M_INDEX] = "5.5M",
[IWL_RATE_11M_INDEX] = "11M",
[IWL_RATE_6M_INDEX] = "6M|MCS0",
[IWL_RATE_9M_INDEX] = "9M",
[IWL_RATE_12M_INDEX] = "12M|MCS1",
[IWL_RATE_18M_INDEX] = "18M|MCS2",
[IWL_RATE_24M_INDEX] = "24M|MCS3",
[IWL_RATE_36M_INDEX] = "36M|MCS4",
[IWL_RATE_48M_INDEX] = "48M|MCS5",
[IWL_RATE_54M_INDEX] = "54M|MCS6",
[IWL_RATE_MCS_7_INDEX] = "MCS7",
[IWL_RATE_MCS_8_INDEX] = "MCS8",
[IWL_RATE_MCS_9_INDEX] = "MCS9",
[IWL_RATE_MCS_10_INDEX] = "MCS10",
[IWL_RATE_MCS_11_INDEX] = "MCS11",
};
char *buff, *pos, *endpos;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/skbuff.h`, `linux/slab.h`, `net/mac80211.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/delay.h`, `linux/workqueue.h`.
- Detected declarations: `struct rs_tx_column`, `struct rs_tx_column`, `struct rs_init_rate_info`, `struct rs_bfer_active_iter_data`, `enum rs_action`, `enum rs_column_mode`, `enum tpc_action`, `function rs_ant_allow`, `function rs_mimo_allow`, `function rs_siso_allow`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.