From owner-svn-src-all@freebsd.org Sat Mar 25 11:36:07 2017 Return-Path: Delivered-To: svn-src-all@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 C41C6D1B956; Sat, 25 Mar 2017 11:36:07 +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 79B881A20; Sat, 25 Mar 2017 11:36:07 +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 v2PBa60H055328; Sat, 25 Mar 2017 11:36:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2PBa66V055327; Sat, 25 Mar 2017 11:36:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703251136.v2PBa66V055327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 25 Mar 2017 11:36:06 +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: r315937 - stable/10/sys/cam X-SVN-Group: stable-10 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.23 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: Sat, 25 Mar 2017 11:36:07 -0000 Author: mav Date: Sat Mar 25 11:36:06 2017 New Revision: 315937 URL: https://svnweb.freebsd.org/changeset/base/315937 Log: MFC r315082: Allow XPT_GDEV_STATS for UNCONFIGURED devices. Queue statistics has nothing to do with presence or absence of INQUIRY data, etc. Target mode devices are never configured, but have queues. Modified: stable/10/sys/cam/cam_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_xpt.c ============================================================================== --- stable/10/sys/cam/cam_xpt.c Sat Mar 25 11:35:31 2017 (r315936) +++ stable/10/sys/cam/cam_xpt.c Sat Mar 25 11:36:06 2017 (r315937) @@ -2674,36 +2674,25 @@ call_sim: } case XPT_GDEV_STATS: { - struct cam_ed *dev; + struct ccb_getdevstats *cgds = &start_ccb->cgds; + struct cam_ed *dev = path->device; + struct cam_eb *bus = path->bus; + struct cam_et *tar = path->target; + struct cam_devq *devq = bus->sim->devq; - dev = path->device; - if ((dev->flags & CAM_DEV_UNCONFIGURED) != 0) { - start_ccb->ccb_h.status = CAM_DEV_NOT_THERE; - } else { - struct ccb_getdevstats *cgds; - struct cam_eb *bus; - struct cam_et *tar; - struct cam_devq *devq; - - cgds = &start_ccb->cgds; - bus = path->bus; - tar = path->target; - devq = bus->sim->devq; - mtx_lock(&devq->send_mtx); - cgds->dev_openings = dev->ccbq.dev_openings; - cgds->dev_active = dev->ccbq.dev_active; - cgds->allocated = dev->ccbq.allocated; - cgds->queued = cam_ccbq_pending_ccb_count(&dev->ccbq); - cgds->held = cgds->allocated - cgds->dev_active - - cgds->queued; - cgds->last_reset = tar->last_reset; - cgds->maxtags = dev->maxtags; - cgds->mintags = dev->mintags; - if (timevalcmp(&tar->last_reset, &bus->last_reset, <)) - cgds->last_reset = bus->last_reset; - mtx_unlock(&devq->send_mtx); - cgds->ccb_h.status = CAM_REQ_CMP; - } + mtx_lock(&devq->send_mtx); + cgds->dev_openings = dev->ccbq.dev_openings; + cgds->dev_active = dev->ccbq.dev_active; + cgds->allocated = dev->ccbq.allocated; + cgds->queued = cam_ccbq_pending_ccb_count(&dev->ccbq); + cgds->held = cgds->allocated - cgds->dev_active - cgds->queued; + cgds->last_reset = tar->last_reset; + cgds->maxtags = dev->maxtags; + cgds->mintags = dev->mintags; + if (timevalcmp(&tar->last_reset, &bus->last_reset, <)) + cgds->last_reset = bus->last_reset; + mtx_unlock(&devq->send_mtx); + cgds->ccb_h.status = CAM_REQ_CMP; break; } case XPT_GDEVLIST: