git: 43571fe7c8dc - stable/13 - fib_dxr: s/KASSERT/MPASS/

From: Marko Zec <zec_at_FreeBSD.org>
Date: Tue, 14 May 2024 20:39:32 UTC
The branch stable/13 has been updated by zec:

URL: https://cgit.FreeBSD.org/src/commit/?id=43571fe7c8dc433266aedb31001659d461d93bbe

commit 43571fe7c8dc433266aedb31001659d461d93bbe
Author:     Marko Zec <zec@FreeBSD.org>
AuthorDate: 2024-05-07 15:33:23 +0000
Commit:     Marko Zec <zec@FreeBSD.org>
CommitDate: 2024-05-14 20:36:09 +0000

    fib_dxr: s/KASSERT/MPASS/
    
    MFC after:      1 week
---
 sys/netinet/in_fib_dxr.c | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c
index 5c5311068169..91f3bafdb47d 100644
--- a/sys/netinet/in_fib_dxr.c
+++ b/sys/netinet/in_fib_dxr.c
@@ -474,8 +474,7 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk)
 		cdp->cd_max_size = size;
 		cdp->cd_base = fdesc->base;
 		LIST_INSERT_HEAD(&da->all_chunks, cdp, cd_all_le);
-		KASSERT(cdp->cd_base + cdp->cd_max_size == da->rtbl_top,
-		    ("dxr: %s %d", __FUNCTION__, __LINE__));
+		MPASS(cdp->cd_base + cdp->cd_max_size == da->rtbl_top);
 	}
 
 	cdp->cd_hash = hash;
@@ -525,7 +524,7 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk)
 		    sizeof(struct range_entry_long) * size) == 0)
 			break;
 
-	KASSERT(cdp != NULL, ("dxr: dangling chunk"));
+	MPASS(cdp != NULL);
 	if (--cdp->cd_refcnt > 0)
 		return;
 
@@ -536,8 +535,7 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk)
 	/* Attempt to merge with the preceding chunk, if empty */
 	cdp2 = LIST_NEXT(cdp, cd_all_le);
 	if (cdp2 != NULL && cdp2->cd_cur_size == 0) {
-		KASSERT(cdp2->cd_base + cdp2->cd_max_size == cdp->cd_base,
-		    ("dxr: %s %d", __FUNCTION__, __LINE__));
+		MPASS(cdp2->cd_base + cdp2->cd_max_size == cdp->cd_base);
 		LIST_REMOVE(cdp, cd_all_le);
 		LIST_REMOVE(cdp2, cd_hash_le);
 		cdp2->cd_max_size += cdp->cd_max_size;
@@ -548,8 +546,7 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk)
 	/* Attempt to merge with the subsequent chunk, if empty */
 	cdp2 = LIST_PREV(cdp, &da->all_chunks, chunk_desc, cd_all_le);
 	if (cdp2 != NULL && cdp2->cd_cur_size == 0) {
-		KASSERT(cdp->cd_base + cdp->cd_max_size == cdp2->cd_base,
-		    ("dxr: %s %d", __FUNCTION__, __LINE__));
+		MPASS(cdp->cd_base + cdp->cd_max_size == cdp2->cd_base);
 		LIST_REMOVE(cdp, cd_all_le);
 		LIST_REMOVE(cdp2, cd_hash_le);
 		cdp2->cd_max_size += cdp->cd_max_size;
@@ -560,8 +557,7 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk)
 
 	if (cdp->cd_base + cdp->cd_max_size == da->rtbl_top) {
 		/* Free the chunk on the top of the range heap, trim the heap */
-		KASSERT(cdp == LIST_FIRST(&da->all_chunks),
-		    ("dxr: %s %d", __FUNCTION__, __LINE__));
+		MPASS(cdp == LIST_FIRST(&da->all_chunks));
 		da->rtbl_top -= cdp->cd_max_size;
 		da->unused_chunks_size -= cdp->cd_max_size;
 		LIST_REMOVE(cdp, cd_all_le);
@@ -875,7 +871,7 @@ dxr_build(struct dxr *dxr)
 	uint32_t trie_frag;
 #endif
 
-	KASSERT(dxr->d == NULL, ("dxr: d not free"));
+	MPASS(dxr->d == NULL);
 
 	if (da == NULL) {
 		da = malloc(sizeof(*dxr->aux), M_DXRAUX, M_NOWAIT);
@@ -1273,16 +1269,14 @@ dxr_change_rib_batch(struct rib_head *rnh, struct fib_change_queue *q,
 	int update_delta = 0;
 #endif
 
-	KASSERT(data != NULL, ("%s: NULL data", __FUNCTION__));
-	KASSERT(q != NULL, ("%s: NULL q", __FUNCTION__));
-	KASSERT(q->count < q->size, ("%s: q->count %d q->size %d",
-	    __FUNCTION__, q->count, q->size));
+	MPASS(data != NULL);
+	MPASS(q != NULL);
+	MPASS(q->count < q->size);
 
 	da = dxr->aux;
-	KASSERT(da != NULL, ("%s: NULL dxr->aux", __FUNCTION__));
-	KASSERT(da->fd != NULL, ("%s: da->fd %p", __FUNCTION__, da->fd));
-	KASSERT(da->refcnt > 0, ("%s: da->refcnt %d", __FUNCTION__,
-	    da->refcnt));
+	MPASS(da != NULL);
+	MPASS(da->fd != NULL);
+	MPASS(da->refcnt > 0);
 
 	FIB_PRINTF(LOG_INFO, da->fd, "processing %d update(s)", q->count);
 	for (ui = 0; ui < q->count; ui++) {
@@ -1315,8 +1309,7 @@ dxr_change_rib_batch(struct rib_head *rnh, struct fib_change_queue *q,
 
 #ifdef INVARIANTS
 	fib_get_rtable_info(fib_get_rh(da->fd), &rinfo);
-	KASSERT(da->prefixes + update_delta == rinfo.num_prefixes,
-	    ("%s: update count mismatch", __FUNCTION__));
+	MPASS(da->prefixes + update_delta == rinfo.num_prefixes);
 #endif
 
 	res = dxr_init(0, dxr->fd, data, (void **) &new_dxr);