Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp765258ybl; Wed, 4 Dec 2019 10:28:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyUmLqTEOevEc+etYwzG0/cjyBwozkk01WDJ/OiroZ4Pci9F/N3kK6V/04UeGoQ1e0gG95A X-Received: by 2002:aca:ecd3:: with SMTP id k202mr3829650oih.71.1575484123057; Wed, 04 Dec 2019 10:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575484123; cv=none; d=google.com; s=arc-20160816; b=k9uk3zxkysCIyXp81yPhfqUAt+V1BdbE9z1mSX2GT2B54rjXt1Lx7flajqQjdAYi1r HV20DNhwBehl+CN2yrPQBnn7ZxsXSRm+yzYxYvyLV+tL1KVbpwLtHVTV9B3avbz4H0+H Sbhl0AGYNQiAu/xvEZvWNYZoUwDEK+c9JkeAyR4vatPM+jPFwYXvGgXH3VAxGvx/ooSw 7GaaNzSBsKarQIah7gJUfQjz5OOZErOgzFFP0gRgfn4bvqfZDzTiHDCbcuO3l3XA6cgM wz+0jFp9xk80H26sDnTjSxAQb2HffGVk3+TI4iFOyGQxlS20vnkWjp1nWIFLNqirxfLm 0UNQ== 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=TCSlAuIG4qGoKkFZIsCSK1lMiBCcrIptHqef0q79RZw=; b=wdtTb4GIrglAAUOhrhZ6ucZ6MmI/6+9Sg2TzfDs8e3p/i6PILw6gTVGd0BWhDsgBho CLQUwbACDm50sDB8o3/K9wL42y0fCgnVFMY7LVHx8WsbMqOacbOx0SQOBeSfGdlsAilL pfVuoSdQX+EwYsfC4SDIsTLgQ1W8KnITRZtQ0pKYrZceQR14zLTr36G/pXhCmXSrWboQ om5rJEt8hMncTv+oBE3F3Jk4Yq7QXoUceMrpW4MBpZgkZgpN/TgMZOYSPaNJX6uLz0su 28O8MHx/7LCbHY8cCC58eO25SZLnbGxHut99cv2d6yNBcGMFhCryVRY+dRbkQ+/EgsF9 xuLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1APHihG1; 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 x126si3573497oix.53.2019.12.04.10.28.30; Wed, 04 Dec 2019 10:28:43 -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=1APHihG1; 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 S1730296AbfLDS04 (ORCPT + 99 others); Wed, 4 Dec 2019 13:26:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:34146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728942AbfLDR6t (ORCPT ); Wed, 4 Dec 2019 12:58:49 -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 71F492073B; Wed, 4 Dec 2019 17:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482328; bh=vqEKwBQUFxSHbtDnx/1d4SRZdBCRaEyfWfJl7WNX7OY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1APHihG10kpvcPCJrnDgS6ZsE5Dvu8fiXqMlP4H/tcAJhIrOaNxmtLyxz6fiFKxML Cg0AwPjPa+tGuhXBc2xmkg1bMRab3qpORqqXC8XLDWfVfZrdrQTG/9dw+ggkpzAtU9 Kn0kW5TstQGygRVZEWlhgGJm5It054fWSAcjuGro= 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.4 09/92] scsi: lpfc: Fix dif and first burst use in write commands Date: Wed, 4 Dec 2019 18:49:09 +0100 Message-Id: <20191204174329.648386338@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204174327.215426506@linuxfoundation.org> References: <20191204174327.215426506@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 bae36cc3740b6..ab6bff60478f9 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -2707,6 +2707,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 @@ -2812,6 +2813,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) @@ -3361,6 +3370,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 @@ -3476,6 +3486,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