cnat: add flow hash config to cnat translation
[vpp.git] / src / plugins / cnat / cnat_translation.h
index 3b6e694..9bb3455 100644 (file)
  */
 extern vlib_combined_counter_main_t cnat_translation_counters;
 
-typedef enum cnat_trk_flag_t_
-{
-  CNAT_TRK_ACTIVE = (1 << 0),
-  CNAT_TRK_FLAG_NO_NAT = (1 << 1),
-} cnat_trk_flag_t;
 
 /**
  * Data used to track an EP in the FIB
@@ -65,12 +60,14 @@ typedef struct cnat_ep_trk_t_
 typedef enum cnat_translation_flag_t_
 {
   /* Do allocate a source port */
-  CNAT_TRANSLATION_FLAG_ALLOCATE_PORT = (1 << 0),
+  CNAT_TR_FLAG_ALLOCATE_PORT = (1 << 0),
   /* Has this translation been satcked ?
    * this allow not being called twice when
    * with more then FIB_PATH_LIST_POPULAR backends  */
-  CNAT_TRANSLATION_STACKED = (1 << 1),
-} cnat_translation_flag_t;
+  CNAT_TR_FLAG_STACKED = (1 << 1),
+  /* Do not create a return session */
+  CNAT_TR_FLAG_NO_RETURN_SESSION = (1 << 2),
+} __clib_packed cnat_translation_flag_t;
 
 typedef enum
 {
@@ -81,11 +78,11 @@ typedef enum
   CNAT_ADDR_N_RESOLUTIONS,
 } cnat_addr_resol_type_t;
 
-typedef enum __attribute__ ((__packed__))
+typedef enum
 {
   CNAT_LB_DEFAULT,
   CNAT_LB_MAGLEV,
-} cnat_lb_type_t;
+} __clib_packed cnat_lb_type_t;
 
 /**
  * Entry used to account for a translation's backend
@@ -165,13 +162,18 @@ typedef struct cnat_translation_t_
   /**
    * Translation flags
    */
-  u8 flags;
+  cnat_translation_flag_t flags;
 
   /**
    * Type of load balancing
    */
   cnat_lb_type_t lb_type;
 
+  /**
+   * Type of flow hash config
+   */
+  flow_hash_config_t fhc;
+
   union
   {
     u32 *lb_maglev;
@@ -194,7 +196,8 @@ extern u8 *format_cnat_translation (u8 * s, va_list * args);
 extern u32 cnat_translation_update (cnat_endpoint_t *vip,
                                    ip_protocol_t ip_proto,
                                    cnat_endpoint_tuple_t *backends, u8 flags,
-                                   cnat_lb_type_t lb_type);
+                                   cnat_lb_type_t lb_type,
+                                   flow_hash_config_t fhc);
 
 /**
  * Delete a translation