drivers/net/wireless/marvell/libertas/cfg.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/libertas/cfg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/marvell/libertas/cfg.c- Extension
.c- Size
- 55820 bytes
- Lines
- 2221
- 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/hardirq.hlinux/sched.hlinux/wait.hlinux/slab.hlinux/ieee80211.hnet/cfg80211.hlinux/unaligned.hdecl.hcfg.hcmd.hmesh.h
Detected Declarations
struct cmd_key_materialstruct region_code_mappingfunction cfg80211function lbs_auth_to_authtypefunction lbs_add_ratesfunction lbs_add_ssid_tlvfunction TLVfunction lbs_add_supported_rates_tlvfunction add_ie_ratesfunction lbs_add_common_rates_tlvfunction firmwarefunction channelfunction Addfunction lbs_add_wpa_tlvfunction lbs_add_wps_enrollee_tlvfunction lbs_cfg_set_monitor_channelfunction lbs_cfg_set_mesh_channelfunction lbs_ret_scanfunction lbs_scan_workerfunction _internal_start_scanfunction lbs_scan_donefunction lbs_cfg_scanfunction lbs_send_disconnect_notificationfunction lbs_send_mic_failureeventfunction lbs_remove_wep_keysfunction lbs_set_wep_keysfunction lbs_enable_rsnfunction lbs_set_key_materialfunction typefunction lbs_associatefunction _new_connect_scan_reqfunction lbs_cfg_connectfunction lbs_disconnectfunction lbs_cfg_disconnectfunction lbs_cfg_set_default_keyfunction lbs_cfg_add_keyfunction lbs_cfg_del_keyfunction lbs_cfg_connectfunction lbs_cfg_get_stationfunction lbs_change_intffunction IBSSfunction lbs_ibss_join_existingfunction lbs_ibss_start_newfunction lbs_join_ibssfunction lbs_leave_ibssfunction lbs_set_power_mgmtfunction interruptsfunction lbs_cfg_wiphy_register
Annotated Snippet
struct cmd_key_material {
struct cmd_header hdr;
__le16 action;
struct MrvlIEtype_keyParamSet param;
} __packed;
static int lbs_set_key_material(struct lbs_private *priv,
int key_type, int key_info,
const u8 *key, u16 key_len)
{
struct cmd_key_material cmd;
int ret;
/*
* Example for WPA (TKIP):
*
* cmd 5e 00
* size 34 00
* sequence xx xx
* result 00 00
* action 01 00
* TLV type 00 01 key param
* length 00 26
* key type 01 00 TKIP
* key info 06 00 UNICAST | ENABLED
* key len 20 00
* key 32 bytes
*/
memset(&cmd, 0, sizeof(cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(CMD_ACT_SET);
cmd.param.type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL);
cmd.param.length = cpu_to_le16(sizeof(cmd.param) - 4);
cmd.param.keytypeid = cpu_to_le16(key_type);
cmd.param.keyinfo = cpu_to_le16(key_info);
cmd.param.keylen = cpu_to_le16(key_len);
if (key && key_len)
memcpy(cmd.param.key, key, key_len);
ret = lbs_cmd_with_response(priv, CMD_802_11_KEY_MATERIAL, &cmd);
return ret;
}
/*
* Sets the auth type (open, shared, etc) in the firmware. That
* we use CMD_802_11_AUTHENTICATE is misleading, this firmware
* command doesn't send an authentication frame at all, it just
* stores the auth_type.
*/
static int lbs_set_authtype(struct lbs_private *priv,
struct cfg80211_connect_params *sme)
{
struct cmd_ds_802_11_authenticate cmd;
int ret;
/*
* cmd 11 00
* size 19 00
* sequence xx xx
* result 00 00
* BSS id 00 13 19 80 da 30
* auth type 00
* reserved 00 00 00 00 00 00 00 00 00 00
*/
memset(&cmd, 0, sizeof(cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
if (sme->bssid)
memcpy(cmd.bssid, sme->bssid, ETH_ALEN);
/* convert auth_type */
ret = lbs_auth_to_authtype(sme->auth_type);
if (ret < 0)
goto done;
cmd.authtype = ret;
ret = lbs_cmd_with_response(priv, CMD_802_11_AUTHENTICATE, &cmd);
done:
return ret;
}
/*
* Create association request
*/
#define LBS_ASSOC_MAX_CMD_SIZE \
(sizeof(struct cmd_ds_802_11_associate) \
+ LBS_MAX_SSID_TLV_SIZE \
Annotation
- Immediate include surface: `linux/hardirq.h`, `linux/sched.h`, `linux/wait.h`, `linux/slab.h`, `linux/ieee80211.h`, `net/cfg80211.h`, `linux/unaligned.h`, `decl.h`.
- Detected declarations: `struct cmd_key_material`, `struct region_code_mapping`, `function cfg80211`, `function lbs_auth_to_authtype`, `function lbs_add_rates`, `function lbs_add_ssid_tlv`, `function TLV`, `function lbs_add_supported_rates_tlv`, `function add_ie_rates`, `function lbs_add_common_rates_tlv`.
- 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.