diff options
author | np <np@FreeBSD.org> | 2013-02-09 00:35:28 +0000 |
---|---|---|
committer | np <np@FreeBSD.org> | 2013-02-09 00:35:28 +0000 |
commit | ca3fe89a4ed7b770242e535be6d5c557a8c1a5fd (patch) | |
tree | 530496abe392a2cebd7f5f96f10b6b615ca6d208 | |
parent | d169cde81cd39eb7fae44ed10f15a903f2fe3d2d (diff) | |
download | FreeBSD-src-ca3fe89a4ed7b770242e535be6d5c557a8c1a5fd.zip FreeBSD-src-ca3fe89a4ed7b770242e535be6d5c557a8c1a5fd.tar.gz |
Do not hold locks around hardware context reads.
MFC after: 3 days
-rw-r--r-- | sys/dev/cxgbe/t4_main.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index c22ec21..96246a6 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5161,23 +5161,24 @@ get_sge_context(struct adapter *sc, struct t4_sge_context *cntxt) cntxt->mem_id != CTXT_FLM && cntxt->mem_id != CTXT_CNM) return (EINVAL); + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4ctxt"); + if (rc) + return (rc); + if (sc->flags & FW_OK) { - rc = begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4ctxt"); - if (rc == 0) { - rc = -t4_sge_ctxt_rd(sc, sc->mbox, cntxt->cid, - cntxt->mem_id, &cntxt->data[0]); - end_synchronized_op(sc, LOCK_HELD); - if (rc == 0) - return (0); - } + rc = -t4_sge_ctxt_rd(sc, sc->mbox, cntxt->cid, cntxt->mem_id, + &cntxt->data[0]); + if (rc == 0) + goto done; } /* * Read via firmware failed or wasn't even attempted. Read directly via * the backdoor. */ - rc = -t4_sge_ctxt_rd_bd(sc, cntxt->cid, cntxt->mem_id, - &cntxt->data[0]); + rc = -t4_sge_ctxt_rd_bd(sc, cntxt->cid, cntxt->mem_id, &cntxt->data[0]); +done: + end_synchronized_op(sc, 0); return (rc); } |