drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_dmfs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_dmfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_dmfs.c- Extension
.c- Size
- 2566 bytes
- Lines
- 101
- 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
en_tc.hen/tc_ct.hen/tc/ct_fs.h
Detected Declarations
struct mlx5_ct_fs_dmfs_rulefunction mlx5_ct_fs_dmfs_initfunction mlx5_ct_fs_dmfs_destroyfunction mlx5_ct_fs_dmfs_ct_rule_delfunction mlx5_ct_fs_dmfs_ct_rule_update
Annotated Snippet
struct mlx5_ct_fs_dmfs_rule {
struct mlx5_ct_fs_rule fs_rule;
struct mlx5_flow_handle *rule;
struct mlx5_flow_attr *attr;
};
static int
mlx5_ct_fs_dmfs_init(struct mlx5_ct_fs *fs, struct mlx5_flow_table *ct,
struct mlx5_flow_table *ct_nat, struct mlx5_flow_table *post_ct)
{
return 0;
}
static void
mlx5_ct_fs_dmfs_destroy(struct mlx5_ct_fs *fs)
{
}
static struct mlx5_ct_fs_rule *
mlx5_ct_fs_dmfs_ct_rule_add(struct mlx5_ct_fs *fs, struct mlx5_flow_spec *spec,
struct mlx5_flow_attr *attr, struct flow_rule *flow_rule)
{
struct mlx5e_priv *priv = netdev_priv(fs->netdev);
struct mlx5_ct_fs_dmfs_rule *dmfs_rule;
int err;
dmfs_rule = kzalloc_obj(*dmfs_rule);
if (!dmfs_rule)
return ERR_PTR(-ENOMEM);
dmfs_rule->rule = mlx5_tc_rule_insert(priv, spec, attr);
if (IS_ERR(dmfs_rule->rule)) {
err = PTR_ERR(dmfs_rule->rule);
ct_dbg("Failed to add ct entry fs rule");
goto err_insert;
}
dmfs_rule->attr = attr;
return &dmfs_rule->fs_rule;
err_insert:
kfree(dmfs_rule);
return ERR_PTR(err);
}
static void
mlx5_ct_fs_dmfs_ct_rule_del(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule)
{
struct mlx5_ct_fs_dmfs_rule *dmfs_rule = container_of(fs_rule,
struct mlx5_ct_fs_dmfs_rule,
fs_rule);
mlx5_tc_rule_delete(netdev_priv(fs->netdev), dmfs_rule->rule, dmfs_rule->attr);
kfree(dmfs_rule);
}
static int mlx5_ct_fs_dmfs_ct_rule_update(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule,
struct mlx5_flow_spec *spec, struct mlx5_flow_attr *attr)
{
struct mlx5_ct_fs_dmfs_rule *dmfs_rule = container_of(fs_rule,
struct mlx5_ct_fs_dmfs_rule,
fs_rule);
struct mlx5e_priv *priv = netdev_priv(fs->netdev);
struct mlx5_flow_handle *rule;
rule = mlx5_tc_rule_insert(priv, spec, attr);
if (IS_ERR(rule))
return PTR_ERR(rule);
mlx5_tc_rule_delete(priv, dmfs_rule->rule, dmfs_rule->attr);
dmfs_rule->rule = rule;
dmfs_rule->attr = attr;
return 0;
}
static struct mlx5_ct_fs_ops dmfs_ops = {
.ct_rule_add = mlx5_ct_fs_dmfs_ct_rule_add,
.ct_rule_del = mlx5_ct_fs_dmfs_ct_rule_del,
.ct_rule_update = mlx5_ct_fs_dmfs_ct_rule_update,
.init = mlx5_ct_fs_dmfs_init,
.destroy = mlx5_ct_fs_dmfs_destroy,
};
struct mlx5_ct_fs_ops *mlx5_ct_fs_dmfs_ops_get(void)
{
return &dmfs_ops;
}
Annotation
- Immediate include surface: `en_tc.h`, `en/tc_ct.h`, `en/tc/ct_fs.h`.
- Detected declarations: `struct mlx5_ct_fs_dmfs_rule`, `function mlx5_ct_fs_dmfs_init`, `function mlx5_ct_fs_dmfs_destroy`, `function mlx5_ct_fs_dmfs_ct_rule_del`, `function mlx5_ct_fs_dmfs_ct_rule_update`.
- 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.