git: b56fe21c6df2 - stable/14 - cxgbe/t4_tom: Do not set unresolved entries to STALE in t4_l2t_update.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Mon, 21 Oct 2024 18:39:31 UTC
The branch stable/14 has been updated by np:

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

commit b56fe21c6df2911f96263675298e19e9b8720366
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-09-24 14:35:09 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2024-10-21 17:14:23 +0000

    cxgbe/t4_tom: Do not set unresolved entries to STALE in t4_l2t_update.
    
    An L2 entry in the driver's hash was marked STALE unconditionally if it
    changed in the kernel when its driver refcount is 0.  Fix the driver to
    do this for VALID entries only.
    
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 3883300afe0bff5c5658274c4d8cfe773d08343e)
---
 sys/dev/cxgbe/tom/t4_tom_l2t.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/cxgbe/tom/t4_tom_l2t.c b/sys/dev/cxgbe/tom/t4_tom_l2t.c
index be42a887323f..8cc3e633444a 100644
--- a/sys/dev/cxgbe/tom/t4_tom_l2t.c
+++ b/sys/dev/cxgbe/tom/t4_tom_l2t.c
@@ -441,7 +441,8 @@ t4_l2_update(struct toedev *tod, if_t ifp, struct sockaddr *sa,
 			mtx_lock(&e->lock);
 			if (atomic_load_acq_int(&e->refcnt))
 				goto found;
-			e->state = L2T_STATE_STALE;
+			if (e->state == L2T_STATE_VALID)
+				e->state = L2T_STATE_STALE;
 			mtx_unlock(&e->lock);
 			break;
 		}