42 #define KMSG_COMPONENT "IPVS"
43 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
46 #include <linux/slab.h>
47 #include <linux/module.h>
48 #include <linux/kernel.h>
54 #include <linux/sysctl.h>
63 #define CHECK_EXPIRE_INTERVAL (60*HZ)
64 #define ENTRY_TIMEOUT (6*60*HZ)
66 #define DEFAULT_EXPIRATION (24*60*60*HZ)
74 #define COUNT_FOR_FULL_EXPIRATION 30
80 #ifndef CONFIG_IP_VS_LBLC_TAB_BITS
81 #define CONFIG_IP_VS_LBLC_TAB_BITS 10
83 #define IP_VS_LBLC_TAB_BITS CONFIG_IP_VS_LBLC_TAB_BITS
84 #define IP_VS_LBLC_TAB_SIZE (1 << IP_VS_LBLC_TAB_BITS)
85 #define IP_VS_LBLC_TAB_MASK (IP_VS_LBLC_TAB_SIZE - 1)
122 .maxlen =
sizeof(
int),
145 static inline unsigned int
150 #ifdef CONFIG_IP_VS_IPV6
152 addr_fold = addr->
ip6[0]^addr->
ip6[1]^
153 addr->
ip6[2]^addr->
ip6[3];
166 unsigned int hash = ip_vs_lblc_hashkey(en->
af, &en->
addr);
181 unsigned int hash = ip_vs_lblc_hashkey(af, addr);
185 if (ip_vs_addr_equal(af, &en->addr, addr))
202 en = ip_vs_lblc_get(dest->af, tbl, daddr);
209 ip_vs_addr_copy(dest->af, &en->
addr, daddr);
215 ip_vs_lblc_hash(tbl, en);
216 }
else if (en->
dest != dest) {
252 static inline void ip_vs_lblc_full_check(
struct ip_vs_service *svc)
266 sysctl_lblc_expiration(svc)))
289 static void ip_vs_lblc_check_expire(
unsigned long data)
300 ip_vs_lblc_full_check(svc);
350 IP_VS_DBG(6,
"LBLC hash table (memory=%Zdbytes) allocated for "
351 "current service\n",
sizeof(*tbl));
357 INIT_LIST_HEAD(&tbl->
bucket[i]);
359 tbl->
max_size = IP_VS_LBLC_TAB_SIZE*16;
382 ip_vs_lblc_flush(tbl);
386 IP_VS_DBG(6,
"LBLC hash table (memory=%Zdbytes) released\n",
416 loh = ip_vs_dest_conn_overhead(least);
430 doh = ip_vs_dest_conn_overhead(dest);
439 "activeconns %d refcnt %d weight %d overhead %d\n",
440 IP_VS_DBG_ADDR(least->
af, &least->
addr),
482 ip_vs_fill_iphdr(svc->
af, skb_network_header(skb), &iph);
484 IP_VS_DBG(6,
"%s(): Scheduling...\n", __func__);
488 en = ip_vs_lblc_get(svc->
af, tbl, &iph.daddr);
512 dest = __ip_vs_lblc_schedule(svc);
520 ip_vs_lblc_new(tbl, &iph.daddr, dest);
524 IP_VS_DBG_BUF(6,
"LBLC: destination IP address %s --> server %s:%d\n",
525 IP_VS_DBG_ADDR(svc->
af, &iph.daddr),
541 .init_service = ip_vs_lblc_init_svc,
542 .done_service = ip_vs_lblc_done_svc,
543 .schedule = ip_vs_lblc_schedule,
559 sizeof(vs_vars_table),
579 static void __net_exit __ip_vs_lblc_exit(
struct net *net)
591 static int __net_init __ip_vs_lblc_init(
struct net *net) {
return 0; }
592 static void __net_exit __ip_vs_lblc_exit(
struct net *net) { }
597 .init = __ip_vs_lblc_init,
598 .exit = __ip_vs_lblc_exit,
601 static int __init ip_vs_lblc_init(
void)
615 static void __exit ip_vs_lblc_cleanup(
void)