Date: Mon, 5 Oct 2015 10:35:36 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288768 - stable/10/sys/cam/ctl Message-ID: <201510051035.t95AZa5f068835@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Mon Oct 5 10:35:36 2015 New Revision: 288768 URL: https://svnweb.freebsd.org/changeset/base/288768 Log: MFC r287921: When reporting TPT UA, report which of thresholds was reached. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_error.c stable/10/sys/cam/ctl/ctl_io.h stable/10/sys/cam/ctl/ctl_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 5 10:34:40 2015 (r288767) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 5 10:35:36 2015 (r288768) @@ -705,6 +705,9 @@ ctl_isc_ua(struct ctl_softc *softc, unio (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) != NULL) { mtx_lock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); + if (msg->ua.ua_type == CTL_UA_THIN_PROV_THRES && + msg->ua.ua_set) + memcpy(lun->ua_tpt_info, msg->ua.ua_info, 8); if (msg->ua.ua_all) { if (msg->ua.ua_set) ctl_est_ua_all(lun, iid, msg->ua.ua_type); @@ -11133,15 +11136,9 @@ ctl_scsiio_precheck(struct ctl_softc *so */ if ((entry->flags & CTL_CMD_FLAG_NO_SENSE) == 0) { ctl_ua_type ua_type; - scsi_sense_data_type sense_format; - - if (lun->flags & CTL_LUN_SENSE_DESC) - sense_format = SSD_TYPE_DESC; - else - sense_format = SSD_TYPE_FIXED; ua_type = ctl_build_ua(lun, initidx, &ctsio->sense_data, - sense_format); + SSD_TYPE_NONE); if (ua_type != CTL_UA_NONE) { mtx_unlock(&lun->lun_lock); ctsio->scsi_status = SCSI_STATUS_CHECK_COND; @@ -13340,12 +13337,16 @@ ctl_thresh_thread(void *arg) continue; if ((page->descr[i].flags & SLBPPD_ARMING_MASK) == SLBPPD_ARMING_INC) - e |= (val >= thres); + e = (val >= thres); else - e |= (val <= thres); + e = (val <= thres); + if (e) + break; } mtx_lock(&lun->lun_lock); if (e) { + scsi_u64to8b((uint8_t *)&page->descr[i] - + (uint8_t *)page, lun->ua_tpt_info); if (lun->lasttpt == 0 || time_uptime - lun->lasttpt >= CTL_LBP_UA_PERIOD) { lun->lasttpt = time_uptime; @@ -13371,6 +13372,7 @@ ctl_thresh_thread(void *arg) msg.ua.ua_all = 1; msg.ua.ua_set = (set > 0); msg.ua.ua_type = CTL_UA_THIN_PROV_THRES; + memcpy(msg.ua.ua_info, lun->ua_tpt_info, 8); mtx_unlock(&softc->ctl_lock); // XXX ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg, sizeof(msg.ua), M_WAITOK); Modified: stable/10/sys/cam/ctl/ctl_error.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_error.c Mon Oct 5 10:34:40 2015 (r288767) +++ stable/10/sys/cam/ctl/ctl_error.c Mon Oct 5 10:35:36 2015 (r288768) @@ -366,8 +366,8 @@ ctl_set_ua(struct ctl_scsiio *ctsio, int } static void -ctl_ua_to_acsq(ctl_ua_type ua_to_build, int *asc, int *ascq, - ctl_ua_type *ua_to_clear) +ctl_ua_to_acsq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc, + int *ascq, ctl_ua_type *ua_to_clear, uint8_t **info) { switch (ua_to_build) { @@ -453,6 +453,7 @@ ctl_ua_to_acsq(ctl_ua_type ua_to_build, /* 38h/07h THIN PROVISIONING SOFT THRESHOLD REACHED */ *asc = 0x38; *ascq = 0x07; + *info = lun->ua_tpt_info; break; default: panic("%s: Unknown UA %x", __func__, ua_to_build); @@ -464,6 +465,7 @@ ctl_build_qae(struct ctl_lun *lun, uint3 { ctl_ua_type ua; ctl_ua_type ua_to_build, ua_to_clear; + uint8_t *info; int asc, ascq; uint32_t p, i; @@ -479,7 +481,8 @@ ctl_build_qae(struct ctl_lun *lun, uint3 ua_to_build = (1 << (ffs(ua) - 1)); ua_to_clear = ua_to_build; - ctl_ua_to_acsq(ua_to_build, &asc, &ascq, &ua_to_clear); + info = NULL; + ctl_ua_to_acsq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info); resp[0] = SSD_KEY_UNIT_ATTENTION; if (ua_to_build == ua) @@ -497,6 +500,7 @@ ctl_build_ua(struct ctl_lun *lun, uint32 { ctl_ua_type *ua; ctl_ua_type ua_to_build, ua_to_clear; + uint8_t *info; int asc, ascq; uint32_t p, i; @@ -522,16 +526,13 @@ ctl_build_ua(struct ctl_lun *lun, uint32 ua_to_build = (1 << (ffs(ua[i]) - 1)); ua_to_clear = ua_to_build; - ctl_ua_to_acsq(ua_to_build, &asc, &ascq, &ua_to_clear); + info = NULL; + ctl_ua_to_acsq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info); - ctl_set_sense_data(sense, - /*lun*/ NULL, - sense_format, - /*current_error*/ 1, - /*sense_key*/ SSD_KEY_UNIT_ATTENTION, - asc, - ascq, - SSD_ELEM_NONE); + ctl_set_sense_data(sense, lun, sense_format, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq, + ((info != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP), 8, info, + SSD_ELEM_NONE); /* We're reporting this UA, so clear it */ ua[i] &= ~ua_to_clear; Modified: stable/10/sys/cam/ctl/ctl_io.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_io.h Mon Oct 5 10:34:40 2015 (r288767) +++ stable/10/sys/cam/ctl/ctl_io.h Mon Oct 5 10:35:36 2015 (r288768) @@ -408,6 +408,7 @@ struct ctl_ha_msg_ua { int ua_all; int ua_set; int ua_type; + uint8_t ua_info[8]; }; /* Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Mon Oct 5 10:34:40 2015 (r288767) +++ stable/10/sys/cam/ctl/ctl_private.h Mon Oct 5 10:35:36 2015 (r288768) @@ -393,6 +393,7 @@ struct ctl_lun { struct scsi_sense_data pending_sense[CTL_MAX_INITIATORS]; #endif ctl_ua_type *pending_ua[CTL_MAX_PORTS]; + uint8_t ua_tpt_info[8]; time_t lasttpt; struct ctl_mode_pages mode_pages; struct ctl_log_pages log_pages;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510051035.t95AZa5f068835>