git: 56bc3b1a95bb - stable/13 - cxgbei: Disable ISO for -SO cards without external memory.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 29 Oct 2021 23:58:41 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=56bc3b1a95bb54ea1653c483d77871f5334637b0

commit 56bc3b1a95bb54ea1653c483d77871f5334637b0
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-09-13 16:57:54 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-10-29 23:35:15 +0000

    cxgbei: Disable ISO for -SO cards without external memory.
    
    Reported by:    Jithesh Arakkan @ Chelsio
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 9b1bb0aee697352b39b3efa1843f581ca29068ba)
---
 sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
index 687fc545cebd..4b1eb0718e86 100644
--- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
+++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
@@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$");
 #include <cam/scsi/scsi_message.h>
 
 #include "common/common.h"
+#include "common/t4_regs.h"
 #include "common/t4_tcb.h"
 #include "tom/t4_tom.h"
 #include "cxgbei.h"
@@ -707,6 +708,19 @@ find_offload_adapter(struct adapter *sc, void *arg)
 	INP_WUNLOCK(inp);
 }
 
+static bool
+is_memfree(struct adapter *sc)
+{
+	uint32_t em;
+
+	em = t4_read_reg(sc, A_MA_TARGET_MEM_ENABLE);
+	if ((em & F_EXT_MEM_ENABLE) != 0)
+		return (false);
+	if (is_t5(sc) && (em & F_EXT_MEM1_ENABLE) != 0)
+		return (false);
+	return (true);
+}
+
 /* XXXNP: move this to t4_tom. */
 static void
 send_iscsi_flowc_wr(struct adapter *sc, struct toepcb *toep, int maxlen)
@@ -863,7 +877,8 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd)
 		if (ic->ic_data_crc32c)
 			icc->ulp_submode |= ULP_CRC_DATA;
 
-		if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5) {
+		if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 &&
+		    !is_memfree(icc->sc)) {
 			max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD /
 			    max_tx_pdu_len;
 			ic->ic_hw_isomax = max_iso_pdus *