drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c- Extension
.c- Size
- 2441 bytes
- Lines
- 92
- 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
lan966x_main.h
Detected Declarations
function lan966x_tc_matchall_addfunction lan966x_tc_matchall_delfunction lan966x_tc_matchall_statsfunction lan966x_tc_matchall
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
#include "lan966x_main.h"
static int lan966x_tc_matchall_add(struct lan966x_port *port,
struct tc_cls_matchall_offload *f,
bool ingress)
{
struct flow_action_entry *act;
if (!flow_offload_has_one_action(&f->rule->action)) {
NL_SET_ERR_MSG_MOD(f->common.extack,
"Only once action per filter is supported");
return -EOPNOTSUPP;
}
act = &f->rule->action.entries[0];
switch (act->id) {
case FLOW_ACTION_POLICE:
return lan966x_police_port_add(port, &f->rule->action, act,
f->cookie, ingress,
f->common.extack);
case FLOW_ACTION_MIRRED:
return lan966x_mirror_port_add(port, act, f->cookie,
ingress, f->common.extack);
case FLOW_ACTION_GOTO:
return lan966x_goto_port_add(port, f->common.chain_index,
act->chain_index, f->cookie,
f->common.extack);
default:
NL_SET_ERR_MSG_MOD(f->common.extack,
"Unsupported action");
return -EOPNOTSUPP;
}
return 0;
}
static int lan966x_tc_matchall_del(struct lan966x_port *port,
struct tc_cls_matchall_offload *f,
bool ingress)
{
if (f->cookie == port->tc.police_id) {
return lan966x_police_port_del(port, f->cookie,
f->common.extack);
} else if (f->cookie == port->tc.ingress_mirror_id ||
f->cookie == port->tc.egress_mirror_id) {
return lan966x_mirror_port_del(port, ingress,
f->common.extack);
} else {
return lan966x_goto_port_del(port, f->cookie, f->common.extack);
}
return 0;
}
static int lan966x_tc_matchall_stats(struct lan966x_port *port,
struct tc_cls_matchall_offload *f,
bool ingress)
{
if (f->cookie == port->tc.police_id) {
lan966x_police_port_stats(port, &f->stats);
} else if (f->cookie == port->tc.ingress_mirror_id ||
f->cookie == port->tc.egress_mirror_id) {
lan966x_mirror_port_stats(port, &f->stats, ingress);
} else {
NL_SET_ERR_MSG_MOD(f->common.extack,
"Unsupported action");
return -EOPNOTSUPP;
}
return 0;
}
int lan966x_tc_matchall(struct lan966x_port *port,
struct tc_cls_matchall_offload *f,
bool ingress)
{
switch (f->command) {
case TC_CLSMATCHALL_REPLACE:
return lan966x_tc_matchall_add(port, f, ingress);
case TC_CLSMATCHALL_DESTROY:
return lan966x_tc_matchall_del(port, f, ingress);
case TC_CLSMATCHALL_STATS:
return lan966x_tc_matchall_stats(port, f, ingress);
default:
return -EOPNOTSUPP;
}
return 0;
Annotation
- Immediate include surface: `lan966x_main.h`.
- Detected declarations: `function lan966x_tc_matchall_add`, `function lan966x_tc_matchall_del`, `function lan966x_tc_matchall_stats`, `function lan966x_tc_matchall`.
- 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.