git: d75b0870e542 - main - cxgbei: Restrict received PDUs to 4 DDP pages in length.
John Baldwin
jhb at FreeBSD.org
Tue Aug 17 18:34:27 UTC 2021
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=d75b0870e542613e63d9f4ac8ec9fb22817e34fa
commit d75b0870e542613e63d9f4ac8ec9fb22817e34fa
Author: John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-08-17 18:14:37 +0000
Commit: John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-08-17 18:14:37 +0000
cxgbei: Restrict received PDUs to 4 DDP pages in length.
Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D31576
---
sys/dev/cxgbe/cxgbei/cxgbei.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c
index acf6ee74c94f..8dc580d65770 100644
--- a/sys/dev/cxgbe/cxgbei/cxgbei.c
+++ b/sys/dev/cxgbe/cxgbei/cxgbei.c
@@ -98,7 +98,7 @@ static struct proc *cxgbei_proc;
static void
read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len,
- uint32_t *max_rx_data_len)
+ uint32_t *max_rx_data_len, struct ppod_region *pr)
{
uint32_t tx_len, rx_len, r, v;
@@ -123,6 +123,14 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_data_len,
tx_len -= ISCSI_BHS_SIZE + ISCSI_HEADER_DIGEST_SIZE +
ISCSI_DATA_DIGEST_SIZE;
+ /*
+ * DDP can place only 4 pages for a single PDU. A single
+ * request might use larger pages than the smallest page size,
+ * but that cannot be guaranteed. Assume the smallest DDP
+ * page size for this limit.
+ */
+ rx_len = min(rx_len, 4 * (1U << pr->pr_page_shift[0]));
+
if (chip_id(sc) == CHELSIO_T5) {
rx_len = rounddown2(rx_len, 512);
tx_len = rounddown2(tx_len, 512);
@@ -149,8 +157,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci)
MPASS(sc->vres.iscsi.size > 0);
MPASS(ci != NULL);
- read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len);
-
pr = &ci->pr;
r = t4_read_reg(sc, A_ULP_RX_ISCSI_PSZ);
rc = t4_init_ppod_region(pr, &sc->vres.iscsi, r, "iSCSI page pods");
@@ -176,6 +182,8 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci)
V_ISCSITAGMASK(M_ISCSITAGMASK), pr->pr_tag_mask);
}
+ read_pdu_limits(sc, &ci->max_tx_data_len, &ci->max_rx_data_len, pr);
+
sysctl_ctx_init(&ci->ctx);
oid = device_get_sysctl_tree(sc->dev); /* dev.t5nex.X */
children = SYSCTL_CHILDREN(oid);
More information about the dev-commits-src-main
mailing list