FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
kp.h File Reference
+ Include dependency graph for kp.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  kp_pod_t
 Each VIP is configured with a set of PODs. More...
 
struct  kp_new_flow_entry_t
 
struct  kp_vip_t
 Load balancing service is provided per VIP. More...
 
struct  kp_nodeport_t
 
struct  kp_snat4_key_t
 
struct  kp_snat6_key_t
 
struct  kp_snat_mapping_t
 
struct  kp_per_cpu_t
 
struct  kp_main_t
 

Macros

#define KP_DEFAULT_PER_CPU_STICKY_BUCKETS   1 << 10
 kp-plugin implements a MagLev-like load balancer. More...
 
#define KP_DEFAULT_FLOW_TIMEOUT   40
 
#define KP_MAPPING_BUCKETS   1024
 
#define KP_MAPPING_MEMORY_SIZE   64<<20
 
#define foreach_kp_nat_in2out_error
 
#define KP_POD_FLAGS_USED   0x1
 
#define kp_foreach_vip_counter
 
#define KP_VIP_FLAGS_USED   0x1
 
#define kp_vip_is_ip4(vip)
 
#define kp_vip_is_nat4(vip)
 
#define foreach_kp_nat_protocol
 
#define ip46_address_type(ip46)   (ip46_address_is_ip4(ip46)?IP46_TYPE_IP4:IP46_TYPE_IP6)
 
#define ip46_prefix_is_ip4(ip46, len)   ((len) >= 96 && ip46_address_is_ip4(ip46))
 
#define ip46_prefix_type(ip46, len)   (ip46_prefix_is_ip4(ip46, len)?IP46_TYPE_IP4:IP46_TYPE_IP6)
 
#define kp_vip_get_by_index(index)   (pool_is_free_index(kp_main.vips, index)?NULL:pool_elt_at_index(kp_main.vips, index))
 

Enumerations

enum  kp_next_t { KP_NEXT_DROP, KP_N_NEXT }
 
enum  kp_nat4_in2out_next_t { KP_NAT4_IN2OUT_NEXT_DROP, KP_NAT4_IN2OUT_NEXT_LOOKUP, KP_NAT4_IN2OUT_N_NEXT }
 
enum  kp_nat_in2out_error_t { KP_NAT_IN2OUT_N_ERROR }
 
enum  kp_svr_type_t { KP_SVR_TYPE_VIP_PORT, KP_SVR_TYPE_NODEIP_PORT, KP_SVR_TYPE_EXT_LB, KP_SVR_N_TYPES }
 kube-proxy supports three types of service More...
 
enum  kp_nodeport_next_t {
  KP_NODEPORT_NEXT_IP4_NAT4, KP_NODEPORT_NEXT_IP4_NAT6, KP_NODEPORT_NEXT_IP6_NAT4, KP_NODEPORT_NEXT_IP6_NAT6,
  KP_NODEPORT_NEXT_DROP, KP_NODEPORT_N_NEXT
}
 
enum  kp_vip_counter_t { KP_N_VIP_COUNTERS }
 
enum  kp_vip_type_t {
  KP_VIP_TYPE_IP4_NAT44, KP_VIP_TYPE_IP4_NAT46, KP_VIP_TYPE_IP6_NAT64, KP_VIP_TYPE_IP6_NAT66,
  KP_VIP_N_TYPES
}
 kube-proxy supports IPv4 and IPv6 traffic and NAT4 and NAT6. More...
 
enum  kp_nat_protocol_t { foreach_kp_nat_protocol }
 

Functions

static u32 kp_ip_proto_to_nat_proto (u8 ip_proto)
 
void ip46_prefix_normalize (ip46_address_t *prefix, u8 plen)
 
uword unformat_ip46_prefix (unformat_input_t *input, va_list *args)
 
u8format_ip46_prefix (u8 *s, va_list *args)
 
int kp_conf (u32 sticky_buckets, u32 flow_timeout)
 Fix global kube-proxy parameters. More...
 
int kp_vip_add (ip46_address_t *prefix, u8 plen, kp_vip_type_t type, u32 new_length, u32 *vip_index, u16 port, u16 target_port, u16 node_port)
 
int kp_vip_del (u32 vip_index)
 
int kp_vip_find_index (ip46_address_t *prefix, u8 plen, u32 *vip_index)
 
int kp_vip_add_pods (u32 vip_index, ip46_address_t *addresses, u32 n)
 
int kp_vip_del_pods (u32 vip_index, ip46_address_t *addresses, u32 n)
 
u32 kp_hash_time_now (vlib_main_t *vm)
 
void kp_garbage_collection ()
 
int kp_nat4_interface_add_del (u32 sw_if_index, int is_del)
 

Variables

format_function_t format_kp_pod
 
format_function_t format_kp_vip_type
 
unformat_function_t unformat_kp_vip_type
 
format_function_t format_kp_vip
 
format_function_t format_kp_vip_detailed
 
kp_main_t kp_main
 
vlib_node_registration_t kp4_node
 
vlib_node_registration_t kp6_node
 
vlib_node_registration_t kp4_nodeport_node
 (constructor) VLIB_REGISTER_NODE (kp4_nodeport_node) More...
 
vlib_node_registration_t kp6_nodeport_node
 (constructor) VLIB_REGISTER_NODE (kp6_nodeport_node) More...
 
vlib_node_registration_t kp_nat4_in2out_node
 (constructor) VLIB_REGISTER_NODE (kp_nat4_in2out_node) More...
 
format_function_t format_kp_main
 

Macro Definition Documentation

#define foreach_kp_nat_in2out_error
Value:
_(UNSUPPORTED_PROTOCOL, "Unsupported protocol") \
_(IN2OUT_PACKETS, "Good in2out packets processed") \
_(NO_TRANSLATION, "No translation")

Definition at line 58 of file kp.h.

#define foreach_kp_nat_protocol
Value:
_(UDP, 0, udp, "udp") \
_(TCP, 1, tcp, "tcp")

Definition at line 284 of file kp.h.

#define ip46_address_type (   ip46)    (ip46_address_is_ip4(ip46)?IP46_TYPE_IP4:IP46_TYPE_IP6)

Definition at line 431 of file kp.h.

#define ip46_prefix_is_ip4 (   ip46,
  len 
)    ((len) >= 96 && ip46_address_is_ip4(ip46))

Definition at line 432 of file kp.h.

#define ip46_prefix_type (   ip46,
  len 
)    (ip46_prefix_is_ip4(ip46, len)?IP46_TYPE_IP4:IP46_TYPE_IP6)

Definition at line 433 of file kp.h.

#define KP_DEFAULT_FLOW_TIMEOUT   40

Definition at line 43 of file kp.h.

#define KP_DEFAULT_PER_CPU_STICKY_BUCKETS   1 << 10

kp-plugin implements a MagLev-like load balancer.

http://research.google.com/pubs/pub44824.html

It hasn't been tested for interoperability with the original MagLev but intends to provide similar functionality. The kube-proxy receives traffic destined to VIP (Virtual IP) addresses from one or multiple(ECMP) routers. The kube-proxy tunnels the traffic toward many application servers ensuring session stickyness (i.e. that a single sessions is tunneled towards a single application server).

Definition at line 42 of file kp.h.

#define kp_foreach_vip_counter
Value:
_(NEXT_PACKET, "packet from existing sessions", 0) \
_(FIRST_PACKET, "first session packet", 1) \
_(UNTRACKED_PACKET, "untracked packet", 2) \
_(NO_SERVER, "no server configured", 3)

Definition at line 154 of file kp.h.

#define KP_MAPPING_BUCKETS   1024

Definition at line 44 of file kp.h.

#define KP_MAPPING_MEMORY_SIZE   64<<20

Definition at line 45 of file kp.h.

#define KP_POD_FLAGS_USED   0x1

Definition at line 118 of file kp.h.

#define KP_VIP_FLAGS_USED   0x1

Definition at line 258 of file kp.h.

#define kp_vip_get_by_index (   index)    (pool_is_free_index(kp_main.vips, index)?NULL:pool_elt_at_index(kp_main.vips, index))

Definition at line 460 of file kp.h.

#define kp_vip_is_ip4 (   vip)
Value:

Definition at line 277 of file kp.h.

#define kp_vip_is_nat4 (   vip)
Value:

Definition at line 279 of file kp.h.

Enumeration Type Documentation

Enumerator
KP_NAT4_IN2OUT_NEXT_DROP 
KP_NAT4_IN2OUT_NEXT_LOOKUP 
KP_NAT4_IN2OUT_N_NEXT 

Definition at line 52 of file kp.h.

Enumerator
KP_NAT_IN2OUT_N_ERROR 

Definition at line 63 of file kp.h.

Enumerator
foreach_kp_nat_protocol 

Definition at line 288 of file kp.h.

enum kp_next_t
Enumerator
KP_NEXT_DROP 
KP_N_NEXT 

Definition at line 47 of file kp.h.

Enumerator
KP_NODEPORT_NEXT_IP4_NAT4 
KP_NODEPORT_NEXT_IP4_NAT6 
KP_NODEPORT_NEXT_IP6_NAT4 
KP_NODEPORT_NEXT_IP6_NAT6 
KP_NODEPORT_NEXT_DROP 
KP_NODEPORT_N_NEXT 

Definition at line 80 of file kp.h.

kube-proxy supports three types of service

Enumerator
KP_SVR_TYPE_VIP_PORT 
KP_SVR_TYPE_NODEIP_PORT 
KP_SVR_TYPE_EXT_LB 
KP_SVR_N_TYPES 

Definition at line 73 of file kp.h.

Enumerator
KP_N_VIP_COUNTERS 

Definition at line 160 of file kp.h.

kube-proxy supports IPv4 and IPv6 traffic and NAT4 and NAT6.

Enumerator
KP_VIP_TYPE_IP4_NAT44 
KP_VIP_TYPE_IP4_NAT46 
KP_VIP_TYPE_IP6_NAT64 
KP_VIP_TYPE_IP6_NAT66 
KP_VIP_N_TYPES 

Definition at line 171 of file kp.h.

Function Documentation

u8* format_ip46_prefix ( u8 s,
va_list *  args 
)

Definition at line 71 of file kp.c.

void ip46_prefix_normalize ( ip46_address_t *  prefix,
u8  plen 
)

Definition at line 35 of file kp.c.

int kp_conf ( u32  sticky_buckets,
u32  flow_timeout 
)

Fix global kube-proxy parameters.

Returns
0 on success. VNET_KP_ERR_XXX on error

Definition at line 421 of file kp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void kp_garbage_collection ( )

Definition at line 292 of file kp.c.

+ Here is the caller graph for this function:

u32 kp_hash_time_now ( vlib_main_t vm)

Definition at line 106 of file kp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 kp_ip_proto_to_nat_proto ( u8  ip_proto)
inlinestatic

Definition at line 295 of file kp.h.

+ Here is the caller graph for this function:

int kp_nat4_interface_add_del ( u32  sw_if_index,
int  is_del 
)

Definition at line 906 of file kp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int kp_vip_add ( ip46_address_t *  prefix,
u8  plen,
kp_vip_type_t  type,
u32  new_length,
u32 vip_index,
u16  port,
u16  target_port,
u16  node_port 
)

Definition at line 725 of file kp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int kp_vip_add_pods ( u32  vip_index,
ip46_address_t *  addresses,
u32  n 
)

Definition at line 481 of file kp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int kp_vip_del ( u32  vip_index)

Definition at line 810 of file kp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int kp_vip_del_pods ( u32  vip_index,
ip46_address_t *  addresses,
u32  n 
)

Definition at line 670 of file kp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int kp_vip_find_index ( ip46_address_t *  prefix,
u8  plen,
u32 vip_index 
)

Definition at line 454 of file kp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_ip46_prefix ( unformat_input_t input,
va_list *  args 
)

Definition at line 49 of file kp.c.

Variable Documentation

format_function_t format_kp_main

Definition at line 471 of file kp.h.

format_function_t format_kp_pod

Definition at line 148 of file kp.h.

format_function_t format_kp_vip

Definition at line 281 of file kp.h.

format_function_t format_kp_vip_detailed

Definition at line 282 of file kp.h.

format_function_t format_kp_vip_type

Definition at line 179 of file kp.h.

vlib_node_registration_t kp4_nodeport_node

(constructor) VLIB_REGISTER_NODE (kp4_nodeport_node)

Definition at line 774 of file kp_node.c.

vlib_node_registration_t kp6_nodeport_node

(constructor) VLIB_REGISTER_NODE (kp6_nodeport_node)

Definition at line 795 of file kp_node.c.

kp_main_t kp_main

Definition at line 28 of file kp.c.

vlib_node_registration_t kp_nat4_in2out_node

(constructor) VLIB_REGISTER_NODE (kp_nat4_in2out_node)

Definition at line 823 of file kp_node.c.

unformat_function_t unformat_kp_vip_type

Definition at line 180 of file kp.h.