drivers/net/ethernet/mellanox/mlx5/core/esw/acl/egress_lgcy.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/egress_lgcy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/egress_lgcy.c- Extension
.c- Size
- 4935 bytes
- Lines
- 179
- 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
mlx5_core.heswitch.hhelper.hlgcy.h
Detected Declarations
function esw_acl_egress_lgcy_rules_destroyfunction esw_acl_egress_lgcy_groups_createfunction esw_acl_egress_lgcy_groups_destroyfunction esw_acl_egress_lgcy_setupfunction esw_acl_egress_lgcy_cleanup
Annotated Snippet
if (IS_ERR(drop_counter)) {
esw_warn(esw->dev,
"vport[%d] configure egress drop rule counter err(%pe)\n",
vport->vport, drop_counter);
drop_counter = NULL;
}
vport->egress.legacy.drop_counter = drop_counter;
}
esw_acl_egress_lgcy_rules_destroy(vport);
if (!vport->info.vlan && !vport->info.qos) {
esw_acl_egress_lgcy_cleanup(esw, vport);
return 0;
}
if (!vport->egress.acl) {
vport->egress.acl = esw_acl_table_create(esw, vport,
MLX5_FLOW_NAMESPACE_ESW_EGRESS,
table_size);
if (IS_ERR(vport->egress.acl)) {
err = PTR_ERR(vport->egress.acl);
vport->egress.acl = NULL;
goto out;
}
err = esw_acl_egress_lgcy_groups_create(esw, vport);
if (err)
goto out;
}
esw_debug(esw->dev,
"vport[%d] configure egress rules, vlan(%d) qos(%d)\n",
vport->vport, vport->info.vlan, vport->info.qos);
/* Allowed vlan rule */
actions_flag = MLX5_FLOW_CONTEXT_ACTION_ALLOW;
if (vst_mode_steering)
actions_flag |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP;
err = esw_egress_acl_vlan_create(esw, vport, NULL, vport->info.vlan,
actions_flag);
if (err)
goto out;
flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP;
/* Attach egress drop flow counter */
if (drop_counter) {
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;
drop_ctr_dst.type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;
drop_ctr_dst.counter = drop_counter;
dst = &drop_ctr_dst;
dest_num++;
}
vport->egress.legacy.drop_rule =
mlx5_add_flow_rules(vport->egress.acl, NULL,
&flow_act, dst, dest_num);
if (IS_ERR(vport->egress.legacy.drop_rule)) {
err = PTR_ERR(vport->egress.legacy.drop_rule);
esw_warn(esw->dev,
"vport[%d] configure egress drop rule failed, err(%d)\n",
vport->vport, err);
vport->egress.legacy.drop_rule = NULL;
goto out;
}
return err;
out:
esw_acl_egress_lgcy_cleanup(esw, vport);
return err;
}
void esw_acl_egress_lgcy_cleanup(struct mlx5_eswitch *esw,
struct mlx5_vport *vport)
{
if (IS_ERR_OR_NULL(vport->egress.acl))
goto clean_drop_counter;
esw_debug(esw->dev, "Destroy vport[%d] E-Switch egress ACL\n", vport->vport);
esw_acl_egress_lgcy_rules_destroy(vport);
esw_acl_egress_lgcy_groups_destroy(vport);
esw_acl_egress_table_destroy(vport);
clean_drop_counter:
if (vport->egress.legacy.drop_counter) {
mlx5_fc_destroy(esw->dev, vport->egress.legacy.drop_counter);
vport->egress.legacy.drop_counter = NULL;
}
Annotation
- Immediate include surface: `mlx5_core.h`, `eswitch.h`, `helper.h`, `lgcy.h`.
- Detected declarations: `function esw_acl_egress_lgcy_rules_destroy`, `function esw_acl_egress_lgcy_groups_create`, `function esw_acl_egress_lgcy_groups_destroy`, `function esw_acl_egress_lgcy_setup`, `function esw_acl_egress_lgcy_cleanup`.
- 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.