raw/ifpga: add APIs to get FPGA information
[dpdk.git] / lib / librte_fib / rte_fib.h
index 096cc92..acad209 100644 (file)
@@ -8,13 +8,27 @@
 
 /**
  * @file
+ *
+ * RTE FIB library.
+ *
+ * @warning
+ * @b EXPERIMENTAL:
+ * All functions in this file may be changed or removed without prior notice.
+ *
  * FIB (Forwarding information base) implementation
  * for IPv4 Longest Prefix Match
  */
 
+#include <stdint.h>
+
 #include <rte_compat.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct rte_fib;
+struct rte_rib;
 
 /** Maximum depth value possible for IPv4 FIB. */
 #define RTE_FIB_MAXDEPTH       32
@@ -22,7 +36,7 @@ struct rte_fib;
 /** Type of FIB struct */
 enum rte_fib_type {
        RTE_FIB_DUMMY,          /**< RIB tree based FIB */
-       RTE_FIB_TYPE_MAX
+       RTE_FIB_DIR24_8         /**< DIR24_8 based FIB */
 };
 
 /** Modify FIB function */
@@ -37,12 +51,45 @@ enum rte_fib_op {
        RTE_FIB_DEL,
 };
 
+/** Size of nexthop (1 << nh_sz) bits for DIR24_8 based FIB */
+enum rte_fib_dir24_8_nh_sz {
+       RTE_FIB_DIR24_8_1B,
+       RTE_FIB_DIR24_8_2B,
+       RTE_FIB_DIR24_8_4B,
+       RTE_FIB_DIR24_8_8B
+};
+
+/** Type of lookup function implementation */
+enum rte_fib_lookup_type {
+       RTE_FIB_LOOKUP_DEFAULT,
+       /**< Selects the best implementation based on the max simd bitwidth */
+       RTE_FIB_LOOKUP_DIR24_8_SCALAR_MACRO,
+       /**< Macro based lookup function */
+       RTE_FIB_LOOKUP_DIR24_8_SCALAR_INLINE,
+       /**<
+        * Lookup implementation using inlined functions
+        * for different next hop sizes
+        */
+       RTE_FIB_LOOKUP_DIR24_8_SCALAR_UNI,
+       /**<
+        * Unified lookup function for all next hop sizes
+        */
+       RTE_FIB_LOOKUP_DIR24_8_VECTOR_AVX512
+       /**< Vector implementation using AVX512 */
+};
+
 /** FIB configuration structure */
 struct rte_fib_conf {
        enum rte_fib_type type; /**< Type of FIB struct */
        /** Default value returned on lookup if there is no route */
        uint64_t default_nh;
        int     max_routes;
+       union {
+               struct {
+                       enum rte_fib_dir24_8_nh_sz nh_sz;
+                       uint32_t        num_tbl8;
+               } dir24_8;
+       };
 };
 
 /**
@@ -143,7 +190,6 @@ __rte_experimental
 int
 rte_fib_lookup_bulk(struct rte_fib *fib, uint32_t *ips,
                uint64_t *next_hops, int n);
-
 /**
  * Get pointer to the dataplane specific struct
  *
@@ -170,4 +216,24 @@ __rte_experimental
 struct rte_rib *
 rte_fib_get_rib(struct rte_fib *fib);
 
+/**
+ * Set lookup function based on type
+ *
+ * @param fib
+ *   FIB object handle
+ * @param type
+ *   type of lookup function
+ *
+ * @return
+ *   0 on success
+ *   -EINVAL on failure
+ */
+__rte_experimental
+int
+rte_fib_select_lookup(struct rte_fib *fib, enum rte_fib_lookup_type type);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_FIB_H_ */