Add ``set ifqueue'' to control the size of the outgoing packet

queue.  Doing ``set ifqueue 0'' and ``set urgent none'' will allow
full use of luigi's WF2Q code.

Requested by: luigi
This commit is contained in:
Brian Somers 2000-06-11 02:30:51 +00:00
parent 4f443c2c44
commit 6c1d673108
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=61534
6 changed files with 57 additions and 2 deletions

View File

@ -440,6 +440,7 @@ bundle_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
struct bundle *bundle = descriptor2bundle(d);
struct datalink *dl;
int result, nlinks;
u_short ifqueue;
size_t queued;
result = 0;
@ -454,7 +455,8 @@ bundle_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
if (r && (bundle->phase == PHASE_NETWORK ||
bundle->phys_type.all & PHYS_AUTO)) {
/* enough surplus so that we can tell if we're getting swamped */
if (queued < 30) {
ifqueue = nlinks > bundle->cfg.ifqueue ? nlinks : bundle->cfg.ifqueue;
if (queued < ifqueue) {
/* Not enough - select() for more */
if (bundle->choked.timer.state == TIMER_RUNNING)
timer_Stop(&bundle->choked.timer); /* Not needed any more */
@ -806,6 +808,7 @@ bundle_Create(const char *prefix, int type, int unit)
OPT_THROUGHPUT | OPT_UTMP;
*bundle.cfg.label = '\0';
bundle.cfg.mtu = DEF_MTU;
bundle.cfg.ifqueue = DEF_IFQUEUE;
bundle.cfg.choked.timeout = CHOKED_TIMEOUT;
bundle.phys_type.all = type;
bundle.phys_type.open = 0;
@ -1156,8 +1159,10 @@ bundle_ShowStatus(struct cmdargs const *arg)
prompt_Printf(arg->prompt, ", up time %d:%02d:%02d", secs / 3600,
(secs / 60) % 60, secs % 60);
}
prompt_Printf(arg->prompt, "\n Queued: %u of %u\n",
ip_QueueLen(&arg->bundle->ncp.ipcp), arg->bundle->cfg.ifqueue);
prompt_Printf(arg->prompt, "\n\nDefaults:\n");
prompt_Printf(arg->prompt, "\nDefaults:\n");
prompt_Printf(arg->prompt, " Label: %s\n", arg->bundle->cfg.label);
prompt_Printf(arg->prompt, " Auth name: %s\n",
arg->bundle->cfg.auth.name);

View File

@ -101,6 +101,7 @@ struct bundle {
unsigned opt; /* Uses OPT_ bits from above */
char label[50]; /* last thing `load'ed */
u_short mtu; /* Interface mtu */
u_short ifqueue; /* Interface queue size */
struct {
int timeout; /* How long to leave the output queue choked */

View File

@ -131,6 +131,7 @@
#define VAR_CRTSCTS 32
#define VAR_URGENTPORTS 33
#define VAR_LOGOUT 34
#define VAR_IFQUEUE 35
/* ``accept|deny|disable|enable'' masks */
#define NEG_HISMASK (1)
@ -1646,6 +1647,11 @@ SetVariable(struct cmdargs const *arg)
cx->cfg.script.hangup[sizeof cx->cfg.script.hangup - 1] = '\0';
break;
case VAR_IFQUEUE:
long_val = atol(argp);
arg->bundle->cfg.ifqueue = long_val < 0 ? 0 : long_val;
break;
case VAR_LOGOUT:
strncpy(cx->cfg.script.logout, argp, sizeof cx->cfg.script.logout - 1);
cx->cfg.script.logout[sizeof cx->cfg.script.logout - 1] = '\0';
@ -1954,6 +1960,8 @@ static struct cmdtab const SetCommands[] = {
"hangup script", "set hangup chat-script", (const void *) VAR_HANGUP},
{"ifaddr", NULL, SetInterfaceAddr, LOCAL_AUTH, "destination address",
"set ifaddr [src-addr [dst-addr [netmask [trg-addr]]]]"},
{"ifqueue", NULL, SetVariable, LOCAL_AUTH, "interface queue",
"set ifqueue packets", (const void *)VAR_IFQUEUE},
{"ipcpretry", "ipcpretries", SetVariable, LOCAL_AUTH, "IPCP retries",
"set ipcpretry value [attempts]", (const void *)VAR_IPCPRETRY},
{"lcpretry", "lcpretries", SetVariable, LOCAL_AUTH | LOCAL_CX, "LCP retries",

View File

@ -59,6 +59,7 @@
#define DEF_FSMRETRY 3 /* FSM retry frequency */
#define DEF_FSMTRIES 5 /* Default max retries */
#define DEF_FSMAUTHTRIES 3 /* Default max auth retries */
#define DEF_IFQUEUE 30 /* Default interface queue size */
#define CONFFILE "ppp.conf"
#define LINKUPFILE "ppp.linkup"

View File

@ -4248,6 +4248,26 @@ In all cases, if the interface is already configured,
.Nm
will try to maintain the interface IP numbers so that any existing
bound sockets will remain valid.
.It set ifqueue Ar packets
Set the maximum number of packets that
.Nm
will read from the tunnel interface while data cannot be sent to any of
the available links. This queue limit is necessary to flow control outgoing
data as the tunnel interface is likely to be far faster than the combined
links available to
.Nm ppp .
.Pp
If
.Ar packets
is set to a value less than the number of links,
.Nm
will read up to that value regardless.
This prevents any possible latency problems.
.Pp
The default value for
.Ar packets
is
.Dq 30 .
.It set ccpretry|ccpretries Oo Ar timeout
.Op Ar reqtries Op Ar trmtries
.Oc

View File

@ -4248,6 +4248,26 @@ In all cases, if the interface is already configured,
.Nm
will try to maintain the interface IP numbers so that any existing
bound sockets will remain valid.
.It set ifqueue Ar packets
Set the maximum number of packets that
.Nm
will read from the tunnel interface while data cannot be sent to any of
the available links. This queue limit is necessary to flow control outgoing
data as the tunnel interface is likely to be far faster than the combined
links available to
.Nm ppp .
.Pp
If
.Ar packets
is set to a value less than the number of links,
.Nm
will read up to that value regardless.
This prevents any possible latency problems.
.Pp
The default value for
.Ar packets
is
.Dq 30 .
.It set ccpretry|ccpretries Oo Ar timeout
.Op Ar reqtries Op Ar trmtries
.Oc