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 680BBA04B7;
	Wed, 14 Oct 2020 10:43:28 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 7889E1DCE8;
	Wed, 14 Oct 2020 10:43:11 +0200 (CEST)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id C00941DCE2
 for <dev@dpdk.org>; Wed, 14 Oct 2020 10:43:08 +0200 (CEST)
IronPort-SDR: 0EZhKCquKynMgnOv8R/qAQpn9duRjUtlynalFKpmySVA7cTwvAP7omgGdismhMPKyd0J+Rp7Jm
 rO/ZgXUY3KOQ==
X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="163432187"
X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="163432187"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 14 Oct 2020 01:43:08 -0700
IronPort-SDR: PZJg+ZJjtmqDac657M/FHmso/+YvtsUHtyGhayPDYZQe79lbnoz1FhHoT9tbLwitgxSwSI+qea
 MBc0tvWs/4ZQ==
X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="299864505"
Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136])
 by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 14 Oct 2020 01:43:05 -0700
From: SimonX Lu <simonx.lu@intel.com>
To: dev@dpdk.org
Cc: jia.guo@intel.com, haiyue.wang@intel.com, qiming.yang@intel.com,
 beilei.xing@intel.com, orika@nvidia.com, Simon Lu <simonx.lu@intel.com>
Date: Wed, 14 Oct 2020 08:41:24 +0000
Message-Id: <20201014084131.72035-2-simonx.lu@intel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20201014084131.72035-1-simonx.lu@intel.com>
References: <20201014084131.72035-1-simonx.lu@intel.com>
Subject: [dpdk-dev] [PATCH v1 1/8] ethdev: support the mirror action for flow
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>

From: Simon Lu <simonx.lu@intel.com>

Added the mirror type within rte_filter_type, and defined corresponding
action & item to support mirror in rte_flow.

Signed-off-by: Simon Lu <simonx.lu@intel.com>
---
 lib/librte_ethdev/rte_eth_ctrl.h | 1 +
 lib/librte_ethdev/rte_flow.c     | 1 +
 lib/librte_ethdev/rte_flow.h     | 7 +++++++
 3 files changed, 9 insertions(+)

diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
index 1416c371f..1418854e0 100644
--- a/lib/librte_ethdev/rte_eth_ctrl.h
+++ b/lib/librte_ethdev/rte_eth_ctrl.h
@@ -35,6 +35,7 @@ enum rte_filter_type {
 	RTE_ETH_FILTER_TUNNEL,
 	RTE_ETH_FILTER_FDIR,
 	RTE_ETH_FILTER_HASH,
+	RTE_ETH_FILTER_MIRROR,
 	RTE_ETH_FILTER_L2_TUNNEL,
 	RTE_ETH_FILTER_GENERIC,
 	RTE_ETH_FILTER_MAX
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 8d1b279bc..2718b9cfb 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -117,6 +117,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(DROP, 0),
 	MK_FLOW_ACTION(COUNT, sizeof(struct rte_flow_action_count)),
 	MK_FLOW_ACTION(RSS, sizeof(struct rte_flow_action_rss)),
+	MK_FLOW_ACTION(MIRROR, 0),
 	MK_FLOW_ACTION(PF, 0),
 	MK_FLOW_ACTION(VF, sizeof(struct rte_flow_action_vf)),
 	MK_FLOW_ACTION(PHY_PORT, sizeof(struct rte_flow_action_phy_port)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index da8bfa548..016578fa2 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1730,6 +1730,13 @@ enum rte_flow_action_type {
 	 */
 	RTE_FLOW_ACTION_TYPE_RSS,
 
+	/**
+	 * Mirror traffic to a given virtual function or physical function
+	 *
+	 * See struct rte_flow_action_mirror.
+	 */
+	RTE_FLOW_ACTION_TYPE_MIRROR,
+
 	/**
 	 * Directs matching traffic to the physical function (PF) of the
 	 * current device.
-- 
2.17.1