drivers/infiniband/hw/mlx5/fs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/mlx5/fs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/mlx5/fs.c- Extension
.c- Size
- 97736 bytes
- Lines
- 3515
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- 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
rdma/ib_user_verbs.hrdma/ib_verbs.hrdma/uverbs_types.hrdma/uverbs_ioctl.hrdma/uverbs_std_types.hrdma/mlx5_user_ioctl_cmds.hrdma/mlx5_user_ioctl_verbs.hrdma/ib_hdrs.hrdma/ib_umem.hrdma/ib_ucaps.hlinux/mlx5/driver.hlinux/mlx5/fs.hlinux/mlx5/fs_helpers.hlinux/mlx5/eswitch.hnet/inet_ecn.hmlx5_ib.hcounters.hdevx.hfs.hrdma/uverbs_named_ioctl.h
Detected Declarations
struct mlx5_per_qp_opfcenum flow_table_typefunction get_match_criteria_enablefunction set_protofunction set_flow_labelfunction set_tosfunction check_mpls_supp_fieldsfunction parse_flow_attrfunction flow_is_multicast_onlyfunction is_valid_ethertypefunction is_valid_attrfunction put_flow_tablefunction mlx5_ib_destroy_flowfunction list_for_each_entry_safefunction ib_prio_to_core_priofunction mlx5_ib_shared_ft_allowedfunction set_vhca_port_specfunction set_ecn_ce_specfunction set_cnp_specfunction put_per_qp_priofunction get_per_qp_priofunction add_op_fc_rulesfunction is_fc_shared_and_in_usefunction mlx5r_fs_destroy_fcsfunction mlx5_ib_fs_add_op_fcfunction mlx5_ib_fs_remove_op_fcfunction mlx5r_fs_unbind_op_fcfunction mlx5r_fs_bind_op_fcfunction set_underlay_qpfunction mlx5_ib_set_rule_source_portfunction mlx5_ib_fill_transport_ns_infofunction _get_flow_tablefunction _create_raw_flow_rulefunction raw_fs_is_multicastfunction destroy_flow_action_rawfunction mlx5_ib_destroy_flow_actionfunction mlx5_ib_ft_type_to_namespacefunction is_flow_destfunction get_destsfunction is_flow_counterfunction UVERBS_HANDLERfunction flow_matcher_cleanupfunction steering_anchor_create_ftfunction steering_anchor_destroy_ftfunction steering_anchor_create_fg_dropfunction steering_anchor_destroy_fg_dropfunction steering_anchor_create_fg_goto_tablefunction steering_anchor_destroy_fg_goto_table
Annotated Snippet
struct mlx5_per_qp_opfc {
struct mlx5_ib_op_fc opfcs[MLX5_IB_OPCOUNTER_MAX];
};
#define HEADER_IS_ZERO(match_criteria, headers) \
!(memchr_inv(MLX5_ADDR_OF(fte_match_param, match_criteria, headers), \
0, MLX5_FLD_SZ_BYTES(fte_match_param, headers))) \
static u8 get_match_criteria_enable(u32 *match_criteria)
{
u8 match_criteria_enable;
match_criteria_enable =
(!HEADER_IS_ZERO(match_criteria, outer_headers)) <<
MATCH_CRITERIA_ENABLE_OUTER_BIT;
match_criteria_enable |=
(!HEADER_IS_ZERO(match_criteria, misc_parameters)) <<
MATCH_CRITERIA_ENABLE_MISC_BIT;
match_criteria_enable |=
(!HEADER_IS_ZERO(match_criteria, inner_headers)) <<
MATCH_CRITERIA_ENABLE_INNER_BIT;
match_criteria_enable |=
(!HEADER_IS_ZERO(match_criteria, misc_parameters_2)) <<
MATCH_CRITERIA_ENABLE_MISC2_BIT;
return match_criteria_enable;
}
static int set_proto(void *outer_c, void *outer_v, u8 mask, u8 val)
{
u8 entry_mask;
u8 entry_val;
int err = 0;
if (!mask)
goto out;
entry_mask = MLX5_GET(fte_match_set_lyr_2_4, outer_c,
ip_protocol);
entry_val = MLX5_GET(fte_match_set_lyr_2_4, outer_v,
ip_protocol);
if (!entry_mask) {
MLX5_SET(fte_match_set_lyr_2_4, outer_c, ip_protocol, mask);
MLX5_SET(fte_match_set_lyr_2_4, outer_v, ip_protocol, val);
goto out;
}
/* Don't override existing ip protocol */
if (mask != entry_mask || val != entry_val)
err = -EINVAL;
out:
return err;
}
static void set_flow_label(void *misc_c, void *misc_v, u32 mask, u32 val,
bool inner)
{
if (inner) {
MLX5_SET(fte_match_set_misc,
misc_c, inner_ipv6_flow_label, mask);
MLX5_SET(fte_match_set_misc,
misc_v, inner_ipv6_flow_label, val);
} else {
MLX5_SET(fte_match_set_misc,
misc_c, outer_ipv6_flow_label, mask);
MLX5_SET(fte_match_set_misc,
misc_v, outer_ipv6_flow_label, val);
}
}
static void set_tos(void *outer_c, void *outer_v, u8 mask, u8 val)
{
MLX5_SET(fte_match_set_lyr_2_4, outer_c, ip_ecn, mask);
MLX5_SET(fte_match_set_lyr_2_4, outer_v, ip_ecn, val);
MLX5_SET(fte_match_set_lyr_2_4, outer_c, ip_dscp, mask >> 2);
MLX5_SET(fte_match_set_lyr_2_4, outer_v, ip_dscp, val >> 2);
}
static int check_mpls_supp_fields(u32 field_support, const __be32 *set_mask)
{
if (MLX5_GET(fte_match_mpls, set_mask, mpls_label) &&
!(field_support & MLX5_FIELD_SUPPORT_MPLS_LABEL))
return -EOPNOTSUPP;
if (MLX5_GET(fte_match_mpls, set_mask, mpls_exp) &&
!(field_support & MLX5_FIELD_SUPPORT_MPLS_EXP))
return -EOPNOTSUPP;
if (MLX5_GET(fte_match_mpls, set_mask, mpls_s_bos) &&
!(field_support & MLX5_FIELD_SUPPORT_MPLS_S_BOS))
return -EOPNOTSUPP;
Annotation
- Immediate include surface: `rdma/ib_user_verbs.h`, `rdma/ib_verbs.h`, `rdma/uverbs_types.h`, `rdma/uverbs_ioctl.h`, `rdma/uverbs_std_types.h`, `rdma/mlx5_user_ioctl_cmds.h`, `rdma/mlx5_user_ioctl_verbs.h`, `rdma/ib_hdrs.h`.
- Detected declarations: `struct mlx5_per_qp_opfc`, `enum flow_table_type`, `function get_match_criteria_enable`, `function set_proto`, `function set_flow_label`, `function set_tos`, `function check_mpls_supp_fields`, `function parse_flow_attr`, `function flow_is_multicast_only`, `function is_valid_ethertype`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.