drivers/net/ethernet/marvell/octeontx2/nic/qos.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeontx2/nic/qos.c- Extension
.c- Size
- 44413 bytes
- Lines
- 1775
- 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/netdevice.hlinux/etherdevice.hlinux/inetdevice.hlinux/bitfield.hotx2_common.hcn10k.hqos.h
Detected Declarations
function Copyrightfunction otx2_qos_get_regaddrfunction otx2_qos_quantum_to_dwrr_weightfunction otx2_config_sched_shapingfunction __otx2_qos_txschq_cfgfunction otx2_qos_txschq_set_parent_topologyfunction otx2_qos_free_hw_node_schqfunction otx2_qos_free_hw_nodefunction list_for_each_entry_safefunction otx2_qos_free_hw_cfgfunction otx2_qos_sw_node_deletefunction otx2_qos_free_sw_node_schqfunction list_for_each_entry_safefunction __otx2_qos_free_sw_nodefunction list_for_each_entry_safefunction otx2_qos_free_sw_nodefunction otx2_qos_destroy_nodefunction otx2_qos_fill_cfg_schqfunction otx2_qos_fill_cfg_tlfunction list_for_each_entryfunction otx2_qos_prepare_txschq_cfgfunction otx2_qos_read_txschq_cfg_schqfunction list_for_each_entryfunction otx2_qos_read_txschq_cfg_tlfunction list_for_each_entryfunction otx2_qos_read_txschq_cfgfunction otx2_qos_alloc_rootfunction otx2_qos_add_child_nodefunction otx2_qos_alloc_txschq_nodefunction otx2_qos_sw_create_leaf_nodefunction hash_for_eachfunction otx2_sw_node_findfunction hash_for_each_possiblefunction otx2_sw_node_find_rcufunction hash_for_each_possible_rcufunction otx2_get_txq_by_classidfunction otx2_qos_txschq_configfunction otx2_qos_txschq_allocfunction otx2_qos_free_unused_txschqfunction otx2_qos_txschq_fill_cfg_schqfunction list_for_each_entryfunction otx2_qos_txschq_fill_cfg_tlfunction list_for_each_entryfunction otx2_qos_txschq_fill_cfgfunction __otx2_qos_assign_base_idx_tlfunction otx2_qos_assign_base_idx_tlfunction otx2_qos_assign_base_idxfunction otx2_qos_txschq_push_cfg_schq
Annotated Snippet
if (level == pfvf->qos.link_cfg_lvl) {
cfg->reg[num_regs] = NIX_AF_TL3_TL2X_LINKX_CFG(node->schq, hw->tx_link);
cfg->regval[num_regs] = BIT_ULL(13) | BIT_ULL(12);
num_regs++;
}
otx2_config_sched_shaping(pfvf, node, cfg, &num_regs);
} else if (level == NIX_TXSCH_LVL_TL2) {
/* configure parent txschq */
cfg->reg[num_regs] = NIX_AF_TL2X_PARENT(node->schq);
cfg->regval[num_regs] = (u64)hw->tx_link << 16;
num_regs++;
/* configure link cfg */
if (level == pfvf->qos.link_cfg_lvl) {
cfg->reg[num_regs] = NIX_AF_TL3_TL2X_LINKX_CFG(node->schq, hw->tx_link);
cfg->regval[num_regs] = BIT_ULL(13) | BIT_ULL(12);
num_regs++;
}
/* check if node is root */
if (node->qid == OTX2_QOS_QID_INNER && !node->parent) {
cfg->reg[num_regs] = NIX_AF_TL2X_SCHEDULE(node->schq);
cfg->regval[num_regs] = (u64)hw->txschq_aggr_lvl_rr_prio << 24 |
mtu_to_dwrr_weight(pfvf,
pfvf->tx_max_pktlen);
num_regs++;
goto txschq_cfg_out;
}
otx2_config_sched_shaping(pfvf, node, cfg, &num_regs);
}
txschq_cfg_out:
cfg->num_regs = num_regs;
}
static int otx2_qos_txschq_set_parent_topology(struct otx2_nic *pfvf,
struct otx2_qos_node *parent)
{
struct mbox *mbox = &pfvf->mbox;
struct nix_txschq_config *cfg;
int rc;
if (parent->level == NIX_TXSCH_LVL_MDQ)
return 0;
mutex_lock(&mbox->lock);
cfg = otx2_mbox_alloc_msg_nix_txschq_cfg(&pfvf->mbox);
if (!cfg) {
mutex_unlock(&mbox->lock);
return -ENOMEM;
}
cfg->lvl = parent->level;
if (parent->level == NIX_TXSCH_LVL_TL4)
cfg->reg[0] = NIX_AF_TL4X_TOPOLOGY(parent->schq);
else if (parent->level == NIX_TXSCH_LVL_TL3)
cfg->reg[0] = NIX_AF_TL3X_TOPOLOGY(parent->schq);
else if (parent->level == NIX_TXSCH_LVL_TL2)
cfg->reg[0] = NIX_AF_TL2X_TOPOLOGY(parent->schq);
else if (parent->level == NIX_TXSCH_LVL_TL1)
cfg->reg[0] = NIX_AF_TL1X_TOPOLOGY(parent->schq);
cfg->regval[0] = (u64)parent->prio_anchor << 32;
cfg->regval[0] |= ((parent->child_dwrr_prio != OTX2_QOS_DEFAULT_PRIO) ?
parent->child_dwrr_prio : 0) << 1;
cfg->num_regs++;
rc = otx2_sync_mbox_msg(&pfvf->mbox);
mutex_unlock(&mbox->lock);
return rc;
}
static void otx2_qos_free_hw_node_schq(struct otx2_nic *pfvf,
struct otx2_qos_node *parent)
{
struct otx2_qos_node *node;
list_for_each_entry_reverse(node, &parent->child_schq_list, list)
otx2_txschq_free_one(pfvf, node->level, node->schq);
}
static void otx2_qos_free_hw_node(struct otx2_nic *pfvf,
struct otx2_qos_node *parent)
{
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/etherdevice.h`, `linux/inetdevice.h`, `linux/bitfield.h`, `otx2_common.h`, `cn10k.h`, `qos.h`.
- Detected declarations: `function Copyright`, `function otx2_qos_get_regaddr`, `function otx2_qos_quantum_to_dwrr_weight`, `function otx2_config_sched_shaping`, `function __otx2_qos_txschq_cfg`, `function otx2_qos_txschq_set_parent_topology`, `function otx2_qos_free_hw_node_schq`, `function otx2_qos_free_hw_node`, `function list_for_each_entry_safe`, `function otx2_qos_free_hw_cfg`.
- 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.