drivers/net/wireless/marvell/libertas_tf/cmd.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/libertas_tf/cmd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/marvell/libertas_tf/cmd.c- Extension
.c- Size
- 20380 bytes
- Lines
- 803
- 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.
- 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/slab.hlinux/export.hlibertas_tf.h
Detected Declarations
function lbtf_cmd_copybackfunction lbtf_geo_initfunction lbtf_update_hw_specfunction lbtf_set_channelfunction lbtf_beacon_setfunction lbtf_beacon_ctrlfunction lbtf_queue_cmdfunction lbtf_submit_commandfunction __lbtf_cleanup_and_insert_cmdfunction lbtf_cleanup_and_insert_cmdfunction lbtf_complete_commandfunction lbtf_cmd_set_mac_multicast_addrfunction lbtf_set_modefunction lbtf_set_bssidfunction lbtf_set_mac_addressfunction lbtf_set_radio_controlfunction lbtf_set_mac_controlfunction lbtf_allocate_cmd_bufferfunction lbtf_free_cmd_bufferfunction lbtf_execute_next_commandfunction lbtf_cmd_asyncfunction __lbtf_cmdfunction lbtf_cmd_response_rxfunction lbtf_process_rx_commandexport lbtf_cmd_copybackexport __lbtf_cmdexport lbtf_cmd_response_rx
Annotated Snippet
if (channel_ranges[i].regdomain == priv->regioncode) {
range = &channel_ranges[i];
break;
}
for (ch = range->start; ch < range->end; ch++)
priv->channels[CHAN_TO_IDX(ch)].flags = 0;
}
/**
* lbtf_update_hw_spec: Updates the hardware details.
*
* @priv: A pointer to struct lbtf_private structure
*
* Returns: 0 on success, error on failure
*/
int lbtf_update_hw_spec(struct lbtf_private *priv)
{
struct cmd_ds_get_hw_spec cmd;
int ret = -1;
u32 i;
lbtf_deb_enter(LBTF_DEB_CMD);
memset(&cmd, 0, sizeof(cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN);
ret = lbtf_cmd_with_response(priv, CMD_GET_HW_SPEC, &cmd);
if (ret)
goto out;
priv->fwcapinfo = le32_to_cpu(cmd.fwcapinfo);
/* The firmware release is in an interesting format: the patch
* level is in the most significant nibble ... so fix that: */
priv->fwrelease = le32_to_cpu(cmd.fwrelease);
priv->fwrelease = (priv->fwrelease << 8) |
(priv->fwrelease >> 24 & 0xff);
printk(KERN_INFO "libertastf: %pM, fw %u.%u.%up%u, cap 0x%08x\n",
cmd.permanentaddr,
priv->fwrelease >> 24 & 0xff,
priv->fwrelease >> 16 & 0xff,
priv->fwrelease >> 8 & 0xff,
priv->fwrelease & 0xff,
priv->fwcapinfo);
lbtf_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n",
cmd.hwifversion, cmd.version);
/* Clamp region code to 8-bit since FW spec indicates that it should
* only ever be 8-bit, even though the field size is 16-bit. Some
* firmware returns non-zero high 8 bits here.
*/
priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF;
for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
/* use the region code to search for the index */
if (priv->regioncode == lbtf_region_code_to_index[i])
break;
}
/* if it's unidentified region code, use the default (USA) */
if (i >= MRVDRV_MAX_REGION_CODE) {
priv->regioncode = 0x10;
pr_info("unidentified region code; using the default (USA)\n");
}
if (priv->current_addr[0] == 0xff)
memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN);
SET_IEEE80211_PERM_ADDR(priv->hw, priv->current_addr);
lbtf_geo_init(priv);
out:
lbtf_deb_leave(LBTF_DEB_CMD);
return ret;
}
/**
* lbtf_set_channel: Set the radio channel
*
* @priv: A pointer to struct lbtf_private structure
* @channel: The desired channel, or 0 to clear a locked channel
*
* Returns: 0 on success, error on failure
*/
int lbtf_set_channel(struct lbtf_private *priv, u8 channel)
{
int ret = 0;
struct cmd_ds_802_11_rf_channel cmd;
Annotation
- Immediate include surface: `linux/hardirq.h`, `linux/slab.h`, `linux/export.h`, `libertas_tf.h`.
- Detected declarations: `function lbtf_cmd_copyback`, `function lbtf_geo_init`, `function lbtf_update_hw_spec`, `function lbtf_set_channel`, `function lbtf_beacon_set`, `function lbtf_beacon_ctrl`, `function lbtf_queue_cmd`, `function lbtf_submit_command`, `function __lbtf_cleanup_and_insert_cmd`, `function lbtf_cleanup_and_insert_cmd`.
- 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.
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.