drivers/net/wireless/intel/iwlwifi/iwl-trans.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/iwl-trans.c- Extension
.c- Size
- 21493 bytes
- Lines
- 841
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/bsearch.hlinux/list.hiwl-trans.hiwl-drv.hlinux/dmapool.hfw/api/commands.hpcie/gen1_2/internal.hpcie/iwl-context-info-v2.h
Detected Declarations
struct iwl_trans_dev_restart_datastruct iwl_trans_reprobefunction iwl_trans_get_restart_datafunction iwl_trans_inc_restart_countfunction iwl_trans_free_restart_listfunction iwl_trans_reprobe_wkfunction iwl_trans_schedule_reprobefunction iwl_trans_determine_restart_modefunction iwl_trans_restart_wkfunction iwl_trans_freefunction iwl_trans_send_cmdfunction iwl_trans_free_tx_cmdfunction iwl_hcmd_names_cmpfunction iwl_trans_op_mode_enterfunction iwl_trans_start_hwfunction iwl_trans_op_mode_leavefunction iwl_trans_write8function iwl_trans_write32function iwl_trans_read32function iwl_trans_read_prphfunction iwl_trans_write_prphfunction iwl_trans_read_memfunction iwl_trans_read_mem_no_grabfunction iwl_trans_write_memfunction iwl_trans_set_pmifunction iwl_trans_sw_resetfunction iwl_trans_dump_datafunction iwl_trans_d3_suspendfunction iwl_trans_d3_resumefunction iwl_trans_interruptsfunction iwl_trans_sync_nmifunction iwl_trans_write_imr_memfunction iwl_trans_set_bits_maskfunction iwl_trans_read_config32function iwl_trans_grab_nic_accessfunction iwl_trans_resched_with_nic_accessfunction __releasesfunction iwl_trans_fw_alivefunction iwl_trans_start_fwfunction iwl_trans_stop_devicefunction iwl_trans_restart_wkfunction iwl_trans_txfunction iwl_trans_reclaimfunction iwl_trans_txq_disablefunction iwl_trans_txq_enable_cfgfunction iwl_trans_wait_txq_emptyfunction iwl_trans_wait_tx_queues_emptyfunction iwl_trans_freeze_txq_timer
Annotated Snippet
struct iwl_trans_dev_restart_data {
struct list_head list;
unsigned int restart_count;
time64_t last_error;
bool backoff;
char name[];
};
static LIST_HEAD(restart_data_list);
static DEFINE_SPINLOCK(restart_data_lock);
static struct iwl_trans_dev_restart_data *
iwl_trans_get_restart_data(struct device *dev)
{
struct iwl_trans_dev_restart_data *tmp, *data = NULL;
const char *name = dev_name(dev);
spin_lock(&restart_data_lock);
list_for_each_entry(tmp, &restart_data_list, list) {
if (strcmp(tmp->name, name))
continue;
data = tmp;
break;
}
spin_unlock(&restart_data_lock);
if (data)
return data;
data = kzalloc_flex(*data, name, strlen(name) + 1, GFP_ATOMIC);
if (!data)
return NULL;
strcpy(data->name, name);
spin_lock(&restart_data_lock);
list_add_tail(&data->list, &restart_data_list);
spin_unlock(&restart_data_lock);
return data;
}
static void iwl_trans_inc_restart_count(struct device *dev)
{
struct iwl_trans_dev_restart_data *data;
data = iwl_trans_get_restart_data(dev);
if (data) {
data->last_error = ktime_get_boottime_seconds();
data->restart_count++;
}
}
void iwl_trans_free_restart_list(void)
{
struct iwl_trans_dev_restart_data *tmp;
while ((tmp = list_first_entry_or_null(&restart_data_list,
typeof(*tmp), list))) {
list_del(&tmp->list);
kfree(tmp);
}
}
struct iwl_trans_reprobe {
struct device *dev;
struct delayed_work work;
};
static void iwl_trans_reprobe_wk(struct work_struct *wk)
{
struct iwl_trans_reprobe *reprobe;
reprobe = container_of(wk, typeof(*reprobe), work.work);
if (device_reprobe(reprobe->dev))
dev_err(reprobe->dev, "reprobe failed!\n");
put_device(reprobe->dev);
kfree(reprobe);
module_put(THIS_MODULE);
}
static void iwl_trans_schedule_reprobe(struct iwl_trans *trans,
unsigned int delay_ms)
{
struct iwl_trans_reprobe *reprobe;
/*
* get a module reference to avoid doing this while unloading
* anyway and to avoid scheduling a work with code that's
* being removed.
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/bsearch.h`, `linux/list.h`, `iwl-trans.h`, `iwl-drv.h`, `linux/dmapool.h`, `fw/api/commands.h`, `pcie/gen1_2/internal.h`.
- Detected declarations: `struct iwl_trans_dev_restart_data`, `struct iwl_trans_reprobe`, `function iwl_trans_get_restart_data`, `function iwl_trans_inc_restart_count`, `function iwl_trans_free_restart_list`, `function iwl_trans_reprobe_wk`, `function iwl_trans_schedule_reprobe`, `function iwl_trans_determine_restart_mode`, `function iwl_trans_restart_wk`, `function iwl_trans_free`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- 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.