drivers/net/wireless/intel/iwlegacy/4965-rs.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlegacy/4965-rs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlegacy/4965-rs.c- Extension
.c- Size
- 80431 bytes
- Lines
- 2793
- 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.hcommon.h4965.h
Detected Declarations
function il4965_hwrate_to_plcp_idxfunction il4965_rs_extract_ratefunction il4965_rs_rate_scale_clear_winfunction il4965_rs_is_valid_antfunction il4965_rs_tl_rm_old_statsfunction il4965_rs_tl_add_packetfunction il4965_rs_tl_get_loadfunction il4965_rs_tl_turn_on_agg_for_tidfunction il4965_rs_tl_turn_on_aggfunction il4965_get_il4965_num_of_ant_from_ratefunction il4965_get_expected_tptfunction il4965_rs_collect_tx_datafunction attemptfunction il4965_rate_n_flags_from_tblfunction il4965_rs_get_tbl_info_from_mcsfunction il4965_rs_toggle_antennafunction il4965_rs_use_greenfunction il4965_rs_get_supported_ratesfunction il4965_rs_get_adjacent_ratefunction il4965_rs_get_lower_ratefunction ratesfunction il4965_table_type_matchesfunction il4965_rs_tx_statusfunction overallfunction il4965_rs_set_expected_tpt_tablefunction ratefunction il4965_rs_switch_to_mimo2function il4965_rs_switch_to_sisofunction il4965_rs_move_legacy_otherfunction il4965_rs_move_siso_to_otherfunction il4965_rs_move_mimo2_to_otherfunction modulationfunction il4965_rs_stay_in_tablefunction tablefunction il4965_rs_update_rate_tblfunction il4965_rs_rate_scale_performfunction functionfunction il4965_rs_get_ratefunction il4965_rs_alloc_stafunction il4965_rs_rate_initfunction il4965_rs_fill_link_cmdfunction il4965_rs_allocfunction il4965_rs_freefunction il4965_rs_free_stafunction il4965_rs_dbgfs_set_mcsfunction il4965_rs_sta_dbgfs_scale_table_writefunction il4965_rs_sta_dbgfs_scale_table_readfunction il4965_rs_sta_dbgfs_stats_table_read
Annotated Snippet
static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
.write = il4965_rs_sta_dbgfs_scale_table_write,
.read = il4965_rs_sta_dbgfs_scale_table_read,
.open = simple_open,
.llseek = default_llseek,
};
static ssize_t
il4965_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 il_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 < 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 = il4965_rs_sta_dbgfs_stats_table_read,
.open = simple_open,
.llseek = default_llseek,
};
static ssize_t
il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file,
char __user *user_buf, size_t count,
loff_t *ppos)
{
char buff[120];
int desc = 0;
struct il_lq_sta *lq_sta = file->private_data;
struct il_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl];
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",
il_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 = il4965_rs_sta_dbgfs_rate_scale_data_read,
.open = simple_open,
.llseek = default_llseek,
};
static void
il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry *dir)
{
struct il_lq_sta *lq_sta = il_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,
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 il4965_hwrate_to_plcp_idx`, `function il4965_rs_extract_rate`, `function il4965_rs_rate_scale_clear_win`, `function il4965_rs_is_valid_ant`, `function il4965_rs_tl_rm_old_stats`, `function il4965_rs_tl_add_packet`, `function il4965_rs_tl_get_load`, `function il4965_rs_tl_turn_on_agg_for_tid`, `function il4965_rs_tl_turn_on_agg`, `function il4965_get_il4965_num_of_ant_from_rate`.
- 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.