drivers/net/wireless/intel/iwlwifi/dvm/rs.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/dvm/rs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/dvm/rs.c- Extension
.c- Size
- 99224 bytes
- Lines
- 3291
- 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.
- 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.hdev.hagn.h
Detected Declarations
function rs_extract_ratefunction iwl_hwrate_to_plcp_idxfunction rs_dbgfs_set_mcsfunction rs_rate_scale_clear_windowfunction rs_is_valid_antfunction rs_tl_rm_old_statsfunction rs_tl_add_packetfunction rs_program_fix_ratefunction rs_tl_get_loadfunction 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 rate_n_flags_from_tblfunction rs_get_tbl_info_from_mcsfunction rs_toggle_antennafunction rs_use_greenfunction rs_get_supported_ratesfunction rs_get_adjacent_ratefunction rs_get_lower_ratefunction ratesfunction table_type_matchesfunction rs_bt_update_lqfunction rs_tx_statusfunction overallfunction rs_set_expected_tpt_tablefunction ratefunction rs_switch_to_mimo2function rs_switch_to_mimo3function rs_switch_to_sisofunction rs_move_legacy_otherfunction rs_move_siso_to_otherfunction rs_move_mimo2_to_otherfunction modulationfunction rs_move_mimo3_to_otherfunction modulationfunction rs_stay_in_tablefunction tablefunction rs_update_rate_tblfunction rs_rate_scale_performfunction functionfunction rs_get_ratefunction iwl_rs_rate_initfunction rs_fill_link_cmdfunction rs_freefunction rs_free_sta
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_lq_sta *lq_sta = file->private_data;
buff = kmalloc(1024, GFP_KERNEL);
if (!buff)
return -ENOMEM;
for (i = 0; i < LQ_SIZE; i++) {
desc += sprintf(buff+desc,
"%s type=%d SGI=%d HT40=%d DUP=%d GF=%d\n"
"rate=0x%X\n",
lq_sta->active_tbl == i ? "*" : "x",
lq_sta->lq_info[i].lq_type,
lq_sta->lq_info[i].is_SGI,
lq_sta->lq_info[i].is_ht40,
lq_sta->lq_info[i].is_dup,
lq_sta->is_green,
lq_sta->lq_info[i].current_rate);
for (j = 0; j < IWL_RATE_COUNT; j++) {
desc += sprintf(buff+desc,
"counter=%d success=%d %%=%d\n",
lq_sta->lq_info[i].win[j].counter,
lq_sta->lq_info[i].win[j].success_counter,
lq_sta->lq_info[i].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_rate_scale_data_read(struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{
struct iwl_lq_sta *lq_sta = file->private_data;
struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl];
char buff[120];
int desc = 0;
if (is_Ht(tbl->lq_type))
desc += sprintf(buff+desc,
"Bit Rate= %d Mb/s\n",
tbl->expected_tpt[lq_sta->last_txrate_idx]);
else
desc += sprintf(buff+desc,
"Bit Rate= %d Mb/s\n",
iwl_rates[lq_sta->last_txrate_idx].ieee >> 1);
return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
}
static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
.read = rs_sta_dbgfs_rate_scale_data_read,
.open = simple_open,
.llseek = default_llseek,
};
static void rs_add_debugfs(void *priv, void *priv_sta,
struct dentry *dir)
{
struct iwl_lq_sta *lq_sta = priv_sta;
debugfs_create_file("rate_scale_table", 0600, dir, lq_sta,
&rs_sta_dbgfs_scale_table_ops);
debugfs_create_file("rate_stats_table", 0400, dir, lq_sta,
&rs_sta_dbgfs_stats_table_ops);
debugfs_create_file("rate_scale_data", 0400, dir, lq_sta,
&rs_sta_dbgfs_rate_scale_data_ops);
debugfs_create_u8("tx_agg_tid_enable", 0600, dir,
&lq_sta->tx_agg_tid_en);
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: `function rs_extract_rate`, `function iwl_hwrate_to_plcp_idx`, `function rs_dbgfs_set_mcs`, `function rs_rate_scale_clear_window`, `function rs_is_valid_ant`, `function rs_tl_rm_old_stats`, `function rs_tl_add_packet`, `function rs_program_fix_rate`, `function rs_tl_get_load`, `function rs_tl_turn_on_agg_for_tid`.
- 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.
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.