From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <nelio.laranjeiro@6wind.com>
Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com
 [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id A96D51B214
 for <dev@dpdk.org>; Thu, 19 Oct 2017 14:51:55 +0200 (CEST)
Received: by mail-wr0-f195.google.com with SMTP id j14so8222223wre.8
 for <dev@dpdk.org>; Thu, 19 Oct 2017 05:51:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :in-reply-to:references;
 bh=i1VW+GpBGLTmJGgTz/QEDxyx7g7x2bRHXATQLb1UnSA=;
 b=uRJryAaqxfax4sLMKdxiOTLj85T1n4cDz9njzRkcX0RyolhyHJUq+gDs/h1ZouNh30
 wq4LeQ4Qx6DXeU9ITD9l2b2hoEMRPaNuF2d7ACGxS7sYBtH7dlzDscLN6JN2UdCNuLmS
 YmFs+bQSEJm95A2VJWAs+RfibdEV1rhM8miIOqe2G95yd8scz5/KVTXRUiADh9K6AQen
 pKZVVOWZ6ubRNFXUnlriwmknz6NjgiM7wOEuJnYV5Eh4QrIPwoBJKA0rGNIfZI0oqSDM
 3GBINA/LGWSv5wslJGqBHUh2kO9tbuJ8Gg3GXcDRJclr+Cah8XXwqsdNUr6ERDCDEizl
 eW1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:in-reply-to:references;
 bh=i1VW+GpBGLTmJGgTz/QEDxyx7g7x2bRHXATQLb1UnSA=;
 b=cVfVsdfD6Nnroe1ZfZx5mAe0J6KdSrKhkXUYnncxlumg60DeUQBagCUy9OIZk11u2w
 8T5wnhv+nowXTOLsoDIdzU6g88O36bBTdWkukO2yUs5bIAAvvD5m3Ecn6uNQGj9/aMQz
 02pg1XrgiS0rNVXWC8JAq+sukJOYQvr4QgkozdWE4UC5DH7DchnKvZ2s2xNGLpDXHOv5
 CICTjvTLtgnykFRjOcCK1qHuTScEVK6lSKtC+e5lP2sKkcOHv8nN2Qqnry4g2pYFl3SS
 IH8CnJTi6miVkyGu9FOey/V36OFpCPxpEiDI0nc3e2oNHJ4rwAJ7wcrau+1vlzMlTAcG
 jo9w==
X-Gm-Message-State: AMCzsaWIclkhIJAob7F4z6kr3D7qPL2FePFoAfnSJapGPBjxL3pJPjpn
 uwv7WaMOMFL3q0Rk9YmYqPwa2l4SqA==
X-Google-Smtp-Source: ABhQp+TuKBLZKj2EQA63aM3/sLD2beodnUXlbh8ghZsZQDgxtcRbU+3ukGQCJNwDwtW30THp/7DRXg==
X-Received: by 10.223.201.8 with SMTP id m8mr1624289wrh.37.1508417513615;
 Thu, 19 Oct 2017 05:51:53 -0700 (PDT)
Received: from laranjeiro-vm.dev.6wind.com.
 (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78])
 by smtp.gmail.com with ESMTPSA id 69sm1024189wmp.11.2017.10.19.05.51.52
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 19 Oct 2017 05:51:53 -0700 (PDT)
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Yongseok Koh <yskoh@mellanox.com>,
 Adrien Mazarguil <adrien.mazarguil@6wind.com>
Date: Thu, 19 Oct 2017 14:51:32 +0200
Message-Id: <3ea64d71e26f882df268a42a16beb2af339b5e05.1508417257.git.nelio.laranjeiro@6wind.com>
X-Mailer: git-send-email 2.11.0
In-Reply-To: <cover.1508417257.git.nelio.laranjeiro@6wind.com>
References: <cover.1508417257.git.nelio.laranjeiro@6wind.com>
In-Reply-To: <cover.1508417257.git.nelio.laranjeiro@6wind.com>
References: <cover.1508417257.git.nelio.laranjeiro@6wind.com>
Subject: [dpdk-dev] [PATCH 4/6] net/mlx5: fix flow director drop action
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Oct 2017 12:51:56 -0000

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(-)

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:
-- 
2.11.0