drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c- Extension
.c- Size
- 26182 bytes
- Lines
- 910
- 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
linux/kernel.hlinux/errno.hlinux/netdevice.hlinux/log2.hnet/net_namespace.hnet/flow_dissector.hnet/pkt_cls.hnet/tc_act/tc_gact.hnet/tc_act/tc_mirred.hnet/tc_act/tc_vlan.hspectrum.hcore_acl_flex_keys.h
Detected Declarations
function mlxsw_sp_policer_validatefunction mlxsw_sp_flower_parse_actionsfunction flow_action_for_eachfunction mlxsw_sp_flower_parse_meta_iiffunction mlxsw_sp_flower_parse_metafunction mlxsw_sp_flower_parse_ipv4function mlxsw_sp_flower_parse_ipv6function mlxsw_sp_flower_parse_portsfunction mlxsw_sp_flower_parse_ports_rangefunction mlxsw_sp_flower_parse_tcpfunction mlxsw_sp_flower_parse_ipfunction mlxsw_sp_flower_parsefunction mlxsw_sp_flower_mall_prio_checkfunction mlxsw_sp_flower_replacefunction mlxsw_sp_flower_destroyfunction mlxsw_sp_flower_statsfunction mlxsw_sp_flower_tmplt_createfunction mlxsw_sp_flower_tmplt_destroyfunction mlxsw_sp_flower_prio_get
Annotated Snippet
switch (act->id) {
case FLOW_ACTION_ACCEPT:
err = mlxsw_sp_acl_rulei_act_terminate(rulei);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Cannot append terminate action");
return err;
}
break;
case FLOW_ACTION_DROP: {
bool ingress;
if (mlxsw_sp_flow_block_is_mixed_bound(block)) {
NL_SET_ERR_MSG_MOD(extack, "Drop action is not supported when block is bound to ingress and egress");
return -EOPNOTSUPP;
}
ingress = mlxsw_sp_flow_block_is_ingress_bound(block);
err = mlxsw_sp_acl_rulei_act_drop(rulei, ingress,
act->user_cookie, extack);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Cannot append drop action");
return err;
}
/* Forbid block with this rulei to be bound
* to ingress/egress in future. Ingress rule is
* a blocker for egress and vice versa.
*/
if (ingress)
rulei->egress_bind_blocker = 1;
else
rulei->ingress_bind_blocker = 1;
}
break;
case FLOW_ACTION_TRAP:
err = mlxsw_sp_acl_rulei_act_trap(rulei);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Cannot append trap action");
return err;
}
break;
case FLOW_ACTION_GOTO: {
u32 chain_index = act->chain_index;
struct mlxsw_sp_acl_ruleset *ruleset;
u16 group_id;
ruleset = mlxsw_sp_acl_ruleset_lookup(mlxsw_sp, block,
chain_index,
MLXSW_SP_ACL_PROFILE_FLOWER);
if (IS_ERR(ruleset))
return PTR_ERR(ruleset);
group_id = mlxsw_sp_acl_ruleset_group_id(ruleset);
err = mlxsw_sp_acl_rulei_act_jump(rulei, group_id);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Cannot append jump action");
return err;
}
}
break;
case FLOW_ACTION_REDIRECT: {
struct net_device *out_dev;
struct mlxsw_sp_fid *fid;
u16 fid_index;
if (mlxsw_sp_flow_block_is_egress_bound(block)) {
NL_SET_ERR_MSG_MOD(extack, "Redirect action is not supported on egress");
return -EOPNOTSUPP;
}
/* Forbid block with this rulei to be bound
* to egress in future.
*/
rulei->egress_bind_blocker = 1;
/* Ignore learning and security lookup as redirection
* using ingress filters happens before the bridge.
*/
err = mlxsw_sp_acl_rulei_act_ignore(mlxsw_sp, rulei,
true, true);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Cannot append ignore action");
return err;
}
fid = mlxsw_sp_acl_dummy_fid(mlxsw_sp);
fid_index = mlxsw_sp_fid_index(fid);
err = mlxsw_sp_acl_rulei_act_fid_set(mlxsw_sp, rulei,
fid_index, extack);
if (err)
return err;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/netdevice.h`, `linux/log2.h`, `net/net_namespace.h`, `net/flow_dissector.h`, `net/pkt_cls.h`, `net/tc_act/tc_gact.h`.
- Detected declarations: `function mlxsw_sp_policer_validate`, `function mlxsw_sp_flower_parse_actions`, `function flow_action_for_each`, `function mlxsw_sp_flower_parse_meta_iif`, `function mlxsw_sp_flower_parse_meta`, `function mlxsw_sp_flower_parse_ipv4`, `function mlxsw_sp_flower_parse_ipv6`, `function mlxsw_sp_flower_parse_ports`, `function mlxsw_sp_flower_parse_ports_range`, `function mlxsw_sp_flower_parse_tcp`.
- 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.