From owner-svn-src-head@freebsd.org Sat Mar 11 18:23:06 2017 Return-Path: Delivered-To: svn-src-head@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 BCC0AD062B1; Sat, 11 Mar 2017 18:23:06 +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 733907DE; Sat, 11 Mar 2017 18:23:06 +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 v2BIN5K1090273; Sat, 11 Mar 2017 18:23:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2BIN5eN090272; Sat, 11 Mar 2017 18:23:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703111823.v2BIN5eN090272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 11 Mar 2017 18:23:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315082 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Mar 2017 18:23:06 -0000 Author: mav Date: Sat Mar 11 18:23:05 2017 New Revision: 315082 URL: https://svnweb.freebsd.org/changeset/base/315082 Log: 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. MFC after: 2 weeks Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sat Mar 11 18:06:20 2017 (r315081) +++ head/sys/cam/cam_xpt.c Sat Mar 11 18:23:05 2017 (r315082) @@ -2724,36 +2724,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: