40 #define KMSG_COMPONENT "IPVS"
41 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
44 #include <linux/slab.h>
45 #include <linux/module.h>
46 #include <linux/kernel.h>
62 #ifndef CONFIG_IP_VS_SH_TAB_BITS
63 #define CONFIG_IP_VS_SH_TAB_BITS 8
65 #define IP_VS_SH_TAB_BITS CONFIG_IP_VS_SH_TAB_BITS
66 #define IP_VS_SH_TAB_SIZE (1 << IP_VS_SH_TAB_BITS)
67 #define IP_VS_SH_TAB_MASK (IP_VS_SH_TAB_SIZE - 1)
77 #ifdef CONFIG_IP_VS_IPV6
79 addr_fold = addr->
ip6[0]^addr->
ip6[1]^
93 return (tbl[ip_vs_sh_hashkey(af, addr)]).dest;
124 i, IP_VS_DBG_ADDR(svc->
af, &dest->
addr),
170 IP_VS_DBG(6,
"SH hash table (memory=%Zdbytes) allocated for "
175 ip_vs_sh_assign(tbl, svc);
190 IP_VS_DBG(6,
"SH hash table (memory=%Zdbytes) released\n",
205 ip_vs_sh_assign(tbl, svc);
215 static inline int is_overloaded(
struct ip_vs_dest *dest)
231 ip_vs_fill_iphdr(svc->
af, skb_network_header(skb), &iph);
233 IP_VS_DBG(6,
"ip_vs_sh_schedule(): Scheduling...\n");
236 dest = ip_vs_sh_get(svc->
af, tbl, &iph.saddr);
240 || is_overloaded(dest)) {
245 IP_VS_DBG_BUF(6,
"SH: source IP address %s --> server %s:%d\n",
246 IP_VS_DBG_ADDR(svc->
af, &iph.saddr),
247 IP_VS_DBG_ADDR(svc->
af, &dest->
addr),
263 .init_service = ip_vs_sh_init_svc,
264 .done_service = ip_vs_sh_done_svc,
265 .update_service = ip_vs_sh_update_svc,
266 .schedule = ip_vs_sh_schedule,
270 static int __init ip_vs_sh_init(
void)
276 static void __exit ip_vs_sh_cleanup(
void)