drivers/net/wireless/intel/iwlwifi/dvm/lib.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/dvm/lib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/dvm/lib.c- Extension
.c- Size
- 36807 bytes
- Lines
- 1259
- 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.
- 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/etherdevice.hlinux/kernel.hlinux/module.hlinux/sched.hnet/mac80211.hiwl-io.hiwl-agn-hw.hiwl-trans.hiwl-modparams.hdev.hagn.h
Detected Declarations
struct wowlan_key_datafunction Copyrightfunction iwlagn_send_tx_powerfunction iwlagn_temperaturefunction iwlagn_hwrate_to_mac80211_idxfunction iwlagn_manage_ibss_stationfunction iwlagn_txfifo_flushfunction iwlagn_dev_txfifo_flushfunction iwlagn_send_advance_bt_configfunction modefunction iwlagn_bt_adjust_rssi_monitorfunction for_each_contextfunction iwlagn_bt_traffic_is_scofunction iwlagn_bt_traffic_change_workfunction for_each_contextfunction iwlagn_bt_coex_rssi_monitorfunction iwlagn_print_uartmsgfunction iwlagn_set_kill_mskfunction iwlagn_fill_txpower_modefunction iwlagn_bt_coex_profile_notiffunction iwlagn_bt_rx_handler_setupfunction iwlagn_bt_setup_deferred_workfunction iwlagn_bt_cancel_deferred_workfunction is_single_rx_streamfunction MIMOfunction iwl_get_idle_rx_chain_countfunction iwl_count_chain_bitmapfunction iwlagn_set_rxon_chainfunction iwl_toggle_tx_antfunction iwlagn_convert_p1kfunction iwlagn_wowlan_program_keysfunction iwlagn_send_patternsfunction iwlagn_suspendfunction iwl_dvm_send_cmdfunction iwl_dvm_send_cmd_pdu
Annotated Snippet
struct wowlan_key_data {
struct iwl_rxon_context *ctx;
struct iwlagn_wowlan_rsc_tsc_params_cmd *rsc_tsc;
struct iwlagn_wowlan_tkip_params_cmd *tkip;
const u8 *bssid;
bool error, use_rsc_tsc, use_tkip;
};
static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key,
void *_data)
{
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
struct wowlan_key_data *data = _data;
struct iwl_rxon_context *ctx = data->ctx;
struct aes_sc *aes_sc, *aes_tx_sc = NULL;
struct tkip_sc *tkip_sc, *tkip_tx_sc = NULL;
struct iwlagn_p1k_cache *rx_p1ks;
u8 *rx_mic_key;
struct ieee80211_key_seq seq;
u32 cur_rx_iv32 = 0;
u16 p1k[IWLAGN_P1K_SIZE];
int ret, i;
mutex_lock(&priv->mutex);
if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
key->cipher == WLAN_CIPHER_SUITE_WEP104) &&
!sta && !ctx->key_mapping_keys)
ret = iwl_set_default_wep_key(priv, ctx, key);
else
ret = iwl_set_dynamic_key(priv, ctx, key, sta);
if (ret) {
IWL_ERR(priv, "Error setting key during suspend!\n");
data->error = true;
}
switch (key->cipher) {
case WLAN_CIPHER_SUITE_TKIP:
if (sta) {
u64 pn64;
tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc;
tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc;
rx_p1ks = data->tkip->rx_uni;
pn64 = atomic64_read(&key->tx_pn);
tkip_tx_sc->iv16 = cpu_to_le16(TKIP_PN_TO_IV16(pn64));
tkip_tx_sc->iv32 = cpu_to_le32(TKIP_PN_TO_IV32(pn64));
ieee80211_get_tkip_p1k_iv(key, seq.tkip.iv32, p1k);
iwlagn_convert_p1k(p1k, data->tkip->tx.p1k);
memcpy(data->tkip->mic_keys.tx,
&key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY],
IWLAGN_MIC_KEY_SIZE);
rx_mic_key = data->tkip->mic_keys.rx_unicast;
} else {
tkip_sc =
data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc;
rx_p1ks = data->tkip->rx_multi;
rx_mic_key = data->tkip->mic_keys.rx_mcast;
}
/*
* For non-QoS this relies on the fact that both the uCode and
* mac80211 use TID 0 (as they need to to avoid replay attacks)
* for checking the IV in the frames.
*/
for (i = 0; i < IWLAGN_NUM_RSC; i++) {
ieee80211_get_key_rx_seq(key, i, &seq);
tkip_sc[i].iv16 = cpu_to_le16(seq.tkip.iv16);
tkip_sc[i].iv32 = cpu_to_le32(seq.tkip.iv32);
/* wrapping isn't allowed, AP must rekey */
if (seq.tkip.iv32 > cur_rx_iv32)
cur_rx_iv32 = seq.tkip.iv32;
}
ieee80211_get_tkip_rx_p1k(key, data->bssid, cur_rx_iv32, p1k);
iwlagn_convert_p1k(p1k, rx_p1ks[0].p1k);
ieee80211_get_tkip_rx_p1k(key, data->bssid,
cur_rx_iv32 + 1, p1k);
iwlagn_convert_p1k(p1k, rx_p1ks[1].p1k);
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/kernel.h`, `linux/module.h`, `linux/sched.h`, `net/mac80211.h`, `iwl-io.h`, `iwl-agn-hw.h`, `iwl-trans.h`.
- Detected declarations: `struct wowlan_key_data`, `function Copyright`, `function iwlagn_send_tx_power`, `function iwlagn_temperature`, `function iwlagn_hwrate_to_mac80211_idx`, `function iwlagn_manage_ibss_station`, `function iwlagn_txfifo_flush`, `function iwlagn_dev_txfifo_flush`, `function iwlagn_send_advance_bt_config`, `function mode`.
- 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.