From patchwork Wed Sep 9 14:00:06 2020 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: 77061 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16783A04B5; Wed, 9 Sep 2020 16:02:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B77211C129; Wed, 9 Sep 2020 16:02:19 +0200 (CEST) Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) by dpdk.org (Postfix) with ESMTP id 09AE11C0B4 for ; Wed, 9 Sep 2020 16:02:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2735; q=dns/txt; s=iport; t=1599660138; x=1600869738; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LcYQNBXTpbyB3MfDOLX1u/O2CctBedHB1Q7LVlYLlwQ=; b=fvO1g/FS1oQy/VG1Jaja3PbUMr2J7h2LYsTo2KyIxLKtNAlMz3iQ7VLa BJDA8FpzUsK64g/nn1Xohjv1QQ8gP2g15wVYGsGASg/SluHGzHflLrj/Q d3jjY+Lk/PHc4E8b3RSb11BJAuqlf0Cj87S4O2o8QPuJyPhGhPyFo2R3O Y=; X-IronPort-AV: E=Sophos;i="5.76,409,1592870400"; d="scan'208";a="530078413" Received: from alln-core-6.cisco.com ([173.36.13.139]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 09 Sep 2020 14:02:17 +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 089E2H1q013188; Wed, 9 Sep 2020 14:02:17 GMT Received: by cisco.com (Postfix, from userid 508933) id 0FB2A20F2005; Wed, 9 Sep 2020 07:02:17 -0700 (PDT) From: Hyong Youb Kim To: Ferruh Yigit Cc: dev@dpdk.org, Hyong Youb Kim , John Daley Date: Wed, 9 Sep 2020 07:00:06 -0700 Message-Id: <20200909140006.23788-7-hyonkim@cisco.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200909140006.23788-1-hyonkim@cisco.com> References: <20200909140006.23788-1-hyonkim@cisco.com> MIME-Version: 1.0 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 6/6] net/enic: support VXLAN decap action combined with VLAN pop 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" Flow Manager (flowman) provides DECAP_STRIP operation which decapsulates VXLAN header and then removes VLAN header from the inner packet. Use this operation to support vxlan_decap followed by of_pop_vlan. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- doc/guides/rel_notes/release_20_11.rst | 1 + drivers/net/enic/enic_fm_flow.c | 30 +++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index 6a7e7d666..4767348d3 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -140,3 +140,4 @@ Tested Platforms * Added support for VF representors with single-queue Tx/Rx and flow API * Added support for egress PORT_ID action * Added support for non-zero priorities for group 0 flows + * Added support for VXLAN decap combined with VLAN pop diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c index 7eec8e6eb..ef4705d47 100644 --- a/drivers/net/enic/enic_fm_flow.c +++ b/drivers/net/enic/enic_fm_flow.c @@ -923,6 +923,20 @@ enic_fm_append_action_op(struct enic_flowman *fm, return 0; } +static struct fm_action_op * +find_prev_action_op(struct enic_flowman *fm, uint32_t opcode) +{ + struct fm_action_op *op; + int i; + + for (i = 0; i < fm->action_op_count; i++) { + op = &fm->action.fma_action_ops[i]; + if (op->fa_op == opcode) + return op; + } + return NULL; +} + /* NIC requires that 1st steer appear before decap. * Correct example: steer, decap, steer, steer, ... */ @@ -938,7 +952,8 @@ enic_fm_reorder_action_op(struct enic_flowman *fm) steer = NULL; decap = NULL; while (op->fa_op != FMOP_END) { - if (!decap && op->fa_op == FMOP_DECAP_NOSTRIP) + if (!decap && (op->fa_op == FMOP_DECAP_NOSTRIP || + op->fa_op == FMOP_DECAP_STRIP)) decap = op; else if (!steer && op->fa_op == FMOP_RQ_STEER) steer = op; @@ -1471,6 +1486,19 @@ enic_fm_copy_action(struct enic_flowman *fm, break; } case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN: { + struct fm_action_op *decap; + + /* + * If decap-nostrip appears before pop vlan, this pop + * applies to the inner packet vlan. Turn it into + * decap-strip. + */ + decap = find_prev_action_op(fm, FMOP_DECAP_NOSTRIP); + if (decap) { + ENICPMD_LOG(DEBUG, "pop-vlan inner: decap-nostrip => decap-strip"); + decap->fa_op = FMOP_DECAP_STRIP; + break; + } memset(&fm_op, 0, sizeof(fm_op)); fm_op.fa_op = FMOP_POP_VLAN; ret = enic_fm_append_action_op(fm, &fm_op, error);