summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorStefan Fritsch <sf@cvs.openbsd.org>2016-01-14 09:44:09 +0000
committerStefan Fritsch <sf@cvs.openbsd.org>2016-01-14 09:44:09 +0000
commit760ace11e6ffc4748736f080e7b7ac0065399b1a (patch)
tree367387f9bf914bb1e225423a7902e4946d706f08 /sys/kern
parente3d0c036438f6732dd0fa4343e7817afec346363 (diff)
Increase buffer sizes and watermarks for tty and ppp
Use 115200 the default speed for buffer sizing in ttymalloc(). A lot of devices call ttymalloc(0) so this affects quite a few of them. Increases the buffer size for 9600 < baud <= 115200 from 1k to 4k. Make ppp use the lo/hi watermarks from the tty layer which are adjusted according to speed + buffer size. The previous fixed values of 100 and 400 were way too small Make pty call ttymalloc() with baud == 1000000, which is the common value used in the tree for "fast". ok deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/tty.c9
-rw-r--r--sys/kern/tty_pty.c10
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index b2760610552..73211ac1bb3 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.127 2015/12/05 10:11:53 tedu Exp $ */
+/* $OpenBSD: tty.c,v 1.128 2016/01/14 09:44:08 sf Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -2330,8 +2330,13 @@ ttymalloc(int baud)
tp = malloc(sizeof(struct tty), M_TTYS, M_WAITOK|M_ZERO);
- if (baud <= 115200)
+ if (baud == 0)
+ baud = 115200;
+
+ if (baud <= 9600)
tp->t_qlen = 1024;
+ else if (baud <= 115200)
+ tp->t_qlen = 4096;
else
tp->t_qlen = 8192;
clalloc(&tp->t_rawq, tp->t_qlen, 1);
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 40b2db29982..d94d91b1d15 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.74 2015/12/05 10:11:53 tedu Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.75 2016/01/14 09:44:08 sf Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -193,7 +193,7 @@ check_pty(int minor)
if (!pt_softc[minor]) {
pti = malloc(sizeof(struct pt_softc), M_DEVBUF,
M_WAITOK|M_ZERO);
- pti->pt_tty = ttymalloc(0);
+ pti->pt_tty = ttymalloc(1000000);
ptydevname(minor, pti);
pt_softc[minor] = pti;
}
@@ -235,7 +235,7 @@ ptsopen(dev_t dev, int flag, int devtype, struct proc *p)
pti = pt_softc[minor(dev)];
if (!pti->pt_tty) {
- tp = pti->pt_tty = ttymalloc(0);
+ tp = pti->pt_tty = ttymalloc(1000000);
} else
tp = pti->pt_tty;
if ((tp->t_state & TS_ISOPEN) == 0) {
@@ -245,7 +245,7 @@ ptsopen(dev_t dev, int flag, int devtype, struct proc *p)
tp->t_oflag = TTYDEF_OFLAG;
tp->t_lflag = TTYDEF_LFLAG;
tp->t_cflag = TTYDEF_CFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+ tp->t_ispeed = tp->t_ospeed = B115200;
ttsetwater(tp); /* would be done in xxparam() */
} else if (tp->t_state&TS_XCLUDE && suser(p, 0) != 0)
return (EBUSY);
@@ -412,7 +412,7 @@ ptcopen(dev_t dev, int flag, int devtype, struct proc *p)
pti = pt_softc[minor(dev)];
if (!pti->pt_tty) {
- tp = pti->pt_tty = ttymalloc(0);
+ tp = pti->pt_tty = ttymalloc(1000000);
} else
tp = pti->pt_tty;
if (tp->t_oproc)