drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c
Extension
.c
Size
34397 bytes
Lines
1239
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.

Dependency Surface

Detected Declarations

Annotated Snippet

list_for_each_entry(bwc_rule, rules_list, list_node) {
			ret = mlx5hws_matcher_resize_rule_move(matcher,
							       bwc_rule->rule,
							       &rule_attr);
			if (unlikely(ret)) {
				if (!move_error) {
					mlx5hws_err(ctx,
						    "Moving BWC rule: move failed (%d), attempting to move rest of the rules\n",
						    ret);
					move_error = ret;
				}
				/* Rule wasn't queued, no need to poll */
				continue;
			}

			pending_rules++;
			drain = pending_rules >=
				hws_bwc_get_burst_th(ctx, rule_attr.queue_id);
			ret = mlx5hws_bwc_queue_poll(ctx,
						     rule_attr.queue_id,
						     &pending_rules,
						     drain);
			if (unlikely(ret)) {
				if (ret == -ETIMEDOUT) {
					mlx5hws_err(ctx,
						    "Moving BWC rule: timeout polling for completions (%d), aborting rehash\n",
						    ret);
					return ret;
				}
				if (!poll_error) {
					mlx5hws_err(ctx,
						    "Moving BWC rule: polling for completions failed (%d), attempting to move rest of the rules\n",
						    ret);
					poll_error = ret;
				}
			}
		}

		if (pending_rules) {
			queue = &ctx->send_queue[rule_attr.queue_id];
			mlx5hws_send_engine_flush_queue(queue);
			ret = mlx5hws_bwc_queue_poll(ctx,
						     rule_attr.queue_id,
						     &pending_rules,
						     true);
			if (unlikely(ret)) {
				if (ret == -ETIMEDOUT) {
					mlx5hws_err(ctx,
						    "Moving bwc rule: timeout draining completions (%d), aborting rehash\n",
						    ret);
					return ret;
				}
				if (!drain_error) {
					mlx5hws_err(ctx,
						    "Moving bwc rule: drain failed (%d), attempting to move rest of the rules\n",
						    ret);
					drain_error = ret;
				}
			}
		}
	}

	/* Return the first error that happened */
	if (unlikely(move_error))
		return move_error;
	if (unlikely(poll_error))
		return poll_error;
	if (unlikely(drain_error))
		return drain_error;

	return ret;
}

static int hws_bwc_matcher_move_all(struct mlx5hws_bwc_matcher *bwc_matcher)
{
	switch (bwc_matcher->matcher_type) {
	case MLX5HWS_BWC_MATCHER_SIMPLE:
		return hws_bwc_matcher_move_all_simple(bwc_matcher);
	case MLX5HWS_BWC_MATCHER_COMPLEX_FIRST:
		return mlx5hws_bwc_matcher_complex_move_first(bwc_matcher);
	case MLX5HWS_BWC_MATCHER_COMPLEX_SUBMATCHER:
		return mlx5hws_bwc_matcher_complex_move(bwc_matcher);
	default:
		return -EINVAL;
	}
}

static int hws_bwc_matcher_move(struct mlx5hws_bwc_matcher *bwc_matcher)
{
	struct mlx5hws_context *ctx = bwc_matcher->matcher->tbl->ctx;

Annotation

Implementation Notes