drivers/net/wireless/ath/ath9k/recv.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/recv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/recv.c- Extension
.c- Size
- 32153 bytes
- Lines
- 1239
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hath9k.har9003_mac.h
Detected Declarations
function Copyrightfunction bufferfunction ath_rx_buf_relinkfunction ath_setdefantennafunction ath_opmode_initfunction ath_rx_edma_buf_linkfunction ath_rx_addbuffer_edmafunction ath_rx_remove_bufferfunction ath_rx_edma_cleanupfunction list_for_each_entryfunction ath_rx_edma_init_queuefunction ath_rx_edma_initfunction ath_edma_start_recvfunction ath_edma_stop_recvfunction ath_rx_initfunction list_for_each_entryfunction ath_rx_cleanupfunction list_for_each_entryfunction receptionfunction ath_startrecvfunction ath_flushrecvfunction ath_stoprecvfunction ath_beacon_dtim_pending_cabfunction ath_rx_ps_beaconfunction ath_rx_psfunction ieee80211_is_actionfunction ath_edma_get_buffersfunction ath9k_process_tsffunction ath9k_rx_skb_preprocessfunction ath_cmn_process_fftfunction ath9k_antenna_checkfunction ath9k_apply_ampdu_detailsfunction ath_rx_count_airtimefunction ath_rx_tasklet
Annotated Snippet
if (bf->bf_mpdu) {
dma_unmap_single(sc->dev, bf->bf_buf_addr,
common->rx_bufsize,
DMA_BIDIRECTIONAL);
dev_kfree_skb_any(bf->bf_mpdu);
bf->bf_buf_addr = 0;
bf->bf_mpdu = NULL;
}
}
}
static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size)
{
__skb_queue_head_init(&rx_edma->rx_fifo);
rx_edma->rx_fifo_hwsize = size;
}
static int ath_rx_edma_init(struct ath_softc *sc, int nbufs)
{
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_hw *ah = sc->sc_ah;
struct sk_buff *skb;
struct ath_rxbuf *bf;
int error = 0, i;
ath9k_hw_set_rx_bufsize(ah, common->rx_bufsize -
ah->caps.rx_status_len);
ath_rx_edma_init_queue(&sc->rx.rx_edma[ATH9K_RX_QUEUE_LP],
ah->caps.rx_lp_qdepth);
ath_rx_edma_init_queue(&sc->rx.rx_edma[ATH9K_RX_QUEUE_HP],
ah->caps.rx_hp_qdepth);
bf = devm_kcalloc(sc->dev, sizeof(struct ath_rxbuf), nbufs, GFP_KERNEL);
if (!bf)
return -ENOMEM;
INIT_LIST_HEAD(&sc->rx.rxbuf);
for (i = 0; i < nbufs; i++, bf++) {
skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_KERNEL);
if (!skb) {
error = -ENOMEM;
goto rx_init_fail;
}
memset(skb->data, 0, common->rx_bufsize);
bf->bf_mpdu = skb;
bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
common->rx_bufsize,
DMA_BIDIRECTIONAL);
if (unlikely(dma_mapping_error(sc->dev,
bf->bf_buf_addr))) {
dev_kfree_skb_any(skb);
bf->bf_mpdu = NULL;
bf->bf_buf_addr = 0;
ath_err(common,
"dma_mapping_error() on RX init\n");
error = -ENOMEM;
goto rx_init_fail;
}
list_add_tail(&bf->list, &sc->rx.rxbuf);
}
return 0;
rx_init_fail:
ath_rx_edma_cleanup(sc);
return error;
}
static void ath_edma_start_recv(struct ath_softc *sc)
{
ath9k_hw_rxena(sc->sc_ah);
ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_HP);
ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_LP);
ath_opmode_init(sc);
ath9k_hw_startpcureceive(sc->sc_ah, sc->cur_chan->offchannel);
}
static void ath_edma_stop_recv(struct ath_softc *sc)
{
ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP);
ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP);
}
int ath_rx_init(struct ath_softc *sc, int nbufs)
{
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `ath9k.h`, `ar9003_mac.h`.
- Detected declarations: `function Copyright`, `function buffer`, `function ath_rx_buf_relink`, `function ath_setdefantenna`, `function ath_opmode_init`, `function ath_rx_edma_buf_link`, `function ath_rx_addbuffer_edma`, `function ath_rx_remove_buffer`, `function ath_rx_edma_cleanup`, `function list_for_each_entry`.
- 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.
- 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.