git: 06b2ed7a3adf - main - nvmf_tcp: Correct padding calculation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 02 Nov 2024 13:54:55 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=06b2ed7a3adf023d8a8ce821616052f03dc18ed6 commit 06b2ed7a3adf023d8a8ce821616052f03dc18ed6 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-11-02 13:54:29 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-11-02 13:54:29 +0000 nvmf_tcp: Correct padding calculation PDU data alignment (PDA) isn't necessarily a power of 2, just a multiple of 4, so use roundup() instead of roundup2() to compute the PDU data offset (PDO). Sponsored by: Chelsio Communications --- lib/libnvmf/nvmf_tcp.c | 2 +- sys/dev/nvmf/nvmf_tcp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libnvmf/nvmf_tcp.c b/lib/libnvmf/nvmf_tcp.c index cc4c0b90b0fb..264a5bb154a0 100644 --- a/lib/libnvmf/nvmf_tcp.c +++ b/lib/libnvmf/nvmf_tcp.c @@ -432,7 +432,7 @@ nvmf_tcp_construct_pdu(struct nvmf_tcp_qpair *qp, void *hdr, size_t hlen, if (qp->header_digests) plen += sizeof(header_digest); if (data_len != 0) { - pdo = roundup2(plen, qp->txpda); + pdo = roundup(plen, qp->txpda); pad = pdo - plen; plen = pdo + data_len; if (qp->data_digests) diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c index 2e33334b92ee..50adbfdd2917 100644 --- a/sys/dev/nvmf/nvmf_tcp.c +++ b/sys/dev/nvmf/nvmf_tcp.c @@ -442,7 +442,7 @@ nvmf_tcp_construct_pdu(struct nvmf_tcp_qpair *qp, void *hdr, size_t hlen, plen += sizeof(digest); if (data_len != 0) { KASSERT(m_length(data, NULL) == data_len, ("length mismatch")); - pdo = roundup2(plen, qp->txpda); + pdo = roundup(plen, qp->txpda); pad = pdo - plen; plen = pdo + data_len; if (qp->data_digests)