From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hyong Youb Kim Subject: [PATCH 07/15] net/enic: enable limited PASSTHRU flow action Date: Wed, 27 Feb 2019 23:03:09 -0800 Message-ID: <20190228070317.17002-8-hyonkim@cisco.com> References: <20190228070317.17002-1-hyonkim@cisco.com> Cc: dev@dpdk.org, John Daley , Hyong Youb Kim To: Ferruh Yigit Return-path: Received: from rcdn-iport-7.cisco.com (rcdn-iport-7.cisco.com [173.37.86.78]) by dpdk.org (Postfix) with ESMTP id 2CE304C74 for ; Thu, 28 Feb 2019 08:05:07 +0100 (CET) In-Reply-To: <20190228070317.17002-1-hyonkim@cisco.com> 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 VPP use PASSTHRU+MARK flow rules to offload packet matching to the NIC. Just like MARK+RSS used by OVS-DPDK and others, PASSTHRU+MARK is used to "mark and then receive normally". Recent VIC adapters support such flow rules, so enable PASSTHRU for this limited use case. Signed-off-by: Hyong Youb Kim --- drivers/net/enic/enic_flow.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 0f6b6b930..c6ed9e1b9 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -283,6 +283,7 @@ static const enum rte_flow_action_type enic_supported_actions_v2_id[] = { RTE_FLOW_ACTION_TYPE_MARK, RTE_FLOW_ACTION_TYPE_FLAG, RTE_FLOW_ACTION_TYPE_RSS, + RTE_FLOW_ACTION_TYPE_PASSTHRU, RTE_FLOW_ACTION_TYPE_END, }; @@ -292,6 +293,7 @@ static const enum rte_flow_action_type enic_supported_actions_v2_drop[] = { RTE_FLOW_ACTION_TYPE_FLAG, RTE_FLOW_ACTION_TYPE_DROP, RTE_FLOW_ACTION_TYPE_RSS, + RTE_FLOW_ACTION_TYPE_PASSTHRU, RTE_FLOW_ACTION_TYPE_END, }; @@ -302,6 +304,7 @@ static const enum rte_flow_action_type enic_supported_actions_v2_count[] = { RTE_FLOW_ACTION_TYPE_DROP, RTE_FLOW_ACTION_TYPE_COUNT, RTE_FLOW_ACTION_TYPE_RSS, + RTE_FLOW_ACTION_TYPE_PASSTHRU, RTE_FLOW_ACTION_TYPE_END, }; @@ -1072,6 +1075,7 @@ enic_copy_action_v2(struct enic *enic, { enum { FATE = 1, MARK = 2, }; uint32_t overlap = 0; + bool passthru = false; FLOW_TRACE(); @@ -1164,6 +1168,19 @@ enic_copy_action_v2(struct enic *enic, overlap |= FATE; break; } + case RTE_FLOW_ACTION_TYPE_PASSTHRU: { + /* + * Like RSS above, PASSTHRU + MARK may be used to + * "mark and then receive normally". MARK usually comes + * after PASSTHRU, so remember we have seen passthru + * and check for mark later. + */ + if (overlap & FATE) + return ENOTSUP; + overlap |= FATE; + passthru = true; + break; + } case RTE_FLOW_ACTION_TYPE_VOID: continue; default: @@ -1171,6 +1188,9 @@ enic_copy_action_v2(struct enic *enic, break; } } + /* Only PASSTHRU + MARK is allowed */ + if (passthru && !(overlap & MARK)) + return ENOTSUP; if (!(overlap & FATE)) return ENOTSUP; enic_action->type = FILTER_ACTION_V2; -- 2.16.2