From: Ciro Iriarte <ciro.iriarte+software@gmail.com>
To: Ram Vegesna <ram.vegesna@broadcom.com>,
"Martin K. Petersen" <mkp@kernel.org>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: [PATCH] scsi: elx: efct: report residual for status-only Data-In responses
Date: Fri, 04 Dec 2026 15:08:17 -0300 [thread overview]
Message-ID: <b82e2805-2368-43c6-9686-927fcf8731d6@gmail.com> (raw)
When a Data-In command fails before any data is sent, for example a READ
that hits a filemark or any command that returns a Unit Attention, LIO
calls ->queue_status() and the FCP_RSP carries only the status and
sense. efct_lio_queue_status() copies LIO's residual, which describes
the command's data buffer (CDB length versus FCP_DL, short backend
reads), not a data phase the fabric skipped. In the failures reproduced
here it is 0, so FCP_RESID_UNDER is not set.
The initiator HBA saw no data for a command that expected FCP_DL bytes.
qla2xxx treats an underrun without FCP_RESID_UNDER, or with a residual
that differs from what the firmware counted, as lost frames:
qla2xxx [0000:01:00.1]-301f:12: Dropped frame(s) detected (0x100000 of 0x100000 bytes).
and completes the command with DID_ERROR instead of passing the CHECK
CONDITION up. On a tape drive this turns every read into a filemark into
a series of retries, and a Bareos restore failed when the first read
after a cartridge load returned DID_ERROR.
For DMA_FROM_DEVICE commands, report the part of FCP_DL that was not
transferred, computed as efct_scsi_send_resp() does when no response is
passed (exp_xfer_len - transferred; negative means overrun).
tcm_qla2xxx_queue_status() handles the same case by adding data_length
to the residual and setting SCF_UNDERFLOW_BIT.
Tested on an LPe31004 (efct, two ports) exporting TCMU tape devices to a
QLE2662 initiator, with 30 reads into a filemark: 120 "Dropped frame(s)"
messages before, 0 after. A Bareos backup and restore across both paths
(2.4 GB, three volumes) logged none either.
Fixes: 692e5d73a811 ("scsi: elx: efct: LIO backend interface routines")
Signed-off-by: Ciro Iriarte <ciro.iriarte+software@gmail.com>
---
drivers/scsi/elx/efct/efct_lio.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/elx/efct/efct_lio.c b/drivers/scsi/elx/efct/efct_lio.c
index 67d686dd6..033bac685 100644
--- a/drivers/scsi/elx/efct/efct_lio.c
+++ b/drivers/scsi/elx/efct/efct_lio.c
@@ -671,7 +671,15 @@ efct_lio_queue_status(struct se_cmd *cmd)
/* Check for residual underrun or overrun, mark negitive value for
* underrun to recognize in HW
*/
- if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT)
+ /*
+ * For a Data-In command, report the part of FCP_DL that was not
+ * transferred, as the initiator counts it. LIO's residual describes
+ * the data buffer, not a data phase skipped because the command
+ * ended with a non-GOOD status (e.g. CHECK CONDITION).
+ */
+ if (cmd->data_direction == DMA_FROM_DEVICE)
+ rsp.residual = io->exp_xfer_len - io->transferred;
+ else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT)
rsp.residual = -cmd->residual_count;
else if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)
rsp.residual = cmd->residual_count;
--
2.55.0
next reply other threads:[~2026-12-04 18:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:08 Ciro Iriarte [this message]
2026-12-04 18:31 ` [PATCH] scsi: elx: efct: report residual for status-only Data-In responses sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b82e2805-2368-43c6-9686-927fcf8731d6@gmail.com \
--to=ciro.iriarte+software@gmail.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=ram.vegesna@broadcom.com \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.