Commit 8a515073 authored by Alex Vesker's avatar Alex Vesker Committed by Jakub Kicinski
Browse files

net/mlx5: HWS, Fix table creation UID



During table creation, caller passes a UID using ft_attr. The UID
value was ignored, which leads to problems when the caller sets the
UID to a non-zero value, such as SHARED_RESOURCE_UID (0xffff) - the
internal FT objects will be created with UID=0.

Fixes: 0869701c ("net/mlx5: HWS, added FW commands handling")
Signed-off-by: default avatarAlex Vesker <valex@nvidia.com>
Reviewed-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
Link: https://patch.msgid.link/20250817202323.308604-7-mbloch@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 7c60952f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ int mlx5hws_cmd_flow_table_create(struct mlx5_core_dev *mdev,

	MLX5_SET(create_flow_table_in, in, opcode, MLX5_CMD_OP_CREATE_FLOW_TABLE);
	MLX5_SET(create_flow_table_in, in, table_type, ft_attr->type);
	MLX5_SET(create_flow_table_in, in, uid, ft_attr->uid);

	ft_ctx = MLX5_ADDR_OF(create_flow_table_in, in, flow_table_context);
	MLX5_SET(flow_table_context, ft_ctx, level, ft_attr->level);
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ struct mlx5hws_cmd_set_fte_attr {
struct mlx5hws_cmd_ft_create_attr {
	u8 type;
	u8 level;
	u16 uid;
	bool rtc_valid;
	bool decap_en;
	bool reformat_en;
+1 −0
Original line number Diff line number Diff line
@@ -267,6 +267,7 @@ static int mlx5_cmd_hws_create_flow_table(struct mlx5_flow_root_namespace *ns,

	tbl_attr.type = MLX5HWS_TABLE_TYPE_FDB;
	tbl_attr.level = ft_attr->level;
	tbl_attr.uid = ft_attr->uid;
	tbl = mlx5hws_table_create(ctx, &tbl_attr);
	if (!tbl) {
		mlx5_core_err(ns->dev, "Failed creating hws flow_table\n");
+4 −1
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ static int hws_matcher_create_end_ft_isolated(struct mlx5hws_matcher *matcher)

	ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev,
					      tbl,
					      0,
					      &matcher->end_ft_id);
	if (ret) {
		mlx5hws_err(tbl->ctx, "Isolated matcher: failed to create end flow table\n");
@@ -112,7 +113,9 @@ static int hws_matcher_create_end_ft(struct mlx5hws_matcher *matcher)
	if (mlx5hws_matcher_is_isolated(matcher))
		ret = hws_matcher_create_end_ft_isolated(matcher);
	else
		ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev, tbl,
		ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev,
						      tbl,
						      0,
						      &matcher->end_ft_id);

	if (ret) {
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ struct mlx5hws_context_attr {
struct mlx5hws_table_attr {
	enum mlx5hws_table_type type;
	u32 level;
	u16 uid;
};

enum mlx5hws_matcher_flow_src {
Loading