Module Name:    src
Committed By:   jdolecek
Date:           Sat Mar 25 18:09:44 UTC 2017

Modified Files:
        src/sys/dev/pci: vioscsi.c

Log Message:
cap adapt_openings to minimum of cmd_per_lun and qsize, so that we don't
overpromise to the upper layer

cap ntargets and nluns to 16 and 1024 as avoid spending excessive time
probing for nonexistent devices; e.g. qemu defaults to 255/16383 causing
the probe to take about a minute


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/vioscsi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/vioscsi.c
diff -u src/sys/dev/pci/vioscsi.c:1.12 src/sys/dev/pci/vioscsi.c:1.13
--- src/sys/dev/pci/vioscsi.c:1.12	Sat Mar 25 18:02:06 2017
+++ src/sys/dev/pci/vioscsi.c	Sat Mar 25 18:09:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vioscsi.c,v 1.12 2017/03/25 18:02:06 jdolecek Exp $	*/
+/*	$NetBSD: vioscsi.c,v 1.13 2017/03/25 18:09:44 jdolecek Exp $	*/
 /*	$OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.12 2017/03/25 18:02:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.13 2017/03/25 18:09:44 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -178,7 +178,7 @@ vioscsi_attach(device_t parent, device_t
 	memset(adapt, 0, sizeof(*adapt));
 	adapt->adapt_dev = sc->sc_dev;
 	adapt->adapt_nchannels = max_channel;
-	adapt->adapt_openings = cmd_per_lun;
+	adapt->adapt_openings = MIN(qsize, cmd_per_lun);
 	adapt->adapt_max_periph = adapt->adapt_openings;
 	adapt->adapt_request = vioscsi_scsipi_request;
 	adapt->adapt_minphys = minphys;
@@ -190,8 +190,8 @@ vioscsi_attach(device_t parent, device_t
 	chan->chan_adapter = adapt;
 	chan->chan_bustype = &scsi_bustype;
 	chan->chan_channel = 0;
-	chan->chan_ntargets = MIN(max_target + 1, 8);
-	chan->chan_nluns = MIN(max_lun + 1, 8);
+	chan->chan_ntargets = MIN(max_target, 16);	/* cap reasonably */
+	chan->chan_nluns = MIN(max_lun, 16);		/* cap reasonably */
 	chan->chan_id = 0;
 	chan->chan_flags = SCSIPI_CHAN_NOSETTLE;
 

Reply via email to