aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cnat/cnat_translation.h
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-02-25 11:14:53 +0100
committerFlorin Coras <florin.coras@gmail.com>2021-02-26 01:55:07 +0000
commit4d237874e5c9922330c62ac1b003a9a171c1bc3b (patch)
tree3ce74a3e85659124653e8406635bec29e156b9f2 /src/plugins/cnat/cnat_translation.h
parent27647a27c7b1e800547e3a3ea97b099b25618177 (diff)
cnat: Add maglev support
* Backend choice in translations is controlled by lb_type switch allowing to enable Maglev. * Size of pool is set with cnat { maglev-len 1009 } Type: feature Change-Id: I956e19d70bc9f3b997b4f8042831164e4b559d17 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/cnat/cnat_translation.h')
-rw-r--r--src/plugins/cnat/cnat_translation.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/plugins/cnat/cnat_translation.h b/src/plugins/cnat/cnat_translation.h
index 8bec7396050..af0b94867af 100644
--- a/src/plugins/cnat/cnat_translation.h
+++ b/src/plugins/cnat/cnat_translation.h
@@ -28,6 +28,7 @@ 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;
/**
@@ -80,6 +81,12 @@ typedef enum
CNAT_ADDR_N_RESOLUTIONS,
} cnat_addr_resol_type_t;
+typedef enum __attribute__ ((__packed__))
+{
+ CNAT_LB_DEFAULT,
+ CNAT_LB_MAGLEV,
+} cnat_lb_type_t;
+
/**
* Entry used to account for a translation's backend
* waiting for address resolution
@@ -159,6 +166,16 @@ typedef struct cnat_translation_t_
* Translation flags
*/
u8 flags;
+
+ /**
+ * Type of load balancing
+ */
+ cnat_lb_type_t lb_type;
+
+ union
+ {
+ u32 *lb_maglev;
+ };
} cnat_translation_t;
extern cnat_translation_t *cnat_translation_pool;
@@ -174,10 +191,10 @@ extern u8 *format_cnat_translation (u8 * s, va_list * args);
*
* @return the ID of the translation. used to delete and gather stats
*/
-extern u32 cnat_translation_update (cnat_endpoint_t * vip,
+extern u32 cnat_translation_update (cnat_endpoint_t *vip,
ip_protocol_t ip_proto,
- cnat_endpoint_tuple_t *
- backends, u8 flags);
+ cnat_endpoint_tuple_t *backends, u8 flags,
+ cnat_lb_type_t lb_type);
/**
* Delete a translation