* Free all entries from given table and free itself. */
| 487 | * Free all entries from given table and free itself. |
| 488 | */ |
| 489 | void |
| 490 | lltable_free(struct lltable *llt) |
| 491 | { |
| 492 | struct llentry *lle, *next; |
| 493 | struct llentries dchain; |
| 494 | |
| 495 | KASSERT(llt != NULL, ("%s: llt is NULL", __func__)); |
| 496 | |
| 497 | lltable_unlink(llt); |
| 498 | |
| 499 | CK_LIST_INIT(&dchain); |
| 500 | IF_AFDATA_WLOCK(llt->llt_ifp); |
| 501 | /* Push all lles to @dchain */ |
| 502 | lltable_foreach_lle(llt, lltable_free_cb, &dchain); |
| 503 | llentries_unlink(llt, &dchain); |
| 504 | IF_AFDATA_WUNLOCK(llt->llt_ifp); |
| 505 | |
| 506 | CK_LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) { |
| 507 | llentry_free(lle); |
| 508 | } |
| 509 | |
| 510 | KASSERT(llt->llt_entries == 0, ("%s: lltable %p (%s) entires not 0: %d", |
| 511 | __func__, llt, llt->llt_ifp->if_xname, llt->llt_entries)); |
| 512 | |
| 513 | llt->llt_free_tbl(llt); |
| 514 | } |
| 515 | |
| 516 | /* |
| 517 | * Deletes an address from given lltable. |
no test coverage detected