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
This commit is contained in:
jdolecek 2016-11-01 14:39:38 +00:00
parent b5e5261cdf
commit a2a95605bd
3 changed files with 11 additions and 9 deletions

View File

@ -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>
@ -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_nvme_attach(device_t parent, device_t self, void *aux)
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;

View File

@ -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 @@ nvme_rescan(device_t self, const char *attr, const int *flags)
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);
}

View File

@ -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_softc {
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 *);