From nobody Mon Aug 08 18:22:22 2022 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 4M1l0t6YW2z4YkHV; Mon, 8 Aug 2022 18:22:22 +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 4M1l0t5zvkz3XCr; Mon, 8 Aug 2022 18:22:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659982942; 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=of/LdWoPdgmSDiwycNQrR7TUcqLa0479j5k7C/3hS6I=; b=X+LNALK/sF6HSC8gAdO2xGzFYCEHUH3IVKNrgkT78+TYBl3FP3XQ9HTltsz1oheVjY6Gbt oWPsQvIPnBkNV2cvoH/7gxajVHwCh/P2xCiCHIfzwYmXHBCqIHZVsl6mQjJZWSD5eLLDDX 9cFuuHPmgEvEciRvaF3jqQonFpx+zxmTPk7wNeU9aO9tGAPozGQvpy+BZiD8Th2tGqGWbx 3mf/klfg0yg+yGmoDBfktEGPSXrVWlOFO5n4TKdmXDrDv33OZi1jx6VhVFGOE228JxBwUA zCIaJrP+6WY6XavgasWB4nVSBzNpVlMi1Zy9CVZ8p9ISFAs+/9yT9v1a8XEcow== 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 4M1l0t526lz12Pk; Mon, 8 Aug 2022 18:22:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 278IMMST040900; Mon, 8 Aug 2022 18:22:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 278IMMQo040899; Mon, 8 Aug 2022 18:22:22 GMT (envelope-from git) Date: Mon, 8 Aug 2022 18:22:22 GMT Message-Id: <202208081822.278IMMQo040899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: bbb2f537156b - main - cxgbe: Rename t4_kern_tls.c to t6_kern_tls.c. 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/main X-Git-Reftype: branch X-Git-Commit: bbb2f537156b663560cb0a45933c0fafdd2525a3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659982942; 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=of/LdWoPdgmSDiwycNQrR7TUcqLa0479j5k7C/3hS6I=; b=x8WjRbykzK4t8ih/9YscEr4W+1o3TLgi9yZunmY+QAATlAS03HrHziEGFnv9WruQBedxqe RFZzbZIbSNfkueH52ltrk8bwZdZY19BSjVyq55GSeFBq2ltNofEU+hqQnD4o/wjLqrQhGf 1L6rsKUCppW6Bkwfs3w09bwIpqesizZYIpFYR6ytpJyMZLZp5C3P1i0HsienAQ351468tG 8xrPn4g4NTUPjzHKSjnGVl7snFcbQjy1SSDPhVtQkW9JjCCH3ZrmwP+LIk07Zm9BR1Vm3y J0ZC2n1J8HfoYQYHHbppM2T1yfut/zHpgtbSEf1EQo1qp87zjTQW8wQSyjRUEQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659982942; a=rsa-sha256; cv=none; b=oU3QncrEqNyx4Uvensn64lC+BgS0vUiaKwdS//dD5V5ZvGpNmpQHfboVp6XBdS1aFLWJB3 FxIsp/bVSqAX3XquhbDnktyV76ppY+iuJ/PyPuMml5irPavgG89Jk1q8JExnHrfHAIC2sr uukkjMCM3sadpjX6aUml4tm+XO9L2uZVZiHO2A/PPt+u9TKFMcuR8DHbLZp9GOAQFzG31z 1e4OhcdgnEUvK3B5SLQOATzXnYLFsaoYYwgmQve2Ri/WVUpPaEK9pOQ6DU0FcXNlpjM97O U3KenPUY7WvP7LVUzB+wzueuYZKh6DflYyAS4344thOoOf8j84aV/tvbvb80pQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bbb2f537156b663560cb0a45933c0fafdd2525a3 commit bbb2f537156b663560cb0a45933c0fafdd2525a3 Author: John Baldwin AuthorDate: 2022-08-08 18:21:53 +0000 Commit: John Baldwin CommitDate: 2022-08-08 18:21:53 +0000 cxgbe: Rename t4_kern_tls.c to t6_kern_tls.c. This implementation of NIC TLS is specific to T6 adapters. Sponsored by: Chelsio Communications --- sys/conf/files | 2 +- sys/dev/cxgbe/adapter.h | 4 +- .../cxgbe/crypto/{t4_kern_tls.c => t6_kern_tls.c} | 14 +++--- sys/dev/cxgbe/t4_main.c | 50 ++++++++++++++-------- sys/modules/cxgbe/if_cxgbe/Makefile | 2 +- 5 files changed, 44 insertions(+), 28 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 0bfd6c147203..bca5c127b525 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1459,7 +1459,7 @@ dev/cxgbe/common/t4_hw.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/common/t4vf_hw.c optional cxgbev pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" -dev/cxgbe/crypto/t4_kern_tls.c optional cxgbe pci kern_tls \ +dev/cxgbe/crypto/t6_kern_tls.c optional cxgbe pci kern_tls \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/crypto/t4_keyctx.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 637fee6b4a78..555f8b36531d 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1299,8 +1299,8 @@ void cxgbe_media_status(struct ifnet *, struct ifmediareq *); void t4_os_cim_err(struct adapter *); #ifdef KERN_TLS -/* t4_kern_tls.c */ -int cxgbe_tls_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, +/* t6_kern_tls.c */ +int t6_tls_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); void t6_ktls_modload(void); void t6_ktls_modunload(void); diff --git a/sys/dev/cxgbe/crypto/t4_kern_tls.c b/sys/dev/cxgbe/crypto/t6_kern_tls.c similarity index 99% rename from sys/dev/cxgbe/crypto/t4_kern_tls.c rename to sys/dev/cxgbe/crypto/t6_kern_tls.c index 725d15e9cb35..1374530f941f 100644 --- a/sys/dev/cxgbe/crypto/t4_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t6_kern_tls.c @@ -102,12 +102,12 @@ struct tlspcb { bool open_pending; }; -static void cxgbe_tls_tag_free(struct m_snd_tag *mst); +static void t6_tls_tag_free(struct m_snd_tag *mst); static int ktls_setup_keys(struct tlspcb *tlsp, const struct ktls_session *tls, struct sge_txq *txq); -static const struct if_snd_tag_sw cxgbe_tls_tag_sw = { - .snd_tag_free = cxgbe_tls_tag_free, +static const struct if_snd_tag_sw t6_tls_tag_sw = { + .snd_tag_free = t6_tls_tag_free, .type = IF_SND_TAG_TYPE_TLS }; @@ -128,7 +128,7 @@ alloc_tlspcb(struct ifnet *ifp, struct vi_info *vi, int flags) if (tlsp == NULL) return (NULL); - m_snd_tag_init(&tlsp->com, ifp, &cxgbe_tls_tag_sw); + m_snd_tag_init(&tlsp->com, ifp, &t6_tls_tag_sw); tlsp->vi = vi; tlsp->sc = sc; tlsp->ctrlq = &sc->sge.ctrlq[pi->port_id]; @@ -373,7 +373,7 @@ ktls_set_tcb_fields(struct tlspcb *tlsp, struct tcpcb *tp, struct sge_txq *txq) } int -cxgbe_tls_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, +t6_tls_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, struct m_snd_tag **pt) { const struct ktls_session *tls; @@ -2078,7 +2078,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struct mbuf *m, u_int nsegs, } static void -cxgbe_tls_tag_free(struct m_snd_tag *mst) +t6_tls_tag_free(struct m_snd_tag *mst) { struct adapter *sc; struct tlspcb *tlsp; @@ -2119,7 +2119,7 @@ t6_ktls_modunload(void) #else int -cxgbe_tls_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, +t6_tls_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, struct m_snd_tag **pt) { return (ENXIO); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 20d69c06f779..27403b681208 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -686,7 +686,7 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, cop_managed_offloading, CTLFLAG_RDTUN, */ static int t4_kern_tls = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, kern_tls, CTLFLAG_RDTUN, &t4_kern_tls, 0, - "Enable KERN_TLS mode for all supported adapters"); + "Enable KERN_TLS mode for T6 adapters"); SYSCTL_NODE(_hw_cxgbe, OID_AUTO, tls, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "cxgbe(4) KERN_TLS parameters"); @@ -1840,7 +1840,10 @@ ok_to_reset(struct adapter *sc) struct port_info *pi; struct vi_info *vi; int i, j; - const int caps = IFCAP_TOE | IFCAP_TXTLS | IFCAP_NETMAP | IFCAP_TXRTLMT; + int caps = IFCAP_TOE | IFCAP_NETMAP | IFCAP_TXRTLMT; + + if (is_t6(sc)) + caps |= IFCAP_TXTLS; ASSERT_SYNCHRONIZED_OP(sc); MPASS(!(sc->flags & IS_VF)); @@ -2554,7 +2557,7 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) #ifdef KERN_TLS if (is_ktls(sc)) { ifp->if_capabilities |= IFCAP_TXTLS; - if (sc->flags & KERN_TLS_ON) + if (sc->flags & KERN_TLS_ON || !is_t6(sc)) ifp->if_capenable |= IFCAP_TXTLS; } #endif @@ -3162,8 +3165,15 @@ cxgbe_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, #endif #ifdef KERN_TLS case IF_SND_TAG_TYPE_TLS: - error = cxgbe_tls_tag_alloc(ifp, params, pt); + { + struct vi_info *vi = ifp->if_softc; + + if (is_t6(vi->pi->adapter)) + error = t6_tls_tag_alloc(ifp, params, pt); + else + error = EOPNOTSUPP; break; + } #endif default: error = EOPNOTSUPP; @@ -5508,7 +5518,7 @@ ktls_tick(void *arg) } static int -t4_config_kern_tls(struct adapter *sc, bool enable) +t6_config_kern_tls(struct adapter *sc, bool enable) { int rc; uint32_t param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | @@ -5654,12 +5664,13 @@ set_params__post_init(struct adapter *sc) */ t4_tp_wr_bits_indirect(sc, A_TP_FRAG_CONFIG, V_PASSMODE(M_PASSMODE), V_PASSMODE(2)); - if (is_ktls(sc)) { - sc->tlst.inline_keys = t4_tls_inline_keys; - sc->tlst.combo_wrs = t4_tls_combo_wrs; - if (t4_kern_tls != 0) - t4_config_kern_tls(sc, true); - } + } + + if (is_ktls(sc)) { + sc->tlst.inline_keys = t4_tls_inline_keys; + sc->tlst.combo_wrs = t4_tls_combo_wrs; + if (t4_kern_tls != 0 && is_t6(sc)) + t6_config_kern_tls(sc, true); } #endif return (0); @@ -7540,9 +7551,12 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RW, &sc->tlst.inline_keys, 0, "Always pass TLS " "keys in work requests (1) or attempt to store TLS keys " "in card memory."); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "combo_wrs", - CTLFLAG_RW, &sc->tlst.combo_wrs, 0, "Attempt to combine " - "TCB field updates with TLS record work requests."); + + if (is_t6(sc)) + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "combo_wrs", + CTLFLAG_RW, &sc->tlst.combo_wrs, 0, "Attempt to " + "combine TCB field updates with TLS record work " + "requests."); } #endif @@ -12395,7 +12409,7 @@ toe_capability(struct vi_info *vi, bool enable) if (enable) { #ifdef KERN_TLS - if (sc->flags & KERN_TLS_ON) { + if (sc->flags & KERN_TLS_ON && is_t6(sc)) { int i, j, n; struct port_info *p; struct vi_info *v; @@ -12422,7 +12436,7 @@ toe_capability(struct vi_info *vi, bool enable) "trying to enable TOE.\n"); return (EAGAIN); } - rc = t4_config_kern_tls(sc, false); + rc = t6_config_kern_tls(sc, false); if (rc) return (rc); } @@ -12665,6 +12679,8 @@ ktls_capability(struct adapter *sc, bool enable) if (!is_ktls(sc)) return (ENODEV); + if (!is_t6(sc)) + return (0); if (hw_off_limits(sc)) return (ENXIO); @@ -12677,7 +12693,7 @@ ktls_capability(struct adapter *sc, bool enable) "this adapter before trying to enable NIC TLS.\n"); return (EAGAIN); } - return (t4_config_kern_tls(sc, true)); + return (t6_config_kern_tls(sc, true)); } else { /* * Nothing to do for disable. If TOE is enabled sometime later diff --git a/sys/modules/cxgbe/if_cxgbe/Makefile b/sys/modules/cxgbe/if_cxgbe/Makefile index 7210d4e8835e..723029264bac 100644 --- a/sys/modules/cxgbe/if_cxgbe/Makefile +++ b/sys/modules/cxgbe/if_cxgbe/Makefile @@ -24,7 +24,7 @@ SRCS+= t4_hw.c SRCS+= t4_if.c t4_if.h SRCS+= t4_iov.c .if ${KERN_OPTS:MKERN_TLS} != "" -SRCS+= t4_kern_tls.c +SRCS+= t6_kern_tls.c .endif SRCS+= t4_keyctx.c SRCS+= t4_l2t.c