summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo/load_balance.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-10-08 14:51:11 +0000
committerFlorin Coras <florin.coras@gmail.com>2018-10-16 01:39:50 +0000
commitac64b71b2893341b2e342865c209ee63c2dc3138 (patch)
tree30d38ed27ab74df23018b94fe5c479e8652a9c44 /src/vnet/dpo/load_balance.h
parenta23caded85ebc754b8e355d04cc747adfde5d467 (diff)
Sticky Load-balance
keep the number of buckets in the load-balanced fixed. If a path goes dwon fill its buckets with those from the next available up path. Change-Id: I15603ccb899fa9b77556b898c99136379cf32eae Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/dpo/load_balance.h')
-rw-r--r--src/vnet/dpo/load_balance.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/vnet/dpo/load_balance.h b/src/vnet/dpo/load_balance.h
index dd9589f9ee8..3f0d5ac2acb 100644
--- a/src/vnet/dpo/load_balance.h
+++ b/src/vnet/dpo/load_balance.h
@@ -77,6 +77,28 @@ typedef struct load_balance_path_t_ {
} load_balance_path_t;
/**
+ * Flags controlling load-balance creation and modification
+ */
+typedef enum load_balance_attr_t_ {
+ LOAD_BALANCE_ATTR_USES_MAP = 0,
+ LOAD_BALANCE_ATTR_STICKY = 1,
+} load_balance_attr_t;
+
+#define LOAD_BALANCE_ATTR_NAMES { \
+ [LOAD_BALANCE_ATTR_USES_MAP] = "uses-map", \
+ [LOAD_BALANCE_ATTR_STICKY] = "sticky", \
+}
+
+#define FOR_EACH_LOAD_BALANCE_ATTR(_attr) \
+ for (_attr = 0; _attr <= LOAD_BALANCE_ATTR_STICKY; _attr++)
+
+typedef enum load_balance_flags_t_ {
+ LOAD_BALANCE_FLAG_NONE = 0,
+ LOAD_BALANCE_FLAG_USES_MAP = (1 << 0),
+ LOAD_BALANCE_FLAG_STICKY = (1 << 1),
+} __attribute__((packed)) load_balance_flags_t;
+
+/**
* The FIB DPO provieds;
* - load-balancing over the next DPOs in the chain/graph
* - per-route counters
@@ -106,6 +128,11 @@ typedef struct load_balance_t_ {
dpo_proto_t lb_proto;
/**
+ * Flags concenring the LB's creation and modification
+ */
+ load_balance_flags_t lb_flags;
+
+ /**
* Flags from the load-balance's associated fib_entry_t
*/
fib_entry_flag_t lb_fib_entry_flags;
@@ -158,14 +185,6 @@ typedef enum load_balance_format_flags_t_ {
LOAD_BALANCE_FORMAT_DETAIL = (1 << 0),
} load_balance_format_flags_t;
-/**
- * Flags controlling load-balance creation and modification
- */
-typedef enum load_balance_flags_t_ {
- LOAD_BALANCE_FLAG_NONE = 0,
- LOAD_BALANCE_FLAG_USES_MAP = (1 << 0),
-} load_balance_flags_t;
-
extern index_t load_balance_create(u32 num_buckets,
dpo_proto_t lb_proto,
flow_hash_config_t fhc);