From owner-svn-src-all@freebsd.org Mon Aug 31 00:59:03 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F18EF3D111A; Mon, 31 Aug 2020 00:59:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BfsKM63bjz3Z58; Mon, 31 Aug 2020 00:59:03 +0000 (UTC) (envelope-from mav@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 B309E1F5E9; Mon, 31 Aug 2020 00:59:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07V0x3Ln072567; Mon, 31 Aug 2020 00:59:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07V0x37I072565; Mon, 31 Aug 2020 00:59:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008310059.07V0x37I072565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 31 Aug 2020 00:59:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364981 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 364981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2020 00:59:04 -0000 Author: mav Date: Mon Aug 31 00:59:02 2020 New Revision: 364981 URL: https://svnweb.freebsd.org/changeset/base/364981 Log: MFC r364309: Extend EIIOE field handling according to ses4r5 draft. It should not affect any existing systems. Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c stable/12/sys/cam/scsi/scsi_ses.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_ses.c Sun Aug 30 21:46:29 2020 (r364980) +++ stable/12/sys/cam/scsi/scsi_enc_ses.c Mon Aug 31 00:59:02 2020 (r364981) @@ -1797,7 +1797,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en ses_elem_index_type_t index_type; eip_hdr = (struct ses_elm_addlstatus_eip_hdr *)elm_hdr; - if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) { + if (SES_ADDL_EIP_EIIOE_EI_GLOB(eip_hdr->byte2)) { index_type = SES_ELEM_INDEX_GLOBAL; expected_index = iter.global_element_index; } else { @@ -1807,8 +1807,8 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en if (eip_hdr->element_index < expected_index) { ENC_VLOG(enc, "%s: provided %selement index " "%d is lower then expected %d\n", - __func__, (eip_hdr->byte2 & - SES_ADDL_EIP_EIIOE) ? "global " : "", + __func__, SES_ADDL_EIP_EIIOE_EI_GLOB( + eip_hdr->byte2) ? "global " : "", eip_hdr->element_index, expected_index); goto badindex; } @@ -1818,7 +1818,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en if (telement == NULL) { ENC_VLOG(enc, "%s: provided %selement index " "%d does not exist\n", __func__, - (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ? + SES_ADDL_EIP_EIIOE_EI_GLOB(eip_hdr->byte2) ? "global " : "", eip_hdr->element_index); goto badindex; } @@ -1827,7 +1827,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en ENC_VLOG(enc, "%s: provided %selement index " "%d can't have additional status\n", __func__, - (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ? + SES_ADDL_EIP_EIIOE_EI_GLOB(eip_hdr->byte2) ? "global " : "", eip_hdr->element_index); badindex: /* @@ -1843,7 +1843,7 @@ badindex: element = telement; } - if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) + if (SES_ADDL_EIP_EIIOE_EI_GLOB(eip_hdr->byte2)) index = iter.global_element_index; else index = iter.individual_element_index; @@ -1852,8 +1852,8 @@ badindex: ENC_VLOG(enc, "%s: provided %s element" "index %d skips mandatory status " " element at index %d\n", - __func__, (eip_hdr->byte2 & - SES_ADDL_EIP_EIIOE) ? "global " : "", + __func__, SES_ADDL_EIP_EIIOE_EI_GLOB( + eip_hdr->byte2) ? "global " : "", index, expected_index); } } Modified: stable/12/sys/cam/scsi/scsi_ses.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_ses.h Sun Aug 30 21:46:29 2020 (r364980) +++ stable/12/sys/cam/scsi/scsi_ses.h Mon Aug 31 00:59:02 2020 (r364981) @@ -2439,7 +2439,13 @@ int ses_elm_addlstatus_invalid(struct ses_elm_addlstat struct ses_elm_addlstatus_eip_hdr { struct ses_elm_addlstatus_base_hdr base; uint8_t byte2; -#define SES_ADDL_EIP_EIIOE 1 +#define SES_ADDL_EIP_EIIOE_MASK 3 +#define SES_ADDL_EIP_EIIOE_SES2 0 +#define SES_ADDL_EIP_EIIOE_GLOB 1 +#define SES_ADDL_EIP_EIIOE_IND 2 +#define SES_ADDL_EIP_EIIOE_MIX 3 +#define SES_ADDL_EIP_EIIOE_EI_GLOB(x) \ + (((x) & SES_ADDL_EIP_EIIOE_MASK) == SES_ADDL_EIP_EIIOE_GLOB) uint8_t element_index; /* NB: This define (currently) applies to all eip=1 headers */ #define SES_EIP_HDR_EXTRA_LEN 2