From owner-p4-projects@FreeBSD.ORG Mon Jun 22 20:32:52 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B1F3B1065693; Mon, 22 Jun 2009 20:32:51 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 540F51065679 for ; Mon, 22 Jun 2009 20:32:51 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 416038FC08 for ; Mon, 22 Jun 2009 20:32:51 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKWpIv059763 for ; Mon, 22 Jun 2009 20:32:51 GMT (envelope-from zec@fer.hr) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5MKWpsg059761 for perforce@freebsd.org; Mon, 22 Jun 2009 20:32:51 GMT (envelope-from zec@fer.hr) Date: Mon, 22 Jun 2009 20:32:51 GMT Message-Id: <200906222032.n5MKWpsg059761@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@fer.hr using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 164901 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:32:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=164901 Change 164901 by zec@zec_amdx4 on 2009/06/22 20:32:38 Store flowtable state in struct vnet_inet, not vnet_net. Suggested by: bz Affected files ... .. //depot/projects/vimage-commit2/src/sys/net/flowtable.c#9 edit .. //depot/projects/vimage-commit2/src/sys/net/vnet.h#27 edit .. //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#45 edit .. //depot/projects/vimage-commit2/src/sys/netinet/vinet.h#35 edit .. //depot/projects/vimage-commit2/src/sys/sys/vimage.h#76 edit Differences ... ==== //depot/projects/vimage-commit2/src/sys/net/flowtable.c#9 (text+ko) ==== @@ -54,7 +54,6 @@ #include #include #include -#include #include #include @@ -65,6 +64,7 @@ #include #include #include +#include #include @@ -180,7 +180,7 @@ static const vnet_modinfo_t flowtable_modinfo = { .vmi_id = VNET_MOD_FLOWTABLE, .vmi_name = "flowtable", - .vmi_dependson = VNET_MOD_NET, + .vmi_dependson = VNET_MOD_INET, .vmi_iattach = flowtable_iattach, #ifdef VIMAGE .vmi_idetach = flowtable_idetach @@ -221,37 +221,37 @@ static int flowtable_nmbflows; #endif SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable"); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW, - flowtable_enable, 0, "enable flowtable caching."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, hits, CTLFLAG_RD, - flowtable_hits, 0, "# flowtable hits."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, lookups, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, enable, + CTLFLAG_RW, flowtable_enable, 0, "enable flowtable caching."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, hits, + CTLFLAG_RD, flowtable_hits, 0, "# flowtable hits."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, lookups, CTLFLAG_RD, flowtable_lookups, 0, "# flowtable lookups."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, misses, CTLFLAG_RD, - flowtable_misses, 0, "#flowtable misses."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, frees, CTLFLAG_RD, - flowtable_frees, 0, "#flows freed."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, free_checks, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, misses, + CTLFLAG_RD, flowtable_misses, 0, "#flowtable misses."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, frees, + CTLFLAG_RD, flowtable_frees, 0, "#flows freed."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, free_checks, CTLFLAG_RD, flowtable_free_checks, 0, "#flows free checks."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, max_depth, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, max_depth, CTLFLAG_RD, flowtable_max_depth, 0, "max collision list length."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, collisions, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, collisions, CTLFLAG_RD, flowtable_collisions, 0, "#flowtable collisions."); /* * XXX This does not end up updating timeouts at runtime * and only reflects the value for the last table added :-/ */ -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, syn_expire, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, syn_expire, CTLFLAG_RW, flowtable_syn_expire, 0, "seconds after which to remove syn allocated flow."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, udp_expire, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, udp_expire, CTLFLAG_RW, flowtable_udp_expire, 0, "seconds after which to remove flow allocated to UDP."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, fin_wait_expire, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, fin_wait_expire, CTLFLAG_RW, flowtable_fin_wait_expire, 0, "seconds after which to remove a flow in FIN_WAIT."); -SYSCTL_V_INT(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, tcp_expire, +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, tcp_expire, CTLFLAG_RW, flowtable_tcp_expire, 0, "seconds after which to remove flow allocated to a TCP connection."); @@ -266,7 +266,7 @@ static int sysctl_nmbflows(SYSCTL_HANDLER_ARGS) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); int error, newnmbflows; newnmbflows = V_flowtable_nmbflows; @@ -283,7 +283,7 @@ } return (error); } -SYSCTL_V_PROC(V_NET, vnet_net, _net_inet_flowtable, OID_AUTO, nmbflows, +SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, nmbflows, CTLTYPE_INT|CTLFLAG_RW, flowtable_nmbflows, 0, sysctl_nmbflows, "IU", "Maximum number of flows allowed"); @@ -338,7 +338,7 @@ ipv4_flow_lookup_hash_internal(struct mbuf *m, struct route *ro, uint32_t *key, uint16_t *flags, uint8_t *protop) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); uint16_t sport = 0, dport = 0; struct ip *ip = NULL; uint8_t proto = 0; @@ -505,7 +505,7 @@ flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key, uint8_t proto, struct route *ro, uint16_t flags) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); struct flentry *fle, *fletail, *newfle, **flep; int depth; uma_zone_t flezone; @@ -596,7 +596,7 @@ int flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); uint32_t key[9], hash; struct flentry *fle; uint16_t flags; @@ -718,7 +718,7 @@ struct flowtable * flowtable_alloc(int nentry, int flags) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); struct flowtable *ft, *fttail; int i; @@ -810,7 +810,7 @@ static int flowtable_iattach(const void *unused __unused) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); V_flowtable_enable = 1; V_flowtable_hits = 0; @@ -839,7 +839,7 @@ static int flowtable_idetach(const void *unused __unused) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); uma_zdestroy(V_flow_ipv4_zone); uma_zdestroy(V_flow_ipv6_zone); @@ -858,7 +858,7 @@ static void fle_free(struct flentry *fle) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); struct rtentry *rt; struct llentry *lle; @@ -873,7 +873,7 @@ static void flowtable_free_stale(struct flowtable *ft) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); int curbit = 0, count; struct flentry *fle, **flehead, *fleprev; struct flentry *flefreehead, *flefreetail, *fletmp; @@ -961,7 +961,7 @@ static void flowtable_clean_vnet(void) { - INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); struct flowtable *ft; int i; ==== //depot/projects/vimage-commit2/src/sys/net/vnet.h#27 (text+ko) ==== @@ -54,25 +54,6 @@ int _if_cloners_count; int _ether_ipfw; - - struct flowtable * _flow_list_head; - uint32_t _flow_hashjitter; - uma_zone_t _flow_ipv4_zone; - uma_zone_t _flow_ipv6_zone; - - int _flowtable_enable; - int _flowtable_hits; - int _flowtable_lookups; - int _flowtable_misses; - int _flowtable_frees; - int _flowtable_free_checks; - int _flowtable_max_depth; - int _flowtable_collisions; - int _flowtable_syn_expire; - int _flowtable_udp_expire; - int _flowtable_fin_wait_expire; - int _flowtable_tcp_expire; - int _flowtable_nmbflows; }; /* Size guard. See sys/vimage.h. */ @@ -93,23 +74,6 @@ #define VNET_NET(sym) VSYM(vnet_net, sym) #define V_ether_ipfw VNET_NET(ether_ipfw) -#define V_flow_hashjitter VNET_NET(flow_hashjitter) -#define V_flow_ipv4_zone VNET_NET(flow_ipv4_zone) -#define V_flow_ipv6_zone VNET_NET(flow_ipv6_zone) -#define V_flow_list_head VNET_NET(flow_list_head) -#define V_flowtable_collisions VNET_NET(flowtable_collisions) -#define V_flowtable_enable VNET_NET(flowtable_enable) -#define V_flowtable_fin_wait_expire VNET_NET(flowtable_fin_wait_expire) -#define V_flowtable_free_checks VNET_NET(flowtable_free_checks) -#define V_flowtable_frees VNET_NET(flowtable_frees) -#define V_flowtable_hits VNET_NET(flowtable_hits) -#define V_flowtable_lookups VNET_NET(flowtable_lookups) -#define V_flowtable_max_depth VNET_NET(flowtable_max_depth) -#define V_flowtable_misses VNET_NET(flowtable_misses) -#define V_flowtable_nmbflows VNET_NET(flowtable_nmbflows) -#define V_flowtable_syn_expire VNET_NET(flowtable_syn_expire) -#define V_flowtable_tcp_expire VNET_NET(flowtable_tcp_expire) -#define V_flowtable_udp_expire VNET_NET(flowtable_udp_expire) #define V_if_index VNET_NET(if_index) #define V_if_indexlim VNET_NET(if_indexlim) #define V_if_cloners VNET_NET(if_cloners) ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#45 (text+ko) ==== @@ -336,9 +336,9 @@ maxnipq_update(); #ifdef FLOWTABLE + V_ip_output_flowtable_size = 2048; TUNABLE_INT_FETCH("net.inet.ip.output_flowtable_size", &V_ip_output_flowtable_size); - V_ip_output_flowtable_size = 2048; V_ip_ft = flowtable_alloc(V_ip_output_flowtable_size, FL_PCPU); #endif ==== //depot/projects/vimage-commit2/src/sys/netinet/vinet.h#35 (text+ko) ==== @@ -214,6 +214,23 @@ int _fw_one_pass; struct flowtable * _ip_ft; + struct flowtable * _flow_list_head; + uint32_t _flow_hashjitter; + uma_zone_t _flow_ipv4_zone; + uma_zone_t _flow_ipv6_zone; + int _flowtable_enable; + int _flowtable_hits; + int _flowtable_lookups; + int _flowtable_misses; + int _flowtable_frees; + int _flowtable_free_checks; + int _flowtable_max_depth; + int _flowtable_collisions; + int _flowtable_syn_expire; + int _flowtable_udp_expire; + int _flowtable_fin_wait_expire; + int _flowtable_tcp_expire; + int _flowtable_nmbflows; }; /* Size guard. See sys/vimage.h. */ @@ -242,6 +259,23 @@ #define V_drop_redirect VNET_INET(drop_redirect) #define V_drop_synfin VNET_INET(drop_synfin) #define V_fw_one_pass VNET_INET(fw_one_pass) +#define V_flow_hashjitter VNET_INET(flow_hashjitter) +#define V_flow_ipv4_zone VNET_INET(flow_ipv4_zone) +#define V_flow_ipv6_zone VNET_INET(flow_ipv6_zone) +#define V_flow_list_head VNET_INET(flow_list_head) +#define V_flowtable_collisions VNET_INET(flowtable_collisions) +#define V_flowtable_enable VNET_INET(flowtable_enable) +#define V_flowtable_fin_wait_expire VNET_INET(flowtable_fin_wait_expire) +#define V_flowtable_free_checks VNET_INET(flowtable_free_checks) +#define V_flowtable_frees VNET_INET(flowtable_frees) +#define V_flowtable_hits VNET_INET(flowtable_hits) +#define V_flowtable_lookups VNET_INET(flowtable_lookups) +#define V_flowtable_max_depth VNET_INET(flowtable_max_depth) +#define V_flowtable_misses VNET_INET(flowtable_misses) +#define V_flowtable_nmbflows VNET_INET(flowtable_nmbflows) +#define V_flowtable_syn_expire VNET_INET(flowtable_syn_expire) +#define V_flowtable_tcp_expire VNET_INET(flowtable_tcp_expire) +#define V_flowtable_udp_expire VNET_INET(flowtable_udp_expire) #define V_icmp_may_rst VNET_INET(icmp_may_rst) #define V_icmp_quotelen VNET_INET(icmp_quotelen) #define V_icmp_rfi VNET_INET(icmp_rfi) ==== //depot/projects/vimage-commit2/src/sys/sys/vimage.h#76 (text+ko) ==== @@ -125,7 +125,6 @@ #define VNET_MOD_RTABLE 14 /* Stateless modules. */ -#define VNET_MOD_FLOWTABLE 18 #define VNET_MOD_IF_CLONE 19 #define VNET_MOD_NG_ETHER 20 #define VNET_MOD_NG_IFACE 21 @@ -136,7 +135,7 @@ #define VNET_MOD_IPCOMP 26 #define VNET_MOD_GIF 27 #define VNET_MOD_ARP 28 - /* 29 */ +#define VNET_MOD_FLOWTABLE 29 #define VNET_MOD_LOIF 30 #define VNET_MOD_DOMAIN 31 #define VNET_MOD_DYNAMIC_START 32