[dpdk-dev] [PATCH 01/10] ethdev: add a generic flow and new behavior switch to fdir

Rahul Lakkireddy rahul.lakkireddy at chelsio.com
Wed Feb 3 09:32:22 CET 2016


Add a new raw packet flow that allows specifying generic flow input.

Add the ability to provide masks for fields in flow to allow range of
values.

Add a new behavior switch.

Add the ability to provide behavior arguments to allow rewriting matched
fields with new values. Ex: allows to provide new ip and port addresses
to rewrite the fields of packets matching a filter rule before NAT'ing.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy at chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras at chelsio.com>
---
 doc/guides/rel_notes/release_2_3.rst |  3 +++
 lib/librte_ether/rte_eth_ctrl.h      | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst
index 99de186..19ce954 100644
--- a/doc/guides/rel_notes/release_2_3.rst
+++ b/doc/guides/rel_notes/release_2_3.rst
@@ -39,6 +39,9 @@ API Changes
 ABI Changes
 -----------
 
+* New flow type ``RTE_ETH_FLOW_RAW_PKT`` had been introduced and hence
+  ``RTE_ETH_FLOW_MAX`` had been increased to 19.
+
 
 Shared Library Versions
 -----------------------
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index ce224ad..1bc0d03 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -74,7 +74,8 @@ extern "C" {
 #define RTE_ETH_FLOW_IPV6_EX            15
 #define RTE_ETH_FLOW_IPV6_TCP_EX        16
 #define RTE_ETH_FLOW_IPV6_UDP_EX        17
-#define RTE_ETH_FLOW_MAX                18
+#define RTE_ETH_FLOW_RAW_PKT            18
+#define RTE_ETH_FLOW_MAX                19
 
 /**
  * Feature filter types
@@ -499,6 +500,9 @@ struct rte_eth_tunnel_flow {
 	struct ether_addr mac_addr;                /**< Mac address to match. */
 };
 
+/**< Max length of raw packet in bytes. */
+#define RTE_ETH_RAW_PKT_FLOW_MAX_LEN 256
+
 /**
  * An union contains the inputs for all types of flow
  */
@@ -514,6 +518,7 @@ union rte_eth_fdir_flow {
 	struct rte_eth_ipv6_flow   ipv6_flow;
 	struct rte_eth_mac_vlan_flow mac_vlan_flow;
 	struct rte_eth_tunnel_flow   tunnel_flow;
+	uint8_t raw_pkt_flow[RTE_ETH_RAW_PKT_FLOW_MAX_LEN];
 };
 
 /**
@@ -534,6 +539,8 @@ struct rte_eth_fdir_input {
 	uint16_t flow_type;
 	union rte_eth_fdir_flow flow;
 	/**< Flow fields to match, dependent on flow_type */
+	union rte_eth_fdir_flow flow_mask;
+	/**< Mask for the fields matched, dependent on flow */
 	struct rte_eth_fdir_flow_ext flow_ext;
 	/**< Additional fields to match */
 };
@@ -545,6 +552,7 @@ enum rte_eth_fdir_behavior {
 	RTE_ETH_FDIR_ACCEPT = 0,
 	RTE_ETH_FDIR_REJECT,
 	RTE_ETH_FDIR_PASSTHRU,
+	RTE_ETH_FDIR_SWITCH,
 };
 
 /**
@@ -558,6 +566,9 @@ enum rte_eth_fdir_status {
 	RTE_ETH_FDIR_REPORT_FLEX_8,        /**< Report 8 flex bytes. */
 };
 
+/**< Max # of behavior arguments */
+#define RTE_ETH_BEHAVIOR_ARG_MAX_LEN 256
+
 /**
  * A structure used to define an action when match FDIR packet filter.
  */
@@ -569,6 +580,8 @@ struct rte_eth_fdir_action {
 	/**< If report_status is RTE_ETH_FDIR_REPORT_ID_FLEX_4 or
 	     RTE_ETH_FDIR_REPORT_FLEX_8, flex_off specifies where the reported
 	     flex bytes start from in flexible payload. */
+	uint8_t behavior_arg[RTE_ETH_BEHAVIOR_ARG_MAX_LEN];
+	/**< Extra arguments for behavior taken */
 };
 
 /**
-- 
2.5.3



More information about the dev mailing list