drivers/net/ethernet/intel/idpf/xdp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/idpf/xdp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/idpf/xdp.c- Extension
.c- Size
- 12163 bytes
- Lines
- 530
- 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.
- 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
idpf.hidpf_ptp.hidpf_virtchnl.hxdp.hxsk.h
Detected Declarations
function idpf_rxq_for_eachfunction __idpf_xdp_rxq_info_initfunction idpf_xdp_rxq_info_initfunction idpf_xdp_rxq_info_init_allfunction __idpf_xdp_rxq_info_deinitfunction idpf_xdp_rxq_info_deinitfunction idpf_xdp_rxq_info_deinit_allfunction idpf_xdp_rxq_assign_progfunction idpf_xdp_copy_prog_to_rqsfunction idpf_xdpsqs_getfunction idpf_xdpsqs_putfunction idpf_xdp_parse_cqefunction idpf_xdpsq_pollfunction idpf_xdpsq_completefunction idpf_xdp_tx_prepfunction idpf_xdp_xmitfunction idpf_xdpmo_rx_hashfunction idpf_xdpmo_rx_timestampfunction idpf_xdp_set_featuresfunction idpf_xdp_setup_progfunction idpf_xdp
Annotated Snippet
if (!timers[i]) {
for (int j = i - 1; j >= 0; j--)
kfree(timers[j]);
return -ENOMEM;
}
}
dev = vport->netdev;
sqs = vport->dflt_qv_rsrc.xdp_txq_offset;
for (u32 i = sqs; i < vport->num_txq; i++) {
struct idpf_tx_queue *xdpsq = vport->txqs[i];
xdpsq->complq = xdpsq->txq_grp->complq;
kfree(xdpsq->refillq);
xdpsq->refillq = NULL;
idpf_queue_clear(FLOW_SCH_EN, xdpsq);
idpf_queue_clear(FLOW_SCH_EN, xdpsq->complq);
idpf_queue_set(NOIRQ, xdpsq);
idpf_queue_set(XDP, xdpsq);
idpf_queue_set(XDP, xdpsq->complq);
xdpsq->timer = timers[i - sqs];
libeth_xdpsq_get(&xdpsq->xdp_lock, dev, vport->xdpsq_share);
libeth_xdpsq_init_timer(xdpsq->timer, xdpsq, &xdpsq->xdp_lock,
idpf_xdp_tx_timer);
xdpsq->pending = 0;
xdpsq->xdp_tx = 0;
xdpsq->thresh = libeth_xdp_queue_threshold(xdpsq->desc_count);
}
return 0;
}
void idpf_xdpsqs_put(const struct idpf_vport *vport)
{
struct net_device *dev;
u32 sqs;
if (!idpf_xdp_enabled(vport))
return;
dev = vport->netdev;
sqs = vport->dflt_qv_rsrc.xdp_txq_offset;
for (u32 i = sqs; i < vport->num_txq; i++) {
struct idpf_tx_queue *xdpsq = vport->txqs[i];
if (!idpf_queue_has_clear(XDP, xdpsq))
continue;
libeth_xdpsq_deinit_timer(xdpsq->timer);
libeth_xdpsq_put(&xdpsq->xdp_lock, dev);
kfree(xdpsq->timer);
xdpsq->refillq = NULL;
idpf_queue_clear(NOIRQ, xdpsq);
}
}
static int idpf_xdp_parse_cqe(const struct idpf_splitq_4b_tx_compl_desc *desc,
bool gen)
{
u32 val;
#ifdef __LIBETH_WORD_ACCESS
val = *(const u32 *)desc;
#else
val = ((u32)le16_to_cpu(desc->q_head_compl_tag.q_head) << 16) |
le16_to_cpu(desc->qid_comptype_gen);
#endif
if (!!(val & IDPF_TXD_COMPLQ_GEN_M) != gen)
return -ENODATA;
if (unlikely((val & GENMASK(IDPF_TXD_COMPLQ_GEN_S - 1, 0)) !=
FIELD_PREP(IDPF_TXD_COMPLQ_COMPL_TYPE_M,
IDPF_TXD_COMPLT_RS)))
return -EINVAL;
return upper_16_bits(val);
}
u32 idpf_xdpsq_poll(struct idpf_tx_queue *xdpsq, u32 budget)
{
struct idpf_compl_queue *cq = xdpsq->complq;
u32 tx_ntc = xdpsq->next_to_clean;
u32 tx_cnt = xdpsq->desc_count;
Annotation
- Immediate include surface: `idpf.h`, `idpf_ptp.h`, `idpf_virtchnl.h`, `xdp.h`, `xsk.h`.
- Detected declarations: `function idpf_rxq_for_each`, `function __idpf_xdp_rxq_info_init`, `function idpf_xdp_rxq_info_init`, `function idpf_xdp_rxq_info_init_all`, `function __idpf_xdp_rxq_info_deinit`, `function idpf_xdp_rxq_info_deinit`, `function idpf_xdp_rxq_info_deinit_all`, `function idpf_xdp_rxq_assign_prog`, `function idpf_xdp_copy_prog_to_rqs`, `function idpf_xdpsqs_get`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.