Home | History | Annotate | Line # | Download | only in netinet
dccp_tcplike.h revision 1.2.16.2
      1  1.2.16.2  jdolecek /*	$KAME: dccp_tcplike.h,v 1.10 2005/07/22 09:31:14 nishida Exp $	*/
      2  1.2.16.2  jdolecek /*	$NetBSD: dccp_tcplike.h,v 1.2.16.2 2017/12/03 11:39:03 jdolecek Exp $ */
      3  1.2.16.2  jdolecek 
      4  1.2.16.2  jdolecek /*
      5  1.2.16.2  jdolecek  * Copyright (c) 2003 Magnus Erixzon
      6  1.2.16.2  jdolecek  * All rights reserved.
      7  1.2.16.2  jdolecek  *
      8  1.2.16.2  jdolecek  * Redistribution and use in source and binary forms, with or without
      9  1.2.16.2  jdolecek  * modification, are permitted provided that the following conditions
     10  1.2.16.2  jdolecek  * are met:
     11  1.2.16.2  jdolecek  *
     12  1.2.16.2  jdolecek  * 1. Redistributions of source code must retain the above copyright
     13  1.2.16.2  jdolecek  *    notice, this list of conditions and the following disclaimer.
     14  1.2.16.2  jdolecek  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.2.16.2  jdolecek  *    notice, this list of conditions and the following disclaimer in the
     16  1.2.16.2  jdolecek  *    documentation and/or other materials provided with the distribution.
     17  1.2.16.2  jdolecek  * 3. The name of the author may not be used to endorse or promote products
     18  1.2.16.2  jdolecek  *    derived from this software without specific prior written permission.
     19  1.2.16.2  jdolecek  *
     20  1.2.16.2  jdolecek  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  1.2.16.2  jdolecek  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  1.2.16.2  jdolecek  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  1.2.16.2  jdolecek  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  1.2.16.2  jdolecek  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  1.2.16.2  jdolecek  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  1.2.16.2  jdolecek  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  1.2.16.2  jdolecek  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  1.2.16.2  jdolecek  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  1.2.16.2  jdolecek  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  1.2.16.2  jdolecek  */
     31  1.2.16.2  jdolecek /*
     32  1.2.16.2  jdolecek  * Headerfile for TCP-like congestion control for DCCP
     33  1.2.16.2  jdolecek  */
     34  1.2.16.2  jdolecek 
     35  1.2.16.2  jdolecek #ifndef _NETINET_DCCP_TCPLIKE_H_
     36  1.2.16.2  jdolecek #define _NETINET_DCCP_TCPLIKE_H_
     37  1.2.16.2  jdolecek 
     38  1.2.16.2  jdolecek /*
     39  1.2.16.2  jdolecek  * TCPlike sender
     40  1.2.16.2  jdolecek  */
     41  1.2.16.2  jdolecek 
     42  1.2.16.2  jdolecek /* Parameter to decide when a packet is considered lost */
     43  1.2.16.2  jdolecek #define TCPLIKE_NUMDUPACK 3
     44  1.2.16.2  jdolecek /* Upperbound timeout value */
     45  1.2.16.2  jdolecek #define TIMEOUT_UBOUND	(30 * hz)
     46  1.2.16.2  jdolecek #define TCPLIKE_MIN_RTT	(hz >> 3)
     47  1.2.16.2  jdolecek #define TCPLIKE_INITIAL_CWND 3
     48  1.2.16.2  jdolecek #define TCPLIKE_INITIAL_CWNDVECTOR 512
     49  1.2.16.2  jdolecek 
     50  1.2.16.2  jdolecek /* TCPlike sender congestion control block (ccb) */
     51  1.2.16.2  jdolecek struct tcplike_send_ccb
     52  1.2.16.2  jdolecek {
     53  1.2.16.2  jdolecek 	kmutex_t mutex;
     54  1.2.16.2  jdolecek 	struct dccpcb *pcb; /* Pointer to associated dccpcb */
     55  1.2.16.2  jdolecek 	dccp_seq cwnd; /* congestion window */
     56  1.2.16.2  jdolecek 	dccp_seq ssthresh;
     57  1.2.16.2  jdolecek 	dccp_seq oldcwnd_ts; /* old cwnd tail seqnr */
     58  1.2.16.2  jdolecek 
     59  1.2.16.2  jdolecek 	u_int16_t rtt; /* estimated round trip-time */
     60  1.2.16.2  jdolecek 	u_int16_t rto; /* Timeout value */
     61  1.2.16.2  jdolecek 	u_int16_t rtt_d;
     62  1.2.16.2  jdolecek 
     63  1.2.16.2  jdolecek 	int16_t outstanding; /* Number of unacked packets sent */
     64  1.2.16.2  jdolecek 	u_int16_t rcvr_ackratio; /* Receiver ack ratio */
     65  1.2.16.2  jdolecek 
     66  1.2.16.2  jdolecek 	u_int16_t acked_in_win; /* No of acked packets in the window */
     67  1.2.16.2  jdolecek 	u_int8_t acked_windows; /* No of acked windows with no lost Acks */
     68  1.2.16.2  jdolecek 
     69  1.2.16.2  jdolecek 	u_int32_t ack_last; /* Last ok Ack packet */
     70  1.2.16.2  jdolecek 	u_int32_t ack_miss; /* oldest missing Ack packet */
     71  1.2.16.2  jdolecek 
     72  1.2.16.2  jdolecek 	struct callout free_timer;
     73  1.2.16.2  jdolecek 	struct callout rto_timer;
     74  1.2.16.2  jdolecek 	u_int rto_timer_callout;
     75  1.2.16.2  jdolecek 
     76  1.2.16.2  jdolecek 	u_char *cwndvector;  /* 2 bits per packet */
     77  1.2.16.2  jdolecek 	u_char *cv_hp;  /* head ptr for cwndvector */
     78  1.2.16.2  jdolecek 	u_int16_t cv_size;
     79  1.2.16.2  jdolecek 	dccp_seq cv_hs, cv_ts; /* lowest/highest seq no in cwndvector */
     80  1.2.16.2  jdolecek 
     81  1.2.16.2  jdolecek 	u_int8_t sample_rtt;
     82  1.2.16.2  jdolecek 	u_int32_t timestamp;
     83  1.2.16.2  jdolecek 
     84  1.2.16.2  jdolecek 	dccp_seq rcvd_ack, lost_ack;
     85  1.2.16.2  jdolecek };
     86  1.2.16.2  jdolecek 
     87  1.2.16.2  jdolecek #ifdef _KERNEL
     88  1.2.16.2  jdolecek 
     89  1.2.16.2  jdolecek /* Functions declared in struct dccp_cc_sw */
     90  1.2.16.2  jdolecek 
     91  1.2.16.2  jdolecek /*
     92  1.2.16.2  jdolecek  * Initialises the sender side
     93  1.2.16.2  jdolecek  * args: pcb  - pointer to dccpcb of associated connection
     94  1.2.16.2  jdolecek  * returns: pointer to a tcplike_send_ccb struct on success, otherwise 0
     95  1.2.16.2  jdolecek  */
     96  1.2.16.2  jdolecek void *tcplike_send_init(struct dccpcb *);
     97  1.2.16.2  jdolecek 
     98  1.2.16.2  jdolecek /*
     99  1.2.16.2  jdolecek  * Free the sender side
    100  1.2.16.2  jdolecek  * args: ccb - ccb of sender
    101  1.2.16.2  jdolecek  */
    102  1.2.16.2  jdolecek void tcplike_send_free(void *);
    103  1.2.16.2  jdolecek 
    104  1.2.16.2  jdolecek /*
    105  1.2.16.2  jdolecek  * Ask TCPlike wheter one can send a packet or not
    106  1.2.16.2  jdolecek  * args: ccb  -  ccb block for current connection
    107  1.2.16.2  jdolecek  * returns: 0 if ok, else <> 0.
    108  1.2.16.2  jdolecek  */
    109  1.2.16.2  jdolecek int tcplike_send_packet(void *, long);
    110  1.2.16.2  jdolecek void tcplike_send_packet_sent(void *, int, long);
    111  1.2.16.2  jdolecek 
    112  1.2.16.2  jdolecek /*
    113  1.2.16.2  jdolecek  * Notify that an ack package was received
    114  1.2.16.2  jdolecek  * args: ccb  -  ccb block for current connection
    115  1.2.16.2  jdolecek  */
    116  1.2.16.2  jdolecek void tcplike_send_packet_recv(void *, char *, int);
    117  1.2.16.2  jdolecek 
    118  1.2.16.2  jdolecek #endif
    119  1.2.16.2  jdolecek 
    120  1.2.16.2  jdolecek /*
    121  1.2.16.2  jdolecek  * TFRC Receiver
    122  1.2.16.2  jdolecek  */
    123  1.2.16.2  jdolecek 
    124  1.2.16.2  jdolecek struct ack_list
    125  1.2.16.2  jdolecek {
    126  1.2.16.2  jdolecek 	u_int64_t localseq, ackthru;
    127  1.2.16.2  jdolecek 	struct ack_list *next;
    128  1.2.16.2  jdolecek };
    129  1.2.16.2  jdolecek 
    130  1.2.16.2  jdolecek /* TCPlike receiver congestion control block (ccb) */
    131  1.2.16.2  jdolecek struct tcplike_recv_ccb {
    132  1.2.16.2  jdolecek 	kmutex_t mutex;
    133  1.2.16.2  jdolecek 	struct dccpcb *pcb;               /* Pointer to associated dccpcb */
    134  1.2.16.2  jdolecek 	/* No ack ratio or vector here. it's a global feature */
    135  1.2.16.2  jdolecek 	struct ack_list *av_list;
    136  1.2.16.2  jdolecek 	u_int16_t unacked; /* no of unacked packets */
    137  1.2.16.2  jdolecek 	struct callout free_timer;
    138  1.2.16.2  jdolecek };
    139  1.2.16.2  jdolecek 
    140  1.2.16.2  jdolecek #ifdef _KERNEL
    141  1.2.16.2  jdolecek 
    142  1.2.16.2  jdolecek /* Functions declared in struct dccp_cc_sw */
    143  1.2.16.2  jdolecek 
    144  1.2.16.2  jdolecek /*
    145  1.2.16.2  jdolecek  * Initialises the receiver side
    146  1.2.16.2  jdolecek  * args: pcb  -  pointer to dccpcb of associated connection
    147  1.2.16.2  jdolecek  * returns: pointer to a tcplike_recv_ccb struct on success, otherwise 0
    148  1.2.16.2  jdolecek  */
    149  1.2.16.2  jdolecek void *tcplike_recv_init(struct dccpcb *);
    150  1.2.16.2  jdolecek 
    151  1.2.16.2  jdolecek /*
    152  1.2.16.2  jdolecek  * Free the receiver side
    153  1.2.16.2  jdolecek  * args: ccb - ccb of recevier
    154  1.2.16.2  jdolecek  */
    155  1.2.16.2  jdolecek void tcplike_recv_free(void *);
    156  1.2.16.2  jdolecek 
    157  1.2.16.2  jdolecek /*
    158  1.2.16.2  jdolecek  * Tell TCPlike that a packet has been received
    159  1.2.16.2  jdolecek  * args: ccb  -  ccb block for current connection
    160  1.2.16.2  jdolecek  */
    161  1.2.16.2  jdolecek void tcplike_recv_packet_recv(void *, char *, int);
    162  1.2.16.2  jdolecek 
    163  1.2.16.2  jdolecek /*
    164  1.2.16.2  jdolecek int tcplike_option_recv(void);
    165  1.2.16.2  jdolecek */
    166  1.2.16.2  jdolecek #endif
    167  1.2.16.2  jdolecek 
    168  1.2.16.2  jdolecek #endif
    169