diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-03-04 10:37:32 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-03-04 10:37:32 +0000 |
commit | 19b3595c2000294ed57cd7cb23e1d91ee553215d (patch) | |
tree | 404b337fc172b005d07d5f30eeeb873a270a9eac /sys/netiso/tp_pcb.h | |
parent | d4b3fca05966647ecd8191d973cdce74570844ca (diff) |
Initial commit of NetBSD 960217 netiso.
all the rest is the fixes to the import by Niklas.
Diffstat (limited to 'sys/netiso/tp_pcb.h')
-rw-r--r-- | sys/netiso/tp_pcb.h | 442 |
1 files changed, 236 insertions, 206 deletions
diff --git a/sys/netiso/tp_pcb.h b/sys/netiso/tp_pcb.h index 99e1216d53b..68af0d3d2c0 100644 --- a/sys/netiso/tp_pcb.h +++ b/sys/netiso/tp_pcb.h @@ -1,4 +1,5 @@ -/* $NetBSD: tp_pcb.h,v 1.8 1995/08/16 00:38:57 mycroft Exp $ */ +/* $OpenBSD: tp_pcb.h,v 1.2 1996/03/04 10:36:20 mickey Exp $ */ +/* $NetBSD: tp_pcb.h,v 1.9 1996/02/13 22:11:44 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,15 +39,15 @@ /*********************************************************** Copyright IBM Corporation 1987 - All Rights Reserved + All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of IBM not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -61,194 +62,214 @@ SOFTWARE. /* * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison */ -/* - * This file defines the transport protocol control block (tpcb). - * and a bunch of #define values that are used in the tpcb. +/* + * This file defines the transport protocol control block (tpcb). and a bunch + * of #define values that are used in the tpcb. */ -#ifndef _NETISO_TP_PCB_H_ -#define _NETISO_TP_PCB_H_ +#ifndef _NETISO_TP_PCB_H_ +#define _NETISO_TP_PCB_H_ #include <netiso/tp_param.h> #include <netiso/tp_timer.h> #include <netiso/tp_user.h> #ifndef sblock #include <sys/socketvar.h> -#endif /* sblock */ +#endif /* sblock */ -/* NOTE: the code depends on REF_CLOSED > REF_OPEN > the rest, and - * on REF_FREE being zero - * - * Possible improvement: - * think about merging the tp_ref w/ the tpcb and doing a search - * through the tpcb list, from tpb. This would slow down lookup - * during data transfer - * It would be a little nicer also to have something based on the - * clock (like top n bits of the reference is part of the clock, to - * minimize the likelihood of reuse after a crash) - * also, need to keep the timer servicing part to a minimum (although - * the cost of this is probably independent of whether the timers are - * in the pcb or in an array.. - * Last, would have to make the number of timers a function of the amount of - * mbufs available, plus some for the frozen references. - * - * Possible improvement: - * Might not need the ref_state stuff either... - * REF_FREE could correspond to tp_state == CLOSED or nonexistend tpcb, - * REF_OPEN to tp_state anywhere from AK_WAIT or CR_SENT to CLOSING - * REF_OPENING could correspond to LISTENING, because that's the - * way it's used, not because the correspondence is exact. - * REF_CLOSED could correspond to REFWAIT +/* + * NOTE: the code depends on REF_CLOSED > REF_OPEN > the rest, and on + * REF_FREE being zero + * + * Possible improvement: think about merging the tp_ref w/ the tpcb and doing a + * search through the tpcb list, from tpb. This would slow down lookup during + * data transfer It would be a little nicer also to have something based on + * the clock (like top n bits of the reference is part of the clock, to + * minimize the likelihood of reuse after a crash) also, need to keep the + * timer servicing part to a minimum (although the cost of this is probably + * independent of whether the timers are in the pcb or in an array.. Last, + * would have to make the number of timers a function of the amount of mbufs + * available, plus some for the frozen references. + * + * Possible improvement: Might not need the ref_state stuff either... REF_FREE + * could correspond to tp_state == CLOSED or nonexistend tpcb, REF_OPEN to + * tp_state anywhere from AK_WAIT or CR_SENT to CLOSING REF_OPENING could + * correspond to LISTENING, because that's the way it's used, not because the + * correspondence is exact. REF_CLOSED could correspond to REFWAIT */ -#define REF_FROZEN 3 /* has ref timer only */ +#define REF_FROZEN 3 /* has ref timer only */ #define REF_OPEN 2 /* has timers, possibly active */ -#define REF_OPENING 1 /* in use (has a pcb) but no timers */ +#define REF_OPENING 1 /* in use (has a pcb) but no timers */ #define REF_FREE 0 /* free to reallocate */ -#define TM_NTIMERS 6 +#define TM_NTIMERS 6 +struct iso_addr; +struct sockaddr; +struct socket; +struct tp_pcb; +struct inpcb; struct tp_ref { - struct tp_pcb *tpr_pcb; /* back ptr to PCB */ + struct tp_pcb *tpr_pcb;/* back ptr to PCB */ }; /* PER system stuff (one static structure instead of a bunch of names) */ struct tp_refinfo { - struct tp_ref *tpr_base; - int tpr_size; - int tpr_maxopen; - int tpr_numopen; + struct tp_ref *tpr_base; + int tpr_size; + int tpr_maxopen; + int tpr_numopen; }; struct nl_protosw { - int nlp_afamily; /* address family */ - int (*nlp_putnetaddr)(); /* puts addresses in nl pcb */ - int (*nlp_getnetaddr)(); /* gets addresses from nl pcb */ - int (*nlp_cmpnetaddr)(); /* compares address in pcb with sockaddr */ - int (*nlp_putsufx)(); /* puts transport suffixes in nl pcb */ - int (*nlp_getsufx)(); /* gets transport suffixes from nl pcb */ - int (*nlp_recycle_suffix)();/* clears suffix from nl pcb */ - int (*nlp_mtu)(); /* figures out mtu based on nl used */ - int (*nlp_pcbbind)(); /* bind to pcb for net level */ - int (*nlp_pcbconn)(); /* connect for net level */ - int (*nlp_pcbdisc)(); /* disconnect net level */ - int (*nlp_pcbdetach)(); /* detach net level pcb */ - int (*nlp_pcballoc)(); /* allocate a net level pcb */ - int (*nlp_output)(); /* prepare a packet to give to nl */ - int (*nlp_dgoutput)(); /* prepare a packet to give to nl */ - int (*nlp_ctloutput)(); /* hook for network set/get options */ - caddr_t nlp_pcblist; /* list of xx_pcb's for connections */ + int nlp_afamily; /* address family */ + void (*nlp_putnetaddr) /* puts addresses in nl pcb */ + __P((void *, struct sockaddr *, int)); + void (*nlp_getnetaddr) /* gets addresses from nl pcb */ + __P((void *, struct mbuf *, int)); + int (*nlp_cmpnetaddr) /* compares address in pcb */ + __P((void *, struct sockaddr *, int)); + /* with sockaddr */ + void (*nlp_putsufx) /* puts transport suffixes in */ + __P((void *, caddr_t, int, int)); + /* nl pcb */ + void (*nlp_getsufx) /* gets transport suffixes */ + __P((void *, u_short *, caddr_t, int)); + /* from nl pcb */ + void (*nlp_recycle_suffix) /* clears suffix from nl pcb */ + __P((void *)); + int (*nlp_mtu) /* figures out mtu based on */ + __P((void *)); /* nl used */ + int (*nlp_pcbbind) /* bind to pcb for net level */ + __P((void *, struct mbuf *)); + int (*nlp_pcbconn) /* connect for net level */ + __P((void *, struct mbuf *)); + void (*nlp_pcbdisc) /* disconnect net level */ + __P((void *)); + void (*nlp_pcbdetach) /* detach net level pcb */ + __P((void *)); + int (*nlp_pcballoc) /* allocate a net level pcb */ + __P((struct socket *, void *)); + int (*nlp_output) /* prepare a packet to give */ + __P((struct mbuf *, ...)); /* to nl */ + int (*nlp_dgoutput) /* prepare a packet to give */ + __P((struct mbuf *, ...)); /*to nl*/ + int (*nlp_ctloutput) /* hook for network set/get */ + __P((int, int, caddr_t, struct mbuf *)); + /* options */ + caddr_t nlp_pcblist; /* list of xx_pcb's for connections */ }; struct tp_pcb { - struct tp_pcb *tp_next; - struct tp_pcb *tp_prev; - struct tp_pcb *tp_nextlisten; /* chain all listeners */ - struct socket *tp_sock; /* back ptr */ - u_short tp_state; /* state of fsm */ - short tp_retrans; /* # times can still retrans */ - caddr_t tp_npcb; /* to lower layer pcb */ - struct nl_protosw *tp_nlproto; /* lower-layer dependent routines */ - struct rtentry **tp_routep; /* obtain mtu; inside npcb */ + struct tp_pcb *tp_next; + struct tp_pcb *tp_prev; + struct tp_pcb *tp_nextlisten; /* chain all listeners */ + struct socket *tp_sock;/* back ptr */ + u_short tp_state; /* state of fsm */ + short tp_retrans; /* # times can still retrans */ + caddr_t tp_npcb;/* to lower layer pcb */ + struct nl_protosw *tp_nlproto; /* lower-layer dependent routines */ + struct rtentry **tp_routep; /* obtain mtu; inside npcb */ - RefNum tp_lref; /* local reference */ - RefNum tp_fref; /* foreign reference */ + RefNum tp_lref;/* local reference */ + RefNum tp_fref;/* foreign reference */ - u_int tp_seqmask; /* mask for seq space */ - u_int tp_seqbit; /* bit for seq number wraparound */ - u_int tp_seqhalf; /* half the seq space */ + u_int tp_seqmask; /* mask for seq space */ + u_int tp_seqbit; /* bit for seq number wraparound */ + u_int tp_seqhalf; /* half the seq space */ - struct mbuf *tp_ucddata; /* user connect/disconnect data */ + struct mbuf *tp_ucddata; /* user connect/disconnect data */ /* credit & sequencing info for SENDING */ - u_short tp_fcredit; /* current remote credit in # packets */ - u_short tp_maxfcredit; /* max remote credit in # packets */ - u_short tp_dupacks; /* intuit packet loss before rxt timo */ - u_long tp_cong_win; /* congestion window in bytes. - * see profuse comments in TCP code - */ - u_long tp_ssthresh; /* cong_win threshold for slow start - * exponential to linear switch - */ - SeqNum tp_snduna; /* seq # of lowest unacked DT */ - SeqNum tp_sndnew; /* seq # of lowest unsent DT */ - SeqNum tp_sndnum; /* next seq # to be assigned */ - SeqNum tp_sndnxt; /* what to do next; poss. rxt */ - struct mbuf *tp_sndnxt_m; /* packet corres. to sndnxt*/ - int tp_Nwindow; /* for perf. measurement */ + u_short tp_fcredit; /* current remote credit in # packets */ + u_short tp_maxfcredit; /* max remote credit in # packets */ + u_short tp_dupacks; /* intuit packet loss before rxt timo */ + u_long tp_cong_win; /* congestion window in bytes. see + * profuse comments in TCP code */ + u_long tp_ssthresh; /* cong_win threshold for slow start + * exponential to linear switch */ + SeqNum tp_snduna; /* seq # of lowest unacked DT */ + SeqNum tp_sndnew; /* seq # of lowest unsent DT */ + SeqNum tp_sndnum; /* next seq # to be assigned */ + SeqNum tp_sndnxt; /* what to do next; poss. rxt */ + struct mbuf *tp_sndnxt_m; /* packet corres. to sndnxt */ + int tp_Nwindow; /* for perf. measurement */ /* credit & sequencing info for RECEIVING */ - SeqNum tp_rcvnxt; /* next DT seq # expect to recv */ - SeqNum tp_sent_lcdt; /* cdt according to last ack sent */ - SeqNum tp_sent_uwe; /* uwe according to last ack sent */ - SeqNum tp_sent_rcvnxt; /* rcvnxt according to last ack sent - * needed for perf measurements only - */ - u_short tp_lcredit; /* current local credit in # packets */ - u_short tp_maxlcredit; /* needed for reassembly queue */ - struct mbuf **tp_rsyq; /* unacked stuff recvd out of order */ - int tp_rsycnt; /* number of packets "" "" "" "" */ - u_long tp_rhiwat; /* remember original RCVBUF size */ - - /* receiver congestion state stuff ... */ - u_int tp_win_recv; + SeqNum tp_rcvnxt; /* next DT seq # expect to recv */ + SeqNum tp_sent_lcdt; /* cdt according to last ack sent */ + SeqNum tp_sent_uwe; /* uwe according to last ack sent */ + SeqNum tp_sent_rcvnxt; /* rcvnxt according to last ack sent + * needed for perf measurements only */ + u_short tp_lcredit; /* current local credit in # packets */ + u_short tp_maxlcredit; /* needed for reassembly queue */ + struct mbuf **tp_rsyq;/* unacked stuff recvd out of order */ + int tp_rsycnt; /* number of packets "" "" "" "" */ + u_long tp_rhiwat; /* remember original RCVBUF size */ + + /* receiver congestion state stuff ... */ + u_int tp_win_recv; /* receive window as a scaled int (8 bit fraction part) */ struct cong_sample { - ushort cs_size; /* current window size */ - ushort cs_received; /* PDUs received in this sample */ - ushort cs_ce_set; /* PDUs received in this sample with CE bit set */ - } tp_cong_sample; + ushort cs_size; /* current window size */ + ushort cs_received; /* PDUs received in this + * sample */ + ushort cs_ce_set; /* PDUs received in this + * sample with CE bit set */ + } tp_cong_sample; /* parameters per-connection controllable by user */ - struct tp_conn_param _tp_param; - -#define tp_Nretrans _tp_param.p_Nretrans -#define tp_dr_ticks _tp_param.p_dr_ticks -#define tp_cc_ticks _tp_param.p_cc_ticks -#define tp_dt_ticks _tp_param.p_dt_ticks -#define tp_xpd_ticks _tp_param.p_x_ticks -#define tp_cr_ticks _tp_param.p_cr_ticks -#define tp_keepalive_ticks _tp_param.p_keepalive_ticks -#define tp_sendack_ticks _tp_param.p_sendack_ticks -#define tp_refer_ticks _tp_param.p_ref_ticks -#define tp_inact_ticks _tp_param.p_inact_ticks -#define tp_xtd_format _tp_param.p_xtd_format -#define tp_xpd_service _tp_param.p_xpd_service -#define tp_ack_strat _tp_param.p_ack_strat -#define tp_rx_strat _tp_param.p_rx_strat -#define tp_use_checksum _tp_param.p_use_checksum -#define tp_use_efc _tp_param.p_use_efc -#define tp_use_nxpd _tp_param.p_use_nxpd -#define tp_use_rcc _tp_param.p_use_rcc -#define tp_tpdusize _tp_param.p_tpdusize -#define tp_class _tp_param.p_class -#define tp_winsize _tp_param.p_winsize -#define tp_no_disc_indications _tp_param.p_no_disc_indications -#define tp_dont_change_params _tp_param.p_dont_change_params -#define tp_netservice _tp_param.p_netservice -#define tp_version _tp_param.p_version -#define tp_ptpdusize _tp_param.p_ptpdusize - - int tp_l_tpdusize; - /* whereas tp_tpdusize is log2(the negotiated max size) - * l_tpdusize is the size we'll use when sending, in # chars - */ - - int tp_rtv; /* max round-trip time variance */ - int tp_rtt; /* smoothed round-trip time */ - SeqNum tp_rttseq; /* packet being timed */ - int tp_rttemit; /* when emitted, in ticks */ - int tp_idle; /* last activity, in ticks */ - short tp_rxtcur; /* current retransmit value */ - short tp_rxtshift; /* log(2) of rexmt exp. backoff */ - u_char tp_cebit_off; /* real DEC bit algorithms not in use */ - u_char tp_oktonagle; /* Last unsent pckt may be append to */ - u_char tp_flags; /* values: */ -#define TPF_NLQOS_PDN TPFLAG_NLQOS_PDN + struct tp_conn_param _tp_param; + +#define tp_Nretrans _tp_param.p_Nretrans +#define tp_dr_ticks _tp_param.p_dr_ticks +#define tp_cc_ticks _tp_param.p_cc_ticks +#define tp_dt_ticks _tp_param.p_dt_ticks +#define tp_xpd_ticks _tp_param.p_x_ticks +#define tp_cr_ticks _tp_param.p_cr_ticks +#define tp_keepalive_ticks _tp_param.p_keepalive_ticks +#define tp_sendack_ticks _tp_param.p_sendack_ticks +#define tp_refer_ticks _tp_param.p_ref_ticks +#define tp_inact_ticks _tp_param.p_inact_ticks +#define tp_xtd_format _tp_param.p_xtd_format +#define tp_xpd_service _tp_param.p_xpd_service +#define tp_ack_strat _tp_param.p_ack_strat +#define tp_rx_strat _tp_param.p_rx_strat +#define tp_use_checksum _tp_param.p_use_checksum +#define tp_use_efc _tp_param.p_use_efc +#define tp_use_nxpd _tp_param.p_use_nxpd +#define tp_use_rcc _tp_param.p_use_rcc +#define tp_tpdusize _tp_param.p_tpdusize +#define tp_class _tp_param.p_class +#define tp_winsize _tp_param.p_winsize +#define tp_no_disc_indications _tp_param.p_no_disc_indications +#define tp_dont_change_params _tp_param.p_dont_change_params +#define tp_netservice _tp_param.p_netservice +#define tp_version _tp_param.p_version +#define tp_ptpdusize _tp_param.p_ptpdusize + + int tp_l_tpdusize; + /* + * whereas tp_tpdusize is log2(the negotiated max size) l_tpdusize is + * the size we'll use when sending, in # chars + */ + + int tp_rtv; /* max round-trip time variance */ + int tp_rtt; /* smoothed round-trip time */ + SeqNum tp_rttseq; /* packet being timed */ + int tp_rttemit; /* when emitted, in ticks */ + int tp_idle;/* last activity, in ticks */ + short tp_rxtcur; /* current retransmit value */ + short tp_rxtshift; /* log(2) of rexmt exp. backoff */ + u_char tp_cebit_off; /* real DEC bit algorithms not in use */ + u_char tp_oktonagle; /* Last unsent pckt may be append to */ + u_char tp_flags; /* values: */ +#define TPF_NLQOS_PDN TPFLAG_NLQOS_PDN #define TPF_PEER_ON_SAMENET TPFLAG_PEER_ON_SAMENET #define TPF_GENERAL_ADDR TPFLAG_GENERAL_ADDR #define TPF_DELACK 0x8 @@ -258,53 +279,62 @@ struct tp_pcb { #define USES_PDN(t) (((t)->tp_flags & TPF_NLQOS_PDN) != 0) - unsigned - tp_sendfcc:1, /* shall next ack include FCC parameter? */ - tp_trace:1, /* is this pcb being traced? (not used yet) */ - tp_perf_on:1, /* 0/1 -> performance measuring on */ - tp_reneged:1, /* have we reneged on cdt since last ack? */ - tp_decbit:3, /* dec bit was set, we're in reneg mode */ - tp_notdetached:1; /* Call tp_detach before freeing XXXXXXX */ + unsigned + tp_sendfcc:1, /* shall next ack include FCC + * parameter? */ + tp_trace:1, /* is this pcb being traced? (not + * used yet) */ + tp_perf_on:1, /* 0/1 -> performance measuring on */ + tp_reneged:1, /* have we reneged on cdt since last + * ack? */ + tp_decbit:3, /* dec bit was set, we're in reneg + * mode */ + tp_notdetached:1; /* Call tp_detach before + * freeing XXXXXXX */ #ifdef TP_PERF_MEAS /* performance stats - see tp_stat.h */ - struct tp_pmeas *tp_p_meas; -#endif /* TP_PERF_MEAS */ + struct tp_pmeas *tp_p_meas; +#endif /* TP_PERF_MEAS */ /* addressing */ - u_short tp_domain; /* domain (INET, ISO) */ - /* for compatibility with the *old* way and with INET, be sure that - * that lsuffix and fsuffix are aligned to a short addr. - * having them follow the u_short *suffixlen should suffice (choke) + u_short tp_domain; /* domain (INET, ISO) */ + /* + * for compatibility with the *old* way and with INET, be sure that + * that lsuffix and fsuffix are aligned to a short addr. having them + * follow the u_short *suffixlen should suffice (choke) */ - u_short tp_fsuffixlen; /* foreign suffix */ - char tp_fsuffix[MAX_TSAP_SEL_LEN]; - u_short tp_lsuffixlen; /* local suffix */ - char tp_lsuffix[MAX_TSAP_SEL_LEN]; + u_short tp_fsuffixlen; /* foreign suffix */ + char tp_fsuffix[MAX_TSAP_SEL_LEN]; + u_short tp_lsuffixlen; /* local suffix */ + char tp_lsuffix[MAX_TSAP_SEL_LEN]; #define SHORT_LSUFXP(tpcb) ((short *)((tpcb)->tp_lsuffix)) #define SHORT_FSUFXP(tpcb) ((short *)((tpcb)->tp_fsuffix)) /* Timer stuff */ - u_char tp_vers; /* protocol version */ - u_char tp_peer_acktime; /* used for DT retrans time */ - u_char tp_refstate; /* values REF_FROZEN, etc. above */ - struct tp_pcb *tp_fasttimeo; /* limit pcbs to examine */ - u_int tp_timer[TM_NTIMERS]; /* C timers */ - - struct sockbuf tp_Xsnd; /* for expedited data */ -/* struct sockbuf tp_Xrcv; /* for expedited data */ + u_char tp_vers;/* protocol version */ + u_char tp_peer_acktime; /* used for DT retrans time */ + u_char tp_refstate; /* values REF_FROZEN, etc. above */ + struct tp_pcb *tp_fasttimeo; /* limit pcbs to examine */ + u_int tp_timer[TM_NTIMERS]; /* C timers */ + + struct sockbuf tp_Xsnd; /* for expedited data */ +#if 0 + struct sockbuf tp_Xrcv; /* for expedited data */ +#else #define tp_Xrcv tp_sock->so_rcv - SeqNum tp_Xsndnxt; /* next XPD seq # to send */ - SeqNum tp_Xuna; /* seq # of unacked XPD */ - SeqNum tp_Xrcvnxt; /* next XPD seq # expect to recv */ +#endif + SeqNum tp_Xsndnxt; /* next XPD seq # to send */ + SeqNum tp_Xuna;/* seq # of unacked XPD */ + SeqNum tp_Xrcvnxt; /* next XPD seq # expect to recv */ /* AK subsequencing */ - u_short tp_s_subseq; /* next subseq to send */ - u_short tp_r_subseq; /* highest recv subseq */ + u_short tp_s_subseq; /* next subseq to send */ + u_short tp_r_subseq; /* highest recv subseq */ }; -u_int tp_start_win; +u_int tp_start_win; #define ROUND(scaled_int) (((scaled_int) >> 8) + (((scaled_int) & 0x80) ? 1:0)) @@ -318,33 +348,33 @@ u_int tp_start_win; #define CONG_UPDATE_SAMPLE(pcb, ce_bit) \ pcb->tp_cong_sample.cs_received++; \ if (ce_bit) { \ - pcb->tp_cong_sample.cs_ce_set++; \ + pcb->tp_cong_sample.cs_ce_set++; \ } \ if (pcb->tp_cong_sample.cs_size <= pcb->tp_cong_sample.cs_received) { \ - if ((pcb->tp_cong_sample.cs_ce_set << 1) >= \ - pcb->tp_cong_sample.cs_size ) { \ - pcb->tp_win_recv -= pcb->tp_win_recv >> 3; /* multiply by .875 */ \ - pcb->tp_win_recv = max(1 << 8, pcb->tp_win_recv); \ - } \ - else { \ - pcb->tp_win_recv += (1 << 8); /* add one to the scaled int */ \ - } \ - pcb->tp_lcredit = ROUND(pcb->tp_win_recv); \ - CONG_INIT_SAMPLE(pcb); \ + if ((pcb->tp_cong_sample.cs_ce_set << 1) >= \ + pcb->tp_cong_sample.cs_size ) { \ + pcb->tp_win_recv -= pcb->tp_win_recv >> 3; /* multiply by .875 */ \ + pcb->tp_win_recv = max(1 << 8, pcb->tp_win_recv); \ + } \ + else { \ + pcb->tp_win_recv += (1 << 8); /* add one to the scaled int */ \ + } \ + pcb->tp_lcredit = ROUND(pcb->tp_win_recv); \ + CONG_INIT_SAMPLE(pcb); \ } #ifdef _KERNEL -extern struct tp_refinfo tp_refinfo; -extern struct tp_ref *tp_ref; -extern struct tp_param tp_param; -extern struct nl_protosw nl_protosw[]; -extern struct tp_pcb *tp_listeners; -extern struct tp_pcb *tp_ftimeolist; +extern struct tp_refinfo tp_refinfo; +extern struct tp_ref *tp_ref; +extern struct tp_param tp_param; +extern struct nl_protosw nl_protosw[]; +extern struct tp_pcb *tp_listeners; +extern struct tp_pcb *tp_ftimeolist; #endif -#define sototpcb(so) ((struct tp_pcb *)(so->so_pcb)) -#define sototpref(so) ((sototpcb(so)->tp_ref)) -#define tpcbtoso(tp) ((struct socket *)((tp)->tp_sock)) -#define tpcbtoref(tp) ((struct tp_ref *)((tp)->tp_ref)) +#define sototpcb(so) ((struct tp_pcb *)(so->so_pcb)) +#define sototpref(so) ((sototpcb(so)->tp_ref)) +#define tpcbtoso(tp) ((struct socket *)((tp)->tp_sock)) +#define tpcbtoref(tp) ((struct tp_ref *)((tp)->tp_ref)) -#endif /* _NETISO_TP_PCB_H_ */ +#endif /* _NETISO_TP_PCB_H_ */ |