drivers/net/ethernet/marvell/prestera/prestera_flow.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/prestera/prestera_flow.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/prestera/prestera_flow.c- Extension
.c- Size
- 7271 bytes
- Lines
- 316
- 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
linux/kernel.hlinux/list.hprestera.hprestera_acl.hprestera_flow.hprestera_flower.hprestera_matchall.hprestera_span.h
Detected Declarations
function prestera_flow_block_mall_cbfunction prestera_flow_block_flower_cbfunction prestera_flow_block_cbfunction prestera_flow_block_destroyfunction prestera_flow_block_createfunction prestera_flow_block_releasefunction prestera_flow_block_is_boundfunction prestera_flow_block_lookupfunction prestera_flow_block_bindfunction prestera_flow_block_unbindfunction prestera_flow_block_getfunction prestera_flow_block_putfunction prestera_setup_flow_block_bindfunction prestera_setup_flow_block_unbindfunction prestera_setup_flow_block_clsactfunction prestera_flow_block_setup
Annotated Snippet
if (IS_ERR(block_cb)) {
prestera_flow_block_destroy(block);
return ERR_CAST(block_cb);
}
block->block_cb = block_cb;
*register_block = true;
} else {
block = flow_block_cb_priv(block_cb);
*register_block = false;
}
flow_block_cb_incref(block_cb);
return block;
}
static void prestera_flow_block_put(struct prestera_flow_block *block)
{
struct flow_block_cb *block_cb = block->block_cb;
if (flow_block_cb_decref(block_cb))
return;
flow_block_cb_free(block_cb);
prestera_flow_block_destroy(block);
}
static int prestera_setup_flow_block_bind(struct prestera_port *port,
struct flow_block_offload *f, bool ingress)
{
struct prestera_switch *sw = port->sw;
struct prestera_flow_block *block;
struct flow_block_cb *block_cb;
bool register_block;
int err;
block = prestera_flow_block_get(sw, f, ®ister_block, ingress);
if (IS_ERR(block))
return PTR_ERR(block);
block_cb = block->block_cb;
err = prestera_flow_block_bind(block, port);
if (err)
goto err_block_bind;
if (register_block) {
flow_block_cb_add(block_cb, f);
list_add_tail(&block_cb->driver_list, &prestera_block_cb_list);
}
if (ingress)
port->ingress_flow_block = block;
else
port->egress_flow_block = block;
return 0;
err_block_bind:
prestera_flow_block_put(block);
return err;
}
static void prestera_setup_flow_block_unbind(struct prestera_port *port,
struct flow_block_offload *f, bool ingress)
{
struct prestera_switch *sw = port->sw;
struct prestera_flow_block *block;
struct flow_block_cb *block_cb;
int err;
block_cb = flow_block_cb_lookup(f->block, prestera_flow_block_cb, sw);
if (!block_cb)
return;
block = flow_block_cb_priv(block_cb);
prestera_mall_destroy(block);
err = prestera_flow_block_unbind(block, port);
if (err)
goto error;
if (!flow_block_cb_decref(block_cb)) {
flow_block_cb_remove(block_cb, f);
list_del(&block_cb->driver_list);
}
error:
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/list.h`, `prestera.h`, `prestera_acl.h`, `prestera_flow.h`, `prestera_flower.h`, `prestera_matchall.h`, `prestera_span.h`.
- Detected declarations: `function prestera_flow_block_mall_cb`, `function prestera_flow_block_flower_cb`, `function prestera_flow_block_cb`, `function prestera_flow_block_destroy`, `function prestera_flow_block_create`, `function prestera_flow_block_release`, `function prestera_flow_block_is_bound`, `function prestera_flow_block_lookup`, `function prestera_flow_block_bind`, `function prestera_flow_block_unbind`.
- 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.