drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c
Source file repositories/reference/linux-study-clean/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c- Extension
.c- Size
- 32927 bytes
- Lines
- 1174
- 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.
- 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/atomic.hlinux/bitfield.hlinux/bitops.hlinux/device.hlinux/dma-direction.hlinux/dma-mapping.hlinux/gfp.hlinux/err.hlinux/iopoll.hlinux/jiffies.hlinux/kernel.hlinux/kthread.hlinux/list.hlinux/minmax.hlinux/mm.hlinux/netdevice.hlinux/pm_runtime.hlinux/sched.hlinux/skbuff.hlinux/slab.hlinux/spinlock.hlinux/string.hlinux/types.hlinux/wait.hlinux/workqueue.hnet/gro.ht7xx_dpmaif.ht7xx_hif_dpmaif.ht7xx_hif_dpmaif_rx.ht7xx_netdev.ht7xx_pci.h
Detected Declarations
function Copyrightfunction t7xx_dpmaif_update_bat_wr_idxfunction t7xx_alloc_and_map_skb_infofunction t7xx_unmap_bat_skbfunction t7xx_dpmaif_rx_buf_allocfunction t7xx_dpmaifq_release_pit_entryfunction t7xx_dpmaif_set_bat_maskfunction t7xx_frag_bat_cur_bid_checkfunction t7xx_unmap_bat_pagefunction t7xx_dpmaif_rx_frag_allocfunction t7xx_dpmaif_set_frag_to_skbfunction t7xx_dpmaif_get_fragfunction t7xx_bat_cur_bid_checkfunction t7xx_dpmaif_read_pit_seqfunction t7xx_dpmaif_check_pit_seqfunction t7xx_dpmaif_avail_pkt_bat_cntfunction t7xx_dpmaif_release_bat_entryfunction t7xx_dpmaif_pit_release_and_addfunction t7xx_dpmaif_bat_release_and_addfunction t7xx_dpmaif_frag_bat_release_and_addfunction t7xx_dpmaif_parse_msg_pitfunction t7xx_dpmaif_set_data_to_skbfunction t7xx_dpmaif_get_rx_pktfunction t7xx_dpmaifq_rx_notify_hwfunction t7xx_dpmaif_rx_skbfunction t7xx_dpmaif_rx_startfunction t7xx_dpmaifq_poll_pitfunction t7xx_dpmaif_napi_rx_data_collectfunction t7xx_dpmaif_napi_rx_pollfunction t7xx_dpmaif_irq_rx_donefunction t7xx_dpmaif_base_freefunction t7xx_dpmaif_bat_allocfunction t7xx_dpmaif_bat_freefunction t7xx_dpmaif_rx_allocfunction t7xx_dpmaif_rx_buf_freefunction t7xx_dpmaif_rxq_initfunction t7xx_dpmaif_rxq_freefunction t7xx_dpmaif_bat_release_workfunction t7xx_dpmaif_bat_rel_wq_allocfunction t7xx_dpmaif_bat_wq_relfunction t7xx_dpmaif_rx_stopfunction t7xx_dpmaif_stop_rxqfunction t7xx_dpmaif_rx_clear
Annotated Snippet
if (hw_wr_idx != bat_req->bat_wr_idx) {
ret = -EFAULT;
dev_err(dpmaif_ctrl->dev, "Write index mismatch in RX ring\n");
goto err_unmap_skbs;
}
}
return 0;
err_unmap_skbs:
while (i--)
t7xx_unmap_bat_skb(dpmaif_ctrl->dev, bat_req->bat_skb, i);
return ret;
}
static int t7xx_dpmaifq_release_pit_entry(struct dpmaif_rx_queue *rxq,
const unsigned int rel_entry_num)
{
struct dpmaif_hw_info *hw_info = &rxq->dpmaif_ctrl->hw_info;
unsigned int old_rel_idx, new_rel_idx, hw_wr_idx;
int ret;
if (!rxq->que_started)
return 0;
if (rel_entry_num >= rxq->pit_size_cnt) {
dev_err(rxq->dpmaif_ctrl->dev, "Invalid PIT release index\n");
return -EINVAL;
}
old_rel_idx = rxq->pit_release_rd_idx;
new_rel_idx = old_rel_idx + rel_entry_num;
hw_wr_idx = rxq->pit_wr_idx;
if (hw_wr_idx < old_rel_idx && new_rel_idx >= rxq->pit_size_cnt)
new_rel_idx -= rxq->pit_size_cnt;
ret = t7xx_dpmaif_dlq_add_pit_remain_cnt(hw_info, rxq->index, rel_entry_num);
if (ret) {
dev_err(rxq->dpmaif_ctrl->dev, "PIT release failure: %d\n", ret);
return ret;
}
rxq->pit_release_rd_idx = new_rel_idx;
return 0;
}
static void t7xx_dpmaif_set_bat_mask(struct dpmaif_bat_request *bat_req, unsigned int idx)
{
unsigned long flags;
spin_lock_irqsave(&bat_req->mask_lock, flags);
set_bit(idx, bat_req->bat_bitmap);
spin_unlock_irqrestore(&bat_req->mask_lock, flags);
}
static int t7xx_frag_bat_cur_bid_check(struct dpmaif_rx_queue *rxq,
const unsigned int cur_bid)
{
struct dpmaif_bat_request *bat_frag = rxq->bat_frag;
struct dpmaif_bat_page *bat_page;
if (cur_bid >= DPMAIF_FRG_COUNT)
return -EINVAL;
bat_page = bat_frag->bat_skb + cur_bid;
if (!bat_page->page)
return -EINVAL;
return 0;
}
static void t7xx_unmap_bat_page(struct device *dev, struct dpmaif_bat_page *bat_page_base,
unsigned int index)
{
struct dpmaif_bat_page *bat_page = bat_page_base + index;
if (bat_page->page) {
dma_unmap_page(dev, bat_page->data_bus_addr, bat_page->data_len, DMA_FROM_DEVICE);
put_page(bat_page->page);
bat_page->page = NULL;
}
}
/**
* t7xx_dpmaif_rx_frag_alloc() - Allocates buffers for the Fragment BAT ring.
* @dpmaif_ctrl: Pointer to DPMAIF context structure.
* @bat_req: Pointer to BAT request structure.
* @buf_cnt: Number of buffers to allocate.
* @initial: Indicates if the ring is being populated for the first time.
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/bitfield.h`, `linux/bitops.h`, `linux/device.h`, `linux/dma-direction.h`, `linux/dma-mapping.h`, `linux/gfp.h`, `linux/err.h`.
- Detected declarations: `function Copyright`, `function t7xx_dpmaif_update_bat_wr_idx`, `function t7xx_alloc_and_map_skb_info`, `function t7xx_unmap_bat_skb`, `function t7xx_dpmaif_rx_buf_alloc`, `function t7xx_dpmaifq_release_pit_entry`, `function t7xx_dpmaif_set_bat_mask`, `function t7xx_frag_bat_cur_bid_check`, `function t7xx_unmap_bat_page`, `function t7xx_dpmaif_rx_frag_alloc`.
- 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.