From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 03:41:38 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83B20106566B; Mon, 8 Jun 2009 03:41:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 685F48FC15; Mon, 8 Jun 2009 03:41:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n583fc0x014725; Mon, 8 Jun 2009 03:41:38 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n583fcJf014724; Mon, 8 Jun 2009 03:41:38 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080341.n583fcJf014724@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 03:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193679 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jun 2009 03:41:38 -0000 Author: kmacy Date: Mon Jun 8 03:41:38 2009 New Revision: 193679 URL: http://svn.freebsd.org/changeset/base/193679 Log: - remove more global variable touching - hash ports when setting flowid Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 03:40:38 2009 (r193678) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Mon Jun 8 03:41:38 2009 (r193679) @@ -147,6 +147,8 @@ struct flowtable { uint32_t ft_collisions; uint32_t ft_allocated; uint32_t ft_misses; + uint64_t ft_free_checks; + uint64_t ft_frees; uint64_t ft_hits; uint64_t ft_lookups; @@ -356,7 +358,8 @@ ipv4_flow_lookup_hash_internal(struct mb key[2] = sin->sin_addr.s_addr; - if ((*flags & FL_HASH_PORTS) == 0) + if ((*flags & FL_HASH_PORTS) == 0 && + (m == NULL || (m->m_flags & M_FLOWID))) goto skipports; proto = ip->ip_p; @@ -390,7 +393,14 @@ ipv4_flow_lookup_hash_internal(struct mb } *protop = proto; - + if (m != NULL && (m->m_flags & M_FLOWID) == 0) { + ((uint16_t *)key)[0] = sport; + ((uint16_t *)key)[1] = dport; + m->m_flags |= M_FLOWID; + m->m_pkthdr.flowid = jenkins_hashword(key, 3, + hashjitter + proto); + } + /* * If this is a transmit route cache then * hash all flows to a given destination to @@ -404,11 +414,6 @@ ipv4_flow_lookup_hash_internal(struct mb skipports: hash = jenkins_hashword(key, 3, hashjitter + proto); - if (m != NULL && (m->m_flags & M_FLOWID) == 0) { - m->m_flags |= M_FLOWID; - m->m_pkthdr.flowid = hash; - } - return (hash); noop: *protop = proto; @@ -488,7 +493,6 @@ flowtable_set_hashkey(struct flentry *fl nwords = 3; hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; } - for (i = 0; i < nwords; i++) hashkey[i] = key[i]; } @@ -507,7 +511,7 @@ flowtable_insert(struct flowtable *ft, u if (newfle == NULL) return (ENOMEM); - newfle->f_flags |= (flags & FL_IPV6); + prefetch(newfle); FL_ENTRY_LOCK(ft, hash); mask = flowtable_mask(ft); @@ -521,7 +525,7 @@ flowtable_insert(struct flowtable *ft, u } depth = 0; - flowtable_collisions++; + ft->ft_collisions++; /* * find end of list and make sure that we were not * preempted by another thread handling this flow @@ -551,6 +555,7 @@ flowtable_insert(struct flowtable *ft, u flowtable_max_depth = depth; fletail->f_next = newfle; fle = newfle; + newfle->f_flags |= (flags & FL_IPV6); skip: flowtable_set_hashkey(fle, key); @@ -852,7 +857,7 @@ flowtable_free_stale(struct flowtable *f flehead = flowtable_entry(ft, curbit); fle = fleprev = *flehead; - flowtable_free_checks++; + ft->ft_free_checks++; #ifdef DIAGNOSTIC if (fle == NULL && curbit > 0) { log(LOG_ALERT, @@ -903,7 +908,7 @@ flowtable_free_stale(struct flowtable *f while ((fle = flefreehead) != NULL) { flefreehead = fle->f_next; count++; - flowtable_frees++; + ft->ft_frees++; fle_free(fle); } if (bootverbose && count)