From owner-svn-src-all@FreeBSD.ORG Thu Aug 2 13:20:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C428C106566C; Thu, 2 Aug 2012 13:20:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73DF38FC0C; Thu, 2 Aug 2012 13:20:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72DKjnO085475; Thu, 2 Aug 2012 13:20:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72DKjfx085470; Thu, 2 Aug 2012 13:20:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201208021320.q72DKjfx085470@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 2 Aug 2012 13:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238989 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 02 Aug 2012 13:20:45 -0000 Author: glebius Date: Thu Aug 2 13:20:44 2012 New Revision: 238989 URL: http://svn.freebsd.org/changeset/base/238989 Log: 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: head/sys/net/flowtable.c head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Thu Aug 2 12:45:13 2012 (r238988) +++ head/sys/net/flowtable.c Thu Aug 2 13:20:44 2012 (r238989) @@ -1258,7 +1258,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 @@ -1267,7 +1267,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: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Thu Aug 2 12:45:13 2012 (r238988) +++ head/sys/net/if_llatbl.c Thu Aug 2 13:20:44 2012 (r238989) @@ -129,42 +129,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: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Thu Aug 2 12:45:13 2012 (r238988) +++ head/sys/net/if_llatbl.h Thu Aug 2 13:20:44 2012 (r238989) @@ -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.