[v3,2/5] net/mlx5: fetch the available registers for NAT64
Checks
Commit Message
REG_C_6 is used as the 1st one and since it is reserved internally
by default, there is no impact.
The remaining 2 registers will be fetched from the available TAGs
array from right to left. They will not be masked in the array due
to the fact that not all the rules will use NAT64 action.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
drivers/net/mlx5/mlx5.c | 9 +++++++++
drivers/net/mlx5/mlx5.h | 2 ++
2 files changed, 11 insertions(+)
@@ -1644,6 +1644,15 @@ mlx5_init_hws_flow_tags_registers(struct mlx5_dev_ctx_shared *sh)
if (!!((1 << i) & masks))
reg->hw_avl_tags[j++] = mlx5_regc_value(i);
}
+ /*
+ * Set the registers for NAT64 usage internally. REG_C_6 is always used.
+ * The other 2 registers will be fetched from right to left, at least 2
+ * tag registers should be available.
+ */
+ MLX5_ASSERT(j >= (MLX5_FLOW_NAT64_REGS_MAX - 1));
+ reg->nat64_regs[0] = REG_C_6;
+ reg->nat64_regs[1] = reg->hw_avl_tags[j - 2];
+ reg->nat64_regs[2] = reg->hw_avl_tags[j - 1];
}
static void
@@ -1407,10 +1407,12 @@ struct mlx5_hws_cnt_svc_mng {
};
#define MLX5_FLOW_HW_TAGS_MAX 12
+#define MLX5_FLOW_NAT64_REGS_MAX 3
struct mlx5_dev_registers {
enum modify_reg aso_reg;
enum modify_reg hw_avl_tags[MLX5_FLOW_HW_TAGS_MAX];
+ enum modify_reg nat64_regs[MLX5_FLOW_NAT64_REGS_MAX];
};
#if defined(HAVE_MLX5DV_DR) && \