Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Oct 2008 04:27:44 GMT
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 150829 for review
Message-ID:  <200810030427.m934Rifq028623@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=150829

Change 150829 by thompsa@thompsa_burger on 2008/10/03 04:26:56

	Update comment on ng_tty and set the outq to a reasonable size.

Affected files ...

.. //depot/projects/mpsafetty/sys/netgraph/ng_tty.c#8 edit

Differences ...

==== //depot/projects/mpsafetty/sys/netgraph/ng_tty.c#8 (text+ko) ====

@@ -42,16 +42,19 @@
  */
 
 /*
- * This file implements a terminal line discipline that is also a
- * netgraph node. Installing this line discipline on a terminal device
- * instantiates a new netgraph node of this type, which allows access
- * to the device via the "hook" hook of the node.
+ * This file implements TTY hooks to link in to the netgraph system.  The node
+ * is created and then passed the callers opened TTY file descriptor number to
+ * NGM_TTY_SET_TTY, this will hook the tty via ttyhook_register().
+ *
+ * Incoming data is delivered directly to ng_tty via the TTY bypass hook as a
+ * buffer pointer and length, this is converted to a mbuf and passed to the
+ * peer.
  *
- * Incoming characters are delievered to the hook one at a time, each
- * in its own mbuf. You may optionally define a ``hotchar,'' which causes
- * incoming characters to be buffered up until either the hotchar is
- * seen or the mbuf is full (MHLEN bytes). Then all buffered characters
- * are immediately delivered.
+ * If the TTY device does not support bypass then incoming characters are
+ * delivered to the hook one at a time, each in its own mbuf. You may
+ * optionally define a ``hotchar,'' which causes incoming characters to be
+ * buffered up until either the hotchar is seen or the mbuf is full (MHLEN
+ * bytes). Then all buffered characters are immediately delivered.
  */
 
 #include <sys/param.h>
@@ -76,10 +79,6 @@
 #include <netgraph/netgraph.h>
 #include <netgraph/ng_tty.h>
 
-/* Misc defs */
-#define MAX_MBUFQ		3	/* Max number of queued mbufs */
-#define NGT_HIWATER		400	/* High water mark on output */
-
 /* Per-node private info */
 struct ngt_softc {
 	struct tty	*tp;		/* Terminal device */
@@ -167,7 +166,7 @@
 	sc->node = node;
 
 	mtx_init(&sc->outq.ifq_mtx, "ng_tty node+queue", NULL, MTX_DEF);
-	IFQ_SET_MAXLEN(&sc->outq, MAX_MBUFQ);
+	IFQ_SET_MAXLEN(&sc->outq, IFQ_MAXLEN);
 
 	atomic_add_int(&ngt_unit, 1);
 	snprintf(name, sizeof(name), "%s%d", typestruct.name, ngt_unit);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810030427.m934Rifq028623>