Commit graph

1169 commits

Author SHA1 Message Date
Gordon Bergling
5e25365d2b cxgbe(4): Fix a typo in a source code comment
- s/commmand/command/

(cherry picked from commit 5ee87525a8)
2022-04-09 08:13:42 +02:00
Andrew Gallatin
392d7f0269 cxgbe: fix enabling lro & rxtimestamps
A recent change caused iq flags, like LRO, to be set before
init_iq(). However, init_iq() clears those flags, so they
became effectively impossible to set.   This change moves
the initializion of these flags to after the call to init_iq().
This fixes LRO.

Differential Revision: https://reviews.freebsd.org/D30460
Reviewed by: np, rrs
Sponsored by: Netflix
Fixes: 43bbae1948

(cherry picked from commit df8437a93d)
2022-04-04 11:57:15 -07:00
Gordon Bergling
42a2373d22 cxgbe(4): Fix a typo in a source code comment
- s/begining/beginning/

(cherry picked from commit c9023cf7fe)
2022-04-02 15:29:40 +02:00
Navdeep Parhar
8c711d0aa2 cxgbe(4): Handle FORCE_FEC in pcaps correctly.
The firmware doesn't report FORCE_FEC in pcaps if the transceiver
plugged in at that time does not support a speed that may use FEC.  It
is incorrect for the driver to assume that the FORCE_FEC value it read
during attach (in init_link_config) is permanent.  Instead, it should
check pcaps just before issuing the L1CFG command.

Sponsored by:	Chelsio Communications

(cherry picked from commit 231f211240)
2022-04-01 18:49:43 -07:00
Navdeep Parhar
82386f825e cxgbe(4): Allow dump_cimla and dump_devlog to sleep.
This has been safe since e9e7bc8250, which moved parts of error
handling from the ithread to a taskqueue.

Sponsored by:	Chelsio Communications

(cherry picked from commit 41c4e1c7f7)
2022-04-01 18:48:52 -07:00
Navdeep Parhar
8824cbace3 cxgbe(4): dump_devlog should never fail silently.
Do the same thing as dump_cimla and log a warning on failure.

Sponsored by:	Chelsio Communications

(cherry picked from commit 9282f04ff0)
2022-03-09 14:45:11 -08:00
Navdeep Parhar
84195600d1 cxgbe(4): Dump some more debug registers in cim_dump_regs.
Sponsored by:	Chelsio Communications

(cherry picked from commit 17f564a784)
2022-03-04 16:37:28 -08:00
Navdeep Parhar
de6c7392d0 cxgbe(4): Changes to the fatal error handler.
* New error_flags that can be used from the error ithread and elsewhere
  without a synch_op.
* Stop the adapter immediately in t4_fatal_err but defer most of the
  rest of the handling to a task.  The task is allowed to sleep, unlike
  the ithread.  Remove async_event_task as it is no longer needed.
* Dump the devlog, CIMLA, and PCIE_FW exactly once on any fatal error
  involving the firmware or the CIM block.  While here, dump some
  additional info (see dump_cim_regs) for these errors.
* If both reset_on_fatal_err and panic_on_fatal_err are set then attempt
  a reset first and do not panic the system if it is successful.

Sponsored by:	Chelsio Communications

(cherry picked from commit e9e7bc8250)
2022-03-02 14:08:33 -08:00
Navdeep Parhar
d30946f4ad cxgbe(4): Fix build warning for LINT-NOIP.
MFC after:	1 week
Sponsored by:	Chelsio Communications

(cherry picked from commit 94e6b3fee1)
2022-03-02 13:28:40 -08:00
Navdeep Parhar
0a3ca84be1 cxgbe(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.
Sponsored by:	Chelsio Communications

(cherry picked from commit 39d5cbdc1b)
2022-03-02 13:25:55 -08:00
Navdeep Parhar
2a13985312 cxgbe(4): Fix illegal hardware access in cxgbe_refresh_stats.
cxgbe_refresh_stats takes into account VI_SKIP_STATS but not
VI_INIT_DONE when deciding whether to read the hardware stats.  But
before this change VI_SKIP_STATS was set only for VIs with VI_INIT_DONE.
That meant that cxgbe_refresh_stats always accessed the hardware for
uninitialized VIs, and this is a problem if the adapter is suspended or
in the middle of a reset.

Fix this by setting VI_SKIP_STATS on all VIs during suspend.  While
here, ignore VI_INIT_DONE in vi_refresh_stats too to be consistent with
cxgbe_refresh_stats.

Sponsored by:	Chelsio Communications

(cherry picked from commit 08c7dc7fd4)
2022-02-27 22:51:51 -08:00
Navdeep Parhar
2f733c60ff cxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.
The hardware is unavailable when the device is suspended or in the
middle of a reset.

Sponsored by:	Chelsio Communications

(cherry picked from commit 39a36707bd)
2022-02-27 22:51:32 -08:00
Navdeep Parhar
e005d417a2 cxgbe(4): Fix bad races between sysctl and driver detach.
The default sysctl context setup by newbus for a device is eventually
freed by device_sysctl_fini, which runs after the device driver's detach
routine.  sysctl nodes associated with this context must not use any
resources (like driver locks, hardware access, counters, etc.) that are
released by driver detach.

There are a lot of sysctl nodes like this in cxgbe(4) and the fix is to
hang them off a context that is explicitly freed by the driver before it
releases any resource that might be used by a sysctl.

This fixes panics when running "sysctl dev.t6nex dev.cc" in a tight loop
and loading/unloading the driver in parallel.

Reported by:	Suhas Lokesha
Sponsored by:	Chelsio Communications

(cherry picked from commit a727d9531a)
2022-02-27 22:51:04 -08:00
Navdeep Parhar
c50239ee30 cxgbe(4): Fix regression in previous attempt to fix FEC selection.
Sponsored by:	Chelsio Communications

(cherry picked from commit d0ff9b029c)
2022-02-27 22:50:29 -08:00
Navdeep Parhar
509de5dc8a cxgbe(4): Do not ignore the return value of ifmedia_ioctl.
This ensures that the driver reports an error instead of failing
silently when an invalid media is requested.

Reported by:	Suhas Lokesha @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit cdd7fe04cb)
2022-02-27 22:50:03 -08:00
Navdeep Parhar
438b835285 cxgbe(4): Do not request an FEC that is invalid for the requested speed.
This eliminates error messages like this from the driver when running at
50Gbps with 100G cables:
[3726] cc0: l1cfg failed: 71
[4407] cc0: l1cfg failed: 71

Note that link comes up anyway with or without this change.

Reported by:	Suhas Lokesha @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit f3c2987f2f)
2022-02-27 22:48:49 -08:00
Navdeep Parhar
86b0782a37 cxgbe(4): Update firmwares to 1.26.6.0.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CHANGES
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Version : 1.26.6.0
Date    : 01/03/2022
================================================================================

Fixes
-----
BASE:
- Fixed one module eeprom read failure.
- Fixed an issue with speed selection when 40G and 25G are advertised and
  supported.
- Fixed a random traffic hang when T5 receives invalid ets BW in dcbx
  messages from a switch.
- Fixed very long link up time with few switches.
================================================================================

Obtained from:	Chelsio Communications
Sponsored by:	Chelsio Communications

(cherry picked from commit 3b76242433)
2022-02-27 22:48:07 -08:00
Navdeep Parhar
cfe1193f5f cxgbe(4): Fix stats collection for ports with port_id != tx_chan
This fixes a driver panic during stats collection when a port's id does
not match its tx channel.  The bug affected only the T580 card running
with a non-default VPD.

Reported by:	Suhas Lokesha @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit bbab9ab579)
2022-02-27 22:47:42 -08:00
Navdeep Parhar
b6c0d81f7d cxgbe(4): Fix panic on driver detach after a partially failed attach.
sge->ctrlq is not always allocated during attach (eg. if firmware
initialization fails) and detach should be able to deal with this.

Sponsored by:	Chelsio Communications

(cherry picked from commit b99651c52f)
2022-02-27 22:47:19 -08:00
Navdeep Parhar
6be5e07275 cxgbe(4): Update firmwares to 1.26.4.0
(Rest is from the README that came with the firmware)

Version : 1.26.4.0
Date    : 12/02/2021

Fixes
-----

BASE:
- Fixed error on setting 25G speed on 100G copper with multiple FEC set in
  firmware commands.
- Handle link of unknown optics modules by enabling module tx unconditionally.
- Fixed link not coming up for 25G CRS phys. Firmware incorrectly tried to
  bring up the link in RS-FEC but as per IEEE spec, it must be BASER FEC.
- Fixed an issue where firmware doesn't automatically retry next FEC if driver
  asks to bring up the link using RS-FEC and link doesn't come up.

Obtained from:	Chelsio Communications
Sponsored by:	Chelsio Communications

(cherry picked from commit 357ba2cf17)
2022-02-27 22:46:38 -08:00
Navdeep Parhar
e804d75c13 cxgbe(4): Change the way t4_shutdown_adapter brings the link(s) down.
Modify the GPIO pins only on the Base-T cards and even there drive all
of them low instead of putting them in hi-z state.  For the rest (this
is the common case), directly power off the PLLs of the high speed
serdes.  This is the simplest method that does not involve or conflict
with the firmware but still works with all T4-T6 cards regardless of
what's plugged into the port.

This fixes a problem where the peer wouldn't always see a link down if
it is connected to the device using a -CR4 copper cable.

Sponsored by:	Chelsio Communications

(cherry picked from commit a8eacf9329)
2022-02-27 22:45:48 -08:00
Navdeep Parhar
f4592cd2a4 cxgbe(4): Keep link configuration compatible with really old firmwares.
Sponsored by:	Chelsio Communications

(cherry picked from commit 8e76bae0b7)
2022-02-27 22:45:20 -08:00
Navdeep Parhar
3db50d924d cxgbe(4): internal knob for flexible control over FEC selection.
Recent firmwares have support for autonomous FEC selection and a "force"
knob to let the driver control this behavior (or not) in a fine grained
manner. This change adds a driver knob so that all the different ways of
configuring the link FEC can be exercised. Note that this controls the
internal driver/firmware interaction for link configuration and is not
meant for general use.

Sponsored by:	Chelsio Communications

(cherry picked from commit 448bcd01dc)
2022-02-27 22:44:51 -08:00
Navdeep Parhar
512eb6235f cxgbe(4): separate sysctls for user-requested and in-use FEC.
Recent firmwares have more leeway in FEC selection and there is a need
to track the FECs requested by the driver separately from the FEC in use
on the link. The existing dev.<port>.<inst>.fec sysctl can read both but
its behavior depends on the link state and it is sometimes hard to find
out what was requested when the link is up.

Split the fec sysctl into two (requested_fec and link_fec) to get access
to both pieces of information regardless of the link state.

Sponsored by:	Chelsio Communications

(cherry picked from commit f6a2e1100f)
2022-02-27 22:43:59 -08:00
Navdeep Parhar
5f328e9e3f cxgbe(4): sysctl to track the last L1_CFG32 requested by the driver.
dev.<port>.<inst>.rcaps

 # sysctl dev.cc | grep rcaps
 dev.cc.1.rcaps: 581107776
 dev.cc.0.rcaps: 582156414

Sponsored by:	Chelsio Communications

(cherry picked from commit d99b1d83b9)
2022-02-27 22:42:32 -08:00
John Baldwin
d8feb950a6 Move the ICL_CONN_*LOCK* macros to <dev/iscsi/icl.h>.
These macros are not backend-specific but reference a
backend-independent field in struct icl_conn.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D32858

(cherry picked from commit e900338c09)
2021-11-23 15:11:53 -08:00
John Baldwin
ff590791ff cxgbe: Only run ktls_tick when NIC TLS is enabled.
Previously the body of ktls_tick was a nop when NIC TLS was disabled,
but the callout was still scheduled consuming power on otherwise-idle
systems with Chelsio T6 adapters.  Now the callout only runs while NIC
TLS is enabled on at least one interface of an adapter.

Reported by:	mav
Reviewed by:	np, mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D32491

(cherry picked from commit ef3f98ae47)
2021-11-23 15:11:43 -08:00
John Baldwin
5767c8ca4c cxgbei: Only convert "plain" TCP connections to ISCSI.
Reject attempts to convert a connection using a different ULP
mode: (e.g. DDP or TLS) to ISCSI.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit f63ddf465f)
2021-10-29 16:37:11 -07:00
John Baldwin
ed2a5ae6aa cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff.
This permits unindenting almost half of the function.

Sponsored by:	Chelsio Communications

(cherry picked from commit b7caa81576)
2021-10-29 16:36:10 -07:00
John Baldwin
56bc3b1a95 cxgbei: Disable ISO for -SO cards without external memory.
Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 9b1bb0aee6)
2021-10-29 16:35:15 -07:00
John Baldwin
075c8d9db3 cxgbei: Handle errors in PDUs.
When a PDU with an error (bad padding, header digest, or data digest)
is received, log the error via ICL_WARN() and then reset the
connection via the ic_error callback.

While here, add per-rxq counters for errors.

Sponsored by:	Chelsio Communications

(cherry picked from commit 4d4cf62e29)
2021-10-29 16:34:01 -07:00
John Baldwin
a75428c375 cxgbei: Add sysctls to report the maximum data segment lengths.
These sysctls report the maximum data segment lengths supported by an
adapter.  These are the values advertised to the remote end during the
login phase.

Sponsored by:	Chelsio Communications

(cherry picked from commit d39e65b5bd)
2021-10-29 16:33:14 -07:00
John Baldwin
d724218a74 cxgbei: Limit T5 transmit data segments to 15k.
This avoids exceeding a limit in the firmware when using ISO with
jumbo frames.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 64f09f2346)
2021-10-29 16:32:24 -07:00
John Baldwin
51983604da iscsi: Teach the iSCSI stack about "large" received PDUs.
When using iSCSI PDU offload (cxgbei) on T6 adapters, a burst of
received PDUs can be reported via a single message to the driver.

Previously the driver passed these multi-PDU bursts up to the iSCSI
stack up as a single "large" PDU by rewriting the buffer offset, data
segment length, and DataSN fields in the iSCSI header.  The DataSN
field in particular was rewritten so that each of the "large" PDUs
used consecutively increasing values.  While this worked, the forged
DataSN values did not match the ExpDataSN value in the subsequent SCSI
Response PDU.  The initiator does not currently verify this value, but
the forged DataSN values prevent adding a check.

To avoid this, allow a logical iSCSI PDU (struct icl_pdu) to describe
a burst of PDUs via a new 'ip_additional_pdus' field.  Normally this
field is set to zero when 'struct icl_pdu' represents a single PDU.
If logical PDU represents a burst of on-the-wire PDUs, then 'ip_npdus'
contains the count of additional on-the-wire PDUs.  The header of this
"large" PDU is still modified, but the DataSN field now contains the
DataSN value of the first on-the-wire PDU in the burst.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31577

(cherry picked from commit c261b6ea4e)
2021-10-29 16:30:51 -07:00
John Baldwin
0967aa717d 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 d75b0870e5)
2021-10-29 16:30:43 -07:00
John Baldwin
da92c273d5 cxgbei: Only round PDU data segment lengths down by 512 on T5.
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31575

(cherry picked from commit f28715fdc1)
2021-10-29 16:29:49 -07:00
John Baldwin
5dfe6f23d3 cxgbei: Restructure how PDU limits are managed.
- Compute data segment limits in read_pdu_limits() rather than PDU
  length limits.

- Add back connection-specific PDU overhead lengths to compute PDU
  length limits in icl_cxgbei_conn_handoff().

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31574

(cherry picked from commit cbc186360c)
2021-10-29 16:29:08 -07:00
John Baldwin
37c5daa855 cxgbei: Wait for the final CPL to be received in icl_cxgbei_conn_close.
A socket in the FIN_WAIT_1 state is marked disconnected by
do_close_con_rpl() even though there might still receive data pending.
This is because the socket at that point has set SBS_CANTRCVMORE which
causes the protocol layer to discard any data received before the FIN.
However, icl_cxgbei_conn_close needs to wait until all the data has
been discarded.  Replace the wait for SS_ISDISCONNECTED with instead
waiting for final_cpl_received() to be called.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 2eb0e53a6b)
2021-10-29 16:27:31 -07:00
John Baldwin
132894ca4b cxgbei: Support for ISO (iSCSI segmentation offload).
ISO can be disabled before establishing a connection by setting
dev.tNnex.N.toe.iso to 0.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31223

(cherry picked from commit 5b27e4b27c)
2021-10-29 16:27:10 -07:00
John Baldwin
bb34f3bce4 iscsi: Remove icl_soft-only fields from struct icl_conn.
Create a struct icl_soft_conn which extends struct icl_conn and
move fields only used by icl_soft from struct icl_conn to
struct icl_soft_conn.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31414

(cherry picked from commit 87322a9075)
2021-10-29 16:19:43 -07:00
John Baldwin
202f2c169b cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6.
The remote peer might send a FIN in the middle of a burst of data
PDUs.  In the case of T6 with data PDU completion moderation, the
driver would not have seen these PDUs since the final PDU in the burst
was never received resulting in a stale rcv_nxt when the FIN is
received.

While here, invert the logic in the condition to be more readable and
always set tp->rcv_nxt from the sequence number in the CPL.  This sets
the proper value of rcv_nxt for FINs on connections with data received
but not reported via a CPL (e.g. a partial iSCSI PDU burst interrupted
by a FIN).

Reported by:	Jithesh Arakkan @ Chelsio
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D30871

(cherry picked from commit d59f1c49e2)

cxgbe tom: Update rcv_nxt for a FIN after handle_ddp_close().

For TCP DDP, handle_ddp_close() needs to see the pre-FIN rcv_nxt to
determine how much data was placed in the local buffer before the FIN
was received.  The changes in d59f1c49e2 broke this by updating
rcv_nxt before calling handle_ddp_close().

Fixes:		d59f1c49e2 cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6.
Sponsored by:	Chelsio Communications

(cherry picked from commit 5dbf8c1588)
2021-10-29 16:17:31 -07:00
John Baldwin
7f82047ec9 cxgbei: Round up the maximum PDU data length by the MSS for TXDATAPLEN_MAX.
Recent firmware versions round down the value passed here by the MSS
and subsequently mishandle transmitted PDUs larger than the rounded
down value.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit d0d631d5f4)
2021-10-29 16:15:44 -07:00
John Baldwin
a2bd630ca7 cxgbei: Wait for socket to close in icl_cxgbei_conn_close.
This ensures the TOE has finished processing any in-flight received
data before returning to the caller.  The caller assumes it is safe to
free any open tasks or transfers (and associated buffers) after this
function returns.

Previously, data placed directly via DDP could be written to buffers
after the caller had freed the buffers.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 67495c13d0)
2021-10-29 16:14:16 -07:00
John Baldwin
a47b1c6f8f cxgbei: Don't assert F for data completion PDUs.
If a data PDU encounters an error such as a digest error, the firmware
will report that data PDU when completion moderation is active even if
it is not the final data PDU in a burst.

Sponsored by:	Chelsio Communications

(cherry picked from commit b5e73dd952)
2021-10-29 16:13:31 -07:00
John Baldwin
4415ec04a4 cxgbei: Remove invalid assertion.
A non-placed PDU can be delivered by CPL_RX_ISCSI_CMP in the middle of
a burst of placed PDUs (received via DDP) in which case the rcv_nxt
will not match the start of the non-placed PDU.

Reported by:	Jithesh Arakkan @ Chelsio
Sponsored by:	Chelsio Communications

(cherry picked from commit 4a7d15ebb6)
2021-10-29 16:11:34 -07:00
John Baldwin
f0334cb8d3 cxgbei: Better handle new tasks and transfers when disconnecting.
If the connection is in the process of disconnecting, ic_socket can be
NULL.  For icl_cxgbei_conn_transfer_setup(), lock the connection and
check ic_socket before using it.  For icl_cxgbei_conn_task_setup(),
the caller already holds the connection lock, so assert it and bail
early with ECONNRESET if the connection is disconnecting.

Reported by:	Jithesh Arakkan @ Chelsio
Fixes:	 	f949967c8e cxgbei: Fix a race between transfer setup and a peer reset.

(cherry picked from commit abc273a290)
2021-10-29 16:10:14 -07:00
John Baldwin
0d4f552d49 cxgbe tom: Free pending iSCSI mbufs on connection shutdown.
If an iSCSI connection is shutdown abruptly (e.g. by a RST from the
peer), pending iSCSI PDUs and page pod work requests can be in the
ulp_pduq when the final CPL is received indicating the death of the
connection.

Reported by:	Jithesh Arakkan @ Chelsio

(cherry picked from commit 677cb9722a)
2021-10-29 16:09:15 -07:00
John Baldwin
0695b57a98 cxgbei: Fix a race between transfer setup and a peer reset.
In 4427ac3675, the TOM driver stopped sending work requests to
program iSCSI page pods directly and instead queued them to be written
asynchronously with iSCSI PDUs.  The queue of mbufs to send is
protected by the inp lock.  However, the inp cannot be safely obtained
from the toep since a RST from the remote peer might have cleared
toep->inp asynchronously in an ithread.  To fix, obtain the inp from
the socket as is already done in icl_cxgbei_conn_pdu_queue_cb() and
fail the new transfer setup with ECONNRESET if the connection has been
reset.

To avoid passing sockets or inps into the page pod routines, pull the
mbufq out of the two relevant page pod routines such that the routines
queue new work request mbufs to a caller-supplied mbufq.

Reported by:	Jithesh Arakkan @ Chelsio
Fixes:		4427ac3675

(cherry picked from commit f949967c8e)
2021-10-29 16:08:09 -07:00
John Baldwin
cc44e4e55b cxgbei: Support iSCSI offload on T6.
T6 makes several changes relative to T5 for receive of iSCSI PDUs.

First, earlier adapters issue either 2 or 3 messages to the host for
each PDU received: CPL_ISCSI_HDR contains the BHS of the PDU,
CPL_ISCSI_DATA (when DDP is not used for zero-copy receive) contains
the PDU data as buffers on the freelist, and CPL_RX_ISCSI_DDP with
status of the PDU such as result of CRC checks.  In T6, a new
CPL_RX_ISCSI_CMP combines CPL_ISCSI_HDR and CPL_RX_ISCSI_DDP.  Data
PDUs which are directly placed via DDP only report a single
CPL_RX_ISCSI_CMP message.  Data PDUs received on the free lists are
reported as CPL_ISCSI_DATA followed by CPL_RX_ISCSI_CMP.  Control PDUs
such as R2T are still reported via CPL_ISCSI_HDR and CPL_RX_ISCSI_DDP.

Supporting this requires changing the CPL_ISCSI_DATA handler to
allocate a PDU structure if it is not preceded by a CPL_ISCSI_HDR as
well as support for the new CPL_RX_ISCSI_CMP.

Second, when using DDP for zero-copy receive, T6 will only issue a
CPL_RX_ISCSI_CMP after a burst of PDUs have been received (indicated
by the F flag in the BHS).  In this case, the CPL_RX_ISCSI_CMP can
reflect the completion of multiple PDUs and the BHS and TCP sequence
number included in the message are from the last PDU received in the
burst.  Notably, the message does not include any information about
earlier PDUs received as part of the burst.  Instead, the driver must
track the amount of data already received for a given transfer and use
this to compute the amount of data received in a burst.  In addition,
the iSCSI layer currently has no way to permit receiving a logical PDU
which spans multiple PDUs.  Instead, the driver presents each burst as
a single, "large" PDU to the iSCSI target and initiators.  This is
done by rewriting the buffer offset and data length fields in the BHS
of the final PDU as well as rewriting the DataSN so that the received
PDUs appear to be in order.

To track all this, cxgbei maintains a hash table of 'cxgbei_cmp'
structures indexed by transfer tags for each offloaded iSCSI
connection.  When a SCSI_DATA_IN message is received, the ITT from the
received BHS is used to find the necessary state in the hash table,
whereas SCSI_DATA_OUT replies use the TTT as the key.  The structure
tracks the expected starting offset and DataSN of the next burst as
well as the rewritten DataSN value used for the previously received
PDU.

Discussed with:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D30458

(cherry picked from commit 67360f7bb0)
2021-10-29 16:07:26 -07:00
John Baldwin
76dacfc99e iscsi: Move the maximum data segment limits into 'struct icl_conn'.
This fixes a few bugs in iSCSI backends where the backends were using
the limits they advertised initially during the login phase as the
final values instead of the values negotiated with the other end.

Reported by:	Jithesh Arakkan @ Chelsio
Reviewed by:	mav
Differential Revision:	https://reviews.freebsd.org/D30271

(cherry picked from commit 0cc7d64a2a)
2021-10-29 16:05:13 -07:00