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
This commit is contained in:
John Baldwin 2024-11-02 09:54:29 -04:00
parent 7b8dd078ea
commit 06b2ed7a3a
2 changed files with 2 additions and 2 deletions

View File

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

View File

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