|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
27 #define AFFINITY_HASH_BUCKETS 65536
28 #define AFFINITY_HASH_MEMORY (2 << 25)
39 s =
format (s,
"client %U backend %U:%d proto %U index %llu",
87 key->client_addr = client_addr;
88 key->service_addr = service_addr;
90 key->service_port = service_port;
125 affinity_per_service_list_head_index)) !=
130 kv.
key[0] =
a->key.as_u64[0];
131 kv.
key[1] =
a->key.as_u64[1];
145 u16 service_port,
u8 *backend_index)
177 *backend_index =
a->backend_index;
211 u16 service_port,
u8 backend_index,
213 u32 affinity_per_service_list_head_index)
234 clib_bihash_add_or_overwrite_stale_16_8 (&nam->
affinity_hash, &kv,
246 a->per_service_index = list_elt - nam->
list_pool;
247 a->backend_index = backend_index;
249 a->sticky_time = sticky_time;
250 a->key.as_u64[0] = kv.
key[0];
251 a->key.as_u64[1] = kv.
key[1];
253 a->per_service_index);
static void clib_spinlock_init(clib_spinlock_t *p)
static u32 clib_dlist_remove_head(dlist_elt_t *pool, u32 head_index)
static void clib_dlist_init(dlist_elt_t *pool, u32 index)
u8 * format_affinity_kvp(u8 *s, va_list *args)
u32 nat_affinity_get_per_service_list_head_index(void)
Get new affinity per service list head index.
#define nat_elog_notice(_pm, nat_elog_str)
#define nat_elog_warn(_pm, nat_elog_str)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
clib_bihash_16_8_t affinity_hash
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
NAT port/address allocation lib.
#define pool_put_index(p, i)
Free pool element with given index.
nat_affinity_t * affinity_pool
#define static_always_inline
static void clib_dlist_remove(dlist_elt_t *pool, u32 index)
static void clib_spinlock_free(clib_spinlock_t *p)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
int nat_affinity_create_and_lock(ip4_address_t client_addr, ip4_address_t service_addr, u8 proto, u16 service_port, u8 backend_index, u32 sticky_time, u32 affinity_per_service_list_head_index)
Create affinity record and take reference counting lock.
static int affinity_is_expired_cb(clib_bihash_kv_16_8_t *kv, void *arg)
#define AFFINITY_HASH_MEMORY
clib_spinlock_t affinity_lock
ip4_address_t client_addr
NAT plugin client-IP based session affinity for load-balancing.
clib_error_t * nat_affinity_init(vlib_main_t *vm)
Initialize NAT client-IP based affinity.
format_function_t format_nat_protocol
#define AFFINITY_HASH_BUCKETS
description fragment has unexpected format
static_always_inline void make_affinity_kv(clib_bihash_kv_16_8_t *kv, ip4_address_t client_addr, ip4_address_t service_addr, u8 proto, u16 service_port)
void nat_affinity_disable()
NAT affinity disable.
static void clib_dlist_addtail(dlist_elt_t *pool, u32 head_index, u32 new_index)
ip4_address_t service_addr
void nat_affinity_flush_service(u32 affinity_per_service_list_head_index)
Flush all service affinity data.
static f64 vlib_time_now(vlib_main_t *vm)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
static vlib_thread_main_t * vlib_get_thread_main()
void nat_affinity_unlock(ip4_address_t client_addr, ip4_address_t service_addr, u8 proto, u16 service_port)
Release a reference counting lock for affinity.
nat_affinity_main_t nat_affinity_main
void nat_affinity_enable()
NAT affinity enable.
int nat_affinity_find_and_lock(vlib_main_t *vm, ip4_address_t client_addr, ip4_address_t service_addr, u8 proto, u16 service_port, u8 *backend_index)
Find service backend index for client-IP and take a reference counting lock.