svn commit: r246575 - head/sys/dev/cxgbe

Navdeep Parhar np at FreeBSD.org
Sat Feb 9 00:35:29 UTC 2013


Author: np
Date: Sat Feb  9 00:35:28 2013
New Revision: 246575
URL: http://svnweb.freebsd.org/changeset/base/246575

Log:
  Do not hold locks around hardware context reads.
  
  MFC after:	3 days

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c	Sat Feb  9 00:29:36 2013	(r246574)
+++ head/sys/dev/cxgbe/t4_main.c	Sat Feb  9 00:35:28 2013	(r246575)
@@ -5161,23 +5161,24 @@ get_sge_context(struct adapter *sc, stru
 	    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);
 }
 


More information about the svn-src-all mailing list