Home | History | Annotate | Download | only in net

Lines Matching defs:llt

72 static void lltable_unlink(struct lltable *llt);
73 static void llentries_unlink(struct lltable *llt, struct llentries *head);
76 static void htable_link_entry(struct lltable *llt, struct llentry *lle);
77 static int htable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f,
81 lltable_dump_entry(struct lltable *llt, struct llentry *lle,
86 struct ifnet *ifp = llt->llt_ifp;
140 lltable_dump_af(struct lltable *llt, struct rt_walkarg *w)
146 if (llt->llt_ifp->if_flags & IFF_LOOPBACK)
150 IF_AFDATA_RLOCK(llt->llt_ifp);
151 error = lltable_foreach_lle(llt,
152 (llt_foreach_cb_t *)llt->llt_dump_entry, w);
153 IF_AFDATA_RUNLOCK(llt->llt_ifp);
164 struct lltable *llt;
168 SLIST_FOREACH(llt, &lltables, llt_link) {
169 if (llt->llt_af == af) {
170 error = lltable_dump_af(llt, w);
185 * Runs specified callback for each entry in @llt.
190 htable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f, void *farg)
197 for (i = 0; i < llt->llt_hsize; i++) {
198 LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) {
199 error = f(llt, lle, farg);
209 htable_link_entry(struct lltable *llt, struct llentry *lle)
217 IF_AFDATA_WLOCK_ASSERT(llt->llt_ifp);
219 hashidx = llt->llt_hash(lle, llt->llt_hsize);
220 lleh = &llt->lle_head[hashidx];
222 lle->lle_tbl = llt;
227 llt->llt_lle_count++;
256 htable_prefix_free_cb(struct lltable *llt, struct llentry *lle, void *farg)
262 if (llt->llt_match_prefix(pmd->prefix, pmd->mask, pmd->flags, lle)) {
271 htable_prefix_free(struct lltable *llt, const struct sockaddr *prefix,
283 IF_AFDATA_WLOCK(llt->llt_ifp);
285 lltable_foreach_lle(llt, htable_prefix_free_cb, &pmd);
287 llentries_unlink(llt, &pmd.dchain);
288 IF_AFDATA_WUNLOCK(llt->llt_ifp);
291 llt->llt_free_entry(llt, lle);
295 htable_free_tbl(struct lltable *llt)
298 free(llt->lle_head, M_LLTABLE);
299 free(llt, M_LLTABLE);
303 llentries_unlink(struct lltable *llt, struct llentries *head)
308 llt->llt_unlink_entry(lle);
369 struct lltable *llt;
377 llt = lle->lle_tbl;
379 IF_AFDATA_WLOCK_ASSERT(llt->llt_ifp);
380 llt->llt_unlink_entry(lle);
435 lltable_free_cb(struct lltable *llt, struct llentry *lle, void *farg)
451 lltable_purge_entries(struct lltable *llt)
456 KASSERTMSG(llt != NULL, "llt is NULL");
459 IF_AFDATA_WLOCK(llt->llt_ifp);
461 lltable_foreach_lle(llt, lltable_free_cb, &dchain);
462 llentries_unlink(llt, &dchain);
463 IF_AFDATA_WUNLOCK(llt->llt_ifp);
473 lltable_free(struct lltable *llt)
476 KASSERTMSG(llt != NULL, "llt is NULL");
478 lltable_unlink(llt);
479 lltable_purge_entries(llt);
480 llt->llt_free_tbl(llt);
486 struct lltable *llt;
491 SLIST_FOREACH(llt, &lltables, llt_link) {
492 if (llt->llt_af != af)
495 for (i=0; i < llt->llt_hsize; i++) {
496 LIST_FOREACH(lle, &llt->lle_head[i], lle_next) {
510 struct lltable *llt;
513 SLIST_FOREACH(llt, &lltables, llt_link) {
514 if (llt->llt_af != af)
517 llt->llt_prefix_free(llt, prefix, mask, flags);
525 struct lltable *llt;
528 llt = malloc(sizeof(struct lltable), M_LLTABLE, M_WAITOK | M_ZERO);
529 llt->llt_hsize = hsize;
530 llt->lle_head = malloc(sizeof(struct llentries) * hsize,
533 for (i = 0; i < llt->llt_hsize; i++)
534 LIST_INIT(&llt->lle_head[i]);
537 llt->llt_link_entry = htable_link_entry;
538 llt->llt_unlink_entry = htable_unlink_entry;
539 llt->llt_prefix_free = htable_prefix_free;
540 llt->llt_foreach_entry = htable_foreach_lle;
542 llt->llt_free_tbl = htable_free_tbl;
544 llt->llt_mowner = NULL;
547 return (llt);
551 * Links lltable to global llt list.
554 lltable_link(struct lltable *llt)
558 SLIST_INSERT_HEAD(&lltables, llt, llt_link);
563 lltable_unlink(struct lltable *llt)
567 SLIST_REMOVE(&lltables, llt, lltable, llt_link);
577 lltable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f, void *farg)
580 return (llt->llt_foreach_entry(llt, f, farg));
584 lltable_link_entry(struct lltable *llt, struct llentry *lle)
587 llt->llt_link_entry(llt, lle);
591 lltable_unlink_entry(struct lltable *llt, struct llentry *lle)
594 llt->llt_unlink_entry(lle);
598 lltable_free_entry(struct lltable *llt, struct llentry *lle)
601 llt->llt_free_entry(llt, lle);
607 struct lltable *llt;
609 llt = lle->lle_tbl;
610 llt->llt_fill_sa_entry(lle, sa);
614 lltable_get_ifp(const struct lltable *llt)
617 return (llt->llt_ifp);
621 lltable_get_af(const struct lltable *llt)
624 return (llt->llt_af);
637 struct lltable *llt;
660 SLIST_FOREACH(llt, &lltables, llt_link) {
661 if (llt->llt_af == dst->sa_family &&
662 llt->llt_ifp == ifp)
666 KASSERTMSG(llt != NULL, "Yep, ugly hacks are bad");
679 lle = lla_lookup(llt, LLE_EXCLUSIVE, dst);
708 lle = lla_create(llt, 0, dst, rt);
772 error = lla_delete(llt, 0, dst);
876 llatbl_llt_show(struct lltable *llt)
881 db_printf("llt=%p llt_af=%d llt_ifp=%p\n",
882 llt, llt->llt_af, llt->llt_ifp);
884 for (i = 0; i < llt->llt_hsize; i++) {
885 LIST_FOREACH(lle, &llt->lle_head[i], lle_next) {
908 struct lltable *llt;
915 SLIST_FOREACH(llt, &lltables, llt_link) {
916 db_printf("llt=%p llt_af=%d llt_ifp=%p(%s)\n",
917 llt, llt->llt_af, llt->llt_ifp,
918 (llt->llt_ifp != NULL) ?
919 llt->llt_ifp->if_xname : "?");
921 llatbl_llt_show(llt);