From nobody Wed Sep 6 21:56:32 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rgx6906tHz4sJJ9; Wed, 6 Sep 2023 21:56:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rgx686Zd2z3ZlC; Wed, 6 Sep 2023 21:56:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694037392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YdWwSylJOobmF+gb8Sldm9c18ZcCa/r0N5Dk1mfVrfw=; b=R+dZgvnfWo1FtPQLyhNGjNr3XBTqCRzqvMXQBZTg+Qm+PnP/cik8IFBhvL+7i7koHPp7F3 8rNyMP3VYyuOlBxtWDsmr2/Ww7iGE+u0f7WKFZaQzhK123fvxj43OIePUSA4Pb9bXAJ43k VHiObYNpccAb3SkH4dbFGoorbJ7mXI9b0qXtmXu9aI929jiTlpUAlw9DPqGvvDcyhZmEsf f9hG+Kt8QQWisABuZ4cPqmwexAhff5r3ZVhhmv7VorYJJDGvcT4S9KILMBYyTb5Xs6FRW+ gM6ffwyK9s0jHoPpxfaYDztsEf4q5NXJVd+6RpiguRjQ3d77O2BFVUU7FGyLDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694037392; a=rsa-sha256; cv=none; b=YNXL/pRmayveCkaC8uCsrVtC9oxL2EnnbrFJ6KaA6dvulbTLb8Meo+WuRy9CncpB8X3mAc fL2kZtIvEROCauUOgeYbvBI5SOetOJjiC0xmyOjhZ0zeIBaqYYk0vf37Fb3BRuEwQzyrwG zOikJLdLgc9GhXptQEMk4kDErKTboD5Zt4lL/m/oqO23lEBmELaGi1sfyqQ0I4hjblct0o mc3w0dnVR1xAsLcqFrskY9tnHG+8HG7YmI8kIM247Lqx9tbSZ3tvAwYy+B9HxVTX0BAfwW 3EYBWMgMqy6DUA1HYVccTH5FTwNz/mQsv+bMIXoIpnhtZ/ZAVaZ6wfAk6fFxVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694037392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YdWwSylJOobmF+gb8Sldm9c18ZcCa/r0N5Dk1mfVrfw=; b=LK0pg4LYgXWgy+QYEEfgORzxBQE9BQbM5tdCF7U+PGx05BftjTWogC5meWYNxLGT+hP9Dj HxAHGyAjoR+2FOWBNrBIr3KWkFsiSoY7DVqBjJ4L8hEzHH0FZ/bAWLSVeGQe+JabzEko++ aYxe9ZqU0hW65RNcQCw3qbwer+pdFWGXoD78ktUIphjqAZoRQt16x7RrpiXP1NBpPodA7E 54K+RqPdiGZYvALgQ6aYM/biSEVaBzQytAFQt2NlzKTcfABspcDhSS8D6aPOybeHTPjt2Z 2Oqa8/HhEQq0sG0Ch6g3APqnqmlUDpepJkf0h4UZiJyj/RF2UaGx6XhdHf+nmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Rgx685c6LzZ8q; Wed, 6 Sep 2023 21:56:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 386LuW2e022425; Wed, 6 Sep 2023 21:56:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 386LuW2i022422; Wed, 6 Sep 2023 21:56:32 GMT (envelope-from git) Date: Wed, 6 Sep 2023 21:56:32 GMT Message-Id: <202309062156.386LuW2i022422@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 12e299e2ab7d - stable/13 - ccr: Retire ccr_softc member in struct adapter. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 12e299e2ab7ded962fbd4b083432f84efa3d3a60 Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=12e299e2ab7ded962fbd4b083432f84efa3d3a60 commit 12e299e2ab7ded962fbd4b083432f84efa3d3a60 Author: John Baldwin AuthorDate: 2022-12-29 19:39:28 +0000 Commit: John Baldwin CommitDate: 2023-09-06 21:56:09 +0000 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 (cherry picked from commit 7063b9974f8a39d860b7abd03884324e71994f65) --- sys/dev/cxgbe/adapter.h | 1 - sys/dev/cxgbe/crypto/t4_crypto.c | 81 ++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index ee6e23d1e43e..58ea1eb3f29a 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -942,7 +942,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 98930da6c1f4..7301174614d2 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -175,43 +175,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; @@ -251,6 +214,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. * @@ -1956,7 +1957,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 @@ -2035,7 +2035,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); } @@ -2417,6 +2416,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) { @@ -2644,7 +2644,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; @@ -2664,6 +2664,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--;