drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp.c- Extension
.c- Size
- 30575 bytes
- Lines
- 1168
- 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/mlx5/device.hnet/psp.hlinux/psp.hmlx5_core.hpsp.hlib/crypto.hen_accel/psp.hfs_core.h
Detected Declarations
struct mlx5e_psp_txstruct mlx5e_psp_rx_errstruct mlx5e_accel_fs_psp_protstruct mlx5e_accel_fs_pspstruct mlx5e_psp_fsstruct psp_keyenum accel_fs_psp_typeenum accel_psp_syndromefunction fs_psp2ttfunction accel_psp_fs_rx_err_del_rulesfunction accel_psp_fs_rx_err_destroy_ftfunction accel_psp_setup_syndrome_matchfunction accel_psp_fs_rx_err_add_rulefunction accel_psp_fs_rx_err_create_ftfunction accel_psp_fs_rx_fs_destroyfunction setup_fte_udp_pspfunction accel_psp_fs_rx_create_ftfunction accel_psp_fs_rx_destroyfunction accel_psp_fs_rx_createfunction accel_psp_fs_rx_ft_getfunction accel_psp_fs_rx_ft_putfunction accel_psp_fs_cleanup_rxfunction accel_psp_fs_init_rxfunction mlx5_accel_psp_fs_cleanup_rx_tablesfunction mlx5_accel_psp_fs_init_rx_tablesfunction accel_psp_fs_tx_create_ft_tablefunction accel_psp_fs_tx_destroyfunction accel_psp_fs_tx_ft_getfunction accel_psp_fs_tx_ft_putfunction accel_psp_fs_cleanup_txfunction accel_psp_fs_init_txfunction mlx5e_accel_psp_fs_get_stats_fillfunction mlx5_accel_psp_fs_cleanup_tx_tablesfunction mlx5_accel_psp_fs_init_tx_tablesfunction mlx5e_accel_psp_fs_cleanupfunction mlx5e_psp_set_configfunction mlx5e_psp_generate_key_spifunction mlx5e_psp_rx_spi_allocfunction mlx5e_psp_assoc_addfunction mlx5e_psp_assoc_delfunction mlx5e_psp_rotate_keyfunction mlx5e_psp_key_rotatefunction mlx5e_psp_get_statsfunction mlx5e_psp_unregisterfunction mlx5e_psp_registerfunction mlx5e_psp_initfunction mlx5e_psp_cleanup
Annotated Snippet
struct mlx5e_psp_tx {
struct mlx5_flow_namespace *ns;
struct mlx5_flow_table *ft;
struct mlx5_flow_group *fg;
struct mlx5_flow_handle *rule;
struct mutex mutex; /* Protect PSP TX steering */
u32 refcnt;
struct mlx5_fc *tx_counter;
};
struct mlx5e_psp_rx_err {
struct mlx5_flow_table *ft;
struct mlx5_flow_handle *rule;
struct mlx5_flow_handle *auth_fail_rule;
struct mlx5_flow_handle *err_rule;
struct mlx5_flow_handle *bad_rule;
struct mlx5_modify_hdr *copy_modify_hdr;
};
struct mlx5e_accel_fs_psp_prot {
struct mlx5_flow_table *ft;
struct mlx5_flow_group *miss_group;
struct mlx5_flow_handle *miss_rule;
struct mlx5_modify_hdr *rx_modify_hdr;
struct mlx5_flow_destination default_dest;
struct mlx5e_psp_rx_err rx_err;
u32 refcnt;
struct mutex prot_mutex; /* protect ESP4/ESP6 protocol */
struct mlx5_flow_handle *def_rule;
};
struct mlx5e_accel_fs_psp {
struct mlx5e_accel_fs_psp_prot fs_prot[ACCEL_FS_PSP_NUM_TYPES];
struct mlx5_fc *rx_counter;
struct mlx5_fc *rx_auth_fail_counter;
struct mlx5_fc *rx_err_counter;
struct mlx5_fc *rx_bad_counter;
};
struct mlx5e_psp_fs {
struct mlx5_core_dev *mdev;
struct mlx5e_psp_tx *tx_fs;
/* Rx manage */
struct mlx5e_flow_steering *fs;
struct mlx5e_accel_fs_psp *rx_fs;
};
/* PSP RX flow steering */
static enum mlx5_traffic_types fs_psp2tt(enum accel_fs_psp_type i)
{
if (i == ACCEL_FS_PSP4)
return MLX5_TT_IPV4_UDP;
return MLX5_TT_IPV6_UDP;
}
static void accel_psp_fs_rx_err_del_rules(struct mlx5e_psp_fs *fs,
struct mlx5e_psp_rx_err *rx_err)
{
if (rx_err->bad_rule) {
mlx5_del_flow_rules(rx_err->bad_rule);
rx_err->bad_rule = NULL;
}
if (rx_err->err_rule) {
mlx5_del_flow_rules(rx_err->err_rule);
rx_err->err_rule = NULL;
}
if (rx_err->auth_fail_rule) {
mlx5_del_flow_rules(rx_err->auth_fail_rule);
rx_err->auth_fail_rule = NULL;
}
if (rx_err->rule) {
mlx5_del_flow_rules(rx_err->rule);
rx_err->rule = NULL;
}
if (rx_err->copy_modify_hdr) {
mlx5_modify_header_dealloc(fs->mdev, rx_err->copy_modify_hdr);
rx_err->copy_modify_hdr = NULL;
}
}
static void accel_psp_fs_rx_err_destroy_ft(struct mlx5e_psp_fs *fs,
struct mlx5e_psp_rx_err *rx_err)
{
accel_psp_fs_rx_err_del_rules(fs, rx_err);
Annotation
- Immediate include surface: `linux/mlx5/device.h`, `net/psp.h`, `linux/psp.h`, `mlx5_core.h`, `psp.h`, `lib/crypto.h`, `en_accel/psp.h`, `fs_core.h`.
- Detected declarations: `struct mlx5e_psp_tx`, `struct mlx5e_psp_rx_err`, `struct mlx5e_accel_fs_psp_prot`, `struct mlx5e_accel_fs_psp`, `struct mlx5e_psp_fs`, `struct psp_key`, `enum accel_fs_psp_type`, `enum accel_psp_syndrome`, `function fs_psp2tt`, `function accel_psp_fs_rx_err_del_rules`.
- 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.