drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c- Extension
.c- Size
- 18334 bytes
- Lines
- 749
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
rx_res.hchannels.hparams.h
Detected Declarations
struct mlx5e_rx_resfunction mlx5e_rx_res_rss_update_num_channelsfunction mlx5e_rx_res_rss_init_deffunction mlx5e_rx_res_rss_initfunction __mlx5e_rx_res_rss_destroyfunction mlx5e_rx_res_rss_destroyfunction mlx5e_rx_res_rss_destroy_allfunction mlx5e_rx_res_rss_enablefunction mlx5e_rx_res_rss_disablefunction mlx5e_rx_res_rss_get_rxfhfunction mlx5e_rx_res_rss_set_rxfhfunction mlx5e_rx_res_rss_get_hash_fieldsfunction mlx5e_rx_res_rss_set_hash_fieldsfunction mlx5e_rx_res_rss_cntfunction mlx5e_rx_res_rss_indexfunction mlx5e_rx_res_freefunction mlx5e_rx_res_channels_initfunction mlx5e_rx_res_ptp_initfunction mlx5e_rx_res_channels_destroyfunction mlx5e_rx_res_ptp_destroyfunction mlx5e_rx_res_createfunction mlx5e_rx_res_destroyfunction mlx5e_rx_res_get_max_nchfunction mlx5e_rx_res_get_tirn_directfunction mlx5e_rx_res_get_tirn_rssfunction mlx5e_rx_res_get_tirn_rss_innerfunction mlx5e_rx_res_get_tirn_ptpfunction mlx5e_rx_res_get_rqtn_directfunction mlx5e_rx_res_channel_activate_directfunction mlx5e_rx_res_channel_deactivate_directfunction mlx5e_rx_res_channels_activatefunction mlx5e_rx_res_channels_deactivatefunction mlx5e_rx_res_xsk_updatefunction mlx5e_rx_res_packet_merge_set_paramfunction mlx5e_rx_res_get_current_hashfunction mlx5e_rx_res_tls_tir_create
Annotated Snippet
struct mlx5e_rx_res {
struct mlx5_core_dev *mdev; /* primary */
enum mlx5e_rx_res_features features;
unsigned int max_nch;
u32 drop_rqn;
struct mlx5e_packet_merge_param pkt_merge_param;
struct rw_semaphore pkt_merge_param_sem;
struct mlx5e_rss *rss[MLX5E_MAX_NUM_RSS];
bool rss_active;
u32 *rss_rqns;
u32 *rss_vhca_ids;
unsigned int rss_nch;
struct {
struct mlx5e_rqt direct_rqt;
struct mlx5e_tir direct_tir;
} *channels;
struct {
struct mlx5e_rqt rqt;
struct mlx5e_tir tir;
} ptp;
};
/* API for rx_res_rss_* */
static u32 *get_vhca_ids(struct mlx5e_rx_res *res, int offset)
{
bool multi_vhca = res->features & MLX5E_RX_RES_FEATURE_MULTI_VHCA;
return multi_vhca ? res->rss_vhca_ids + offset : NULL;
}
/* Updates the indirection table SW shadow, does not update the HW resources yet
*/
void mlx5e_rx_res_rss_update_num_channels(struct mlx5e_rx_res *res, u32 nch,
struct net_device *netdev)
{
u32 new_size = mlx5e_rqt_size(res->mdev, nch);
int i;
WARN_ON_ONCE(res->rss_active);
/* Default context: fold/unfold user-configured table, then update size
* and reset to uniform when unconfigured.
*/
mlx5e_rss_indir_resize(res->rss[0], netdev, new_size);
/* mlx5e_rss_indir_resize() is a no-op when the table is not
* user-configured. actual_table_size is updated after the resize
* because ethtool_rxfh_indir_resize() uses it as the old size to
* replicate the pattern; updating it first would make the grow a no-op.
* It must be updated before mlx5e_rss_set_indir_uniform() so that
* the uniform fill covers all new entries, not just the old ones.
*/
mlx5e_rss_set_indir_actual_size(res->rss[0], new_size);
if (!netif_is_rxfh_configured(netdev))
mlx5e_rss_set_indir_uniform(res->rss[0], nch);
/* Non-default contexts */
for (i = 1; i < MLX5E_MAX_NUM_RSS; i++) {
if (res->rss[i]) {
mlx5e_rss_ctx_resize(res->rss[i], new_size);
mlx5e_rss_set_indir_actual_size(res->rss[i], new_size);
}
}
}
static int mlx5e_rx_res_rss_init_def(struct mlx5e_rx_res *res,
unsigned int init_nch)
{
bool inner_ft_support = res->features & MLX5E_RX_RES_FEATURE_INNER_FT;
struct mlx5e_rss_init_params init_params;
struct mlx5e_rss_params rss_params;
struct mlx5e_rss *rss;
if (WARN_ON(res->rss[0]))
return -EINVAL;
init_params = (struct mlx5e_rss_init_params) {
.type = MLX5E_RSS_INIT_TIRS,
.pkt_merge_param = &res->pkt_merge_param,
.nch = init_nch,
.max_nch = res->max_nch,
};
rss_params = (struct mlx5e_rss_params) {
.inner_ft_support = inner_ft_support,
Annotation
- Immediate include surface: `rx_res.h`, `channels.h`, `params.h`.
- Detected declarations: `struct mlx5e_rx_res`, `function mlx5e_rx_res_rss_update_num_channels`, `function mlx5e_rx_res_rss_init_def`, `function mlx5e_rx_res_rss_init`, `function __mlx5e_rx_res_rss_destroy`, `function mlx5e_rx_res_rss_destroy`, `function mlx5e_rx_res_rss_destroy_all`, `function mlx5e_rx_res_rss_enable`, `function mlx5e_rx_res_rss_disable`, `function mlx5e_rx_res_rss_get_rxfh`.
- 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.