net/sfc: check mbufs allocated using mempool API for Rx
[dpdk.git] / lib / librte_pipeline / rte_table_action.h
index 53b9866..c7f751a 100644 (file)
@@ -61,6 +61,7 @@ extern "C" {
 #include <rte_compat.h>
 #include <rte_ether.h>
 #include <rte_meter.h>
+#include <rte_table_hash.h>
 
 #include "rte_pipeline.h"
 
@@ -69,6 +70,9 @@ enum rte_table_action_type {
        /** Forward to next pipeline table, output port or drop. */
        RTE_TABLE_ACTION_FWD = 0,
 
+       /**  Load balance. */
+       RTE_TABLE_ACTION_LB,
+
        /**  Traffic Metering and Policing. */
        RTE_TABLE_ACTION_MTR,
 
@@ -86,6 +90,9 @@ enum rte_table_action_type {
 
        /** Statistics. */
        RTE_TABLE_ACTION_STATS,
+
+       /** Timestamp. */
+       RTE_TABLE_ACTION_TIME,
 };
 
 /** Common action configuration (per table action profile). */
@@ -113,6 +120,54 @@ struct rte_table_action_fwd_params {
        uint32_t id;
 };
 
+/**
+ * RTE_TABLE_ACTION_LB
+ */
+/** Load balance key size min (number of bytes). */
+#define RTE_TABLE_ACTION_LB_KEY_SIZE_MIN                    8
+
+/** Load balance key size max (number of bytes). */
+#define RTE_TABLE_ACTION_LB_KEY_SIZE_MAX                    64
+
+/** Load balance table size. */
+#define RTE_TABLE_ACTION_LB_TABLE_SIZE                      8
+
+/** Load balance action configuration (per table action profile). */
+struct rte_table_action_lb_config {
+       /** Key size (number of bytes). */
+       uint32_t key_size;
+
+       /** Key offset within the input packet buffer. Offset 0 points to the
+        * first byte of the MBUF structure.
+        */
+       uint32_t key_offset;
+
+       /** Key mask (*key_size* bytes are valid). */
+       uint8_t key_mask[RTE_TABLE_ACTION_LB_KEY_SIZE_MAX];
+
+       /** Hash function. */
+       rte_table_hash_op_hash f_hash;
+
+       /** Seed value for *f_hash*. */
+       uint64_t seed;
+
+       /** Output value offset within the input packet buffer. Offset 0 points
+        * to the first byte of the MBUF structure.
+        */
+       uint32_t out_offset;
+};
+
+/** Load balance action parameters (per table rule). */
+struct rte_table_action_lb_params {
+       /** Table defining the output values and their weights. The weights are
+        * set in 1/RTE_TABLE_ACTION_LB_TABLE_SIZE increments. To assign a
+        * weight of N/RTE_TABLE_ACTION_LB_TABLE_SIZE to a given output value
+        * (0 <= N <= RTE_TABLE_ACTION_LB_TABLE_SIZE), the same output value
+        * needs to show up exactly N times in this table.
+        */
+       uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE];
+};
+
 /**
  * RTE_TABLE_ACTION_MTR
  */
@@ -541,6 +596,15 @@ struct rte_table_action_stats_counters {
        int n_bytes_valid;
 };
 
+/**
+ * RTE_TABLE_ACTION_TIME
+ */
+/** Timestamp action parameters (per table rule). */
+struct rte_table_action_time_params {
+       /** Initial timestamp value. Typically set to current time. */
+       uint64_t time;
+};
+
 /**
  * Table action profile.
  */
@@ -815,6 +879,25 @@ rte_table_action_stats_read(struct rte_table_action *action,
        struct rte_table_action_stats_counters *stats,
        int clear);
 
+/**
+ * Table action timestamp read.
+ *
+ * @param[in] action
+ *   Handle to table action object (needs to be valid).
+ * @param[in] data
+ *   Data byte array (typically table rule data) with timestamp action
+ *   previously applied on it.
+ * @param[inout] timestamp
+ *   Pre-allocated memory where the timestamp read from *data* is saved (has to
+ *   be non-NULL).
+ * @return
+ *   Zero on success, non-zero error code otherwise.
+ */
+int __rte_experimental
+rte_table_action_time_read(struct rte_table_action *action,
+       void *data,
+       uint64_t *timestamp);
+
 #ifdef __cplusplus
 }
 #endif