From owner-svn-src-stable@freebsd.org Thu Jan 5 11:28:03 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AD26C9FA86; Thu, 5 Jan 2017 11:28: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 mx1.freebsd.org (Postfix) with ESMTPS id 2B4631245; Thu, 5 Jan 2017 11:28: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 v05BS2TJ049068; Thu, 5 Jan 2017 11:28:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v05BS27r049065; Thu, 5 Jan 2017 11:28:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201701051128.v05BS27r049065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 5 Jan 2017 11:28:02 +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: r311406 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2017 11:28:03 -0000 Author: mav Date: Thu Jan 5 11:28:01 2017 New Revision: 311406 URL: https://svnweb.freebsd.org/changeset/base/311406 Log: MFC r310265: Add set of macros to simplify code access to mode pages fields. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_error.c stable/11/sys/cam/ctl/ctl_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Thu Jan 5 11:27:01 2017 (r311405) +++ stable/11/sys/cam/ctl/ctl.c Thu Jan 5 11:28:01 2017 (r311406) @@ -5869,21 +5869,19 @@ static void ctl_ie_timer(void *arg) { struct ctl_lun *lun = arg; - struct scsi_info_exceptions_page *pg; uint64_t t; if (lun->ie_asc == 0) return; - pg = &lun->mode_pages.ie_page[CTL_PAGE_CURRENT]; - if (pg->mrie == SIEP_MRIE_UA) + if (lun->MODE_IE.mrie == SIEP_MRIE_UA) ctl_est_ua_all(lun, -1, CTL_UA_IE); else lun->ie_reported = 0; - if (lun->ie_reportcnt < scsi_4btoul(pg->report_count)) { + if (lun->ie_reportcnt < scsi_4btoul(lun->MODE_IE.report_count)) { lun->ie_reportcnt++; - t = scsi_4btoul(pg->interval_timer); + t = scsi_4btoul(lun->MODE_IE.interval_timer); if (t == 0 || t == UINT32_MAX) t = 3000; /* 5 min */ callout_schedule(&lun->ie_callout, t * hz / 10); @@ -6477,9 +6475,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) if (lun->be_lun->lun_type == T_DIRECT) { header->dev_specific = 0x10; /* DPOFUA */ if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) || - (lun->mode_pages.control_page[CTL_PAGE_CURRENT] - .eca_and_aen & SCP_SWP) != 0) - header->dev_specific |= 0x80; /* WP */ + (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ } if (dbd) header->block_descr_len = 0; @@ -6500,9 +6497,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) if (lun->be_lun->lun_type == T_DIRECT) { header->dev_specific = 0x10; /* DPOFUA */ if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) || - (lun->mode_pages.control_page[CTL_PAGE_CURRENT] - .eca_and_aen & SCP_SWP) != 0) - header->dev_specific |= 0x80; /* WP */ + (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ } if (dbd) scsi_ulto2b(0, header->block_descr_len); @@ -8807,12 +8803,10 @@ ctl_read_write(struct ctl_scsiio *ctsio) /* Set FUA and/or DPO if caches are disabled. */ if (isread) { - if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 & - SCP_RCD) != 0) + if ((lun->MODE_CACHING.flags1 & SCP_RCD) != 0) flags |= CTL_LLF_FUA | CTL_LLF_DPO; } else { - if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 & - SCP_WCE) == 0) + if ((lun->MODE_CACHING.flags1 & SCP_WCE) == 0) flags |= CTL_LLF_FUA; } @@ -8915,8 +8909,7 @@ ctl_cnw(struct ctl_scsiio *ctsio) } /* Set FUA if write cache is disabled. */ - if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 & - SCP_WCE) == 0) + if ((lun->MODE_CACHING.flags1 & SCP_WCE) == 0) flags |= CTL_LLF_FUA; ctsio->kern_total_len = 2 * num_blocks * lun->be_lun->blocksize; @@ -9323,7 +9316,7 @@ ctl_request_sense(struct ctl_scsiio *cts /* * Report informational exception if have one and allowed. */ - if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != SIEP_MRIE_NO) { + if (lun->MODE_IE.mrie != SIEP_MRIE_NO) { asc = lun->ie_asc; ascq = lun->ie_ascq; } @@ -11088,8 +11081,8 @@ ctl_check_for_blockage(struct ctl_lun *l return (ctl_extent_check(ooa_io, pending_io, (lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); case CTL_SER_EXTENTOPT: - if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT].queue_flags - & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED) + if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != + SCP_QUEUE_ALG_UNRESTRICTED) return (ctl_extent_check(ooa_io, pending_io, (lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); @@ -11101,8 +11094,8 @@ ctl_check_for_blockage(struct ctl_lun *l case CTL_SER_PASS: return (CTL_ACTION_PASS); case CTL_SER_BLOCKOPT: - if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT].queue_flags - & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED) + if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != + SCP_QUEUE_ALG_UNRESTRICTED) return (CTL_ACTION_BLOCK); return (CTL_ACTION_PASS); case CTL_SER_SKIP: @@ -11343,8 +11336,7 @@ ctl_scsiio_lun_check(struct ctl_lun *lun retval = 1; goto bailout; } - if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT] - .eca_and_aen & SCP_SWP) != 0) { + if ((lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0) { ctl_set_sense(ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_DATA_PROTECT, /*asc*/ 0x27, /*ascq*/ 0x02, SSD_ELEM_NONE); @@ -13211,12 +13203,9 @@ ctl_process_done(union ctl_io *io) if (lun->ie_reported == 0 && lun->ie_asc != 0 && io->io_hdr.status == CTL_SUCCESS && (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) == 0) { - uint8_t mrie = lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie; - uint8_t per = - ((lun->mode_pages.rw_er_page[CTL_PAGE_CURRENT].byte3 & - SMS_RWER_PER) || - (lun->mode_pages.verify_er_page[CTL_PAGE_CURRENT].byte3 & - SMS_VER_PER)); + uint8_t mrie = lun->MODE_IE.mrie; + uint8_t per = ((lun->MODE_RWER.byte3 & SMS_RWER_PER) || + (lun->MODE_VER.byte3 & SMS_VER_PER)); if (((mrie == SIEP_MRIE_REC_COND && per) || mrie == SIEP_MRIE_REC_UNCOND || mrie == SIEP_MRIE_NO_SENSE) && @@ -13622,7 +13611,6 @@ ctl_thresh_thread(void *arg) { struct ctl_softc *softc = (struct ctl_softc *)arg; struct ctl_lun *lun; - struct scsi_da_rw_recovery_page *rwpage; struct ctl_logical_block_provisioning_page *page; const char *attr; union ctl_ha_msg msg; @@ -13641,11 +13629,10 @@ ctl_thresh_thread(void *arg) if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && softc->ha_mode == CTL_HA_MODE_XFER) continue; - rwpage = &lun->mode_pages.rw_er_page[CTL_PAGE_CURRENT]; - if ((rwpage->byte8 & SMS_RWER_LBPERE) == 0) + if ((lun->MODE_RWER.byte8 & SMS_RWER_LBPERE) == 0) continue; e = 0; - page = &lun->mode_pages.lbp_page[CTL_PAGE_CURRENT]; + page = &lun->MODE_LBP; for (i = 0; i < CTL_NUM_LBP_THRESH; i++) { if ((page->descr[i].flags & SLBPPD_ENABLED) == 0) continue; Modified: stable/11/sys/cam/ctl/ctl_error.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_error.c Thu Jan 5 11:27:01 2017 (r311405) +++ stable/11/sys/cam/ctl/ctl_error.c Thu Jan 5 11:28:01 2017 (r311406) @@ -83,9 +83,7 @@ ctl_set_sense_data_va(struct scsi_sense_ * sense if the LUN exists and descriptor sense is turned * on for that LUN. */ - if ((lun != NULL) - && (lun->mode_pages.control_page[CTL_PAGE_CURRENT].rlec & - SCP_DSENSE)) + if ((lun != NULL) && (lun->MODE_CTRL.rlec & SCP_DSENSE)) sense_format = SSD_TYPE_DESC; else sense_format = SSD_TYPE_FIXED; Modified: stable/11/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_private.h Thu Jan 5 11:27:01 2017 (r311405) +++ stable/11/sys/cam/ctl/ctl_private.h Thu Jan 5 11:28:01 2017 (r311406) @@ -313,6 +313,17 @@ struct ctl_mode_pages { struct ctl_page_index index[CTL_NUM_MODE_PAGES]; }; +#define MODE_RWER mode_pages.rw_er_page[CTL_PAGE_CURRENT] +#define MODE_FMT mode_pages.format_page[CTL_PAGE_CURRENT] +#define MODE_RDISK mode_pages.rigid_disk_page[CTL_PAGE_CURRENT] +#define MODE_VER mode_pages.verify_er_page[CTL_PAGE_CURRENT] +#define MODE_CACHING mode_pages.caching_page[CTL_PAGE_CURRENT] +#define MODE_CTRL mode_pages.control_page[CTL_PAGE_CURRENT] +#define MODE_CTRLE mode_pages.control_ext_page[CTL_PAGE_CURRENT] +#define MODE_IE mode_pages.ie_page[CTL_PAGE_CURRENT] +#define MODE_LBP mode_pages.lbp_page[CTL_PAGE_CURRENT] +#define MODE_CDDVD mode_pages.cddvd_page[CTL_PAGE_CURRENT] + static const struct ctl_page_index log_page_index_template[] = { {SLS_SUPPORTED_PAGES_PAGE, 0, 0, NULL, CTL_PAGE_FLAG_ALL, NULL, NULL},