drivers/net/wireless/ath/ath9k/hif_usb.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/hif_usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/hif_usb.c- Extension
.c- Size
- 35734 bytes
- Lines
- 1524
- 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/unaligned.hhtc.h
Detected Declarations
function hif_usb_regout_cbfunction hif_usb_send_regoutfunction hif_usb_mgmt_cbfunction hif_usb_send_mgmtfunction ath9k_skb_queue_purgefunction ath9k_skb_queue_completefunction hif_usb_tx_cbfunction __hif_usb_txfunction hif_usb_send_txfunction hif_usb_startfunction hif_usb_stopfunction hif_usb_sendfunction check_indexfunction hif_usb_sta_drainfunction skb_queue_walk_safefunction ath9k_hif_usb_free_rx_remain_skbfunction ath9k_hif_usb_rx_streamfunction ath9k_hif_usb_rx_cbfunction ath9k_hif_usb_reg_in_cbfunction ath9k_hif_usb_dealloc_tx_urbsfunction ath9k_hif_usb_alloc_tx_urbsfunction ath9k_hif_usb_dealloc_rx_urbsfunction ath9k_hif_usb_alloc_rx_urbsfunction ath9k_hif_usb_dealloc_reg_in_urbsfunction ath9k_hif_usb_alloc_reg_in_urbsfunction ath9k_hif_usb_alloc_urbsfunction ath9k_hif_usb_dealloc_urbsfunction ath9k_hif_usb_download_fwfunction ath9k_hif_usb_dev_initfunction ath9k_hif_usb_dev_deinitfunction ath9k_hif_usb_firmware_failfunction ath9k_hif_request_firmwarefunction ath9k_hif_usb_firmware_cbfunction send_eject_commandfunction ath9k_hif_usb_probefunction usb_endpoint_numfunction ath9k_hif_usb_rebootfunction ath9k_hif_usb_disconnectfunction ath9k_hif_usb_suspendfunction ath9k_hif_usb_resume
Annotated Snippet
if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
dev_kfree_skb_any(cmd->skb);
kfree(cmd);
return;
}
spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
break;
default:
txok = false;
break;
}
skb_pull(cmd->skb, 4);
ath9k_htc_txcompletion_cb(cmd->hif_dev->htc_handle,
cmd->skb, txok);
kfree(cmd);
}
static int hif_usb_send_mgmt(struct hif_device_usb *hif_dev,
struct sk_buff *skb)
{
struct urb *urb;
struct cmd_buf *cmd;
int ret = 0;
__le16 *hdr;
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (urb == NULL)
return -ENOMEM;
cmd = kzalloc_obj(*cmd, GFP_ATOMIC);
if (cmd == NULL) {
usb_free_urb(urb);
return -ENOMEM;
}
cmd->skb = skb;
cmd->hif_dev = hif_dev;
hdr = skb_push(skb, 4);
*hdr++ = cpu_to_le16(skb->len - 4);
*hdr++ = cpu_to_le16(ATH_USB_TX_STREAM_MODE_TAG);
usb_fill_bulk_urb(urb, hif_dev->udev,
usb_sndbulkpipe(hif_dev->udev, USB_WLAN_TX_PIPE),
skb->data, skb->len,
hif_usb_mgmt_cb, cmd);
usb_anchor_urb(urb, &hif_dev->mgmt_submitted);
ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret) {
usb_unanchor_urb(urb);
kfree(cmd);
}
usb_free_urb(urb);
return ret;
}
static inline void ath9k_skb_queue_purge(struct hif_device_usb *hif_dev,
struct sk_buff_head *list)
{
struct sk_buff *skb;
while ((skb = __skb_dequeue(list)) != NULL) {
dev_kfree_skb_any(skb);
}
}
static inline void ath9k_skb_queue_complete(struct hif_device_usb *hif_dev,
struct sk_buff_head *queue,
bool txok)
{
struct sk_buff *skb;
while ((skb = __skb_dequeue(queue)) != NULL) {
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
int ln = skb->len;
#endif
ath9k_htc_txcompletion_cb(hif_dev->htc_handle,
skb, txok);
if (txok) {
TX_STAT_INC(hif_dev, skb_success);
TX_STAT_ADD(hif_dev, skb_success_bytes, ln);
}
else
TX_STAT_INC(hif_dev, skb_failed);
}
Annotation
- Immediate include surface: `linux/unaligned.h`, `htc.h`.
- Detected declarations: `function hif_usb_regout_cb`, `function hif_usb_send_regout`, `function hif_usb_mgmt_cb`, `function hif_usb_send_mgmt`, `function ath9k_skb_queue_purge`, `function ath9k_skb_queue_complete`, `function hif_usb_tx_cb`, `function __hif_usb_tx`, `function hif_usb_send_tx`, `function hif_usb_start`.
- 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.