aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-12-29 19:39:28 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-12-29 19:39:28 +0000
commit7063b9974f8a39d860b7abd03884324e71994f65 (patch)
tree9a1825edf4bc8f4726277a1956be3113ba4a0fe5
parentf3c043bb5fa2b30d4119c2e68fb1e7cd56deffd4 (diff)
downloadsrc-7063b9974f8a39d860b7abd03884324e71994f65.tar.gz
src-7063b9974f8a39d860b7abd03884324e71994f65.zip
ccr: Retire ccr_softc member in struct adapter.
Prior to Conrad's changes to replace session integer IDs with a pointer to the driver-specific state in commit 1b0909d51a8aa, the driver had to find the softc pointer from the adapter before it could locate the ccr_session structure for a completed request. Since Conrad's changes, the ccr_session pointer can now be obtained directly from the crp. Add a backpoint from ccr_session back to ccr_softc and use this in place of the ccr_softc member in cxgbe's struct adapter. Sponsored by: Chelsio Communications
-rw-r--r--sys/dev/cxgbe/adapter.h1
-rw-r--r--sys/dev/cxgbe/crypto/t4_crypto.c81
2 files changed, 41 insertions, 41 deletions
diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h
index 665de371a2a2..5460462c5f51 100644
--- a/sys/dev/cxgbe/adapter.h
+++ b/sys/dev/cxgbe/adapter.h
@@ -940,7 +940,6 @@ struct adapter {
void *iwarp_softc; /* (struct c4iw_dev *) */
struct iw_tunables iwt;
void *iscsi_ulp_softc; /* (struct cxgbei_data *) */
- void *ccr_softc; /* (struct ccr_softc *) */
struct l2t_data *l2t; /* L2 table */
struct smt_data *smt; /* Source MAC Table */
struct tid_info tids;
diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c
index 81f4f670a159..c4d0bbf868a9 100644
--- a/sys/dev/cxgbe/crypto/t4_crypto.c
+++ b/sys/dev/cxgbe/crypto/t4_crypto.c
@@ -177,43 +177,6 @@ struct ccr_port {
counter_u64_t stats_completed;
};
-struct ccr_session {
-#ifdef INVARIANTS
- int pending;
-#endif
- enum { HASH, HMAC, CIPHER, ETA, GCM, CCM } mode;
- struct ccr_port *port;
- union {
- struct ccr_session_hmac hmac;
- struct ccr_session_gmac gmac;
- struct ccr_session_ccm_mac ccm_mac;
- };
- struct ccr_session_cipher cipher;
- struct mtx lock;
-
- /*
- * A fallback software session is used for certain GCM/CCM
- * requests that the hardware can't handle such as requests
- * with only AAD and no payload.
- */
- crypto_session_t sw_session;
-
- /*
- * Pre-allocate S/G lists used when preparing a work request.
- * 'sg_input' contains an sglist describing the entire input
- * buffer for a 'struct cryptop'. 'sg_output' contains an
- * sglist describing the entire output buffer. 'sg_ulptx' is
- * used to describe the data the engine should DMA as input
- * via ULPTX_SGL. 'sg_dsgl' is used to describe the
- * destination that cipher text and a tag should be written
- * to.
- */
- struct sglist *sg_input;
- struct sglist *sg_output;
- struct sglist *sg_ulptx;
- struct sglist *sg_dsgl;
-};
-
struct ccr_softc {
struct adapter *adapter;
device_t dev;
@@ -253,6 +216,44 @@ struct ccr_softc {
struct sysctl_ctx_list ctx;
};
+struct ccr_session {
+#ifdef INVARIANTS
+ int pending;
+#endif
+ enum { HASH, HMAC, CIPHER, ETA, GCM, CCM } mode;
+ struct ccr_softc *sc;
+ struct ccr_port *port;
+ union {
+ struct ccr_session_hmac hmac;
+ struct ccr_session_gmac gmac;
+ struct ccr_session_ccm_mac ccm_mac;
+ };
+ struct ccr_session_cipher cipher;
+ struct mtx lock;
+
+ /*
+ * A fallback software session is used for certain GCM/CCM
+ * requests that the hardware can't handle such as requests
+ * with only AAD and no payload.
+ */
+ crypto_session_t sw_session;
+
+ /*
+ * Pre-allocate S/G lists used when preparing a work request.
+ * 'sg_input' contains an sglist describing the entire input
+ * buffer for a 'struct cryptop'. 'sg_output' contains an
+ * sglist describing the entire output buffer. 'sg_ulptx' is
+ * used to describe the data the engine should DMA as input
+ * via ULPTX_SGL. 'sg_dsgl' is used to describe the
+ * destination that cipher text and a tag should be written
+ * to.
+ */
+ struct sglist *sg_input;
+ struct sglist *sg_output;
+ struct sglist *sg_ulptx;
+ struct sglist *sg_dsgl;
+};
+
/*
* Crypto requests involve two kind of scatter/gather lists.
*
@@ -1964,7 +1965,6 @@ ccr_attach(device_t dev)
return (ENXIO);
}
sc->cid = cid;
- sc->adapter->ccr_softc = sc;
/*
* The FID must be the first RXQ for port 0 regardless of
@@ -2043,7 +2043,6 @@ ccr_detach(device_t dev)
}
sglist_free(sc->sg_iv_aad);
free(sc->iv_aad_buf, M_CCR);
- sc->adapter->ccr_softc = NULL;
return (0);
}
@@ -2425,6 +2424,7 @@ ccr_newsession(device_t dev, crypto_session_t cses,
}
sc = device_get_softc(dev);
+ s->sc = sc;
mtx_lock(&sc->lock);
if (sc->detaching) {
@@ -2652,7 +2652,7 @@ static int
do_cpl6_fw_pld(struct sge_iq *iq, const struct rss_header *rss,
struct mbuf *m)
{
- struct ccr_softc *sc = iq->adapter->ccr_softc;
+ struct ccr_softc *sc;
struct ccr_session *s;
const struct cpl_fw6_pld *cpl;
struct cryptop *crp;
@@ -2672,6 +2672,7 @@ do_cpl6_fw_pld(struct sge_iq *iq, const struct rss_header *rss,
else
error = 0;
+ sc = s->sc;
#ifdef INVARIANTS
mtx_lock(&s->lock);
s->pending--;