svn commit: r261859 - in head: sys/net usr.bin/netstat

Adrian Chadd adrian at FreeBSD.org
Fri Feb 14 00:05:10 UTC 2014


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


More information about the svn-src-head mailing list