drivers/net/ethernet/microchip/lan966x/lan966x_tc.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/microchip/lan966x/lan966x_tc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/microchip/lan966x/lan966x_tc.c- Extension
.c- Size
- 3568 bytes
- Lines
- 143
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/pkt_cls.hnet/pkt_sched.hlan966x_main.h
Detected Declarations
function lan966x_tc_setup_qdisc_mqpriofunction lan966x_tc_setup_qdisc_tapriofunction lan966x_tc_setup_qdisc_tbffunction lan966x_tc_setup_qdisc_cbsfunction lan966x_tc_setup_qdisc_etsfunction lan966x_tc_block_cbfunction lan966x_tc_block_cb_ingressfunction lan966x_tc_block_cb_egressfunction lan966x_tc_setup_blockfunction lan966x_tc_setup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
#include <net/pkt_cls.h>
#include <net/pkt_sched.h>
#include "lan966x_main.h"
static LIST_HEAD(lan966x_tc_block_cb_list);
static int lan966x_tc_setup_qdisc_mqprio(struct lan966x_port *port,
struct tc_mqprio_qopt_offload *mqprio)
{
u8 num_tc = mqprio->qopt.num_tc;
mqprio->qopt.hw = TC_MQPRIO_HW_OFFLOAD_TCS;
return num_tc ? lan966x_mqprio_add(port, num_tc) :
lan966x_mqprio_del(port);
}
static int lan966x_tc_setup_qdisc_taprio(struct lan966x_port *port,
struct tc_taprio_qopt_offload *taprio)
{
switch (taprio->cmd) {
case TAPRIO_CMD_REPLACE:
return lan966x_taprio_add(port, taprio);
case TAPRIO_CMD_DESTROY:
return lan966x_taprio_del(port);
default:
return -EOPNOTSUPP;
}
}
static int lan966x_tc_setup_qdisc_tbf(struct lan966x_port *port,
struct tc_tbf_qopt_offload *qopt)
{
switch (qopt->command) {
case TC_TBF_REPLACE:
return lan966x_tbf_add(port, qopt);
case TC_TBF_DESTROY:
return lan966x_tbf_del(port, qopt);
default:
return -EOPNOTSUPP;
}
return -EOPNOTSUPP;
}
static int lan966x_tc_setup_qdisc_cbs(struct lan966x_port *port,
struct tc_cbs_qopt_offload *qopt)
{
return qopt->enable ? lan966x_cbs_add(port, qopt) :
lan966x_cbs_del(port, qopt);
}
static int lan966x_tc_setup_qdisc_ets(struct lan966x_port *port,
struct tc_ets_qopt_offload *qopt)
{
switch (qopt->command) {
case TC_ETS_REPLACE:
return lan966x_ets_add(port, qopt);
case TC_ETS_DESTROY:
return lan966x_ets_del(port, qopt);
default:
return -EOPNOTSUPP;
};
return -EOPNOTSUPP;
}
static int lan966x_tc_block_cb(enum tc_setup_type type, void *type_data,
void *cb_priv, bool ingress)
{
struct lan966x_port *port = cb_priv;
switch (type) {
case TC_SETUP_CLSMATCHALL:
return lan966x_tc_matchall(port, type_data, ingress);
case TC_SETUP_CLSFLOWER:
return lan966x_tc_flower(port, type_data, ingress);
default:
return -EOPNOTSUPP;
}
}
static int lan966x_tc_block_cb_ingress(enum tc_setup_type type,
void *type_data, void *cb_priv)
{
return lan966x_tc_block_cb(type, type_data, cb_priv, true);
}
Annotation
- Immediate include surface: `net/pkt_cls.h`, `net/pkt_sched.h`, `lan966x_main.h`.
- Detected declarations: `function lan966x_tc_setup_qdisc_mqprio`, `function lan966x_tc_setup_qdisc_taprio`, `function lan966x_tc_setup_qdisc_tbf`, `function lan966x_tc_setup_qdisc_cbs`, `function lan966x_tc_setup_qdisc_ets`, `function lan966x_tc_block_cb`, `function lan966x_tc_block_cb_ingress`, `function lan966x_tc_block_cb_egress`, `function lan966x_tc_setup_block`, `function lan966x_tc_setup`.
- 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.