aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/lb.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/lb/lb.h')
-rw-r--r--src/plugins/lb/lb.h38
1 files changed, 33 insertions, 5 deletions
diff --git a/src/plugins/lb/lb.h b/src/plugins/lb/lb.h
index fa0b5d48b07..8db0394075c 100644
--- a/src/plugins/lb/lb.h
+++ b/src/plugins/lb/lb.h
@@ -37,6 +37,7 @@
#include <vnet/ip/ip.h>
#include <vnet/dpo/dpo.h>
#include <vnet/fib/fib_table.h>
+#include <vppinfra/hash.h>
#include <lb/lbhash.h>
@@ -128,18 +129,27 @@ typedef enum {
LB_N_VIP_COUNTERS
} lb_vip_counter_t;
+typedef enum {
+ LB_ENCAP_TYPE_GRE4,
+ LB_ENCAP_TYPE_GRE6,
+ LB_ENCAP_TYPE_L3DSR,
+ LB_ENCAP_N_TYPES,
+} lb_encap_type_t;
+
/**
* The load balancer supports IPv4 and IPv6 traffic
- * and GRE4 and GRE6 encap.
+ * and GRE4, GRE6 and L3DSR encap.
*/
typedef enum {
LB_VIP_TYPE_IP6_GRE6,
LB_VIP_TYPE_IP6_GRE4,
LB_VIP_TYPE_IP4_GRE6,
LB_VIP_TYPE_IP4_GRE4,
+ LB_VIP_TYPE_IP4_L3DSR,
LB_VIP_N_TYPES,
} lb_vip_type_t;
+
format_function_t format_lb_vip_type;
unformat_function_t unformat_lb_vip_type;
@@ -196,6 +206,11 @@ typedef struct {
lb_vip_type_t type;
/**
+ * DSCP bits for L3DSR
+ */
+ u8 dscp;
+
+ /**
* Flags related to this VIP.
* LB_VIP_FLAGS_USED means the VIP is active.
* When it is not set, the VIP in the process of being removed.
@@ -212,8 +227,20 @@ typedef struct {
u32 *as_indexes;
} lb_vip_t;
-#define lb_vip_is_ip4(vip) ((vip)->type == LB_VIP_TYPE_IP4_GRE6 || (vip)->type == LB_VIP_TYPE_IP4_GRE4)
-#define lb_vip_is_gre4(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE4 || (vip)->type == LB_VIP_TYPE_IP4_GRE4)
+#define lb_vip_is_ip4(vip) ((vip)->type == LB_VIP_TYPE_IP4_GRE6 \
+ || (vip)->type == LB_VIP_TYPE_IP4_GRE4 \
+ || (vip)->type == LB_VIP_TYPE_IP4_L3DSR )
+
+#define lb_vip_is_gre4(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE4 \
+ || (vip)->type == LB_VIP_TYPE_IP4_GRE4)
+#define lb_vip_is_gre6(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE6 \
+ || (vip)->type == LB_VIP_TYPE_IP4_GRE6)
+#define lb_vip_is_l3dsr(vip) ((vip)->type == LB_VIP_TYPE_IP4_L3DSR)
+
+#define lb_encap_is_ip4(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE4 \
+ || (vip)->type == LB_VIP_TYPE_IP4_GRE4 \
+ || (vip)->type == LB_VIP_TYPE_IP4_L3DSR)
+
format_function_t format_lb_vip;
format_function_t format_lb_vip_detailed;
@@ -286,6 +313,7 @@ typedef struct {
*/
dpo_type_t dpo_gre4_type;
dpo_type_t dpo_gre6_type;
+ dpo_type_t dpo_l3dsr_type;
/**
* Node type for registering to fib changes.
@@ -313,8 +341,8 @@ extern vlib_node_registration_t lb4_node;
int lb_conf(ip4_address_t *ip4_address, ip6_address_t *ip6_address,
u32 sticky_buckets, u32 flow_timeout);
-int lb_vip_add(ip46_address_t *prefix, u8 plen, lb_vip_type_t type,
- u32 new_length, u32 *vip_index);
+int lb_vip_add(ip46_address_t *prefix, u8 plen, lb_vip_type_t type, u8 dscp,
+ u32 new_length, u32 *vip_index);
int lb_vip_del(u32 vip_index);
int lb_vip_find_index(ip46_address_t *prefix, u8 plen, u32 *vip_index);