Date: Tue, 13 May 2025 14:11:48 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 2befd0658832 - main - cxgbe nic TLS: Fix requests with 8 bytes of immediate data padding Message-ID: <202505131411.54DEBmk3040830@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2befd06588325c541d400fcc4915a1adfd1c7d17 commit 2befd06588325c541d400fcc4915a1adfd1c7d17 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2025-05-13 13:57:18 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2025-05-13 14:05:09 +0000 cxgbe nic TLS: Fix requests with 8 bytes of immediate data padding Requests whose immediate data do not end on a 16-byte boundary are padded with zeroes before the next WR command. Since ULP commands are 8 byte aligned, if there are more than 8 bytes of padding, the immediate data is padded with zeroes up to an 8 byte boundary and the last 8 bytes contain a ULP NOOP command. In the case of exactly 8 bytes of padding, the result should be that no zeroes are inserted, only the ULP NOOP. However, the code was actually inserting 8 bytes of zero padding followed by the ULP NOOP causing the following real command to be misaligned. Fix this by skipping the zero padding if there exactly 8 padding bytes. Reported by: Sony Arpita Das @ Chelsio Sponsored by: Chelsio Communications --- sys/dev/cxgbe/crypto/t6_kern_tls.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/cxgbe/crypto/t6_kern_tls.c b/sys/dev/cxgbe/crypto/t6_kern_tls.c index 167eb77da942..897773d2d867 100644 --- a/sys/dev/cxgbe/crypto/t6_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t6_kern_tls.c @@ -1793,9 +1793,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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505131411.54DEBmk3040830>