aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2024-10-04 18:11:22 +0000
committerNavdeep Parhar <np@FreeBSD.org>2024-10-07 17:25:53 +0000
commit52e5a66eac22d24e29f204c5b65232378e71f4cf (patch)
treeafe96efa23f8e188d29c2153caee2f4da813cd1b
parentbe9243409d6be99f5d7815b6d074a85a6e84f7ce (diff)
cxgbe(4): Use correct synchronization when marking the adapter offline.
adapter->flags are guarded by a synch_op, as noted in the comment in adapter.h where the flags are defined. Fixes: 5241b210a4e cxgbe(4): Basic infrastructure for ULDs to participate in adapter reset. MFC after: 1 week Sponsored by: Chelsio Communications
-rw-r--r--sys/dev/cxgbe/t4_main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 508f3f08f22a..57cc41bb50fa 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -1990,18 +1990,23 @@ restart_adapter(struct adapter *sc)
static inline void
set_adapter_hwstatus(struct adapter *sc, const bool usable)
{
- mtx_lock(&sc->reg_lock);
if (usable) {
/* Must be marked reusable by the designated thread. */
+ ASSERT_SYNCHRONIZED_OP(sc);
MPASS(sc->reset_thread == curthread);
+ mtx_lock(&sc->reg_lock);
atomic_clear_int(&sc->error_flags, HW_OFF_LIMITS);
+ mtx_unlock(&sc->reg_lock);
} else {
/* Mark the adapter totally off limits. */
+ begin_synchronized_op(sc, NULL, SLEEP_OK, "t4hwsts");
+ mtx_lock(&sc->reg_lock);
atomic_set_int(&sc->error_flags, HW_OFF_LIMITS);
+ mtx_unlock(&sc->reg_lock);
sc->flags &= ~(FW_OK | MASTER_PF);
sc->reset_thread = NULL;
+ end_synchronized_op(sc, 0);
}
- mtx_unlock(&sc->reg_lock);
}
static int