Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2019 18:53:45 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343056 - head/sys/dev/cxgbe/crypto
Message-ID:  <201901151853.x0FIrjWS044348@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Jan 15 18:53:45 2019
New Revision: 343056
URL: https://svnweb.freebsd.org/changeset/base/343056

Log:
  Reject new sessions if the necessary queues aren't initialized.
  
  ccr reuses the control queue and first rx queue from the first port on
  each adapter.  The driver cannot send requests until those queues are
  initialized.  Refuse to create sessions for now if the queues aren't
  ready.  This is a workaround until cxgbe allocates one or more
  dedicated queues for ccr.
  
  PR:		233851
  MFC after:	1 week
  Sponsored by:	Chelsio Communications
  Differential Revision:	https://reviews.freebsd.org/D18478

Modified:
  head/sys/dev/cxgbe/crypto/t4_crypto.c

Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c
==============================================================================
--- head/sys/dev/cxgbe/crypto/t4_crypto.c	Tue Jan 15 18:50:11 2019	(r343055)
+++ head/sys/dev/cxgbe/crypto/t4_crypto.c	Tue Jan 15 18:53:45 2019	(r343056)
@@ -1652,12 +1652,6 @@ ccr_attach(device_t dev)
 	struct ccr_softc *sc;
 	int32_t cid;
 
-	/*
-	 * TODO: Crypto requests will panic if the parent device isn't
-	 * initialized so that the queues are up and running.  Need to
-	 * figure out how to handle that correctly, maybe just reject
-	 * requests if the adapter isn't fully initialized?
-	 */
 	sc = device_get_softc(dev);
 	sc->dev = dev;
 	sc->adapter = device_get_softc(device_get_parent(dev));
@@ -2058,6 +2052,16 @@ ccr_newsession(device_t dev, crypto_session_t cses, st
 	}
 
 	sc = device_get_softc(dev);
+
+	/*
+	 * XXX: Don't create a session if the queues aren't
+	 * initialized.  This is racy as the rxq can be destroyed by
+	 * the associated VI detaching.  Eventually ccr should use
+	 * dedicated queues.
+	 */
+	if (sc->rxq->iq.adapter == NULL || sc->txq->adapter == NULL)
+		return (ENXIO);
+	
 	mtx_lock(&sc->lock);
 	if (sc->detaching) {
 		mtx_unlock(&sc->lock);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901151853.x0FIrjWS044348>