drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c- Extension
.c- Size
- 24338 bytes
- Lines
- 886
- 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
fs_core.hfs_cmd.hen.hlib/ipsec_fs_roce.hmlx5_core.hlinux/random.h
Detected Declarations
struct mlx5_ipsec_missstruct mlx5_ipsec_rx_rocestruct mlx5_ipsec_tx_rocestruct mlx5_ipsec_fsfunction ipsec_fs_roce_setup_udp_dportfunction ipsec_fs_create_alias_supported_onefunction ipsec_fs_create_alias_supportedfunction ipsec_fs_create_aliased_ftfunction MLX5_CAP_GENfunction ipsec_fs_roce_rx_rule_setupfunction ipsec_fs_roce_tx_rule_setupfunction ipsec_fs_roce_tx_mpv_rule_setupfunction ipsec_fs_roce_tx_mpv_create_ftfunction ipsec_fs_roce_tx_mpv_create_group_rulesfunction ipsec_fs_roce_tx_mpv_createfunction roce_rx_mpv_destroy_tablesfunction ipsec_fs_roce_rx_mpv_createfunction mlx5_ipsec_fs_roce_tx_destroyfunction mlx5_ipsec_fs_roce_tx_createfunction mlx5_ipsec_fs_roce_rx_destroyfunction mlx5_ipsec_fs_roce_rx_createfunction mlx5_ipsec_fs_is_mpv_roce_supportedfunction mlx5_ipsec_fs_roce_cleanup
Annotated Snippet
struct mlx5_ipsec_miss {
struct mlx5_flow_group *group;
struct mlx5_flow_handle *rule;
};
struct mlx5_ipsec_rx_roce {
struct mlx5_flow_group *g;
struct mlx5_flow_table *ft;
struct mlx5_flow_handle *rule;
struct mlx5_ipsec_miss roce_miss;
struct mlx5_flow_table *nic_master_ft;
struct mlx5_flow_group *nic_master_group;
struct mlx5_flow_handle *nic_master_rule;
struct mlx5_flow_table *goto_alias_ft;
u32 alias_id;
char key[ACCESS_KEY_LEN];
struct mlx5_flow_table *ft_rdma;
struct mlx5_flow_namespace *ns_rdma;
};
struct mlx5_ipsec_tx_roce {
struct mlx5_flow_group *g;
struct mlx5_flow_table *ft;
struct mlx5_flow_handle *rule;
struct mlx5_flow_table *goto_alias_ft;
u32 alias_id;
char key[ACCESS_KEY_LEN];
struct mlx5_flow_namespace *ns;
};
struct mlx5_ipsec_fs {
struct mlx5_ipsec_rx_roce ipv4_rx;
struct mlx5_ipsec_rx_roce ipv6_rx;
struct mlx5_ipsec_tx_roce tx;
struct mlx5_devcom_comp_dev **devcom;
};
static void ipsec_fs_roce_setup_udp_dport(struct mlx5_flow_spec *spec,
u16 dport)
{
spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;
MLX5_SET_TO_ONES(fte_match_param, spec->match_criteria, outer_headers.ip_protocol);
MLX5_SET(fte_match_param, spec->match_value, outer_headers.ip_protocol, IPPROTO_UDP);
MLX5_SET_TO_ONES(fte_match_param, spec->match_criteria, outer_headers.udp_dport);
MLX5_SET(fte_match_param, spec->match_value, outer_headers.udp_dport, dport);
}
static bool ipsec_fs_create_alias_supported_one(struct mlx5_core_dev *mdev)
{
u64 obj_allowed = MLX5_CAP_GEN_2_64(mdev, allowed_object_for_other_vhca_access);
u32 obj_supp = MLX5_CAP_GEN_2(mdev, cross_vhca_object_to_object_supported);
if (!(obj_supp &
MLX5_CROSS_VHCA_OBJ_TO_OBJ_SUPPORTED_LOCAL_FLOW_TABLE_TO_REMOTE_FLOW_TABLE_MISS))
return false;
if (!(obj_allowed & MLX5_ALLOWED_OBJ_FOR_OTHER_VHCA_ACCESS_FLOW_TABLE))
return false;
return true;
}
static bool ipsec_fs_create_alias_supported(struct mlx5_core_dev *mdev,
struct mlx5_core_dev *master_mdev)
{
if (ipsec_fs_create_alias_supported_one(mdev) &&
ipsec_fs_create_alias_supported_one(master_mdev))
return true;
return false;
}
static int ipsec_fs_create_aliased_ft(struct mlx5_core_dev *ibv_owner,
struct mlx5_core_dev *ibv_allowed,
struct mlx5_flow_table *ft,
u32 *obj_id, char *alias_key, bool from_event)
{
u32 aliased_object_id = (ft->type << FT_ID_FT_TYPE_OFFSET) | ft->id;
u16 vhca_id_to_be_accessed = MLX5_CAP_GEN(ibv_owner, vhca_id);
struct mlx5_cmd_allow_other_vhca_access_attr allow_attr = {};
struct mlx5_cmd_alias_obj_create_attr alias_attr = {};
int ret;
int i;
if (!ipsec_fs_create_alias_supported(ibv_owner, ibv_allowed))
return -EOPNOTSUPP;
for (i = 0; i < ACCESS_KEY_LEN; i++)
if (!from_event)
Annotation
- Immediate include surface: `fs_core.h`, `fs_cmd.h`, `en.h`, `lib/ipsec_fs_roce.h`, `mlx5_core.h`, `linux/random.h`.
- Detected declarations: `struct mlx5_ipsec_miss`, `struct mlx5_ipsec_rx_roce`, `struct mlx5_ipsec_tx_roce`, `struct mlx5_ipsec_fs`, `function ipsec_fs_roce_setup_udp_dport`, `function ipsec_fs_create_alias_supported_one`, `function ipsec_fs_create_alias_supported`, `function ipsec_fs_create_aliased_ft`, `function MLX5_CAP_GEN`, `function ipsec_fs_roce_rx_rule_setup`.
- 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.