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 782db2881b)
This commit is contained in:
John Baldwin 2022-08-08 11:21:54 -07:00
parent 7252457be7
commit 39b724b727
2 changed files with 6 additions and 10 deletions

View file

@ -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 |

View file

@ -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 {