drivers/net/wireless/intel/ipw2x00/libipw_wx.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/ipw2x00/libipw_wx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/ipw2x00/libipw_wx.c- Extension
.c- Size
- 19534 bytes
- Lines
- 723
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/hardirq.hlinux/kmod.hlinux/slab.hlinux/module.hlinux/jiffies.hlinux/wireless.hlibipw.h
Detected Declarations
function elapsed_jiffies_msecsfunction libipw_wx_get_scanfunction list_for_each_entryfunction libipw_wx_set_encodefunction libipw_wx_get_encodefunction libipw_wx_set_encodeextfunction libipw_wx_get_encodeextexport libipw_wx_set_encodeextexport libipw_wx_get_encodeextexport libipw_wx_get_scanexport libipw_wx_set_encodeexport libipw_wx_get_encode
Annotated Snippet
if (stop - ev < SCAN_ITEM_SIZE) {
err = -E2BIG;
break;
}
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
ev = libipw_translate_scan(ieee, ev, stop, network,
info);
else {
LIBIPW_DEBUG_SCAN("Not showing network '%*pE (%pM)' due to age (%ums).\n",
network->ssid_len, network->ssid,
network->bssid,
elapsed_jiffies_msecs(
network->last_scanned));
}
}
spin_unlock_irqrestore(&ieee->lock, flags);
wrqu->data.length = ev - extra;
wrqu->data.flags = 0;
LIBIPW_DEBUG_WX("exit: %d networks returned.\n", i);
return err;
}
int libipw_wx_set_encode(struct libipw_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
struct iw_point *erq = &(wrqu->encoding);
struct net_device *dev = ieee->dev;
struct libipw_security sec = {
.flags = 0
};
int i, key, key_provided, len;
struct libipw_crypt_data **crypt;
int host_crypto = ieee->host_encrypt || ieee->host_decrypt;
LIBIPW_DEBUG_WX("SET_ENCODE\n");
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
return -EINVAL;
key--;
key_provided = 1;
} else {
key_provided = 0;
key = ieee->crypt_info.tx_keyidx;
}
LIBIPW_DEBUG_WX("Key: %d [%s]\n", key, key_provided ?
"provided" : "default");
crypt = &ieee->crypt_info.crypt[key];
if (erq->flags & IW_ENCODE_DISABLED) {
if (key_provided && *crypt) {
LIBIPW_DEBUG_WX("Disabling encryption on key %d.\n",
key);
libipw_crypt_delayed_deinit(&ieee->crypt_info, crypt);
} else
LIBIPW_DEBUG_WX("Disabling encryption.\n");
/* Check all the keys to see if any are still configured,
* and if no key index was provided, de-init them all */
for (i = 0; i < WEP_KEYS; i++) {
if (ieee->crypt_info.crypt[i] != NULL) {
if (key_provided)
break;
libipw_crypt_delayed_deinit(&ieee->crypt_info,
&ieee->crypt_info.crypt[i]);
}
}
if (i == WEP_KEYS) {
sec.enabled = 0;
sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL | SEC_ENCRYPT;
}
goto done;
}
sec.enabled = 1;
sec.encrypt = 1;
Annotation
- Immediate include surface: `linux/hardirq.h`, `linux/kmod.h`, `linux/slab.h`, `linux/module.h`, `linux/jiffies.h`, `linux/wireless.h`, `libipw.h`.
- Detected declarations: `function elapsed_jiffies_msecs`, `function libipw_wx_get_scan`, `function list_for_each_entry`, `function libipw_wx_set_encode`, `function libipw_wx_get_encode`, `function libipw_wx_set_encodeext`, `function libipw_wx_get_encodeext`, `export libipw_wx_set_encodeext`, `export libipw_wx_get_encodeext`, `export libipw_wx_get_scan`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.