From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id BFDD2A057B;
	Wed, 15 Apr 2020 03:08:27 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 9B29A1D410;
	Wed, 15 Apr 2020 03:08:27 +0200 (CEST)
Received: from alln-iport-8.cisco.com (alln-iport-8.cisco.com [173.37.142.95])
 by dpdk.org (Postfix) with ESMTP id 3B50E1D40F
 for <dev@dpdk.org>; Wed, 15 Apr 2020 03:08:26 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=cisco.com; i=@cisco.com; l=4251; q=dns/txt; s=iport;
 t=1586912906; x=1588122506;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=FmoHdmlBbMWER7WQ8NmqiWrhO85+cJzW5B6VQrhpkj0=;
 b=ksGd2mQaT1WDlDNzbjg4g0L/j6LXQXqjR8PIAbca5mPIZMRI92xhJHgH
 qlAlneec7+FBlG1tBinOXy4JInBVYL4KAsNRwlNzImxXKcYJIRkBgE2hc
 dY9zk8JPXLKlHNOuEFnXQWfkPV6eq/hvTPyxHUzUk7XkxnPE1eJlG0C2j w=;
X-IronPort-AV: E=Sophos;i="5.72,385,1580774400"; d="scan'208";a="476537982"
Received: from rcdn-core-3.cisco.com ([173.37.93.154])
 by alln-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA;
 15 Apr 2020 01:08:25 +0000
Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48])
 by rcdn-core-3.cisco.com (8.15.2/8.15.2) with ESMTP id 03F18Ps4010265;
 Wed, 15 Apr 2020 01:08:25 GMT
Received: by cisco.com (Postfix, from userid 392789)
 id DC15220F2003; Tue, 14 Apr 2020 18:08:24 -0700 (PDT)
From: John Daley <johndale@cisco.com>
To: ferruh.yigit@intel.com, arybchenko@solarflare.com
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>,
 Hyong Youb Kim <hyonkim@cisco.com>
Date: Tue, 14 Apr 2020 18:06:40 -0700
Message-Id: <20200415010641.5195-4-johndale@cisco.com>
X-Mailer: git-send-email 2.22.0
In-Reply-To: <20200415010641.5195-1-johndale@cisco.com>
References: <20200415010641.5195-1-johndale@cisco.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com
X-Outbound-Node: rcdn-core-3.cisco.com
Subject: [dpdk-dev] [PATCH 4/5] net/enic: support flow API RSS ranges on
	outer headers
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Support rte_flow RSS action on outer headers (level 0). RSS ranges on
the non-default port is OK.
Restrictions:
 - The RETA is ignored. The hash function is simply applied across
   the RSS queue range.
 - The queues used in the RSS group must be sequential.
 - There is a performance hit if the number of queues is not a power
   of 2.

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
---
 doc/guides/nics/enic.rst        |  4 +++
 drivers/net/enic/enic_fm_flow.c | 56 ++++++++++++++++++++++-----------
 2 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/doc/guides/nics/enic.rst b/doc/guides/nics/enic.rst
index 65e536d422..aa4fdc0e39 100644
--- a/doc/guides/nics/enic.rst
+++ b/doc/guides/nics/enic.rst
@@ -459,6 +459,10 @@ PKT_RX_VLAN_STRIPPED mbuf flags would not be set. This mode is enabled with the
     packets and then receive them normally. These require 1400 series VIC adapters
     and latest firmware.
   - RAW items are limited to matching UDP tunnel headers like VXLAN.
+  - For 1400 VICs, all flows using the RSS action on a port use same hash
+    configuration. The RETA is ignored. The queues used in the RSS group must be
+    sequential. There is a performance hit if the number of queues is not a power of 2.
+    Only level 0 (outer header) RSS is allowed.
 
 - **Statistics**
 
diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
index 8d715fc436..86efeffc64 100644
--- a/drivers/net/enic/enic_fm_flow.c
+++ b/drivers/net/enic/enic_fm_flow.c
@@ -1174,8 +1174,8 @@ enic_fm_copy_action(struct enic_flowman *fm,
 				actions->conf;
 
 			/*
-			 * If other fate kind is set, fail.  Multiple
-			 * queue actions are ok.
+			 * If fate other than QUEUE or RSS, fail. Multiple
+			 * rss and queue actions are ok.
 			 */
 			if ((overlap & FATE) && first_rq)
 				goto unsupported;
@@ -1185,6 +1185,7 @@ enic_fm_copy_action(struct enic_flowman *fm,
 			fm_op.fa_op = FMOP_RQ_STEER;
 			fm_op.rq_steer.rq_index =
 				enic_rte_rq_idx_to_sop_idx(queue->index);
+			fm_op.rq_steer.rq_count = 1;
 			fm_op.rq_steer.vnic_handle = vnic_h;
 			ret = enic_fm_append_action_op(fm, &fm_op, error);
 			if (ret)
@@ -1219,27 +1220,44 @@ enic_fm_copy_action(struct enic_flowman *fm,
 			uint16_t i;
 
 			/*
-			 * Hardware does not support general RSS actions, but
-			 * we can still support the dummy one that is used to
-			 * "receive normally".
+			 * If fate other than QUEUE or RSS, fail. Multiple
+			 * rss and queue actions are ok.
+			 */
+			if ((overlap & FATE) && first_rq)
+				goto unsupported;
+			first_rq = false;
+			overlap |= FATE;
+
+			/*
+			 * Hardware only supports RSS actions on outer level
+			 * with default type and function. Queues must be
+			 * sequential.
 			 */
 			allow = rss->func == RTE_ETH_HASH_FUNCTION_DEFAULT &&
-				rss->level == 0 &&
-				(rss->types == 0 ||
-				 rss->types == enic->rss_hf) &&
-				rss->queue_num == enic->rq_count &&
-				rss->key_len == 0;
-			/* Identity queue map is ok */
-			for (i = 0; i < rss->queue_num; i++)
-				allow = allow && (i == rss->queue[i]);
+				rss->level == 0 && (rss->types == 0 ||
+				rss->types == enic->rss_hf) &&
+				rss->queue_num <= enic->rq_count &&
+				rss->queue[rss->queue_num - 1] < enic->rq_count;
+
+
+			/* Identity queue map needs to be sequential */
+			for (i = 1; i < rss->queue_num; i++)
+				allow = allow && (rss->queue[i] ==
+					rss->queue[i - 1] + 1);
 			if (!allow)
 				goto unsupported;
-			if (overlap & FATE)
-				goto unsupported;
-			/* Need MARK or FLAG */
-			if (!(overlap & MARK))
-				goto unsupported;
-			overlap |= FATE;
+
+			memset(&fm_op, 0, sizeof(fm_op));
+			fm_op.fa_op = FMOP_RQ_STEER;
+			fm_op.rq_steer.rq_index =
+				enic_rte_rq_idx_to_sop_idx(rss->queue[0]);
+			fm_op.rq_steer.rq_count = rss->queue_num;
+			fm_op.rq_steer.vnic_handle = vnic_h;
+			ret = enic_fm_append_action_op(fm, &fm_op, error);
+			if (ret)
+				return ret;
+			ENICPMD_LOG(DEBUG, "create QUEUE action rq: %u",
+				    fm_op.rq_steer.rq_index);
 			break;
 		}
 		case RTE_FLOW_ACTION_TYPE_PORT_ID: {
-- 
2.22.0