diff options
Diffstat (limited to 'sys/dev/cxgbe/crypto/t6_kern_tls.c')
-rw-r--r-- | sys/dev/cxgbe/crypto/t6_kern_tls.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/sys/dev/cxgbe/crypto/t6_kern_tls.c b/sys/dev/cxgbe/crypto/t6_kern_tls.c index f374de5241f6..04bb6c944050 100644 --- a/sys/dev/cxgbe/crypto/t6_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t6_kern_tls.c @@ -995,7 +995,7 @@ t6_ktls_parse_pkt(struct mbuf *m) * See if we have any TCP options or a FIN requiring a * dedicated packet. */ - if ((tcp->th_flags & TH_FIN) != 0 || ktls_has_tcp_options(tcp)) { + if ((tcp_get_flags(tcp) & TH_FIN) != 0 || ktls_has_tcp_options(tcp)) { wr_len = sizeof(struct fw_eth_tx_pkt_wr) + sizeof(struct cpl_tx_pkt_core) + roundup2(m->m_len, 16); if (wr_len > SGE_MAX_WR_LEN) { @@ -1167,7 +1167,8 @@ ktls_write_tcp_options(struct sge_txq *txq, void *dst, struct mbuf *m, } else { ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen); newip6 = *ip6; - newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen); + newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen - + sizeof(*ip6)); copy_to_txd(&txq->eq, (caddr_t)&newip6, &out, sizeof(newip6)); MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6)); ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) | @@ -1180,7 +1181,7 @@ ktls_write_tcp_options(struct sge_txq *txq, void *dst, struct mbuf *m, /* Clear PUSH and FIN in the TCP header if present. */ tcp = (void *)((char *)eh + m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen); newtcp = *tcp; - newtcp.th_flags &= ~(TH_PUSH | TH_FIN); + tcp_set_flags(&newtcp, tcp_get_flags(&newtcp) & ~(TH_PUSH | TH_FIN)); copy_to_txd(&txq->eq, (caddr_t)&newtcp, &out, sizeof(newtcp)); /* Copy rest of packet. */ @@ -1267,7 +1268,8 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *dst, struct mbuf *m, } else { ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen); newip6 = *ip6; - newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen); + newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen - + sizeof(*ip6)); copy_to_txd(&txq->eq, (caddr_t)&newip6, &out, sizeof(newip6)); MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6)); ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) | @@ -1370,7 +1372,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq *txq, void *dst, CTR4(KTR_CXGBE, "%s: tid %d short TLS record %u with offset %u", __func__, tlsp->tid, (u_int)m_tls->m_epg_seqno, offset); #endif - if (m_tls->m_next == NULL && (tcp->th_flags & TH_FIN) != 0) { + if (m_tls->m_next == NULL && (tcp_get_flags(tcp) & TH_FIN) != 0) { txq->kern_tls_fin_short++; #ifdef INVARIANTS panic("%s: FIN on short TLS record", __func__); @@ -1385,7 +1387,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq *txq, void *dst, * FIN is set, then ktls_write_tcp_fin() will write out the * last work request. */ - last_wr = m_tls->m_next == NULL && (tcp->th_flags & TH_FIN) == 0; + last_wr = m_tls->m_next == NULL && (tcp_get_flags(tcp) & TH_FIN) == 0; /* * The host stack may ask us to not send part of the start of @@ -1769,7 +1771,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq *txq, void *dst, tx_data->rsvd = htobe32(tcp_seqno + m_tls->m_epg_hdrlen + offset); } tx_data->flags = htobe32(F_TX_BYPASS); - if (last_wr && tcp->th_flags & TH_PUSH) + if (last_wr && tcp_get_flags(tcp) & TH_PUSH) tx_data->flags |= htobe32(F_TX_PUSH | F_TX_SHOVE); /* Populate the TLS header */ @@ -1793,9 +1795,11 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq *txq, void *dst, } if (imm_len % 16 != 0) { - /* Zero pad to an 8-byte boundary. */ - memset(out, 0, 8 - (imm_len % 8)); - out += 8 - (imm_len % 8); + if (imm_len % 8 != 0) { + /* Zero pad to an 8-byte boundary. */ + memset(out, 0, 8 - (imm_len % 8)); + out += 8 - (imm_len % 8); + } /* * Insert a ULP_TX_SC_NOOP if needed so the SGL is @@ -1909,7 +1913,8 @@ ktls_write_tcp_fin(struct sge_txq *txq, void *dst, struct mbuf *m, } else { ip6 = (void *)((char *)eh + m->m_pkthdr.l2hlen); newip6 = *ip6; - newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen); + newip6.ip6_plen = htons(pktlen - m->m_pkthdr.l2hlen - + sizeof(*ip6)); copy_to_txd(&txq->eq, (caddr_t)&newip6, &out, sizeof(newip6)); MPASS(m->m_pkthdr.l3hlen == sizeof(*ip6)); ctrl1 = V_TXPKT_CSUM_TYPE(TX_CSUM_TCPIP6) | @@ -1966,7 +1971,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struct mbuf *m, tcp = (struct tcphdr *)((char *)eh + m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen); pidx = eq->pidx; - has_fin = (tcp->th_flags & TH_FIN) != 0; + has_fin = (tcp_get_flags(tcp) & TH_FIN) != 0; /* * If this TLS record has a FIN, then we will send any |