From owner-svn-src-head@freebsd.org Tue Nov 14 20:38:03 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 E606BDDD144 for ; Tue, 14 Nov 2017 20:38:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C8AD6E43B for ; Tue, 14 Nov 2017 20:38:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id i38so11275077iod.2 for ; Tue, 14 Nov 2017 12:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=BuBI8Y3F7HWSvAw2prJwRI/Ah8MIJd5YbvdfFmGV+OA=; b=rZKxDpWWv9HBZRGpZDuJP0vR82vwuLAnUKmu9Da3C4Gwa0G27MuatyTx3FhpLJrmxi jGrLxKiBF/Zp53oKAYOWQc6ADk8g0BSHCQuouLNi584RVh8VKek1ahGJnJNLbqpl33/y +PnHxf8fyeOi0kxTPps34qPTVFDR0lE/gKU43C/m5p1eG3IhPY95WpJKZaH3zQ3ZuhL5 BmkN9IHrB1a75yUXYhAysETIDVJLl4k+v+RuQsY5RJzVBUf6qTj+VDwa0wqE1JlcPkF0 MJB3G0KZPaWXCww24aedtA82S5ds6nMch/qTPsVL5HyZD37YSAkItPQ+2x3TqyBEBkfZ etUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=BuBI8Y3F7HWSvAw2prJwRI/Ah8MIJd5YbvdfFmGV+OA=; b=Mt4zKsEjBcVflxdwTkRtod/w4u4xejMxrG+S6dtLRWDEca63xKGrkwvXdix1SACLWq VPGxoEeZc9M6hPMzPNO719cljvi6/mNzeC+CNb0YSTxSOjLsqE8lPUT1K/igyzIL8sP8 kI+vzOvB/koZCjykySIuTFGCkpBV7IIRptJUZmraSy3SNOzLqUfLtH5gIx6ZIofmZjDN Tb4SykOYvbALVVTJg0hxmVBKVR9SQy66Rl9kiQz6lMJrwsL1wXVw239Ifa/2VOIIEVzV XfQ+mlZlxeITd4DrJgTqBif8J89NSt3A0+8GJVoDq/arwkUjgN+wOioFkiDN82DIwYaW NeZw== X-Gm-Message-State: AJaThX5TlYbrLWSImL6CzQBuwnUVoa6OHiRqTsiRGutP6HltAd8Z+kNy /KerbRO2eBLyrM6i2Kyjr8AERgalCUBxCcekAkZlvw== X-Google-Smtp-Source: AGs4zMbqYJYqaq9ZURIU0Te2D4FugucQx+IXmJiADtKjx1vQmIGhhFlVjV+/9iWY2O0dSomsade97SOWVsBnTiJR8+M= X-Received: by 10.107.46.216 with SMTP id u85mr14324328iou.136.1510691882672; Tue, 14 Nov 2017 12:38:02 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.108.204 with HTTP; Tue, 14 Nov 2017 12:38:01 -0800 (PST) X-Originating-IP: [50.253.109.65] In-Reply-To: <50ACB3CA-9F18-4033-8D0F-F02363BA5B37@mac.com> References: <201711140505.vAE55Qaw042726@repo.freebsd.org> <50ACB3CA-9F18-4033-8D0F-F02363BA5B37@mac.com> From: Warner Losh Date: Tue, 14 Nov 2017 13:38:01 -0700 X-Google-Sender-Auth: PyfDtk0eY1QIdBQO7BAJRFP_mms Message-ID: Subject: Re: svn commit: r325796 - head/sys/cam/nvme To: Ravi Pokala Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 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: Tue, 14 Nov 2017 20:38:04 -0000 On Mon, Nov 13, 2017 at 10:35 PM, Ravi Pokala wrote: > In r325794, you set speed/max_speed to a KBps value; here, you're > reporting those values as PCI Generation. That's... not right. > Two different CCBs. The PATH_INQ one returns a general KB/s number. The GET_TRANSPORT one returns the raw numbers. Warner > -Ravi (rpokala@) > > -----Original Message----- > From: on behalf of Warner Losh > > Date: 2017-11-13, Monday at 21:05 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r325796 - head/sys/cam/nvme > > Author: imp > Date: Tue Nov 14 05:05:26 2017 > New Revision: 325796 > URL: https://svnweb.freebsd.org/changeset/base/325796 > > Log: > Properly decode NVMe state of the drive and print out the information > in the attach to more closely match what SCSI and ATA attached > storage provides. > > Sponsored by: Netflix > > Modified: > head/sys/cam/nvme/nvme_all.c > head/sys/cam/nvme/nvme_all.h > head/sys/cam/nvme/nvme_xpt.c > > Modified: head/sys/cam/nvme/nvme_all.c > ============================================================ > ================== > --- head/sys/cam/nvme/nvme_all.c Tue Nov 14 05:05:21 2017 > (r325795) > +++ head/sys/cam/nvme/nvme_all.c Tue Nov 14 05:05:26 2017 > (r325796) > @@ -87,9 +87,16 @@ nvme_identify_match(caddr_t identbuffer, caddr_t table > > void > nvme_print_ident(const struct nvme_controller_data *cdata, > - const struct nvme_namespace_data *data) > + const struct nvme_namespace_data *data, struct sbuf *sb) > { > - printf("I'm a pretty NVME drive\n"); > + > + sbuf_printf(sb, "<"); > + cam_strvis_sbuf(sb, cdata->mn, sizeof(cdata->mn), 0); > + sbuf_printf(sb, " "); > + cam_strvis_sbuf(sb, cdata->fr, sizeof(cdata->fr), 0); > + sbuf_printf(sb, " "); > + cam_strvis_sbuf(sb, cdata->sn, sizeof(cdata->sn), 0); > + sbuf_printf(sb, ">\n"); > } > > /* XXX need to do nvme admin opcodes too, but those aren't used yet by > nda */ > > Modified: head/sys/cam/nvme/nvme_all.h > ============================================================ > ================== > --- head/sys/cam/nvme/nvme_all.h Tue Nov 14 05:05:21 2017 > (r325795) > +++ head/sys/cam/nvme/nvme_all.h Tue Nov 14 05:05:26 2017 > (r325796) > @@ -39,7 +39,8 @@ void nvme_ns_cmd(struct ccb_nvmeio *nvmeio, uint8_t cm > > int nvme_identify_match(caddr_t identbuffer, caddr_t table_entry); > > -void nvme_print_ident(const struct nvme_controller_data *, const struct > nvme_namespace_data *); > +struct sbuf; > +void nvme_print_ident(const struct nvme_controller_data *, const struct > nvme_namespace_data *, struct sbuf *); > const char *nvme_op_string(const struct nvme_command *); > const char *nvme_cmd_string(const struct nvme_command *, char *, size_t); > const void *nvme_get_identify_cntrl(struct cam_periph *); > > Modified: head/sys/cam/nvme/nvme_xpt.c > ============================================================ > ================== > --- head/sys/cam/nvme/nvme_xpt.c Tue Nov 14 05:05:21 2017 > (r325795) > +++ head/sys/cam/nvme/nvme_xpt.c Tue Nov 14 05:05:26 2017 > (r325796) > @@ -619,35 +619,49 @@ nvme_announce_periph(struct cam_periph *periph) > struct ccb_pathinq cpi; > struct ccb_trans_settings cts; > struct cam_path *path = periph->path; > + struct ccb_trans_settings_nvme *nvmex; > > cam_periph_assert(periph, MA_OWNED); > > + /* Ask the SIM for connection details */ > xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); > cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; > cts.type = CTS_TYPE_CURRENT_SETTINGS; > xpt_action((union ccb*)&cts); > if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) > return; > + nvmex = &cts.xport_specific.nvme; > + > /* Ask the SIM for its base transfer speed */ > xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); > cpi.ccb_h.func_code = XPT_PATH_INQ; > xpt_action((union ccb *)&cpi); > - /* XXX NVME STUFF HERE */ > + printf("%s%d: nvme version %d.%d x%d (max x%d) lanes PCIe Gen%d > (max Gen%d) link", > + periph->periph_name, periph->unit_number, > + NVME_MAJOR(nvmex->spec), > + NVME_MINOR(nvmex->spec), > + nvmex->lanes, nvmex->max_lanes, > + nvmex->speed, nvmex->max_speed); > printf("\n"); > } > > static void > nvme_proto_announce(struct cam_ed *device) > { > + struct sbuf sb; > + char buffer[120]; > > - nvme_print_ident(device->nvme_cdata, device->nvme_data); > + sbuf_new(&sb, buffer, sizeof(buffer), SBUF_FIXEDLEN); > + nvme_print_ident(device->nvme_cdata, device->nvme_data, &sb); > + sbuf_finish(&sb); > + sbuf_putbuf(&sb); > } > > static void > nvme_proto_denounce(struct cam_ed *device) > { > > - nvme_print_ident(device->nvme_cdata, device->nvme_data); > + nvme_proto_announce(device); > } > > static void > > > > >