From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.171 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796407757; b=5Yh22lqbvlDLK+rgZkmwBYIrtMhEFdwJIeSbkBcvK9ZrIuM0bC/zUUd0PhPBXkiIjsxI BZeSizlEkKb9p4/ZWAkQVwT6NYAc1daAvdgiEY+IaRYSunvyTpEdx3YGWXhOxctMs/T4m oXgAcpYEBbAAKLxSuOES/sr3HvXmfR5N/zIGdCuiFODVk4bPURVsIrmCZKYKo5bVMSfzI 3498cPIG8Y50AbsC2TIOm7D8K8CZOdeygUAxWOUPJk2k68R3jKi144eVtnb0y4f5bhzSG DnzCjVhw91Sbqln02p2GOoMiXMEWu6YWgKPa+kvmDhmcTDBhnyLpbB8N4vba8hHcYAw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796407757; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Sender:From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=LdfAD/0y27rbHFBvRV2UuLIh3Zx2U4Sq9niEoEu94yU=; b=mzwct/tLU4DWH+ksRrM8jNaEplwUnEZbQA0AeH42F0eoGZNeXRUdsIE523pCIGuhiSdV gBJc0094ZkLb8p6V6IVRkhR+KtKWZw3BbivreS9XEsQ9ugoL06KbDx60lpBLOphPh4Hjd csdTrgaDNLt72mFCKah1WdtfCB72l+XRhZjalzq7XaRreRL1fAbC1TrYmjfZvjmqBDvqj nxokIX4sBC3RVceRZ9iMoXr9Y9mbXJnYBdErt2/8vOEx+LnK6oU54UMsAEgMVViXzRuq0 YAHveO7kE1P4NFbMbm0wVbjnq9Fc5UJGtQo/MDtsW/HMWO62vPtFSmlxWwHGPMJ4eSA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=iwMtwr96; arc=none smtp.remote-ip=209.85.214.171 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DFC6606A330 for ; Fri, 4 Dec 2026 18:09:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9DFC6606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=iwMtwr96 Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2f07a960666so12612085ad.1 for ; Fri, 04 Dec 2026 10:09:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796407756; x=1797012556; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to:content-type; bh=LdfAD/0y27rbHFBvRV2UuLIh3Zx2U4Sq9niEoEu94yU=; b=iwMtwr96U+nf48YkTBYQVLJLLWt4dOXoS6nuZUaSNL0GIEwCu1PXt8JrRo2DQa4eTo hJdOgGCz35ChfCNDLTmJvmCvxge/fVWQsEBXWPuOHvNmDzzDrAiF6ZUW17f2uZvVcdX5 u4bgS9b3ksIPzU1F5GPQ3th4d/M86vRTlz4OIHL4F/Zjt8/qSyZXt8XJVVF/H4OzeiCd lhabflKA6xczNCDdq9VnAAf0iWMl0XUqk/htXpIFIyLTJPPdaREywhYUvA+EcCGHSP1t RMS017LNyTnDNbbYdYLX1LzhEX7Q0GCygCzWbfJjj1o6RVaAUXV0MrP6qfiYOu6sZa4D v3xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796407756; x=1797012556; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:sender:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=LdfAD/0y27rbHFBvRV2UuLIh3Zx2U4Sq9niEoEu94yU=; b=rZQgfGxmYzjVh0m40gQUnFWZ/7mx1uCJp8AW+DkZurXiJB+L2XO0zI7FvoHq4/WiK9 5lAOQBaPbnKXp+q+oG2CLMsytDmoW4SxHc6DW+mux1zjWeT8NpGQhQ2Jq5ZC1X8x9vvo wqderChPv3nO753xgJCPZMCX8sjAdh8/dVrHD/I2zeXgxAgqyt5wq72lXJXB/4BLLAlG aGh0PvoyoPXZsIBKwN8kDuGBqymO9SIpVvb9jrOcM7/Yo8Nsvxd+3KZbd0FkFRBnh4K5 t1eVlD3+8aw66Dz7koOIyRg9jPur8trGdbI4Nm55VaVdbAG7BFCZ/RjOuWglJEmXRv52 e7xA== X-Forwarded-Encrypted: i=1; AL+hErFwebV3eTxb/+t/WwAnTfS3wUG5rUFxcu0/AkHTpaAnYxOfdI/ZoS/EhDsHC4MzT5RkbJBE7OZrdIG0@vger.kernel.org X-Gm-Message-State: AB4q+uH9vhTYVurDMBqVoHjXo988Brfgw90kNgH9KCalIXrD4B74TPsJ iwQJADnghTdSWH3yuw1c7aq3Gw5GjrmZCu0YHRlTS16bffSQE28fNUy8 X-Gm-Gg: AZFdTZe2jTGoSWXA0HhZvLK6TQRYZZ6JA2bRGEl65ljuFYt0p1fEt6S4ma0wbJ7V+7Y 4dfoGSS+w/ablhyASS6WhkPFN2mIEXbfP8NJTXP2VZn5Q/iaXWozQl6+VpePBO1zy8FD/9p5j5M jHl/gzt9Gzg3ZXXHvlZF/1BX4l1vd5GEhn5yZnxK5a+2UOKS0H/zM3BHIrhi1DRSoGPVhKzS4rp i0Vwx8QehwAFYR4dLg86ghvS9dpQk6SentnIOKEC7JPYUr+1jWyhFHb7ZzycpWREF2rPEkEA54h 3JCJtmJFM6FQTyE63HcWNW1Ep0YO9jEFKYzkdS+bm1/tWtA3K4cqh2EisiV7l2kLvjr2lqMGBiI 20t0ycTW64SFOVMfPvCNU6/OTmSgJXKFojuUIzpSNNmRiTPhmxRR4gvcsyDXiXNO0ox4m3Y+cIE uJZE/ajPWzr3xVVT94YZCcfKXk3kFHdKc5fHzpTkmOe4ZMvNUSXV2BX3R2g2xpVqhUVohe134Hk 44ECkoEgHv+UMFO5fUuZbuRjYsv/hVSr534tIUAcESFz4ye5xqP5b+lZNQK+vs3dQmsG0diEroz JS8rES2ZbG4dAB8Qt/rcZPq8c83IUR0eRQ7g1HAVtOetFivzFDMOklFkrhQVpMhTSpyWZZGoGA= = X-Received: by 2002:a17:902:f54e:b0:2f1:1e93:9f23 with SMTP id d9443c01a7336-2f1ba224b18mr27106275ad.49.1796407755588; Fri, 04 Dec 2026 10:09:15 -0800 (PST) Received: from nb-x1-03 ([181.120.144.175]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f1b78f9e55sm16797535ad.12.2026.12.04.10.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 10:09:15 -0800 (PST) Sender: Ciro Iriarte From: Ciro Iriarte To: Ram Vegesna , "Martin K. Petersen" Cc: "James E.J. Bottomley" , 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 Message-ID: X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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