Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Sep 2012 12:11:12 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r240311 - stable/9/sys/net
Message-ID:  <201209101211.q8ACBClP050712@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Sep 10 12:11:11 2012
New Revision: 240311
URL: http://svn.freebsd.org/changeset/base/240311

Log:
  Merge r238989:
    The llentry_update() is used only by flowtable and the latter
    always passes NULL pointer to it. Thus, code can be simplified
    and function renamed to llentry_alloc() to match rtalloc().

Modified:
  stable/9/sys/net/flowtable.c
  stable/9/sys/net/if_llatbl.c
  stable/9/sys/net/if_llatbl.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/net/flowtable.c
==============================================================================
--- stable/9/sys/net/flowtable.c	Mon Sep 10 12:09:19 2012	(r240310)
+++ stable/9/sys/net/flowtable.c	Mon Sep 10 12:11:11 2012	(r240311)
@@ -1257,7 +1257,7 @@ uncached:
 			
 			else
 				l3addr = (struct sockaddr_storage *)&ro->ro_dst;
-			llentry_update(&lle, LLTABLE6(ifp), l3addr, ifp);
+			lle = llentry_alloc(ifp, LLTABLE6(ifp), l3addr);
 		}
 #endif	
 #ifdef INET
@@ -1266,7 +1266,7 @@ uncached:
 				l3addr = (struct sockaddr_storage *)rt->rt_gateway;
 			else
 				l3addr = (struct sockaddr_storage *)&ro->ro_dst;
-			llentry_update(&lle, LLTABLE(ifp), l3addr, ifp);	
+			lle = llentry_alloc(ifp, LLTABLE(ifp), l3addr);	
 		}
 			
 #endif

Modified: stable/9/sys/net/if_llatbl.c
==============================================================================
--- stable/9/sys/net/if_llatbl.c	Mon Sep 10 12:09:19 2012	(r240310)
+++ stable/9/sys/net/if_llatbl.c	Mon Sep 10 12:11:11 2012	(r240311)
@@ -132,42 +132,33 @@ llentry_free(struct llentry *lle)
 }
 
 /*
- * Update an llentry for address dst (equivalent to rtalloc for new-arp)
- * Caller must pass in a valid struct llentry * (or NULL)
+ * (al)locate an llentry for address dst (equivalent to rtalloc for new-arp).
  *
- * if found the llentry * is returned referenced and unlocked
+ * If found the llentry * is returned referenced and unlocked.
  */
-int
-llentry_update(struct llentry **llep, struct lltable *lt,
-    struct sockaddr_storage *dst, struct ifnet *ifp)
+struct llentry *
+llentry_alloc(struct ifnet *ifp, struct lltable *lt,
+    struct sockaddr_storage *dst)
 {
 	struct llentry *la;
 
 	IF_AFDATA_RLOCK(ifp);
-	la = lla_lookup(lt, LLE_EXCLUSIVE,
-	    (struct sockaddr *)dst);
+	la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst);
 	IF_AFDATA_RUNLOCK(ifp);
 	if ((la == NULL) &&
 	    (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) {
 		IF_AFDATA_WLOCK(ifp);
-		la = lla_lookup(lt,
-		    (LLE_CREATE | LLE_EXCLUSIVE),
+		la = lla_lookup(lt, (LLE_CREATE | LLE_EXCLUSIVE),
 		    (struct sockaddr *)dst);
 		IF_AFDATA_WUNLOCK(ifp);
 	}
-	if (la != NULL && (*llep != la)) {
-		if (*llep != NULL)
-			LLE_FREE(*llep);
+
+	if (la != NULL) {
 		LLE_ADDREF(la);
 		LLE_WUNLOCK(la);
-		*llep = la;
-	} else if (la != NULL)
-		LLE_WUNLOCK(la);
-
-	if (la == NULL)
-		return (ENOENT);
+	}
 
-	return (0);
+	return (la);
 }
 
 /*

Modified: stable/9/sys/net/if_llatbl.h
==============================================================================
--- stable/9/sys/net/if_llatbl.h	Mon Sep 10 12:09:19 2012	(r240310)
+++ stable/9/sys/net/if_llatbl.h	Mon Sep 10 12:11:11 2012	(r240311)
@@ -189,8 +189,8 @@ void		lltable_drain(int);
 int		lltable_sysctl_dumparp(int, struct sysctl_req *);
 
 size_t		llentry_free(struct llentry *);
-int		llentry_update(struct llentry **, struct lltable *,
-		    struct sockaddr_storage *, struct ifnet *);
+struct llentry  *llentry_alloc(struct ifnet *, struct lltable *,
+		    struct sockaddr_storage *);
 
 /*
  * Generic link layer address lookup function.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209101211.q8ACBClP050712>