[dpdk-dev] [PATCH v5 2/5] ethdev: add enum type and relevant structures for hash filter control

Helin Zhang helin.zhang at intel.com
Tue Oct 21 05:14:46 CEST 2014


enum type and relevant structures are added in rte_eth_ctrl.h to
support hash filter control.

Signed-off-by: Helin Zhang <helin.zhang at intel.com>
---
 lib/librte_ether/rte_eth_ctrl.h | 75 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

v5 changes:
* Integrated with filter API defined recently.

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index df21ac6..c469b57 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -51,6 +51,7 @@ extern "C" {
  */
 enum rte_filter_type {
 	RTE_ETH_FILTER_NONE = 0,
+	RTE_ETH_FILTER_HASH,
 	RTE_ETH_FILTER_MAX
 };
 
@@ -71,6 +72,80 @@ enum rte_filter_op {
 	RTE_ETH_FILTER_OP_MAX
 };
 
+/**
+ * Hash filter information types.
+ */
+enum rte_eth_hash_filter_info_type {
+	RTE_ETH_HASH_FILTER_INFO_TYPE_UNKNOWN = 0,
+	RTE_ETH_HASH_FILTER_INFO_TYPE_SYM_HASH_ENA_PER_PCTYPE,
+	RTE_ETH_HASH_FILTER_INFO_TYPE_SYM_HASH_ENA_PER_PORT,
+	RTE_ETH_HASH_FILTER_INFO_TYPE_FILTER_SWAP,
+	RTE_ETH_HASH_FILTER_INFO_TYPE_HASH_FUNCTION,
+	RTE_ETH_HASH_FILTER_INFO_TYPE_MAX,
+};
+
+/**
+ * Hash function types.
+ */
+enum rte_eth_hash_function {
+	RTE_ETH_HASH_FUNCTION_UNKNOWN = 0,
+	RTE_ETH_HASH_FUNCTION_TOEPLITZ,
+	RTE_ETH_HASH_FUNCTION_SIMPLE_XOR,
+	RTE_ETH_HASH_FUNCTION_MAX,
+};
+
+/**
+ * A structure used to set or get symmetric hash enable information, to support
+ * 'RTE_ETH_FILTER_HASH', 'RTE_ETH_FILTER_GET/RTE_ETH_FILTER_SET', with
+ * information type 'RTE_ETH_HASH_FILTER_INFO_TYPE_SYM_HASH_ENA_PER_PCTYPE'.
+ */
+struct rte_eth_sym_hash_ena_info {
+	/**< packet classification type, defined in rte_ethdev.h */
+	uint8_t pctype;
+	uint8_t enable; /**< enable or disable flag */
+};
+
+/**
+ * A structure used to set or get filter swap information, to support
+ * 'RTE_ETH_FILTER_HASH', 'RTE_ETH_FILTER_GET/RTE_ETH_FILTER_SET',
+ * with information type 'RTE_ETH_HASH_FILTER_INFO_TYPE_FILTER_SWAP'.
+ */
+struct rte_eth_filter_swap_info {
+	/**< Packet classification type, defined in rte_ethdev.h */
+	uint8_t pctype;
+	/**< Offset of the 1st field of the 1st couple to be swapped. */
+	uint8_t off0_src0;
+	/**< Offset of the 2nd field of the 1st couple to be swapped. */
+	uint8_t off0_src1;
+	/**< Field length of the first couple. */
+	uint8_t len0;
+	/**< Offset of the 1st field of the 2nd couple to be swapped. */
+	uint8_t off1_src0;
+	/**< Offset of the 2nd field of the 2nd couple to be swapped. */
+	uint8_t off1_src1;
+	/**< Field length of the second couple. */
+	uint8_t len1;
+};
+
+/**
+ * A structure used to set or get hash filter information, to support filter
+ * type of 'RTE_ETH_FILTER_HASH' and its operations.
+ */
+struct rte_eth_hash_filter_info {
+	enum rte_eth_hash_filter_info_type info_type; /**< Information type. */
+	/**< Details of hash filter infomation */
+	union {
+		/* For RTE_ETH_HASH_FILTER_INFO_TYPE_SYM_HASH_ENA_PER_PCTYPE */
+		struct rte_eth_sym_hash_ena_info sym_hash_ena;
+		/* For RTE_ETH_HASH_FILTER_INFO_TYPE_FILTER_SWAP */
+		struct rte_eth_filter_swap_info filter_swap;
+		/* For RTE_ETH_HASH_FILTER_INFO_TYPE_SYM_HASH_ENA_PER_PORT */
+		uint8_t enable;
+		/* For RTE_ETH_HASH_FILTER_INFO_TYPE_HASH_FUNCTION */
+		enum rte_eth_hash_function hash_function;
+	} info;
+};
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.1.4



More information about the dev mailing list