Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic pass maxphys from device rather then assuming MAX...



details:   https://anonhg.NetBSD.org/src/rev/9d6bf51bfc5f
branches:  trunk
changeset: 818802:9d6bf51bfc5f
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Nov 01 14:39:38 2016 +0000

description:
pass maxphys from device rather then assuming MAXPHYS; it's clipped in ld(4)
if bigger then MAXPHYS

multiply the queue size by number of queues for ld(4) sc_maxqueuecnt, so
that ld_diskstart() would try to use full capacity, instead of throttling
to one queue worth of commands

diffstat:

 sys/dev/ic/ld_nvme.c |  8 ++++----
 sys/dev/ic/nvme.c    |  7 ++++---
 sys/dev/ic/nvmevar.h |  5 +++--
 3 files changed, 11 insertions(+), 9 deletions(-)

diffs (76 lines):

diff -r 543f7830dae4 -r 9d6bf51bfc5f sys/dev/ic/ld_nvme.c
--- a/sys/dev/ic/ld_nvme.c      Tue Nov 01 14:24:35 2016 +0000
+++ b/sys/dev/ic/ld_nvme.c      Tue Nov 01 14:39:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_nvme.c,v 1.9 2016/10/20 18:42:28 jdolecek Exp $     */
+/*     $NetBSD: ld_nvme.c,v 1.10 2016/11/01 14:39:38 jdolecek Exp $    */
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.9 2016/10/20 18:42:28 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.10 2016/11/01 14:39:38 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -108,8 +108,8 @@
 
        ld->sc_secsize = 1 << f->lbads;
        ld->sc_secperunit = nsze;
-       ld->sc_maxxfer = MAXPHYS; /* XXX set according to device */
-       ld->sc_maxqueuecnt = naa->naa_qentries; /* XXX set to max allowed by device, not current config */
+       ld->sc_maxxfer = naa->naa_maxphys;
+       ld->sc_maxqueuecnt = naa->naa_qentries;
        ld->sc_start = ld_nvme_start;
        ld->sc_dump = ld_nvme_dump;
        ld->sc_flush = ld_nvme_flush;
diff -r 543f7830dae4 -r 9d6bf51bfc5f sys/dev/ic/nvme.c
--- a/sys/dev/ic/nvme.c Tue Nov 01 14:24:35 2016 +0000
+++ b/sys/dev/ic/nvme.c Tue Nov 01 14:39:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvme.c,v 1.20 2016/11/01 14:24:35 jdolecek Exp $       */
+/*     $NetBSD: nvme.c,v 1.21 2016/11/01 14:39:38 jdolecek Exp $       */
 /*     $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.20 2016/11/01 14:24:35 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.21 2016/11/01 14:39:38 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -460,7 +460,8 @@
                        continue;
                memset(&naa, 0, sizeof(naa));
                naa.naa_nsid = i + 1;
-               naa.naa_qentries = ioq_entries;
+               naa.naa_qentries = (ioq_entries - 1) * sc->sc_nq;
+               naa.naa_maxphys = sc->sc_mdts;
                sc->sc_namespaces[i].dev = config_found(sc->sc_dev, &naa,
                    nvme_print);
        }
diff -r 543f7830dae4 -r 9d6bf51bfc5f sys/dev/ic/nvmevar.h
--- a/sys/dev/ic/nvmevar.h      Tue Nov 01 14:24:35 2016 +0000
+++ b/sys/dev/ic/nvmevar.h      Tue Nov 01 14:39:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvmevar.h,v 1.10 2016/11/01 14:24:35 jdolecek Exp $    */
+/*     $NetBSD: nvmevar.h,v 1.11 2016/11/01 14:39:38 jdolecek Exp $    */
 /*     $OpenBSD: nvmevar.h,v 1.8 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -145,7 +145,8 @@
 
 struct nvme_attach_args {
        uint16_t        naa_nsid;
-       uint32_t        naa_qentries;
+       uint32_t        naa_qentries;   /* total number of queue slots */
+       uint32_t        naa_maxphys;    /* maximum device transfer size */
 };
 
 int    nvme_attach(struct nvme_softc *);



Home | Main Index | Thread Index | Old Index