Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp818394ybl; Wed, 4 Dec 2019 11:22:49 -0800 (PST) X-Google-Smtp-Source: APXvYqz+YAKsbPNiFYWnLqmrGCxDSqbhuLcqGbVtFgDiO4DouWb3T+rT3uRhjUGCbBN7XGNcgmAr X-Received: by 2002:aca:c415:: with SMTP id u21mr4052889oif.49.1575487369525; Wed, 04 Dec 2019 11:22:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575487369; cv=none; d=google.com; s=arc-20160816; b=SkRyeR15RYCnwMVxl+kyKWlf4oLl8zF4DPsn/I4Qkwe5bZnyMnDtOshlPWV1CD6+F3 xEFrnpO/01pZsMEfRoiDrWVAoGS7eoyN/pYixlW1C+SQlGY91SC+dDb+6VoZNQI81O7D OkCno3ifJcQEdevNQOnSk07yyEhzQMJ8jsvpYbVV9ZwiEtqrR7OT7oXR7AACM7CBLriG OrgKNcsWEj9IbU3Gbi2SVYSZgaMUcn2IkRVam/77ibyL0dN2RdA5LV3JM28PYB3dVQUH VxI5gD8x1BLSg8E8UZOdlvSXz4tEy5K+cA7+Xj4qsrrCCwIqTfvdqmZol/AtrLDlvVhA /TUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kBdSFlJteh+A72oL6XIrrRcO95h0GjcYYFaZuaoPfeA=; b=GF3GBsZTCzOQ69sI/5EnX5fqidmqHMJKKcsX5IuU0Tf2C/Oas7dW5hwqI1NjNVM7vO RbwrC5j4f8rx9KebEKXo+lvGGzl90C2I59f1grLG2pUtGPIvNhlC55nIH8EXT8bBGphD TsYb4kdncRwA2lA7iW2IH/Qy1WZbAoeGpDGQ+H8yHp1KCBYBDVQSS5k824aLSaWooDzQ G9C0QoJMl+5ZG3dQvJkFLYuy8yftQXUx7A/g3Mo+QZt6Zy8zCDYvKdfdAD6mMx+ZducV mugYpHz4PKi1iyDZMVBPo2uLFtSZuQ9n7K02SqFpNAs3ZJztl/jyruc7zRVBkjrbOh2f CbvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ORiwYoIR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 73si3558421otj.82.2019.12.04.11.22.35; Wed, 04 Dec 2019 11:22:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ORiwYoIR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729789AbfLDSCL (ORCPT + 99 others); Wed, 4 Dec 2019 13:02:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:43754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729774AbfLDSCI (ORCPT ); Wed, 4 Dec 2019 13:02:08 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4FA4F206DF; Wed, 4 Dec 2019 18:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482527; bh=a84wFZWHFaoV0m4VFKLRCiScqrK5dvzdvTvmGaCGcfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ORiwYoIR3mbit34ZSFBuGbziqBHFBcwKXrBLgPo/PTvEHbFRFIqLl1zMQoZGRlJzn mVgvT8ceaMBzCQEzroY96MaaBDzlc3RTkl2C6L2fAcKiDb5KYM/iuvz4wzfqbNH/wf jmqec/rFuheLxwsBEgLSXCedzTU5pNwPaqMZn8aY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dick Kennedy , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 031/209] scsi: lpfc: Fix dif and first burst use in write commands Date: Wed, 4 Dec 2019 18:54:03 +0100 Message-Id: <20191204175323.634921579@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 7c4042a4d0b7532cfbc90478fd3084b2dab5849e ] When dif and first burst is used in a write command wqe, the driver was not properly setting fields in the io command request. This resulted in no dif bytes being sent and invalid xfer_rdy's, resulting in the io being aborted by the hardware. Correct the wqe initializaton when both dif and first burst are used. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_scsi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 07cb671bb8550..2eba0c39ac1c4 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -2714,6 +2714,7 @@ lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, int datasegcnt, protsegcnt, datadir = scsi_cmnd->sc_data_direction; int prot_group_type = 0; int fcpdl; + struct lpfc_vport *vport = phba->pport; /* * Start the lpfc command prep by bumping the bpl beyond fcp_cmnd @@ -2819,6 +2820,14 @@ lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, */ iocb_cmd->un.fcpi.fcpi_parm = fcpdl; + /* + * For First burst, we may need to adjust the initial transfer + * length for DIF + */ + if (iocb_cmd->un.fcpi.fcpi_XRdy && + (fcpdl < vport->cfg_first_burst_size)) + iocb_cmd->un.fcpi.fcpi_XRdy = fcpdl; + return 0; err: if (lpfc_cmd->seg_cnt) @@ -3371,6 +3380,7 @@ lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, int datasegcnt, protsegcnt, datadir = scsi_cmnd->sc_data_direction; int prot_group_type = 0; int fcpdl; + struct lpfc_vport *vport = phba->pport; /* * Start the lpfc command prep by bumping the sgl beyond fcp_cmnd @@ -3486,6 +3496,14 @@ lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, */ iocb_cmd->un.fcpi.fcpi_parm = fcpdl; + /* + * For First burst, we may need to adjust the initial transfer + * length for DIF + */ + if (iocb_cmd->un.fcpi.fcpi_XRdy && + (fcpdl < vport->cfg_first_burst_size)) + iocb_cmd->un.fcpi.fcpi_XRdy = fcpdl; + /* * If the OAS driver feature is enabled and the lun is enabled for * OAS, set the oas iocb related flags. -- 2.20.1