ethdev: new flex filter API
authorJingjing Wu <jingjing.wu@intel.com>
Sat, 21 Feb 2015 01:53:07 +0000 (01:53 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 22 Feb 2015 01:48:31 +0000 (02:48 +0100)
This patch defines flex filter type RTE_ETH_FILTER_FLEXIBLE and its structure rte_eth_flex_filter.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
lib/librte_ether/rte_eth_ctrl.h

index be93a5a..bda880e 100644 (file)
@@ -53,6 +53,7 @@ enum rte_filter_type {
        RTE_ETH_FILTER_NONE = 0,
        RTE_ETH_FILTER_MACVLAN,
        RTE_ETH_FILTER_ETHERTYPE,
+       RTE_ETH_FILTER_FLEXIBLE,
        RTE_ETH_FILTER_TUNNEL,
        RTE_ETH_FILTER_FDIR,
        RTE_ETH_FILTER_HASH,
@@ -116,6 +117,25 @@ struct rte_eth_ethertype_filter {
        uint16_t queue;               /**< Queue assigned to when match*/
 };
 
+#define RTE_FLEX_FILTER_MAXLEN 128     /**< bytes to use in flex filter. */
+#define RTE_FLEX_FILTER_MASK_SIZE      \
+       (RTE_ALIGN(RTE_FLEX_FILTER_MAXLEN, CHAR_BIT) / CHAR_BIT)
+                                       /**< mask bytes in flex filter. */
+
+/**
+ *  A structure used to define the flex filter entry
+ *  to support RTE_ETH_FILTER_FLEXIBLE with RTE_ETH_FILTER_ADD,
+ *  RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations.
+ */
+struct rte_eth_flex_filter {
+       uint16_t len;
+       uint8_t bytes[RTE_FLEX_FILTER_MAXLEN];  /**< flex bytes in big endian.*/
+       uint8_t mask[RTE_FLEX_FILTER_MASK_SIZE];    /**< if mask bit is 1b, do
+                                       not compare corresponding byte. */
+       uint8_t priority;
+       uint16_t queue;       /**< Queue assigned to when match. */
+};
+
 /**
  * Tunneled type.
  */