Date: Fri, 11 Nov 2022 00:39:04 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 38168ab37f25 - stable/13 - cxgbe: Rename t4_kern_tls.c to t6_kern_tls.c. Message-ID: <202211110039.2AB0d4RM057329@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=38168ab37f2549703e4678814e74fc0300fc0bff commit 38168ab37f2549703e4678814e74fc0300fc0bff Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-08-08 18:21:53 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-11-11 00:35:35 +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 (cherry picked from commit bbb2f537156b663560cb0a45933c0fafdd2525a3) --- sys/conf/files | 2 +- sys/dev/cxgbe/adapter.h | 6 +-- .../cxgbe/crypto/{t4_kern_tls.c => t6_kern_tls.c} | 8 ++-- sys/dev/cxgbe/t4_main.c | 52 ++++++++++++++-------- sys/modules/cxgbe/if_cxgbe/Makefile | 2 +- 5 files changed, 43 insertions(+), 27 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 2af31ca3dc44..ab20cea43699 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1481,7 +1481,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 9efad088cdfe..db72a7baf189 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1297,10 +1297,10 @@ 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 cxgbe_tls_tag_free(struct m_snd_tag *); +void t6_tls_tag_free(struct m_snd_tag *); void t6_ktls_modload(void); void t6_ktls_modunload(void); int t6_ktls_try(struct ifnet *, struct socket *, struct ktls_session *); 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 a20c3045b5b3..f34da07903c8 100644 --- a/sys/dev/cxgbe/crypto/t4_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t6_kern_tls.c @@ -367,7 +367,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; @@ -2072,7 +2072,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struct mbuf *m, u_int nsegs, } 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; @@ -2113,7 +2113,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); @@ -2133,7 +2133,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struct mbuf *m, u_int nsegs, } void -cxgbe_tls_tag_free(struct m_snd_tag *mst) +t6_tls_tag_free(struct m_snd_tag *mst) { panic("can't happen"); } diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 6c1a8162b477..3d4e2f3a7a71 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -691,7 +691,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"); @@ -1846,7 +1846,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)); @@ -2563,7 +2566,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 @@ -3171,8 +3174,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; @@ -3222,7 +3232,7 @@ cxgbe_snd_tag_free(struct m_snd_tag *mst) #endif #ifdef KERN_TLS case IF_SND_TAG_TYPE_TLS: - cxgbe_tls_tag_free(mst); + t6_tls_tag_free(mst); return; #endif default: @@ -5556,7 +5566,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) | @@ -5702,12 +5712,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); @@ -7588,9 +7599,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 @@ -12428,7 +12442,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; @@ -12455,7 +12469,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); } @@ -12698,6 +12712,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); @@ -12710,7 +12726,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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202211110039.2AB0d4RM057329>