* Copyright (C) Dirk Husemann, Computer Science Department IV,
* University of Erlangen-Nuremberg, Germany, 1990, 1991, 1992
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
* This code is derived from software contributed to Berkeley by
* Dirk Husemann and the Computer Science Department (IV) of
* the University of Erlangen-Nuremberg, Germany.
* %sccs.include.redist.c%
* @(#)llc_timer.c 8.1 (Berkeley) %G%
#include <netccitt/dll.h>
#include <netccitt/llc_var.h>
* Various timer values. They can be adjusted
* by patching the binary with adb if necessary.
int llc_n2
= LLC_N2_VALUE
;
int llc_ACK_timer
= LLC_ACK_TIMER
;
int llc_P_timer
= LLC_P_TIMER
;
int llc_BUSY_timer
= LLC_BUSY_TIMER
;
int llc_REJ_timer
= LLC_REJ_TIMER
;
/* Implementation specific timers */
int llc_AGE_timer
= LLC_AGE_TIMER
;
int llc_DACTION_timer
= LLC_DACTION_TIMER
;
* The timer routine. We are called every 500ms by the kernel.
* Handle the various virtual timers.
register struct llc_linkcb
*linkp
;
register struct llc_linkcb
*nlinkp
;
register int s
= splimp();
* All links are accessible over the doubly linked list llccb_q
* A for-loop is not that great an idea as the linkp
* might get deleted if the age timer has expired ...
* Check implementation specific timers first
/* The delayed action/acknowledge idle timer */
switch (LLC_TIMERXPIRED(linkp
, DACTION
)) {
LLC_AGETIMER(linkp
, DACTION
);
case LLC_TIMER_EXPIRED
: {
switch (LLC_GETFLAG(linkp
, DACTION
)) {
cmdrsp
= LLC_CMD
, pollfinal
= 0;
cmdrsp
= LLC_CMD
, pollfinal
= 1;
cmdrsp
= LLC_RSP
, pollfinal
= 0;
cmdrsp
= LLC_RSP
, pollfinal
= 1;
llc_send(linkp
, LLCFT_RR
, cmdrsp
, pollfinal
);
LLC_STOPTIMER(linkp
, DACTION
);
/* The link idle timer */
switch (LLC_TIMERXPIRED(linkp
, AGE
)) {
LLC_AGETIMER(linkp
, AGE
);
* Only crunch the link when really no
* timers are running any more.
if (llc_anytimersup(linkp
) == 0) {
LLC_STOPTIMER(linkp
, AGE
);
LLC_STARTTIMER(linkp
, AGE
);
* Now, check all the ISO 8802-2 timers
FOR_ALL_LLC_TIMERS(timer
) {
if ((linkp
->llcl_timerflags
& (1<<timer
)) &&
(linkp
->llcl_timers
[timer
] == 0)) {
action
= LLC_ACK_TIMER_EXPIRED
;
action
= LLC_P_TIMER_EXPIRED
;
action
= LLC_BUSY_TIMER_EXPIRED
;
action
= LLC_REJ_TIMER_EXPIRED
;
linkp
->llcl_timerflags
&= ~(1<<timer
);
(void)llc_statehandler(linkp
, (struct llc
*)0, action
, 0, 1);
} else if (linkp
->llcl_timers
[timer
] > 0)
linkp
->llcl_timers
[timer
]--;