From owner-svn-src-stable-11@freebsd.org Tue Mar 27 20:34:50 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E656CF57C01; Tue, 27 Mar 2018 20:34:49 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93EEB7EE1D; Tue, 27 Mar 2018 20:34:49 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8ED6A21182; Tue, 27 Mar 2018 20:34:49 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2RKYnDI058157; Tue, 27 Mar 2018 20:34:49 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2RKYnDU058155; Tue, 27 Mar 2018 20:34:49 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201803272034.w2RKYnDU058155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 27 Mar 2018 20:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331646 - in stable/11/sys/dev: mpr mps X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/11/sys/dev: mpr mps X-SVN-Commit-Revision: 331646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Mar 2018 20:34:50 -0000 Author: ken Date: Tue Mar 27 20:34:49 2018 New Revision: 331646 URL: https://svnweb.freebsd.org/changeset/base/331646 Log: MFC r331422: ------------------------------------------------------------------------ r331422 | ken | 2018-03-23 07:52:26 -0600 (Fri, 23 Mar 2018) | 42 lines Disable T10 Protection Information / EEDP handling for type 2 protection. The mps(4) and mpr(4) drivers and hardware handle T10 Protection Information, which is a system of checksums and guard blocks to protect data while it is being transferred and while it is on disk. It is also known as T10 DIF. For more details, see section 4.22 of the SBC-4 spec. Supporting Type 2 protection requires using 32 byte CDBs, and filling in the fields in those CDBs. We don't yet support that in the da(4) driver. Type 1 and Type 3 protection don't require that, and can be handled by the mps(4)/mpr(4) driver's code and firmware without any additional input from the da(4) driver. If a drive has Type 2 protection enabled (you frequently see this with SAS drives shipped from Dell), don't set the various EEDP fields in the mps(4)/mpr(4) driver command fields. Otherwise, you wind up with errors like this that would otherwise make no sense: (da9:mpr0:0:18:0): READ(10). CDB: 28 00 00 00 00 00 00 02 00 00 (da9:mpr0:0:18:0): CAM status: SCSI Status Error (da9:mpr0:0:18:0): SCSI status: Check Condition (da9:mpr0:0:18:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code) (da9:mpr0:0:18:0): (da9:mpr0:0:18:0): Field Replaceable Unit: 0 (da9:mpr0:0:18:0): Command Specific Info: 0 (da9:mpr0:0:18:0): (da9:mpr0:0:18:0): Descriptor 0x80: f8 21 (da9:mpr0:0:18:0): Descriptor 0x81: 00 00 00 00 00 00 (da9:mpr0:0:18:0): Error 22, Unretryable error In other words, what kind of strange SAS hard drive doesn't support a standard 10 byte SCSI READ command? In this case, one that has Type 2 protection enabled. We can revisit this when we put Type 2 protection support in the da(4) driver, but for now this will help people who put Type 2 formatted drives in a system and wonder what in the world is going on. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/11/sys/dev/mpr/mpr_sas.c stable/11/sys/dev/mps/mps_sas.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_sas.c Tue Mar 27 20:14:22 2018 (r331645) +++ stable/11/sys/dev/mpr/mpr_sas.c Tue Mar 27 20:34:49 2018 (r331646) @@ -2112,8 +2112,8 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union CDB.EEDP32.PrimaryReferenceTag); req->CDB.EEDP32.PrimaryApplicationTagMask = 0xFFFF; - req->CDB.CDB32[1] = (req->CDB.CDB32[1] & 0x1F) | - 0x20; + req->CDB.CDB32[1] = + (req->CDB.CDB32[1] & 0x1F) | 0x20; } else { eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_APPTAG; @@ -3614,8 +3614,19 @@ mprsas_async(void *callback_arg, uint32_t code, struct if ((mprsas_get_ccbstatus((union ccb *)&cdai) == CAM_REQ_CMP) && (rcap_buf.prot & SRC16_PROT_EN)) { - lun->eedp_formatted = TRUE; - lun->eedp_block_size = scsi_4btoul(rcap_buf.length); + switch (rcap_buf.prot & SRC16_P_TYPE) { + case SRC16_PTYPE_1: + case SRC16_PTYPE_3: + lun->eedp_formatted = TRUE; + lun->eedp_block_size = + scsi_4btoul(rcap_buf.length); + break; + case SRC16_PTYPE_2: + default: + lun->eedp_formatted = FALSE; + lun->eedp_block_size = 0; + break; + } } else { lun->eedp_formatted = FALSE; lun->eedp_block_size = 0; Modified: stable/11/sys/dev/mps/mps_sas.c ============================================================================== --- stable/11/sys/dev/mps/mps_sas.c Tue Mar 27 20:14:22 2018 (r331645) +++ stable/11/sys/dev/mps/mps_sas.c Tue Mar 27 20:34:49 2018 (r331646) @@ -3338,8 +3338,19 @@ mpssas_async(void *callback_arg, uint32_t code, struct if ((mpssas_get_ccbstatus((union ccb *)&cdai) == CAM_REQ_CMP) && (rcap_buf.prot & SRC16_PROT_EN)) { - lun->eedp_formatted = TRUE; - lun->eedp_block_size = scsi_4btoul(rcap_buf.length); + switch (rcap_buf.prot & SRC16_P_TYPE) { + case SRC16_PTYPE_1: + case SRC16_PTYPE_3: + lun->eedp_formatted = TRUE; + lun->eedp_block_size = + scsi_4btoul(rcap_buf.length); + break; + case SRC16_PTYPE_2: + default: + lun->eedp_formatted = FALSE; + lun->eedp_block_size = 0; + break; + } } else { lun->eedp_formatted = FALSE; lun->eedp_block_size = 0;