From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 760A3A057B; Wed, 15 Apr 2020 03:07:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4DD6A1D41A; Wed, 15 Apr 2020 03:07:01 +0200 (CEST) Received: from alln-iport-5.cisco.com (alln-iport-5.cisco.com [173.37.142.92]) by dpdk.org (Postfix) with ESMTP id 7DBD81D416; Wed, 15 Apr 2020 03:06:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3540; q=dns/txt; s=iport; t=1586912819; x=1588122419; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4OeCbWu/c2aNnI3aufox8MnzNl6lHk+1TETkcAHdk24=; b=jsAG7W8Znm5BeqTOTx9o4SPtyODw03TneJzA7Mi09agF4LT2xVzYhoVS Hb5koCD5iGYG99Eh82/8IfkydG8ZckesrRkHnpnSqVMqaAX0akNQIgQ1d CwDmtJO6yXlQOAvpiK53qXdKP1Fd3CXMjgWwH1YQ+c5h4m3gwUL2bTi1f s=; X-IronPort-AV: E=Sophos;i="5.72,385,1580774400"; d="scan'208";a="472813092" Received: from alln-core-6.cisco.com ([173.36.13.139]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 15 Apr 2020 01:06:57 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-6.cisco.com (8.15.2/8.15.2) with ESMTP id 03F16v8U012519; Wed, 15 Apr 2020 01:06:57 GMT Received: by cisco.com (Postfix, from userid 392789) id 3C8C120F2003; Tue, 14 Apr 2020 18:06:57 -0700 (PDT) From: John Daley To: ferruh.yigit@intel.com, arybchenko@solarflare.com Cc: dev@dpdk.org, Hyong Youb Kim , stable@dpdk.org, John Daley Date: Tue, 14 Apr 2020 18:06:37 -0700 Message-Id: <20200415010641.5195-1-johndale@cisco.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: alln-core-6.cisco.com Subject: [dpdk-dev] [PATCH 1/5] net/enic: fix action reordering 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" From: Hyong Youb Kim The current implementation produces wrong ordering for several cases like these: 1. mark, decap, steer Current: steer, mark, decap Correct: mark, steer, decap 2. decap, steer, steer Current: steer, steer, decap Correct: steer, decap, steer Simplify the logic and swap 1st steer and decap. Also, allow just one decap action per flow. Fixes: ea7768b5bba8 ("net/enic: add flow implementation based on Flow Manager API") Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim Signed-off-by: John Daley --- drivers/net/enic/enic_fm_flow.c | 63 +++++++++++++++------------------ 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c index d815f369ed..8d715fc436 100644 --- a/drivers/net/enic/enic_fm_flow.c +++ b/drivers/net/enic/enic_fm_flow.c @@ -870,46 +870,36 @@ enic_fm_append_action_op(struct enic_flowman *fm, return 0; } -/* Steer operations need to appear before other ops */ +/* NIC requires that 1st steer appear before decap. + * Correct example: steer, decap, steer, steer, ... + */ static void enic_fm_reorder_action_op(struct enic_flowman *fm) { - struct fm_action_op *dst, *dst_head, *src, *src_head; + struct fm_action_op *op, *steer, *decap; + struct fm_action_op tmp_op; ENICPMD_FUNC_TRACE(); - /* Move steer ops to the front. */ - src = fm->action.fma_action_ops; - src_head = src; - dst = fm->action_tmp.fma_action_ops; - dst_head = dst; - /* Copy steer ops to tmp */ - while (src->fa_op != FMOP_END) { - if (src->fa_op == FMOP_RQ_STEER) { - ENICPMD_LOG(DEBUG, "move op: %ld -> dst %ld", - (long)(src - src_head), - (long)(dst - dst_head)); - *dst = *src; - dst++; - } - src++; - } - /* Then append non-steer ops */ - src = src_head; - while (src->fa_op != FMOP_END) { - if (src->fa_op != FMOP_RQ_STEER) { - ENICPMD_LOG(DEBUG, "move op: %ld -> dst %ld", - (long)(src - src_head), - (long)(dst - dst_head)); - *dst = *src; - dst++; - } - src++; + /* Find 1st steer and decap */ + op = fm->action.fma_action_ops; + steer = NULL; + decap = NULL; + while (op->fa_op != FMOP_END) { + if (!decap && op->fa_op == FMOP_DECAP_NOSTRIP) + decap = op; + else if (!steer && op->fa_op == FMOP_RQ_STEER) + steer = op; + op++; + } + /* If decap is before steer, swap */ + if (steer && decap && decap < steer) { + op = fm->action.fma_action_ops; + ENICPMD_LOG(DEBUG, "swap decap %ld <-> steer %ld", + (long)(decap - op), (long)(steer - op)); + tmp_op = *decap; + *decap = *steer; + *steer = tmp_op; } - /* Copy END */ - *dst = *src; - /* Finally replace the original action with the reordered one */ - memcpy(fm->action.fma_action_ops, fm->action_tmp.fma_action_ops, - sizeof(fm->action.fma_action_ops)); } /* VXLAN decap is done via flowman compound action */ @@ -1100,6 +1090,7 @@ enic_fm_copy_action(struct enic_flowman *fm, PASSTHRU = 1 << 2, COUNT = 1 << 3, ENCAP = 1 << 4, + DECAP = 1 << 5, }; struct fm_tcam_match_entry *fmt; struct fm_action_op fm_op; @@ -1282,6 +1273,10 @@ enic_fm_copy_action(struct enic_flowman *fm, break; } case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: { + if (overlap & DECAP) + goto unsupported; + overlap |= DECAP; + ret = enic_fm_copy_vxlan_decap(fm, fmt, actions, error); if (ret != 0) -- 2.22.0