From owner-svn-src-stable@freebsd.org Mon Oct 5 10:35:38 2015 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 F077099AFD4; Mon, 5 Oct 2015 10:35:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 D64E8C2F; Mon, 5 Oct 2015 10:35:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t95AZb2w068840; Mon, 5 Oct 2015 10:35:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t95AZa5f068835; Mon, 5 Oct 2015 10:35:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510051035.t95AZa5f068835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 5 Oct 2015 10:35:36 +0000 (UTC) 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 X-SVN-Group: stable-10 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.20 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: Mon, 05 Oct 2015 10:35:38 -0000 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;