drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c- Extension
.c- Size
- 69400 bytes
- Lines
- 2539
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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
net/netfilter/nf_conntrack.hnet/netfilter/nf_conntrack_core.hnet/netfilter/nf_conntrack_zones.hnet/netfilter/nf_conntrack_labels.hnet/netfilter/nf_conntrack_helper.hnet/netfilter/nf_conntrack_acct.huapi/linux/tc_act/tc_pedit.hnet/tc_act/tc_ct.hnet/flow_offload.hnet/netfilter/nf_flow_table.hlinux/workqueue.hlinux/refcount.hlinux/xarray.hlinux/if_macvlan.hlinux/debugfs.hlib/fs_chains.hen/tc_ct.hen/tc/ct_fs.hen/tc_priv.hen/mod_hdr.hen/mapping.hen/tc/post_act.hen.hen_tc.hen_rep.hfs_core.h
Detected Declarations
struct mlx5_tc_ct_debugfsstruct mlx5_tc_ct_privstruct mlx5_ct_zone_rulestruct mlx5_tc_ct_prestruct mlx5_ct_ftstruct mlx5_ct_tuplestruct mlx5_ct_counterstruct mlx5_ct_entryfunction mlx5_tc_ct_entry_in_ct_tablefunction mlx5_tc_ct_entry_in_ct_nat_tablefunction mlx5_get_label_mappingfunction mlx5_put_label_mappingfunction mlx5_tc_ct_rule_to_tuplefunction mlx5_tc_ct_rule_to_tuple_natfunction flow_action_for_eachfunction mlx5_tc_ct_get_flow_source_matchfunction mlx5_tc_ct_set_tuple_matchfunction mlx5_tc_ct_counter_putfunction mlx5_tc_ct_entry_del_rulefunction mlx5_tc_ct_entry_del_rulesfunction mlx5_tc_ct_get_ct_metadata_actionfunction flow_action_for_eachfunction mlx5_tc_ct_entry_set_registersfunction mlx5_tc_ct_parse_mangle_to_mod_actfunction mlx5_tc_ct_entry_create_natfunction flow_action_for_eachfunction mlx5_tc_ct_entry_create_mod_hdrfunction mlx5_tc_ct_entry_destroy_mod_hdrfunction mlx5_tc_ct_entry_add_rulefunction mlx5_tc_ct_entry_update_rulefunction mlx5_tc_ct_entry_validfunction mlx5_tc_ct_entry_getfunction refcount_inc_not_zerofunction mlx5_tc_ct_entry_remove_from_tuplesfunction mlx5_tc_ct_entry_delfunction mlx5_tc_ct_entry_putfunction mlx5_tc_ct_entry_del_workfunction __mlx5_tc_ct_entry_putfunction mlx5_tc_ct_counter_createfunction mlx5_tc_ct_shared_counter_getfunction mlx5_tc_ct_entry_add_rulesfunction mlx5_tc_ct_entry_update_rulesfunction mlx5_tc_ct_block_flow_offload_updatefunction mlx5_tc_ct_block_flow_offload_addfunction mlx5_tc_ct_block_flow_offload_delfunction mlx5_tc_ct_block_flow_offload_statsfunction mlx5_tc_ct_filter_legacy_non_nic_flowsfunction mlx5_tc_ct_block_flow_offload
Annotated Snippet
struct mlx5_tc_ct_debugfs {
struct {
atomic_t offloaded;
atomic_t rx_dropped;
} stats;
struct dentry *root;
};
struct mlx5_tc_ct_priv {
struct mlx5_core_dev *dev;
struct mlx5e_priv *priv;
const struct net_device *netdev;
struct mod_hdr_tbl *mod_hdr_tbl;
struct xarray tuple_ids;
struct rhashtable zone_ht;
struct rhashtable ct_tuples_ht;
struct rhashtable ct_tuples_nat_ht;
struct mlx5_flow_table *ct;
struct mlx5_flow_table *ct_nat;
struct mlx5_flow_group *ct_nat_miss_group;
struct mlx5_flow_handle *ct_nat_miss_rule;
struct mlx5e_post_act *post_act;
struct mutex control_lock; /* guards parallel adds/dels */
struct mapping_ctx *zone_mapping;
struct mapping_ctx *labels_mapping;
enum mlx5_flow_namespace_type ns_type;
struct mlx5_fs_chains *chains;
struct mlx5_ct_fs *fs;
struct mlx5_ct_fs_ops *fs_ops;
spinlock_t ht_lock; /* protects ft entries */
struct workqueue_struct *wq;
struct mlx5_tc_ct_debugfs debugfs;
};
struct mlx5_ct_zone_rule {
struct mlx5_ct_fs_rule *rule;
struct mlx5e_mod_hdr_handle *mh;
struct mlx5_flow_attr *attr;
bool nat;
};
struct mlx5_tc_ct_pre {
struct mlx5_flow_table *ft;
struct mlx5_flow_group *flow_grp;
struct mlx5_flow_group *miss_grp;
struct mlx5_flow_handle *flow_rule;
struct mlx5_flow_handle *miss_rule;
struct mlx5_modify_hdr *modify_hdr;
};
struct mlx5_ct_ft {
struct rhash_head node;
u16 zone;
u32 zone_restore_id;
refcount_t refcount;
struct nf_flowtable *nf_ft;
struct mlx5_tc_ct_priv *ct_priv;
struct rhashtable ct_entries_ht;
struct mlx5_tc_ct_pre pre_ct;
struct mlx5_tc_ct_pre pre_ct_nat;
};
struct mlx5_ct_tuple {
u16 addr_type;
__be16 n_proto;
u8 ip_proto;
struct {
union {
__be32 src_v4;
struct in6_addr src_v6;
};
union {
__be32 dst_v4;
struct in6_addr dst_v6;
};
} ip;
struct {
__be16 src;
__be16 dst;
} port;
u16 zone;
};
struct mlx5_ct_counter {
struct mlx5_fc *counter;
refcount_t refcount;
bool is_shared;
Annotation
- Immediate include surface: `net/netfilter/nf_conntrack.h`, `net/netfilter/nf_conntrack_core.h`, `net/netfilter/nf_conntrack_zones.h`, `net/netfilter/nf_conntrack_labels.h`, `net/netfilter/nf_conntrack_helper.h`, `net/netfilter/nf_conntrack_acct.h`, `uapi/linux/tc_act/tc_pedit.h`, `net/tc_act/tc_ct.h`.
- Detected declarations: `struct mlx5_tc_ct_debugfs`, `struct mlx5_tc_ct_priv`, `struct mlx5_ct_zone_rule`, `struct mlx5_tc_ct_pre`, `struct mlx5_ct_ft`, `struct mlx5_ct_tuple`, `struct mlx5_ct_counter`, `struct mlx5_ct_entry`, `function mlx5_tc_ct_entry_in_ct_table`, `function mlx5_tc_ct_entry_in_ct_nat_table`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.