From patchwork Sat Mar 2 10:42:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hyong Youb Kim (hyonkim)" X-Patchwork-Id: 50752 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 135D0374C; Sat, 2 Mar 2019 11:44:27 +0100 (CET) Received: from rcdn-iport-7.cisco.com (rcdn-iport-7.cisco.com [173.37.86.78]) by dpdk.org (Postfix) with ESMTP id 208A73576 for ; Sat, 2 Mar 2019 11:44:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=5885; q=dns/txt; s=iport; t=1551523466; x=1552733066; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=FhHaWsPRY3SiJZO1SVrR7qHcdFfxAdrlgQFUjmaPBBU=; b=KwI73XCWMQ65rWI4WQ0gQi/3u3gxWl20q5h5u2URz+ZGyYqt+8JMi9ty un009YJskVy3ljkLVbRMeC6fkZtdRqUDubYBYiMEmJV8nKd+LJxIiGJOs vGi6PdhtB6VZ7Bg10va1H+39tmVuL7wgLmWD+6mVsbtne4lMJZI1n+wFF 4=; X-IronPort-AV: E=Sophos;i="5.58,431,1544486400"; d="scan'208";a="524228194" Received: from alln-core-3.cisco.com ([173.36.13.136]) by rcdn-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2019 10:44:25 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-3.cisco.com (8.15.2/8.15.2) with ESMTP id x22AiP8l020196; Sat, 2 Mar 2019 10:44:25 GMT Received: by cisco.com (Postfix, from userid 508933) id 25B2A20F2001; Sat, 2 Mar 2019 02:44:25 -0800 (PST) From: Hyong Youb Kim To: Ferruh Yigit Cc: dev@dpdk.org, John Daley , Hyong Youb Kim Date: Sat, 2 Mar 2019 02:42:44 -0800 Message-Id: <20190302104251.32565-7-hyonkim@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20190302104251.32565-1-hyonkim@cisco.com> References: <20190302104251.32565-1-hyonkim@cisco.com> X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: alln-core-3.cisco.com Subject: [dpdk-dev] [PATCH v2 06/13] net/enic: enable limited RSS flow action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some apps like OVS-DPDK use MARK+RSS flow rules in order to offload packet matching to the NIC. The RSS action in such flow rules simply indicates "receive packet normally", not trying to override the port wide RSS. The action is included in the flow rules simply to terminate them, as MARK is not a fate-deciding action. And, the RSS action has a most basic config: default hash, level, types, null key, and identity queue mapping. Recent VIC adapters can support these "mark and receive" flow rules. So, enable support for RSS action for this limited use case. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- doc/guides/nics/enic.rst | 2 +- doc/guides/rel_notes/release_19_05.rst | 3 +++ drivers/net/enic/enic_flow.c | 48 +++++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/doc/guides/nics/enic.rst b/doc/guides/nics/enic.rst index e456e6c2d..ed093ef44 100644 --- a/doc/guides/nics/enic.rst +++ b/doc/guides/nics/enic.rst @@ -256,7 +256,7 @@ Generic Flow API is supported. The baseline support is: - Attributes: ingress - Items: eth, ipv4, ipv6, udp, tcp, vxlan, inner eth, ipv4, ipv6, udp, tcp - - Actions: queue, mark, drop, flag and void + - Actions: queue, mark, drop, flag, rss, and void - Selectors: 'is', 'spec' and 'mask'. 'last' is not supported - In total, up to 64 bytes of mask is allowed across all headers diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index 4a3e2a7f3..73403c79e 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -77,6 +77,9 @@ New Features which includes the directory name, lib name, filenames, makefile, docs, macros, functions, structs and any other strings in the code. +* **Updated the enic driver.** + + * Added limited support for RSS. Removed Items ------------- diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index c60476c8c..0f6b6b930 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -45,7 +45,8 @@ struct enic_filter_cap { }; /* functions for copying flow actions into enic actions */ -typedef int (copy_action_fn)(const struct rte_flow_action actions[], +typedef int (copy_action_fn)(struct enic *enic, + const struct rte_flow_action actions[], struct filter_action_v2 *enic_action); /* functions for copying items into enic filters */ @@ -57,8 +58,7 @@ struct enic_action_cap { /** list of valid actions */ const enum rte_flow_action_type *actions; /** copy function for a particular NIC */ - int (*copy_fn)(const struct rte_flow_action actions[], - struct filter_action_v2 *enic_action); + copy_action_fn *copy_fn; }; /* Forward declarations */ @@ -282,6 +282,7 @@ static const enum rte_flow_action_type enic_supported_actions_v2_id[] = { RTE_FLOW_ACTION_TYPE_QUEUE, RTE_FLOW_ACTION_TYPE_MARK, RTE_FLOW_ACTION_TYPE_FLAG, + RTE_FLOW_ACTION_TYPE_RSS, RTE_FLOW_ACTION_TYPE_END, }; @@ -290,6 +291,7 @@ static const enum rte_flow_action_type enic_supported_actions_v2_drop[] = { RTE_FLOW_ACTION_TYPE_MARK, RTE_FLOW_ACTION_TYPE_FLAG, RTE_FLOW_ACTION_TYPE_DROP, + RTE_FLOW_ACTION_TYPE_RSS, RTE_FLOW_ACTION_TYPE_END, }; @@ -299,6 +301,7 @@ static const enum rte_flow_action_type enic_supported_actions_v2_count[] = { RTE_FLOW_ACTION_TYPE_FLAG, RTE_FLOW_ACTION_TYPE_DROP, RTE_FLOW_ACTION_TYPE_COUNT, + RTE_FLOW_ACTION_TYPE_RSS, RTE_FLOW_ACTION_TYPE_END, }; @@ -1016,7 +1019,8 @@ enic_copy_filter(const struct rte_flow_item pattern[], * @param error[out] */ static int -enic_copy_action_v1(const struct rte_flow_action actions[], +enic_copy_action_v1(__rte_unused struct enic *enic, + const struct rte_flow_action actions[], struct filter_action_v2 *enic_action) { enum { FATE = 1, }; @@ -1062,7 +1066,8 @@ enic_copy_action_v1(const struct rte_flow_action actions[], * @param error[out] */ static int -enic_copy_action_v2(const struct rte_flow_action actions[], +enic_copy_action_v2(struct enic *enic, + const struct rte_flow_action actions[], struct filter_action_v2 *enic_action) { enum { FATE = 1, MARK = 2, }; @@ -1128,6 +1133,37 @@ enic_copy_action_v2(const struct rte_flow_action actions[], enic_action->flags |= FILTER_ACTION_COUNTER_FLAG; break; } + case RTE_FLOW_ACTION_TYPE_RSS: { + const struct rte_flow_action_rss *rss = + (const struct rte_flow_action_rss *) + actions->conf; + bool allow; + uint16_t i; + + /* + * Hardware does not support general RSS actions, but + * we can still support the dummy one that is used to + * "receive normally". + */ + 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]); + if (!allow) + return ENOTSUP; + if (overlap & FATE) + return ENOTSUP; + /* Need MARK or FLAG */ + if (!(overlap & MARK)) + return ENOTSUP; + overlap |= FATE; + break; + } case RTE_FLOW_ACTION_TYPE_VOID: continue; default: @@ -1418,7 +1454,7 @@ enic_flow_parse(struct rte_eth_dev *dev, action, "Invalid action."); return -rte_errno; } - ret = enic_action_cap->copy_fn(actions, enic_action); + ret = enic_action_cap->copy_fn(enic, actions, enic_action); if (ret) { rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Unsupported action.");