drivers/net/ethernet/mellanox/mlx5/core/steering/hws/send.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/send.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/send.c- Extension
.c- Size
- 37652 bytes
- Lines
- 1356
- 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
internal.hlib/clock.h
Detected Declarations
function mlx5hws_send_add_new_dep_wqefunction mlx5hws_send_abort_new_dep_wqefunction mlx5hws_send_all_dep_wqefunction mlx5hws_send_engine_post_startfunction mlx5hws_send_engine_post_req_wqefunction hws_send_engine_post_ringfunction hws_send_wqe_set_tagfunction mlx5hws_send_engine_post_endfunction hws_send_wqefunction mlx5hws_send_stefunction hws_send_engine_retry_post_sendfunction mlx5hws_send_engine_flush_queuefunction hws_send_engine_update_rule_resizefunction hws_send_engine_dump_error_cqefunction hws_send_engine_update_rulefunction hws_send_engine_updatefunction mlx5hws_parse_cqefunction mlx5hws_cq_poll_onefunction hws_send_engine_poll_cqfunction hws_send_engine_poll_listfunction hws_send_engine_pollfunction mlx5hws_send_queue_pollfunction hws_send_ring_alloc_sqfunction hws_send_ring_free_sqfunction hws_send_ring_create_sqfunction hws_send_ring_destroy_sqfunction hws_send_ring_set_sq_rdyfunction hws_send_ring_close_sqfunction hws_send_ring_create_sq_rdyfunction hws_send_ring_open_sqfunction hws_send_ring_alloc_cqfunction hws_send_ring_create_cqfunction hws_send_ring_open_cqfunction hws_send_ring_close_cqfunction hws_send_ring_closefunction mlx5hws_send_ring_openfunction mlx5hws_send_queue_closefunction mlx5hws_send_queue_openfunction __hws_send_queues_closefunction hws_send_queues_bwc_locks_destroyfunction mlx5hws_send_queues_closefunction hws_bwc_send_queues_initfunction mlx5hws_send_queues_openfunction mlx5hws_send_queue_actionfunction hws_send_wqe_fwfunction mlx5hws_send_stes_fw
Annotated Snippet
if (priv->rule->status == MLX5HWS_RULE_STATUS_FAILING) {
/* Backup original RTCs */
u32 orig_rtc_0 = priv->rule->resize_info->rtc_0;
u32 orig_rtc_1 = priv->rule->resize_info->rtc_1;
/* Delete partially failed move rule using resize_info */
priv->rule->resize_info->rtc_0 = priv->rule->rtc_0;
priv->rule->resize_info->rtc_1 = priv->rule->rtc_1;
/* Move rule to original RTC for future delete */
priv->rule->rtc_0 = orig_rtc_0;
priv->rule->rtc_1 = orig_rtc_1;
}
/* Clean leftovers */
mlx5hws_rule_move_hws_remove(priv->rule, queue, priv->user_data);
break;
case MLX5HWS_RULE_RESIZE_STATE_DELETING:
if (priv->rule->status == MLX5HWS_RULE_STATUS_FAILING) {
*status = MLX5HWS_FLOW_OP_ERROR;
} else {
*status = MLX5HWS_FLOW_OP_SUCCESS;
priv->rule->matcher = priv->rule->matcher->resize_dst;
}
priv->rule->resize_info->state = MLX5HWS_RULE_RESIZE_STATE_IDLE;
priv->rule->status = MLX5HWS_RULE_STATUS_CREATED;
break;
default:
break;
}
}
static void hws_send_engine_dump_error_cqe(struct mlx5hws_send_engine *queue,
struct mlx5hws_send_ring_priv *priv,
struct mlx5_cqe64 *cqe)
{
u8 wqe_opcode = cqe ? be32_to_cpu(cqe->sop_drop_qpn) >> 24 : 0;
struct mlx5hws_context *ctx = priv->rule->matcher->tbl->ctx;
u32 opcode = cqe ? get_cqe_opcode(cqe) : 0;
struct mlx5hws_rule *rule = priv->rule;
/* If something bad happens and lots of rules are failing, we don't
* want to pollute dmesg. Print only the first bad cqe per engine,
* the one that started the avalanche.
*/
if (queue->error_cqe_printed)
return;
queue->error_cqe_printed = true;
if (mlx5hws_rule_move_in_progress(rule))
mlx5hws_err(ctx,
"--- rule 0x%08llx: error completion moving rule: phase %s, wqes left %d\n",
HWS_PTR_TO_ID(rule),
rule->resize_info->state ==
MLX5HWS_RULE_RESIZE_STATE_WRITING ? "WRITING" :
rule->resize_info->state ==
MLX5HWS_RULE_RESIZE_STATE_DELETING ? "DELETING" :
"UNKNOWN",
rule->pending_wqes);
else
mlx5hws_err(ctx,
"--- rule 0x%08llx: error completion %s (%d), wqes left %d\n",
HWS_PTR_TO_ID(rule),
rule->status ==
MLX5HWS_RULE_STATUS_CREATING ? "CREATING" :
rule->status ==
MLX5HWS_RULE_STATUS_DELETING ? "DELETING" :
rule->status ==
MLX5HWS_RULE_STATUS_FAILING ? "FAILING" :
rule->status ==
MLX5HWS_RULE_STATUS_UPDATING ? "UPDATING" : "NA",
rule->status,
rule->pending_wqes);
mlx5hws_err(ctx, " rule 0x%08llx: matcher 0x%llx %s\n",
HWS_PTR_TO_ID(rule),
HWS_PTR_TO_ID(rule->matcher),
(rule->matcher->flags & MLX5HWS_MATCHER_FLAGS_ISOLATED) ?
"(isolated)" : "");
if (!cqe) {
mlx5hws_err(ctx, " rule 0x%08llx: no CQE\n",
HWS_PTR_TO_ID(rule));
return;
}
mlx5hws_err(ctx, " rule 0x%08llx: cqe->opcode = %d %s\n",
HWS_PTR_TO_ID(rule), opcode,
Annotation
- Immediate include surface: `internal.h`, `lib/clock.h`.
- Detected declarations: `function mlx5hws_send_add_new_dep_wqe`, `function mlx5hws_send_abort_new_dep_wqe`, `function mlx5hws_send_all_dep_wqe`, `function mlx5hws_send_engine_post_start`, `function mlx5hws_send_engine_post_req_wqe`, `function hws_send_engine_post_ring`, `function hws_send_wqe_set_tag`, `function mlx5hws_send_engine_post_end`, `function hws_send_wqe`, `function mlx5hws_send_ste`.
- 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.