From owner-svn-src-all@FreeBSD.ORG Fri Feb 14 00:05:10 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4CABA6E9; Fri, 14 Feb 2014 00:05:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1CEF9145D; Fri, 14 Feb 2014 00:05:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1E059F6030527; Fri, 14 Feb 2014 00:05:09 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1E059Gh030523; Fri, 14 Feb 2014 00:05:09 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201402140005.s1E059Gh030523@svn.freebsd.org> From: Adrian Chadd Date: Fri, 14 Feb 2014 00:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261859 - in head: sys/net usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2014 00:05:10 -0000 Author: adrian Date: Fri Feb 14 00:05:09 2014 New Revision: 261859 URL: http://svnweb.freebsd.org/changeset/base/261859 Log: Don't insert a flowtable entry if the lle isn't yet valid. Some of the collisions that are occuring are due to flowtable lookups that succeed but have an invalid lle - typically because the L2 adjacency lookup hasn't completed. This would lead to a follow-up insert which would then fail (ie, collision) and the code would fall through to doing a slow-path L2/L3 lookup in the netinet/netinet6 code. This patch simply aborts storing a new flowtable entry if the lle isn't yet valid. Whilst I'm here, add a new pcpu counter for the item so the number of failures can be tracked separately from generic "collisions." Reviewed by: glebius MFC after: 10 days Sponsored by: Netflix, Inc. Modified: head/sys/net/flowtable.c head/sys/net/flowtable.h head/usr.bin/netstat/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Thu Feb 13 22:24:36 2014 (r261858) +++ head/sys/net/flowtable.c Fri Feb 14 00:05:09 2014 (r261859) @@ -966,6 +966,15 @@ flowtable_lookup_common(struct flowtable RTFREE(rt); return (NULL); } + + /* Don't insert the entry if the ARP hasn't yet finished resolving */ + if ((lle->la_flags & LLE_VALID) == 0) { + RTFREE(rt); + LLE_FREE(lle); + FLOWSTAT_INC(ft, ft_fail_lle_invalid); + return (NULL); + } + ro->ro_lle = lle; if (flowtable_insert(ft, hash, key, fibnum, ro, flags) != 0) { Modified: head/sys/net/flowtable.h ============================================================================== --- head/sys/net/flowtable.h Thu Feb 13 22:24:36 2014 (r261858) +++ head/sys/net/flowtable.h Fri Feb 14 00:05:09 2014 (r261859) @@ -39,6 +39,7 @@ struct flowtable_stat { uint64_t ft_frees; uint64_t ft_hits; uint64_t ft_lookups; + uint64_t ft_fail_lle_invalid; }; #ifdef _KERNEL Modified: head/usr.bin/netstat/flowtable.c ============================================================================== --- head/usr.bin/netstat/flowtable.c Thu Feb 13 22:24:36 2014 (r261858) +++ head/usr.bin/netstat/flowtable.c Fri Feb 14 00:05:09 2014 (r261859) @@ -55,6 +55,7 @@ print_stats(struct flowtable_stat *stat) p(ft_collisions, "\t%ju collision%s\n"); p(ft_free_checks, "\t%ju free check%s\n"); p(ft_frees, "\t%ju free%s\n"); + p(ft_fail_lle_invalid, "\t%ju lookups w/ no resolved ARP%s\n"); #undef p2 #undef p