diff mbox series

[v1,1/8] ethdev: support the mirror action for flow

Message ID 20201014084131.72035-2-simonx.lu@intel.com (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers show
Series use generic flow command to re-realize mirror rule | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

SimonX Lu Oct. 14, 2020, 8:41 a.m. UTC
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(+)

Comments

Ori Kam Oct. 14, 2020, 12:07 p.m. UTC | #1
Hi Simon,
BSP,

> -----Original Message-----
> From: SimonX Lu <simonx.lu@intel.com>
> Sent: Wednesday, October 14, 2020 11:41 AM
> To: dev@dpdk.org
> Cc: jia.guo@intel.com; haiyue.wang@intel.com; qiming.yang@intel.com;
> beilei.xing@intel.com; Ori Kam <orika@nvidia.com>; Simon Lu
> <simonx.lu@intel.com>
> Subject: [PATCH v1 1/8] ethdev: support the mirror action for flow
> 
> 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(+)
>

Why did you create new action?
There was a new action "sampling" submitted in this release.
When set to 1 it means mirror since all packets will get duplicated
Please review https://patches.dpdk.org/cover/78893/
Thanks,
Ori
diff mbox series

Patch

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.