drivers/net/wireless/ath/ath10k/usb.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath10k/usb.c- Extension
.c- Size
- 27972 bytes
- Lines
- 1127
- 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/module.hlinux/usb.hdebug.hcore.hbmi.hhif.hhtc.husb.h
Detected Declarations
function eid_from_htc_hdrfunction is_trailer_only_msgfunction ath10k_usb_alloc_urb_from_pipefunction ath10k_usb_free_urb_to_pipefunction ath10k_usb_cleanup_recv_urbfunction ath10k_usb_free_pipe_resourcesfunction ath10k_usb_cleanup_pipe_resourcesfunction ath10k_usb_recv_completefunction ath10k_usb_transmit_completefunction ath10k_usb_post_recv_transfersfunction ath10k_usb_flush_allfunction ath10k_usb_start_recv_pipesfunction ath10k_usb_tx_completefunction ath10k_usb_rx_completefunction ath10k_usb_io_comp_workfunction ath10k_usb_destroyfunction ath10k_usb_hif_startfunction ath10k_usb_hif_tx_sgfunction ath10k_usb_hif_stopfunction ath10k_usb_hif_get_free_queue_numberfunction ath10k_usb_submit_ctrl_outfunction ath10k_usb_submit_ctrl_infunction ath10k_usb_ctrl_msg_exchangefunction ath10k_usb_hif_diag_readfunction ath10k_usb_hif_diag_writefunction ath10k_usb_bmi_exchange_msgfunction ath10k_usb_hif_get_default_pipefunction ath10k_usb_hif_map_service_to_pipefunction ath10k_usb_hif_power_upfunction ath10k_usb_hif_power_downfunction ath10k_usb_hif_suspendfunction ath10k_usb_hif_resumefunction ath10k_usb_get_logical_pipe_numfunction ath10k_usb_alloc_pipe_resourcesfunction ath10k_usb_setup_pipe_resourcesfunction ath10k_usb_createfunction ath10k_usb_napi_pollfunction ath10k_usb_probefunction ath10k_usb_disconnectfunction ath10k_usb_pm_suspendfunction ath10k_usb_pm_resume
Annotated Snippet
switch (urb->status) {
case -ECONNRESET:
case -ENOENT:
case -ESHUTDOWN:
/* no need to spew these errors when device
* removed or urb killed due to driver shutdown
*/
status = -ECANCELED;
break;
default:
ath10k_dbg(ar, ATH10K_DBG_USB_BULK,
"usb recv pipe %d ep 0x%2.2x failed: %d\n",
pipe->logical_pipe_num,
pipe->ep_address, urb->status);
break;
}
goto cleanup_recv_urb;
}
if (urb->actual_length == 0)
goto cleanup_recv_urb;
skb = urb_context->skb;
/* we are going to pass it up */
urb_context->skb = NULL;
skb_put(skb, urb->actual_length);
/* note: queue implements a lock */
skb_queue_tail(&pipe->io_comp_queue, skb);
schedule_work(&pipe->io_complete_work);
cleanup_recv_urb:
ath10k_usb_cleanup_recv_urb(urb_context);
if (status == 0 &&
pipe->urb_cnt >= pipe->urb_cnt_thresh) {
/* our free urbs are piling up, post more transfers */
ath10k_usb_post_recv_transfers(ar, pipe);
}
}
static void ath10k_usb_transmit_complete(struct urb *urb)
{
struct ath10k_urb_context *urb_context = urb->context;
struct ath10k_usb_pipe *pipe = urb_context->pipe;
struct ath10k *ar = pipe->ar_usb->ar;
struct sk_buff *skb;
if (urb->status != 0) {
ath10k_dbg(ar, ATH10K_DBG_USB_BULK,
"pipe: %d, failed:%d\n",
pipe->logical_pipe_num, urb->status);
}
skb = urb_context->skb;
urb_context->skb = NULL;
ath10k_usb_free_urb_to_pipe(urb_context->pipe, urb_context);
/* note: queue implements a lock */
skb_queue_tail(&pipe->io_comp_queue, skb);
schedule_work(&pipe->io_complete_work);
}
/* pipe operations */
static void ath10k_usb_post_recv_transfers(struct ath10k *ar,
struct ath10k_usb_pipe *recv_pipe)
{
struct ath10k_urb_context *urb_context;
struct urb *urb;
int usb_status;
for (;;) {
urb_context = ath10k_usb_alloc_urb_from_pipe(recv_pipe);
if (!urb_context)
break;
urb_context->skb = dev_alloc_skb(ATH10K_USB_RX_BUFFER_SIZE);
if (!urb_context->skb)
goto err;
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb)
goto err;
usb_fill_bulk_urb(urb,
recv_pipe->ar_usb->udev,
recv_pipe->usb_pipe_handle,
urb_context->skb->data,
ATH10K_USB_RX_BUFFER_SIZE,
Annotation
- Immediate include surface: `linux/module.h`, `linux/usb.h`, `debug.h`, `core.h`, `bmi.h`, `hif.h`, `htc.h`, `usb.h`.
- Detected declarations: `function eid_from_htc_hdr`, `function is_trailer_only_msg`, `function ath10k_usb_alloc_urb_from_pipe`, `function ath10k_usb_free_urb_to_pipe`, `function ath10k_usb_cleanup_recv_urb`, `function ath10k_usb_free_pipe_resources`, `function ath10k_usb_cleanup_pipe_resources`, `function ath10k_usb_recv_complete`, `function ath10k_usb_transmit_complete`, `function ath10k_usb_post_recv_transfers`.
- 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.