drivers/net/wireless/intel/iwlegacy/4965-calib.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlegacy/4965-calib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlegacy/4965-calib.c- Extension
.c- Size
- 30734 bytes
- Lines
- 935
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hnet/mac80211.hcommon.h4965.h
Detected Declarations
struct stats_general_datafunction networkfunction il4965_sens_auto_corr_ofdmfunction il4965_prepare_legacy_sensitivity_tblfunction il4965_sensitivity_writefunction il4965_init_sensitivityfunction il4965_sensitivity_calibrationfunction il4965_find_first_chainfunction il4965_find_disconn_antennafunction il4965_gain_computationfunction il4965_chain_noise_calibrationfunction il4965_reset_run_time_calib
Annotated Snippet
struct stats_general_data {
u32 beacon_silence_rssi_a;
u32 beacon_silence_rssi_b;
u32 beacon_silence_rssi_c;
u32 beacon_energy_a;
u32 beacon_energy_b;
u32 beacon_energy_c;
};
/*****************************************************************************
* RUNTIME calibrations framework
*****************************************************************************/
/* "false alarms" are signals that our DSP tries to lock onto,
* but then determines that they are either noise, or transmissions
* from a distant wireless network (also "noise", really) that get
* "stepped on" by stronger transmissions within our own network.
* This algorithm attempts to set a sensitivity level that is high
* enough to receive all of our own network traffic, but not so
* high that our DSP gets too busy trying to lock onto non-network
* activity/noise. */
static int
il4965_sens_energy_cck(struct il_priv *il, u32 norm_fa, u32 rx_enable_time,
struct stats_general_data *rx_info)
{
u32 max_nrg_cck = 0;
int i = 0;
u8 max_silence_rssi = 0;
u32 silence_ref = 0;
u8 silence_rssi_a = 0;
u8 silence_rssi_b = 0;
u8 silence_rssi_c = 0;
u32 val;
/* "false_alarms" values below are cross-multiplications to assess the
* numbers of false alarms within the measured period of actual Rx
* (Rx is off when we're txing), vs the min/max expected false alarms
* (some should be expected if rx is sensitive enough) in a
* hypothetical listening period of 200 time units (TU), 204.8 msec:
*
* MIN_FA/fixed-time < false_alarms/actual-rx-time < MAX_FA/beacon-time
*
* */
u32 false_alarms = norm_fa * 200 * 1024;
u32 max_false_alarms = MAX_FA_CCK * rx_enable_time;
u32 min_false_alarms = MIN_FA_CCK * rx_enable_time;
struct il_sensitivity_data *data = NULL;
const struct il_sensitivity_ranges *ranges = il->hw_params.sens;
data = &(il->sensitivity_data);
data->nrg_auto_corr_silence_diff = 0;
/* Find max silence rssi among all 3 receivers.
* This is background noise, which may include transmissions from other
* networks, measured during silence before our network's beacon */
silence_rssi_a =
(u8) ((rx_info->beacon_silence_rssi_a & ALL_BAND_FILTER) >> 8);
silence_rssi_b =
(u8) ((rx_info->beacon_silence_rssi_b & ALL_BAND_FILTER) >> 8);
silence_rssi_c =
(u8) ((rx_info->beacon_silence_rssi_c & ALL_BAND_FILTER) >> 8);
val = max(silence_rssi_b, silence_rssi_c);
max_silence_rssi = max(silence_rssi_a, (u8) val);
/* Store silence rssi in 20-beacon history table */
data->nrg_silence_rssi[data->nrg_silence_idx] = max_silence_rssi;
data->nrg_silence_idx++;
if (data->nrg_silence_idx >= NRG_NUM_PREV_STAT_L)
data->nrg_silence_idx = 0;
/* Find max silence rssi across 20 beacon history */
for (i = 0; i < NRG_NUM_PREV_STAT_L; i++) {
val = data->nrg_silence_rssi[i];
silence_ref = max(silence_ref, val);
}
D_CALIB("silence a %u, b %u, c %u, 20-bcn max %u\n", silence_rssi_a,
silence_rssi_b, silence_rssi_c, silence_ref);
/* Find max rx energy (min value!) among all 3 receivers,
* measured during beacon frame.
* Save it in 10-beacon history table. */
i = data->nrg_energy_idx;
val = min(rx_info->beacon_energy_b, rx_info->beacon_energy_c);
data->nrg_value[i] = min(rx_info->beacon_energy_a, val);
data->nrg_energy_idx++;
if (data->nrg_energy_idx >= 10)
data->nrg_energy_idx = 0;
Annotation
- Immediate include surface: `linux/slab.h`, `net/mac80211.h`, `common.h`, `4965.h`.
- Detected declarations: `struct stats_general_data`, `function network`, `function il4965_sens_auto_corr_ofdm`, `function il4965_prepare_legacy_sensitivity_tbl`, `function il4965_sensitivity_write`, `function il4965_init_sensitivity`, `function il4965_sensitivity_calibration`, `function il4965_find_first_chain`, `function il4965_find_disconn_antenna`, `function il4965_gain_computation`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.