git: 0967aa717d50 - stable/13 - cxgbei: Restrict received PDUs to 4 DDP pages in length.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Oct 2021 23:58:35 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0967aa717d50e767c756a2ab4969424bccb29b01 commit 0967aa717d50e767c756a2ab4969424bccb29b01 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2021-08-17 18:14:37 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2021-10-29 23:30:43 +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 (cherry picked from commit d75b0870e542613e63d9f4ac8ec9fb22817e34fa) --- 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);