Deleted Added
full compact
mp.c (64652) mp.c (64670)
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/ppp/mp.c 64652 2000-08-15 00:59:21Z brian $
26 * $FreeBSD: head/usr.sbin/ppp/mp.c 64670 2000-08-15 10:25:42Z brian $
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31#include <netinet/in_systm.h>
32#include <netinet/ip.h>
33#include <arpa/inet.h>
34#include <net/if_dl.h>

--- 149 unchanged lines hidden (view full) ---

184}
185
186static void
187mp_UpDown(void *v)
188{
189 struct mp *mp = (struct mp *)v;
190 int percent;
191
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31#include <netinet/in_systm.h>
32#include <netinet/ip.h>
33#include <arpa/inet.h>
34#include <net/if_dl.h>

--- 149 unchanged lines hidden (view full) ---

184}
185
186static void
187mp_UpDown(void *v)
188{
189 struct mp *mp = (struct mp *)v;
190 int percent;
191
192 percent = mp->link.stats.total.OctetsPerSecond * 800 / mp->bundle->bandwidth;
192 percent = MAX(mp->link.stats.total.in.OctetsPerSecond,
193 mp->link.stats.total.out.OctetsPerSecond) * 800 /
194 mp->bundle->bandwidth;
193 if (percent >= mp->cfg.autoload.max) {
194 log_Printf(LogDEBUG, "%d%% saturation - bring a link up ?\n", percent);
195 bundle_AutoAdjust(mp->bundle, percent, AUTO_UP);
196 } else if (percent <= mp->cfg.autoload.min) {
197 log_Printf(LogDEBUG, "%d%% saturation - bring a link down ?\n", percent);
198 bundle_AutoAdjust(mp->bundle, percent, AUTO_DOWN);
199 }
200}

--- 946 unchanged lines hidden ---
195 if (percent >= mp->cfg.autoload.max) {
196 log_Printf(LogDEBUG, "%d%% saturation - bring a link up ?\n", percent);
197 bundle_AutoAdjust(mp->bundle, percent, AUTO_UP);
198 } else if (percent <= mp->cfg.autoload.min) {
199 log_Printf(LogDEBUG, "%d%% saturation - bring a link down ?\n", percent);
200 bundle_AutoAdjust(mp->bundle, percent, AUTO_DOWN);
201 }
202}

--- 946 unchanged lines hidden ---