2005-12-11 15:16:03 +03:00
|
|
|
/* $NetBSD: tp_timer.c,v 1.17 2005/12/11 12:25:12 christos Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1993-04-09 16:00:07 +04:00
|
|
|
/*-
|
1994-05-13 10:08:03 +04:00
|
|
|
* Copyright (c) 1991, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 20:26:28 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-04-09 16:00:07 +04:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1994-06-29 10:39:25 +04:00
|
|
|
* @(#)tp_timer.c 8.1 (Berkeley) 6/10/93
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Copyright IBM Corporation 1987
|
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
1993-04-09 16:00:07 +04:00
|
|
|
provided that the above copyright notice appear in all copies and that
|
1996-02-14 01:07:57 +03:00
|
|
|
both that copyright notice and this permission notice appear in
|
1993-04-09 16:00:07 +04:00
|
|
|
supporting documentation, and that the name of IBM not be
|
|
|
|
used in advertising or publicity pertaining to distribution of the
|
1996-02-14 01:07:57 +03:00
|
|
|
software without specific, written prior permission.
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
|
|
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
|
|
IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
|
|
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
|
|
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
|
|
SOFTWARE.
|
|
|
|
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
|
|
|
|
*/
|
|
|
|
|
2001-11-13 03:56:55 +03:00
|
|
|
#include <sys/cdefs.h>
|
2005-12-11 15:16:03 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: tp_timer.c,v 1.17 2005/12/11 12:25:12 christos Exp $");
|
2001-11-13 03:56:55 +03:00
|
|
|
|
1993-12-18 03:40:47 +03:00
|
|
|
#include <sys/param.h>
|
1994-05-13 10:08:03 +04:00
|
|
|
#include <sys/systm.h>
|
1993-12-18 03:40:47 +03:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/malloc.h>
|
1994-05-13 10:08:03 +04:00
|
|
|
#include <sys/protosw.h>
|
1993-12-18 03:40:47 +03:00
|
|
|
#include <sys/socket.h>
|
1994-05-13 10:08:03 +04:00
|
|
|
#include <sys/kernel.h>
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1994-05-13 10:08:03 +04:00
|
|
|
#include <netiso/argo_debug.h>
|
1993-12-18 03:40:47 +03:00
|
|
|
#include <netiso/tp_param.h>
|
|
|
|
#include <netiso/tp_timer.h>
|
|
|
|
#include <netiso/tp_stat.h>
|
|
|
|
#include <netiso/tp_pcb.h>
|
|
|
|
#include <netiso/tp_tpdu.h>
|
|
|
|
#include <netiso/tp_trace.h>
|
|
|
|
#include <netiso/tp_seq.h>
|
1996-02-14 01:07:57 +03:00
|
|
|
#include <netiso/tp_var.h>
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
struct tp_ref *tp_ref;
|
|
|
|
int tp_rttdiv, tp_rttadd, N_TPREF = 127;
|
|
|
|
struct tp_refinfo tp_refinfo;
|
|
|
|
struct tp_pcb *tp_ftimeolist = (struct tp_pcb *) & tp_ftimeolist;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CALLED FROM:
|
1996-02-14 01:07:57 +03:00
|
|
|
* at autoconfig time from tp_init()
|
1993-04-09 16:00:07 +04:00
|
|
|
* a combo of event, state, predicate
|
|
|
|
* FUNCTION and ARGUMENTS:
|
|
|
|
* initialize data structures for the timers
|
|
|
|
*/
|
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_timerinit(void)
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
2000-03-30 16:51:13 +04:00
|
|
|
int s;
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* Initialize storage
|
|
|
|
*/
|
1994-05-13 10:08:03 +04:00
|
|
|
if (tp_refinfo.tpr_base)
|
|
|
|
return;
|
1996-02-14 01:07:57 +03:00
|
|
|
tp_refinfo.tpr_size = N_TPREF + 1; /* Need to start somewhere */
|
1994-05-13 10:08:03 +04:00
|
|
|
s = sizeof(*tp_ref) * tp_refinfo.tpr_size;
|
2004-04-18 22:54:03 +04:00
|
|
|
if ((tp_ref = (struct tp_ref *) malloc(s, M_PCB, M_NOWAIT|M_ZERO)) == 0)
|
1994-05-13 10:08:03 +04:00
|
|
|
panic("tp_timerinit");
|
|
|
|
tp_refinfo.tpr_base = tp_ref;
|
|
|
|
tp_rttdiv = hz / PR_SLOWHZ;
|
|
|
|
tp_rttadd = (2 * tp_rttdiv) - 1;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
1994-05-13 10:08:03 +04:00
|
|
|
#ifdef TP_DEBUG_TIMERS
|
1993-04-09 16:00:07 +04:00
|
|
|
/********************** e timers *************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CALLED FROM:
|
|
|
|
* tp.trans all over
|
|
|
|
* FUNCTION and ARGUMENTS:
|
1994-05-13 10:08:03 +04:00
|
|
|
* Set an E type timer.
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_etimeout(
|
|
|
|
struct tp_pcb *tpcb,
|
|
|
|
int fun, /* function to be called */
|
|
|
|
int ticks)
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
|
|
|
|
2000-03-30 16:51:13 +04:00
|
|
|
u_int *callp;
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_TIMER]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("etimeout pcb %p state 0x%x\n", tpcb, tpcb->tp_state);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef TPPT
|
|
|
|
if (tp_traceflags[D_TIMER]) {
|
1994-05-13 10:08:03 +04:00
|
|
|
tptrace(TPPTmisc, "tp_etimeout ref refstate tks Etick", tpcb->tp_lref,
|
1996-02-14 01:07:57 +03:00
|
|
|
tpcb->tp_state, ticks, tp_stat.ts_Eticks);
|
|
|
|
}
|
|
|
|
#endif
|
1994-05-13 10:08:03 +04:00
|
|
|
if (tpcb == 0)
|
|
|
|
return;
|
1993-04-09 16:00:07 +04:00
|
|
|
IncStat(ts_Eset);
|
|
|
|
if (ticks == 0)
|
|
|
|
ticks = 1;
|
1994-05-13 10:08:03 +04:00
|
|
|
callp = tpcb->tp_timer + fun;
|
|
|
|
if (*callp == 0 || *callp > ticks)
|
|
|
|
*callp = ticks;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CALLED FROM:
|
|
|
|
* tp.trans all over
|
|
|
|
* FUNCTION and ARGUMENTS:
|
|
|
|
* Cancel all occurrences of E-timer function (fun) for reference (refp)
|
|
|
|
*/
|
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_euntimeout(struct tp_pcb *tpcb, int fun)
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef TPPT
|
|
|
|
if (tp_traceflags[D_TIMER]) {
|
1994-05-13 10:08:03 +04:00
|
|
|
tptrace(TPPTmisc, "tp_euntimeout ref", tpcb->tp_lref, 0, 0, 0);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1994-05-13 10:08:03 +04:00
|
|
|
if (tpcb)
|
|
|
|
tpcb->tp_timer[fun] = 0;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************** c timers **********************
|
|
|
|
*
|
|
|
|
* These are not chained together; they sit
|
|
|
|
* in the tp_ref structure. they are the kind that
|
|
|
|
* are typically cancelled so it's faster not to
|
|
|
|
* mess with the chains
|
|
|
|
*/
|
1994-05-13 10:08:03 +04:00
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* CALLED FROM:
|
|
|
|
* the clock, every 500 ms
|
|
|
|
* FUNCTION and ARGUMENTS:
|
|
|
|
* Look for open references with active timers.
|
|
|
|
* If they exist, call the appropriate timer routines to update
|
|
|
|
* the timers and possibly generate events.
|
|
|
|
*/
|
1994-05-13 10:08:03 +04:00
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_slowtimo(void)
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
2000-03-30 16:51:13 +04:00
|
|
|
u_int *cp;
|
|
|
|
struct tp_ref *rp;
|
1996-02-14 01:07:57 +03:00
|
|
|
struct tp_pcb *tpcb;
|
|
|
|
struct tp_event E;
|
|
|
|
int s = splsoftnet(), t;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
/* check only open reference structures */
|
|
|
|
IncStat(ts_Cticks);
|
1994-05-13 10:08:03 +04:00
|
|
|
/* tp_ref[0] is never used */
|
|
|
|
for (rp = tp_ref + tp_refinfo.tpr_maxopen; rp > tp_ref; rp--) {
|
1996-02-14 01:07:57 +03:00
|
|
|
if ((tpcb = rp->tpr_pcb) == 0 || tpcb->tp_refstate < REF_OPEN)
|
1993-04-09 16:00:07 +04:00
|
|
|
continue;
|
1994-05-13 10:08:03 +04:00
|
|
|
/* check the timers */
|
|
|
|
for (t = 0; t < TM_NTIMERS; t++) {
|
|
|
|
cp = tpcb->tp_timer + t;
|
1996-02-14 01:07:57 +03:00
|
|
|
if (*cp && --(*cp) <= 0) {
|
1994-05-13 10:08:03 +04:00
|
|
|
*cp = 0;
|
|
|
|
E.ev_number = t;
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_TIMER]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("tp_slowtimo: pcb %p t %d\n",
|
1996-02-14 01:07:57 +03:00
|
|
|
tpcb, t);
|
|
|
|
}
|
|
|
|
#endif
|
1994-05-13 10:08:03 +04:00
|
|
|
IncStat(ts_Cexpired);
|
|
|
|
tp_driver(tpcb, &E);
|
|
|
|
if (t == TM_reference && tpcb->tp_state == TP_CLOSED) {
|
|
|
|
if (tpcb->tp_notdetached) {
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_CONN]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("PRU_DETACH: not detached\n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1994-05-13 10:08:03 +04:00
|
|
|
tp_detach(tpcb);
|
|
|
|
}
|
|
|
|
/* XXX wart; where else to do it? */
|
1996-02-14 01:07:57 +03:00
|
|
|
free((caddr_t) tpcb, M_PCB);
|
2005-02-24 11:29:23 +03:00
|
|
|
break;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
1994-05-13 10:08:03 +04:00
|
|
|
/*
|
|
|
|
* Called From: tp.trans from tp_slowtimo() -- retransmission timer went off.
|
|
|
|
*/
|
1996-02-14 01:07:57 +03:00
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_data_retrans(struct tp_pcb *tpcb)
|
1994-05-13 10:08:03 +04:00
|
|
|
{
|
1996-02-14 01:07:57 +03:00
|
|
|
int rexmt, win;
|
1994-05-13 10:08:03 +04:00
|
|
|
tpcb->tp_rttemit = 0; /* cancel current round trip time */
|
|
|
|
tpcb->tp_dupacks = 0;
|
|
|
|
tpcb->tp_sndnxt = tpcb->tp_snduna;
|
|
|
|
if (tpcb->tp_fcredit == 0) {
|
|
|
|
/*
|
|
|
|
* We transmitted new data, started timing it and the window
|
|
|
|
* got shrunk under us. This can only happen if all data
|
|
|
|
* that they wanted us to send got acked, so don't
|
|
|
|
* bother shrinking the congestion windows, et. al.
|
|
|
|
* The retransmission timer should have been reset in goodack()
|
|
|
|
*/
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ACKRECV]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("tp_data_retrans: 0 window tpcb %p una 0x%x\n",
|
1996-02-14 01:07:57 +03:00
|
|
|
tpcb, tpcb->tp_snduna);
|
|
|
|
}
|
|
|
|
#endif
|
1994-05-13 10:08:03 +04:00
|
|
|
tpcb->tp_rxtshift = 0;
|
|
|
|
tpcb->tp_timer[TM_data_retrans] = 0;
|
|
|
|
tpcb->tp_timer[TM_sendack] = tpcb->tp_dt_ticks;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
rexmt = tpcb->tp_dt_ticks << min(tpcb->tp_rxtshift, TP_MAXRXTSHIFT);
|
|
|
|
win = min(tpcb->tp_fcredit, (tpcb->tp_cong_win / tpcb->tp_l_tpdusize / 2));
|
|
|
|
win = max(win, 2);
|
|
|
|
tpcb->tp_cong_win = tpcb->tp_l_tpdusize; /* slow start again. */
|
|
|
|
tpcb->tp_ssthresh = win * tpcb->tp_l_tpdusize;
|
1996-02-14 01:07:57 +03:00
|
|
|
/*
|
|
|
|
* We're losing; our srtt estimate is probably bogus. Clobber it so
|
|
|
|
* we'll take the next rtt measurement as our srtt; Maintain current
|
|
|
|
* rxt times until then.
|
1994-05-13 10:08:03 +04:00
|
|
|
*/
|
|
|
|
if (++tpcb->tp_rxtshift > TP_NRETRANS / 4) {
|
|
|
|
/* tpcb->tp_nlprotosw->nlp_losing(tpcb->tp_npcb) someday */
|
|
|
|
tpcb->tp_rtt = 0;
|
|
|
|
}
|
|
|
|
TP_RANGESET(tpcb->tp_rxtcur, rexmt, tpcb->tp_peer_acktime, 128);
|
|
|
|
tpcb->tp_timer[TM_data_retrans] = tpcb->tp_rxtcur;
|
|
|
|
tp_send(tpcb);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_fasttimo(void)
|
1994-05-13 10:08:03 +04:00
|
|
|
{
|
2000-03-30 16:51:13 +04:00
|
|
|
struct tp_pcb *t;
|
1996-02-14 01:07:57 +03:00
|
|
|
int s = splsoftnet();
|
|
|
|
struct tp_event E;
|
1994-05-13 10:08:03 +04:00
|
|
|
|
|
|
|
E.ev_number = TM_sendack;
|
1996-02-14 01:07:57 +03:00
|
|
|
while ((t = tp_ftimeolist) != (struct tp_pcb *) & tp_ftimeolist) {
|
1994-05-13 10:08:03 +04:00
|
|
|
if (t == 0) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("tp_fasttimeo: should panic");
|
1996-02-14 01:07:57 +03:00
|
|
|
tp_ftimeolist = (struct tp_pcb *) & tp_ftimeolist;
|
1994-05-13 10:08:03 +04:00
|
|
|
} else {
|
|
|
|
if (t->tp_flags & TPF_DELACK) {
|
|
|
|
IncStat(ts_Fdelack);
|
|
|
|
tp_driver(t, &E);
|
|
|
|
t->tp_flags &= ~TPF_DELACK;
|
|
|
|
} else
|
|
|
|
IncStat(ts_Fpruned);
|
|
|
|
tp_ftimeolist = t->tp_fasttimeo;
|
|
|
|
t->tp_fasttimeo = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef TP_DEBUG_TIMERS
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* CALLED FROM:
|
|
|
|
* tp.trans, tp_emit()
|
|
|
|
* FUNCTION and ARGUMENTS:
|
|
|
|
* Set a C type timer of type (which) to go off after (ticks) time.
|
|
|
|
*/
|
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_ctimeout(struct tp_pcb *tpcb, int which, int ticks)
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef TPPT
|
|
|
|
if (tp_traceflags[D_TIMER]) {
|
|
|
|
tptrace(TPPTmisc, "tp_ctimeout ref which tpcb active",
|
1994-05-13 10:08:03 +04:00
|
|
|
tpcb->tp_lref, which, tpcb, tpcb->tp_timer[which]);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (tpcb->tp_timer[which])
|
1993-04-09 16:00:07 +04:00
|
|
|
IncStat(ts_Ccan_act);
|
|
|
|
IncStat(ts_Cset);
|
1994-05-13 10:08:03 +04:00
|
|
|
if (ticks <= 0)
|
|
|
|
ticks = 1;
|
|
|
|
tpcb->tp_timer[which] = ticks;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CALLED FROM:
|
1996-02-14 01:07:57 +03:00
|
|
|
* tp.trans
|
1993-04-09 16:00:07 +04:00
|
|
|
* FUNCTION and ARGUMENTS:
|
1996-02-14 01:07:57 +03:00
|
|
|
* Version of tp_ctimeout that resets the C-type time if the
|
1993-04-09 16:00:07 +04:00
|
|
|
* parameter (ticks) is > the current value of the timer.
|
|
|
|
*/
|
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_ctimeout_MIN(struct tp_pcb *tpcb, int which, int ticks)
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef TPPT
|
|
|
|
if (tp_traceflags[D_TIMER]) {
|
|
|
|
tptrace(TPPTmisc, "tp_ctimeout_MIN ref which tpcb active",
|
1994-05-13 10:08:03 +04:00
|
|
|
tpcb->tp_lref, which, tpcb, tpcb->tp_timer[which]);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
IncStat(ts_Cset);
|
|
|
|
if (tpcb->tp_timer[which]) {
|
1994-05-13 10:08:03 +04:00
|
|
|
tpcb->tp_timer[which] = min(ticks, tpcb->tp_timer[which]);
|
|
|
|
IncStat(ts_Ccan_act);
|
|
|
|
} else
|
|
|
|
tpcb->tp_timer[which] = ticks;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CALLED FROM:
|
|
|
|
* tp.trans
|
|
|
|
* FUNCTION and ARGUMENTS:
|
|
|
|
* Cancel the (which) timer in the ref structure indicated by (refp).
|
|
|
|
*/
|
|
|
|
void
|
2004-04-19 09:16:45 +04:00
|
|
|
tp_cuntimeout(struct tp_pcb *tpcb, int which)
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_TIMER]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("tp_cuntimeout(%p, %d) active %d\n",
|
1996-02-14 01:07:57 +03:00
|
|
|
tpcb, which, tpcb->tp_timer[which]);
|
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef TPPT
|
|
|
|
if (tp_traceflags[D_TIMER]) {
|
|
|
|
tptrace(TPPTmisc, "tp_cuntimeout ref which, active", refp - tp_ref,
|
1994-05-13 10:08:03 +04:00
|
|
|
which, tpcb->tp_timer[which], 0);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1994-05-13 10:08:03 +04:00
|
|
|
if (tpcb->tp_timer[which])
|
1993-04-09 16:00:07 +04:00
|
|
|
IncStat(ts_Ccan_act);
|
|
|
|
else
|
|
|
|
IncStat(ts_Ccan_inact);
|
1994-05-13 10:08:03 +04:00
|
|
|
tpcb->tp_timer[which] = 0;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
1994-05-13 10:08:03 +04:00
|
|
|
#endif
|