summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/bundle.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-08-15 10:25:42 +0000
committerbrian <brian@FreeBSD.org>2000-08-15 10:25:42 +0000
commit2e8f0fe474c0ef6857cb0581ea2879daccbf85b1 (patch)
tree9d83481cb2a113087032c12eb168892b507b84f6 /usr.sbin/ppp/bundle.c
parentead30e83239251cba3bf2fd08387ab9e4963dbe7 (diff)
downloadFreeBSD-src-2e8f0fe474c0ef6857cb0581ea2879daccbf85b1.zip
FreeBSD-src-2e8f0fe474c0ef6857cb0581ea2879daccbf85b1.tar.gz
Maintain input and output throughput averages and choose the highest
of the two when calculating the MP throughput average for the ``set autoload'' implementation. This makes more sense as all links I know of are full-duplex. This also means that people may need to adjust their autoload settings as 100% bandwidth is now the theoretical maximum rather than 200% (but of course, halfing the current settings is probably not the correct answer either!). This involves a ppp version bump as we need to pass an extra throughput array through the MP local domain socket.
Diffstat (limited to 'usr.sbin/ppp/bundle.c')
-rw-r--r--usr.sbin/ppp/bundle.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 925535a..3e3e41f 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -95,8 +95,8 @@
#include "ip.h"
#include "iface.h"
-#define SCATTER_SEGMENTS 6 /* version, datalink, name, physical,
- throughput, device */
+#define SCATTER_SEGMENTS 7 /* version, datalink, name, physical,
+ throughput, throughput, device */
#define SEND_MAXFD 3 /* Max file descriptors passed through
the local domain socket */
@@ -1117,28 +1117,31 @@ bundle_ShowLinks(struct cmdargs const *arg)
{
struct datalink *dl;
struct pppThroughput *t;
+ unsigned long long octets;
int secs;
for (dl = arg->bundle->links; dl; dl = dl->next) {
+ octets = MAX(dl->physical->link.stats.total.in.OctetsPerSecond,
+ dl->physical->link.stats.total.out.OctetsPerSecond);
+
prompt_Printf(arg->prompt, "Name: %s [%s, %s]",
dl->name, mode2Nam(dl->physical->type), datalink_State(dl));
if (dl->physical->link.stats.total.rolling && dl->state == DATALINK_OPEN)
prompt_Printf(arg->prompt, " bandwidth %d, %llu bps (%llu bytes/sec)",
dl->mp.bandwidth ? dl->mp.bandwidth :
physical_GetSpeed(dl->physical),
- dl->physical->link.stats.total.OctetsPerSecond * 8,
- dl->physical->link.stats.total.OctetsPerSecond);
+ octets * 8, octets);
prompt_Printf(arg->prompt, "\n");
}
t = &arg->bundle->ncp.mp.link.stats.total;
+ octets = MAX(t->in.OctetsPerSecond, t->out.OctetsPerSecond);
secs = t->downtime ? 0 : throughput_uptime(t);
if (secs > t->SamplePeriod)
secs = t->SamplePeriod;
if (secs)
prompt_Printf(arg->prompt, "Currently averaging %llu bps (%llu bytes/sec)"
- " over the last %d secs\n", t->OctetsPerSecond * 8,
- t->OctetsPerSecond, secs);
+ " over the last %d secs\n", octets * 8, octets, secs);
return 0;
}
OpenPOWER on IntegriCloud