Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Aug 2022 17:31:34 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: 39b724b72775 - stable/13 - cxgbe TOE TLS: Fix handling of unusual record types.
Message-ID:  <202208251731.27PHVYcP041533@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=39b724b72775bcb328ac1c220c67b288ff6f6aee

commit 39b724b72775bcb328ac1c220c67b288ff6f6aee
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-08-08 18:21:54 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-08-25 16:33:04 +0000

    cxgbe TOE TLS: Fix handling of unusual record types.
    
    This doesn't matter for real traffic but fixes failures in the KTLS
    unit tests that use unusual record types.
    
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 782db2881b6b9c8460f7f311e0e4bbbab36eb88a)
---
 sys/dev/cxgbe/tom/t4_tls.c | 14 +++++---------
 sys/dev/cxgbe/tom/t4_tls.h |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c
index 97bf3a016fb2..0a97d020eb94 100644
--- a/sys/dev/cxgbe/tom/t4_tls.c
+++ b/sys/dev/cxgbe/tom/t4_tls.c
@@ -268,11 +268,6 @@ tls_copy_tx_key(struct toepcb *toep, void *dst)
 static inline unsigned char
 tls_content_type(unsigned char content_type)
 {
-	/*
-	 * XXX: Shouldn't this map CONTENT_TYPE_APP_DATA to DATA and
-	 * default to "CUSTOM" for all other types including
-	 * heartbeat?
-	 */
 	switch (content_type) {
 	case CONTENT_TYPE_CCS:
 		return CPL_TX_TLS_SFO_TYPE_CCS;
@@ -280,10 +275,11 @@ tls_content_type(unsigned char content_type)
 		return CPL_TX_TLS_SFO_TYPE_ALERT;
 	case CONTENT_TYPE_HANDSHAKE:
 		return CPL_TX_TLS_SFO_TYPE_HANDSHAKE;
-	case CONTENT_TYPE_HEARTBEAT:
-		return CPL_TX_TLS_SFO_TYPE_HEARTBEAT;
+	case CONTENT_TYPE_APP_DATA:
+		return CPL_TX_TLS_SFO_TYPE_DATA;
+	default:
+		return CPL_TX_TLS_SFO_TYPE_CUSTOM;
 	}
-	return CPL_TX_TLS_SFO_TYPE_DATA;
 }
 
 static unsigned char
@@ -1277,7 +1273,7 @@ write_tlstx_cpl(struct cpl_tx_tls_sfo *cpl, struct toepcb *toep,
 	    V_CPL_TX_TLS_SFO_DATA_TYPE(data_type) |
 	    V_CPL_TX_TLS_SFO_CPL_LEN(2) | V_CPL_TX_TLS_SFO_SEG_LEN(seglen));
 	cpl->pld_len = htobe32(plen);
-	if (data_type == CPL_TX_TLS_SFO_TYPE_HEARTBEAT)
+	if (data_type == CPL_TX_TLS_SFO_TYPE_CUSTOM)
 		cpl->type_protover = htobe32(
 		    V_CPL_TX_TLS_SFO_TYPE(tls_hdr->type));
 	cpl->seqno_numivs = htobe32(tls_ofld->scmd0.seqno_numivs |
diff --git a/sys/dev/cxgbe/tom/t4_tls.h b/sys/dev/cxgbe/tom/t4_tls.h
index 37266206c31f..1950e6f927da 100644
--- a/sys/dev/cxgbe/tom/t4_tls.h
+++ b/sys/dev/cxgbe/tom/t4_tls.h
@@ -230,7 +230,7 @@ enum {
 	CPL_TX_TLS_SFO_TYPE_ALERT,
 	CPL_TX_TLS_SFO_TYPE_HANDSHAKE,
 	CPL_TX_TLS_SFO_TYPE_DATA,
-	CPL_TX_TLS_SFO_TYPE_HEARTBEAT,	/* XXX: Shouldn't this be "CUSTOM"? */
+	CPL_TX_TLS_SFO_TYPE_CUSTOM,
 };
 
 enum {



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