summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5
diff options
context:
space:
mode:
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>2019-11-07 17:09:56 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-11-11 14:23:02 +0100
commit0e9d000276861b2e3f3eefc90b9ae3baca8baf22 (patch)
tree6ee33456e81e42fd8108b619f81ba3dfe41bd774 /drivers/net/mlx5
parent3913937151f6cbd9fb360f79130cbfe18377d6ba (diff)
downloaddpdk-0e9d000276861b2e3f3eefc90b9ae3baca8baf22.zip
dpdk-0e9d000276861b2e3f3eefc90b9ae3baca8baf22.tar.gz
dpdk-0e9d000276861b2e3f3eefc90b9ae3baca8baf22.tar.xz
net/mlx5: check maximum modify actions number
If the extensive metadata registers are supported, it can be regarded inclusively that the extensive metadata support is possible. E.g. metadata register copy action, supporting 16 modify header actions, reserving register across different steering domain (FDB and NIC) and so on. This patch handles the maximal amount of header modify actions depending on discovered metadata registers support. Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5')
-rw-r--r--drivers/net/mlx5/mlx5_flow.h9
-rw-r--r--drivers/net/mlx5/mlx5_flow_dv.c25
2 files changed, 32 insertions, 2 deletions
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index ba43ad7..a8f4e5c 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -348,8 +348,13 @@ struct mlx5_flow_dv_tag_resource {
uint32_t tag; /**< the tag value. */
};
-/* Number of modification commands. */
-#define MLX5_MODIFY_NUM 8
+/*
+ * Number of modification commands.
+ * If extensive metadata registers are supported
+ * the maximal actions amount is 16 and 8 otherwise.
+ */
+#define MLX5_MODIFY_NUM 16
+#define MLX5_MODIFY_NUM_NO_MREG 8
/* Modify resource structure */
struct mlx5_flow_dv_modify_hdr_resource {
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 98161d3..5f3ea1f 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -2749,6 +2749,27 @@ flow_dv_validate_action_port_id(struct rte_eth_dev *dev,
}
/**
+ * Get the maximum number of modify header actions.
+ *
+ * @param dev
+ * Pointer to rte_eth_dev structure.
+ *
+ * @return
+ * Max number of modify header actions device can support.
+ */
+static unsigned int
+flow_dv_modify_hdr_action_max(struct rte_eth_dev *dev)
+{
+ /*
+ * There's no way to directly query the max cap. Although it has to be
+ * acquried by iterative trial, it is a safe assumption that more
+ * actions are supported by FW if extensive metadata register is
+ * supported.
+ */
+ return mlx5_flow_ext_mreg_supported(dev) ? MLX5_MODIFY_NUM :
+ MLX5_MODIFY_NUM_NO_MREG;
+}
+/**
* Find existing modify-header resource or create and register a new one.
*
* @param dev[in, out]
@@ -2775,6 +2796,10 @@ flow_dv_modify_hdr_resource_register
struct mlx5_flow_dv_modify_hdr_resource *cache_resource;
struct mlx5dv_dr_domain *ns;
+ if (resource->actions_num > flow_dv_modify_hdr_action_max(dev))
+ return rte_flow_error_set(error, EOVERFLOW,
+ RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+ "too many modify header items");
if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB)
ns = sh->fdb_domain;
else if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_TX)