From 8b5f9bb75549de6d0439ef4a26d75d4e9a4c491f Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Wed, 13 Nov 2019 11:21:02 +0000 Subject: [PATCH] lltabl: remove dead code Remove the long (8? years ago) #if 0 marked function lltable_drain() and while here also remove the unused function llentry_alloc() which has call paths tools keep finding and are never used. Sponsored by: Netflix --- sys/net/if_llatbl.c | 72 --------------------------------------------- sys/net/if_llatbl.h | 5 ---- 2 files changed, 77 deletions(-) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 71e2c3ab9a52..289c36ce7597 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -446,50 +446,6 @@ llentry_free(struct llentry *lle) return (pkts_dropped); } -/* - * (al)locate an llentry for address dst (equivalent to rtalloc for new-arp). - * - * If found the llentry * is returned referenced and unlocked. - */ -struct llentry * -llentry_alloc(struct ifnet *ifp, struct lltable *lt, - struct sockaddr_storage *dst) -{ - struct epoch_tracker et; - struct llentry *la, *la_tmp; - - NET_EPOCH_ENTER(et); - la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); - NET_EPOCH_EXIT(et); - - if (la != NULL) { - LLE_ADDREF(la); - LLE_WUNLOCK(la); - return (la); - } - - if ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { - la = lltable_alloc_entry(lt, 0, (struct sockaddr *)dst); - if (la == NULL) - return (NULL); - IF_AFDATA_WLOCK(ifp); - LLE_WLOCK(la); - /* Prefer any existing LLE over newly-created one */ - la_tmp = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); - if (la_tmp == NULL) - lltable_link_entry(lt, la); - IF_AFDATA_WUNLOCK(ifp); - if (la_tmp != NULL) { - lltable_free_entry(lt, la); - la = la_tmp; - } - LLE_ADDREF(la); - LLE_WUNLOCK(la); - } - - return (la); -} - /* * Free all entries from given table and free itself. */ @@ -534,34 +490,6 @@ lltable_free(struct lltable *llt) llt->llt_free_tbl(llt); } -#if 0 -void -lltable_drain(int af) -{ - struct lltable *llt; - struct llentry *lle; - int i; - - LLTABLE_LIST_RLOCK(); - SLIST_FOREACH(llt, &V_lltables, llt_link) { - if (llt->llt_af != af) - continue; - - for (i=0; i < llt->llt_hsize; i++) { - CK_LIST_FOREACH(lle, &llt->lle_head[i], lle_next) { - LLE_WLOCK(lle); - if (lle->la_hold) { - m_freem(lle->la_hold); - lle->la_hold = NULL; - } - LLE_WUNLOCK(lle); - } - } - } - LLTABLE_LIST_RUNLOCK(); -} -#endif - /* * Deletes an address from given lltable. * Used for userland interaction to remove diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index 7bf57bdbd98a..d194eac63810 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -211,14 +211,9 @@ void lltable_free(struct lltable *); void lltable_link(struct lltable *llt); void lltable_prefix_free(int, struct sockaddr *, struct sockaddr *, u_int); -#if 0 -void lltable_drain(int); -#endif int lltable_sysctl_dumparp(int, struct sysctl_req *); size_t llentry_free(struct llentry *); -struct llentry *llentry_alloc(struct ifnet *, struct lltable *, - struct sockaddr_storage *); /* helper functions */ size_t lltable_drop_entry_queue(struct llentry *);