drivers/net/wireless/intel/iwlwifi/dvm/sta.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/dvm/sta.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/dvm/sta.c- Extension
.c- Size
- 38286 bytes
- Lines
- 1426
- 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.hnet/mac80211.hiwl-trans.hdev.hagn.h
Detected Declarations
function iwl_sta_ucode_activatefunction iwl_process_add_sta_respfunction iwl_add_sta_callbackfunction iwl_send_add_stafunction iwl_is_ht40_tx_allowedfunction iwl_sta_calc_ht_flagsfunction iwl_sta_update_htfunction iwl_set_ht_add_stationfunction iwl_prep_stationfunction iwl_add_station_commonfunction iwl_sta_ucode_deactivatefunction iwl_send_remove_stationfunction iwl_remove_stationfunction iwl_deactivate_stationfunction iwl_sta_fill_lqfunction iwl_clear_ucode_stationsfunction iwl_restore_stationsfunction iwl_get_free_ucode_key_offsetfunction iwl_dealloc_bcast_stationsfunction iwl_dump_lq_cmdfunction iwl_dump_lq_cmdfunction iwl_send_lq_cmdfunction iwl_sta_alloc_lqfunction iwlagn_add_bssid_stationfunction iwl_send_static_wepkey_cmdfunction iwl_restore_default_wep_keysfunction iwl_remove_default_wep_keyfunction iwl_set_default_wep_keyfunction iwlagn_key_sta_idfunction iwlagn_send_sta_keyfunction iwl_update_tkip_keyfunction iwl_remove_dynamic_keyfunction iwl_set_dynamic_keyfunction iwlagn_alloc_bcast_stationfunction iwl_update_bcast_stationfunction iwl_update_bcast_stationsfunction for_each_contextfunction iwl_sta_tx_modify_enable_tidfunction iwl_sta_rx_agg_startfunction iwl_sta_rx_agg_stopfunction iwl_sta_modify_sleep_tx_count
Annotated Snippet
ether_addr_equal(priv->stations[sta_id].sta.sta.addr, addr)) {
IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not "
"adding again.\n", sta_id, addr);
return sta_id;
}
station = &priv->stations[sta_id];
station->used = IWL_STA_DRIVER_ACTIVE;
IWL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n",
sta_id, addr);
priv->num_stations++;
/* Set up the REPLY_ADD_STA command to send to device */
memset(&station->sta, 0, sizeof(struct iwl_addsta_cmd));
memcpy(station->sta.sta.addr, addr, ETH_ALEN);
station->sta.mode = 0;
station->sta.sta.sta_id = sta_id;
station->sta.station_flags = ctx->station_flags;
station->ctxid = ctx->ctxid;
if (sta) {
struct iwl_station_priv *sta_priv;
sta_priv = (void *)sta->drv_priv;
sta_priv->ctx = ctx;
}
/*
* OK to call unconditionally, since local stations (IBSS BSSID
* STA and broadcast STA) pass in a NULL sta, and mac80211
* doesn't allow HT IBSS.
*/
iwl_set_ht_add_station(priv, sta_id, sta, ctx);
return sta_id;
}
#define STA_WAIT_TIMEOUT (HZ/2)
/*
* iwl_add_station_common -
*/
int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
const u8 *addr, bool is_ap,
struct ieee80211_sta *sta, u8 *sta_id_r)
{
int ret = 0;
u8 sta_id;
struct iwl_addsta_cmd sta_cmd;
*sta_id_r = 0;
spin_lock_bh(&priv->sta_lock);
sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta);
if (sta_id == IWL_INVALID_STATION) {
IWL_ERR(priv, "Unable to prepare station %pM for addition\n",
addr);
spin_unlock_bh(&priv->sta_lock);
return -EINVAL;
}
/*
* uCode is not able to deal with multiple requests to add a
* station. Keep track if one is in progress so that we do not send
* another.
*/
if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) {
IWL_DEBUG_INFO(priv, "STA %d already in process of being "
"added.\n", sta_id);
spin_unlock_bh(&priv->sta_lock);
return -EEXIST;
}
if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) &&
(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) {
IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not "
"adding again.\n", sta_id, addr);
spin_unlock_bh(&priv->sta_lock);
return -EEXIST;
}
priv->stations[sta_id].used |= IWL_STA_UCODE_INPROGRESS;
memcpy(&sta_cmd, &priv->stations[sta_id].sta,
sizeof(struct iwl_addsta_cmd));
spin_unlock_bh(&priv->sta_lock);
/* Add station to device's station table */
ret = iwl_send_add_sta(priv, &sta_cmd, 0);
if (ret) {
spin_lock_bh(&priv->sta_lock);
Annotation
- Immediate include surface: `linux/etherdevice.h`, `net/mac80211.h`, `iwl-trans.h`, `dev.h`, `agn.h`.
- Detected declarations: `function iwl_sta_ucode_activate`, `function iwl_process_add_sta_resp`, `function iwl_add_sta_callback`, `function iwl_send_add_sta`, `function iwl_is_ht40_tx_allowed`, `function iwl_sta_calc_ht_flags`, `function iwl_sta_update_ht`, `function iwl_set_ht_add_station`, `function iwl_prep_station`, `function iwl_add_station_common`.
- 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.