diff options
author | brian <brian@FreeBSD.org> | 2000-06-11 02:30:51 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2000-06-11 02:30:51 +0000 |
commit | 41ff0cf69369bdc738ed42d51e7cda113ff55624 (patch) | |
tree | 19d65876345c30efb0c75dc3d31df574dba4046c | |
parent | 588124d70f7f4ecbb19857e53505887e8132a593 (diff) | |
download | FreeBSD-src-41ff0cf69369bdc738ed42d51e7cda113ff55624.zip FreeBSD-src-41ff0cf69369bdc738ed42d51e7cda113ff55624.tar.gz |
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
-rw-r--r-- | usr.sbin/ppp/bundle.c | 9 | ||||
-rw-r--r-- | usr.sbin/ppp/bundle.h | 1 | ||||
-rw-r--r-- | usr.sbin/ppp/command.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/defs.h | 1 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8 | 20 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8.m4 | 20 |
6 files changed, 57 insertions, 2 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index 5c3011c..66efa93 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -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); diff --git a/usr.sbin/ppp/bundle.h b/usr.sbin/ppp/bundle.h index 594045e..7007d78 100644 --- a/usr.sbin/ppp/bundle.h +++ b/usr.sbin/ppp/bundle.h @@ -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 */ diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index e648d66..afd8865 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -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", diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h index cb704d8..402bd18 100644 --- a/usr.sbin/ppp/defs.h +++ b/usr.sbin/ppp/defs.h @@ -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" diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index fe64202..95d2e4d 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -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 diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index fe64202..95d2e4d 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -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 |