Skip to contentSkip to conversation

net/mlx5: workaround not supported drop action on the root table

PATCH Applied Suanming Mou 2 participants 2 messages Aug 2, 2021 – Aug 3, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: workaround not supported drop action on the root table

Currently, there are two types of drop action implementation in the PMD. One is the DR(Direct Rules) dummy placeholder drop action and another is the dedicated dummy queue drop action. When creates flow on the root table with DR drop action, the action will be converted to MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP Verbs attribute in rdma-core.

In some inbox systems, MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP Verbs attribute may not be supported in the kernel driver. Create flow with drop action on the root table will be failed as it is not supported. In this case, the dummy queue drop action should be used instead of DR dummy placeholder drop action.

This commit adds the DR drop action support detect on the root table. If MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP Verbs is not supported in the system, a dummy queue will be used as drop action.

Fixes da845ae9d7c1 ("net/mlx5: fix drop action for Direct Rules/Verbs")
---
 drivers/net/mlx5/linux/mlx5_os.c | 27 ++++++++++++
 drivers/net/mlx5/mlx5.h          |  1 +
 drivers/net/mlx5/mlx5_flow.h     |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c  | 72 +++++++++++++++++++++++++++++++-
 4 files changed, 100 insertions(+), 1 deletion(-)
drivers/net/mlx5/linux/mlx5_os.c +27 -0
index 8f98cf1716..2e25de5489 100644
@@ -786,6 +786,32 @@ mlx5_flow_counter_mode_config(struct rte_eth_dev *dev __rte_unused)
 #endif
 }
 
+/**
+ * DR flow drop action support detect.
+ *
+ * @param dev
+ *   Pointer to rte_eth_dev structure.
+ *
+ */
+static void
+mlx5_flow_drop_action_config(struct rte_eth_dev *dev __rte_unused)
+{
+#ifdef HAVE_MLX5DV_DR
+	struct mlx5_priv *priv = dev->data->dev_private;
+
+	if (!priv->config.dv_flow_en || !priv->sh->dr_drop_action)
+		return;
+	/**
+	 * DR supports drop action placeholder when it is supported;
+	 * otherwise, use the queue drop action.
+	 */
+	if (mlx5_flow_discover_dr_action_support(dev))
+		priv->root_drop_action = priv->drop_queue.hrxq->action;
+	else
+		priv->root_drop_action = priv->sh->dr_drop_action;
+#endif
+}
+
 static void
 mlx5_queue_counter_id_prepare(struct rte_eth_dev *dev)
 {
@@ -1864,6 +1890,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	}
 	rte_spinlock_init(&priv->shared_act_sl);
 	mlx5_flow_counter_mode_config(eth_dev);
+	mlx5_flow_drop_action_config(eth_dev);
 	if (priv->config.dv_flow_en)
 		eth_dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE;
 	return eth_dev;
drivers/net/mlx5/mlx5.h +1 -0
index faafe3d3f1..34d66e93ad 100644
@@ -1411,6 +1411,7 @@ struct mlx5_priv {
 	unsigned int (*reta_idx)[]; /* RETA index table. */
 	unsigned int reta_idx_n; /* RETA index size. */
 	struct mlx5_drop drop_queue; /* Flow drop queues. */
+	void *root_drop_action; /* Pointer to root drop action. */
 	struct mlx5_indexed_pool *flows[MLX5_FLOW_TYPE_MAXI];
 	/* RTE Flow rules. */
 	uint32_t ctrl_flows; /* Control flow rules. */
drivers/net/mlx5/mlx5_flow.h +1 -0
index 3724293d26..218b5b6994 100644
@@ -1571,6 +1571,7 @@ struct mlx5_flow_meter_sub_policy *mlx5_flow_meter_sub_policy_rss_prepare
 void mlx5_flow_destroy_sub_policy_with_rxq(struct rte_eth_dev *dev,
 		struct mlx5_flow_meter_policy *mtr_policy);
 int mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev);
+int mlx5_flow_discover_dr_action_support(struct rte_eth_dev *dev);
 int mlx5_action_handle_flush(struct rte_eth_dev *dev);
 void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id);
 int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh);
drivers/net/mlx5/mlx5_flow_dv.c +71 -1

84 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

02/08/2021 16:30, Suanming Mou:

Quoted 18 lines

Currently, there are two types of drop action implementation in the PMD. One is the DR(Direct Rules) dummy placeholder drop action and another is the dedicated dummy queue drop action. When creates flow on the root table with DR drop action, the action will be converted to MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP Verbs attribute in rdma-core.

In some inbox systems, MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP Verbs attribute may not be supported in the kernel driver. Create flow with drop action on the root table will be failed as it is not supported. In this case, the dummy queue drop action should be used instead of DR dummy placeholder drop action.

This commit adds the DR drop action support detect on the root table. If MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP Verbs is not supported in the system, a dummy queue will be used as drop action.

Quoted 5 lines
Fixes da845ae9d7c1 ("net/mlx5: fix drop action for Direct Rules/Verbs")

Applied, thanks.