drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c- Extension
.c- Size
- 79003 bytes
- Lines
- 2923
- 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
linux/netdevice.hen.hen/fs.heswitch.hipsec.hfs_core.hlib/ipsec_fs_roce.hlib/fs_chains.hesw/ipsec_fs.hen_rep.h
Detected Declarations
struct mlx5e_ipsec_fcstruct mlx5e_ipsec_txstruct mlx5e_ipsec_status_checksstruct mlx5e_ipsec_rxfunction family2ttfunction ipsec_chains_createfunction ipsec_chains_destroyfunction ipsec_chains_get_tablefunction ipsec_chains_put_tablefunction ipsec_rx_status_drop_destroyfunction ipsec_rx_status_pass_destroyfunction ipsec_rx_rule_add_match_objfunction rx_add_rule_drop_auth_trailerfunction rx_add_rule_drop_replayfunction ipsec_rx_status_drop_all_createfunction ipsec_rx_status_pass_group_createfunction ipsec_rx_status_pass_createfunction mlx5_ipsec_rx_status_destroyfunction mlx5_ipsec_rx_status_createfunction ipsec_miss_createfunction ipsec_rx_decrypted_pkt_def_destfunction ipsec_rx_update_default_destfunction handle_ipsec_rx_bringupfunction handle_ipsec_rx_cleanupfunction ipsec_mpv_work_handlerfunction ipsec_rx_ft_disconnectfunction ipsec_rx_policy_destroyfunction ipsec_rx_sa_selector_destroyfunction rx_destroyfunction ipsec_rx_create_attr_setfunction ipsec_rx_status_pass_dest_getfunction ipsec_rx_sa_miss_dest_getfunction ipsec_rx_default_dest_getfunction ipsec_rx_ft_connectfunction ipsec_rx_chains_create_missfunction ipsec_rx_policy_createfunction ipsec_rx_sa_selector_createfunction failsfunction rx_getfunction rx_putfunction rx_ft_putfunction rx_ft_put_policyfunction ipsec_counter_rule_txfunction tx_destroyfunction ipsec_tx_create_attr_setfunction tx_createfunction ipsec_esw_tx_ft_policy_setfunction tx_get
Annotated Snippet
struct mlx5e_ipsec_fc {
struct mlx5_fc *cnt;
struct mlx5_fc *drop;
};
struct mlx5e_ipsec_tx {
struct mlx5e_ipsec_ft ft;
struct mlx5e_ipsec_miss pol;
struct mlx5e_ipsec_miss sa;
struct mlx5e_ipsec_rule status;
struct mlx5_flow_namespace *ns;
struct mlx5e_ipsec_fc *fc;
struct mlx5_fs_chains *chains;
u8 allow_tunnel_mode : 1;
};
struct mlx5e_ipsec_status_checks {
struct mlx5_flow_group *pass_group;
struct mlx5_flow_handle *packet_offload_pass_rule;
struct mlx5_flow_handle *crypto_offload_pass_rule;
struct mlx5_flow_group *drop_all_group;
struct mlx5e_ipsec_drop all;
};
struct mlx5e_ipsec_rx {
struct mlx5e_ipsec_ft ft;
struct mlx5e_ipsec_miss pol;
struct mlx5e_ipsec_miss sa;
struct mlx5e_ipsec_miss sa_sel;
struct mlx5e_ipsec_status_checks status_checks;
struct mlx5e_ipsec_fc *fc;
struct mlx5_fs_chains *chains;
struct mlx5_flow_table *pol_miss_ft;
struct mlx5_flow_handle *pol_miss_rule;
u8 allow_tunnel_mode : 1;
u8 ttc_rules_added : 1;
};
/* IPsec RX flow steering */
static enum mlx5_traffic_types family2tt(u32 family)
{
if (family == AF_INET)
return MLX5_TT_IPV4_IPSEC_ESP;
return MLX5_TT_IPV6_IPSEC_ESP;
}
static struct mlx5e_ipsec_rx *ipsec_rx(struct mlx5e_ipsec *ipsec, u32 family, int type)
{
if (ipsec->is_uplink_rep && type == XFRM_DEV_OFFLOAD_PACKET)
return ipsec->rx_esw;
if (family == AF_INET)
return ipsec->rx_ipv4;
return ipsec->rx_ipv6;
}
static struct mlx5e_ipsec_tx *ipsec_tx(struct mlx5e_ipsec *ipsec, int type)
{
if (ipsec->is_uplink_rep && type == XFRM_DEV_OFFLOAD_PACKET)
return ipsec->tx_esw;
return ipsec->tx;
}
static struct mlx5_fs_chains *
ipsec_chains_create(struct mlx5_core_dev *mdev, struct mlx5_flow_table *miss_ft,
enum mlx5_flow_namespace_type ns, int base_prio,
int base_level, struct mlx5_flow_table **root_ft)
{
struct mlx5_chains_attr attr = {};
struct mlx5_fs_chains *chains;
struct mlx5_flow_table *ft;
int err;
attr.flags = MLX5_CHAINS_AND_PRIOS_SUPPORTED |
MLX5_CHAINS_IGNORE_FLOW_LEVEL_SUPPORTED;
attr.max_grp_num = 2;
attr.default_ft = miss_ft;
attr.ns = ns;
attr.fs_base_prio = base_prio;
attr.fs_base_level = base_level;
chains = mlx5_chains_create(mdev, &attr);
if (IS_ERR(chains))
return chains;
/* Create chain 0, prio 1, level 0 to connect chains to prev in fs_core */
ft = mlx5_chains_get_table(chains, 0, 1, 0);
if (IS_ERR(ft)) {
err = PTR_ERR(ft);
Annotation
- Immediate include surface: `linux/netdevice.h`, `en.h`, `en/fs.h`, `eswitch.h`, `ipsec.h`, `fs_core.h`, `lib/ipsec_fs_roce.h`, `lib/fs_chains.h`.
- Detected declarations: `struct mlx5e_ipsec_fc`, `struct mlx5e_ipsec_tx`, `struct mlx5e_ipsec_status_checks`, `struct mlx5e_ipsec_rx`, `function family2tt`, `function ipsec_chains_create`, `function ipsec_chains_destroy`, `function ipsec_chains_get_table`, `function ipsec_chains_put_table`, `function ipsec_rx_status_drop_destroy`.
- 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.