[dpdk-dev,4/6] net/mlx5: fix flow director drop action

Message ID 3ea64d71e26f882df268a42a16beb2af339b5e05.1508417257.git.nelio.laranjeiro@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Nélio Laranjeiro Oct. 19, 2017, 12:51 p.m. UTC
  Flow director drop action as not been brought back with the new
implementation on top of rte flow.

Fixes: 4c3e9bcdd52e ("net/mlx5: support flow director")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 6f458f44a..96a753e8d 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2601,20 +2601,27 @@  priv_fdir_filter_convert(struct priv *priv,
 		ERROR("invalid queue number %d", fdir_filter->action.rx_queue);
 		return EINVAL;
 	}
-	/* Validate the behavior. */
-	if (fdir_filter->action.behavior != RTE_ETH_FDIR_ACCEPT) {
-		ERROR("invalid behavior %d", fdir_filter->action.behavior);
-		return ENOTSUP;
-	}
 	attributes->attr.ingress = 1;
 	attributes->items[0] = (struct rte_flow_item) {
 		.type = RTE_FLOW_ITEM_TYPE_ETH,
 		.spec = &attributes->l2,
 	};
-	attributes->actions[0] = (struct rte_flow_action){
-		.type = RTE_FLOW_ACTION_TYPE_QUEUE,
-		.conf = &attributes->queue,
-	};
+	switch (fdir_filter->action.behavior) {
+	case RTE_ETH_FDIR_ACCEPT:
+		attributes->actions[0] = (struct rte_flow_action){
+			.type = RTE_FLOW_ACTION_TYPE_QUEUE,
+			.conf = &attributes->queue,
+		};
+		break;
+	case RTE_ETH_FDIR_REJECT:
+		attributes->actions[0] = (struct rte_flow_action){
+			.type = RTE_FLOW_ACTION_TYPE_DROP,
+		};
+		break;
+	default:
+		ERROR("invalid behavior %d", fdir_filter->action.behavior);
+		return ENOTSUP;
+	}
 	attributes->queue.index = fdir_filter->action.rx_queue;
 	switch (fdir_filter->input.flow_type) {
 	case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: