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

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

File Facts

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

if (!hws_action_ste_table_chunk_alloc(action_tbl, chunk)) {
			found = true;
			break;
		}
	}

	if (!found) {
		action_tbl = hws_action_ste_table_alloc(elem);
		if (IS_ERR(action_tbl)) {
			err = PTR_ERR(action_tbl);
			goto out;
		}

		err = hws_action_ste_table_chunk_alloc(action_tbl, chunk);
		if (err)
			goto out;
	}

	if (mlx5hws_pool_empty(action_tbl->pool))
		list_move(&action_tbl->list_node, &elem->full);

	err = 0;

out:
	mutex_unlock(&pool->lock);

	return err;
}

void mlx5hws_action_ste_chunk_free(struct mlx5hws_action_ste_chunk *chunk)
{
	struct mutex *lock = &chunk->action_tbl->parent_elem->parent_pool->lock;

	mlx5hws_dbg(chunk->action_tbl->pool->ctx,
		    "Freeing action STEs offset %d order %d\n",
		    chunk->ste.offset, chunk->ste.order);

	mutex_lock(lock);
	mlx5hws_pool_chunk_free(chunk->action_tbl->pool, &chunk->ste);
	chunk->action_tbl->last_used = jiffies;
	list_move(&chunk->action_tbl->list_node,
		  &chunk->action_tbl->parent_elem->available);
	mutex_unlock(lock);
}

Annotation

Implementation Notes