LCOV - code coverage report
Current view: top level - vnet/tcp - tcp_types.h (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 6 6 100.0 %
Date: 2023-10-26 01:39:38 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2020 Cisco and/or its affiliates.
       3             :  * Licensed under the Apache License, Version 2.0 (the "License");
       4             :  * you may not use this file except in compliance with the License.
       5             :  * You may obtain a copy of the License at:
       6             :  *
       7             :  *     http://www.apache.org/licenses/LICENSE-2.0
       8             :  *
       9             :  * Unless required by applicable law or agreed to in writing, software
      10             :  * distributed under the License is distributed on an "AS IS" BASIS,
      11             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             :  * See the License for the specific language governing permissions and
      13             :  * limitations under the License.
      14             :  */
      15             : 
      16             : #ifndef SRC_VNET_TCP_TCP_TYPES_H_
      17             : #define SRC_VNET_TCP_TCP_TYPES_H_
      18             : 
      19             : #include <vppinfra/clib.h>
      20             : #include <vppinfra/rbtree.h>
      21             : #include <vnet/tcp/tcp_packet.h>
      22             : #include <vnet/session/transport.h>
      23             : 
      24             : #define TCP_TICK 0.000001                       /**< TCP tick period (s) */
      25             : #define THZ (u32) (1/TCP_TICK)                  /**< TCP tick frequency */
      26             : 
      27             : #define TCP_TSTP_TICK 0.001                     /**< Timestamp tick (s) */
      28             : #define TCP_TSTP_HZ (u32) (1/TCP_TSTP_TICK)     /**< Timestamp freq */
      29             : #define TCP_PAWS_IDLE (24 * 86400 * TCP_TSTP_HZ)/**< 24 days */
      30             : #define TCP_TSTP_TO_HZ (u32) (TCP_TSTP_TICK * THZ)
      31             : 
      32             : #define TCP_FIB_RECHECK_PERIOD  1 * THZ /**< Recheck every 1s */
      33             : #define TCP_MAX_OPTION_SPACE 40
      34             : #define TCP_CC_DATA_SZ 24
      35             : #define TCP_RXT_MAX_BURST 10
      36             : 
      37             : #define TCP_DUPACK_THRESHOLD    3
      38             : #define TCP_IW_N_SEGMENTS       10
      39             : #define TCP_ALWAYS_ACK          1       /**< On/off delayed acks */
      40             : #define TCP_USE_SACKS           1       /**< Disable only for testing */
      41             : 
      42             : /** TCP FSM state definitions as per RFC793. */
      43             : #define foreach_tcp_fsm_state   \
      44             :   _(CLOSED, "CLOSED")           \
      45             :   _(LISTEN, "LISTEN")           \
      46             :   _(SYN_SENT, "SYN_SENT")       \
      47             :   _(SYN_RCVD, "SYN_RCVD")       \
      48             :   _(ESTABLISHED, "ESTABLISHED") \
      49             :   _(CLOSE_WAIT, "CLOSE_WAIT")   \
      50             :   _(FIN_WAIT_1, "FIN_WAIT_1")   \
      51             :   _(LAST_ACK, "LAST_ACK")       \
      52             :   _(CLOSING, "CLOSING")         \
      53             :   _(FIN_WAIT_2, "FIN_WAIT_2")   \
      54             :   _(TIME_WAIT, "TIME_WAIT")
      55             : 
      56             : typedef enum _tcp_state
      57             : {
      58             : #define _(sym, str) TCP_STATE_##sym,
      59             :   foreach_tcp_fsm_state
      60             : #undef _
      61             :   TCP_N_STATES
      62             : } tcp_state_t;
      63             : 
      64             : /** TCP timers */
      65             : #define foreach_tcp_timer               \
      66             :   _(RETRANSMIT, "RETRANSMIT")           \
      67             :   _(PERSIST, "PERSIST")                 \
      68             :   _(WAITCLOSE, "WAIT CLOSE")            \
      69             :   _(RETRANSMIT_SYN, "RETRANSMIT SYN")   \
      70             : 
      71             : typedef enum _tcp_timers
      72             : {
      73             : #define _(sym, str) TCP_TIMER_##sym,
      74             :   foreach_tcp_timer
      75             : #undef _
      76             :   TCP_N_TIMERS
      77             : } __clib_packed tcp_timers_e;
      78             : 
      79             : #define TCP_TIMER_HANDLE_INVALID ((u32) ~0)
      80             : 
      81             : #define TCP_TIMER_TICK          0.0001          /**< Timer tick in seconds */
      82             : #define TCP_TO_TIMER_TICK       TCP_TICK*10000  /**< Factor for converting
      83             :                                                      ticks to timer ticks */
      84             : 
      85             : #define TCP_RTO_MAX 60 * THZ    /* Min max RTO (60s) as per RFC6298 */
      86             : #define TCP_RTO_MIN 0.2 * THZ   /* Min RTO (200ms) - lower than standard */
      87             : #define TCP_RTT_MAX 30 * THZ    /* 30s (probably too much) */
      88             : #define TCP_RTO_SYN_RETRIES 3   /* SYN retries without doubling RTO */
      89             : #define TCP_RTO_INIT 1 * THZ    /* Initial retransmit timer */
      90             : #define TCP_RTO_BOFF_MAX 8      /* Max number of retries before reset */
      91             : #define TCP_ESTABLISH_TIME (60 * THZ)   /* Connection establish timeout */
      92             : 
      93             : /** Connection configuration flags */
      94             : #define foreach_tcp_cfg_flag                    \
      95             :   _(RATE_SAMPLE, "Rate sampling")             \
      96             :   _(NO_CSUM_OFFLOAD, "No csum offload")       \
      97             :   _(NO_TSO, "TSO off")                                \
      98             :   _(TSO, "TSO")                                       \
      99             :   _(NO_ENDPOINT,"No endpoint")                        \
     100             : 
     101             : typedef enum tcp_cfg_flag_bits_
     102             : {
     103             : #define _(sym, str) TCP_CFG_F_##sym##_BIT,
     104             :   foreach_tcp_cfg_flag
     105             : #undef _
     106             :   TCP_CFG_N_FLAG_BITS
     107             : } tcp_cfg_flag_bits_e;
     108             : 
     109             : typedef enum tcp_cfg_flag_
     110             : {
     111             : #define _(sym, str) TCP_CFG_F_##sym = 1 << TCP_CFG_F_##sym##_BIT,
     112             :   foreach_tcp_cfg_flag
     113             : #undef _
     114             :   TCP_CFG_N_FLAGS
     115             : } tcp_cfg_flags_e;
     116             : 
     117             : /** TCP connection flags */
     118             : #define foreach_tcp_connection_flag             \
     119             :   _(SNDACK, "Send ACK")                         \
     120             :   _(FINSNT, "FIN sent")                               \
     121             :   _(RECOVERY, "Recovery")                     \
     122             :   _(FAST_RECOVERY, "Fast Recovery")           \
     123             :   _(DCNT_PENDING, "Disconnect pending")               \
     124             :   _(HALF_OPEN_DONE, "Half-open completed")    \
     125             :   _(FINPNDG, "FIN pending")                   \
     126             :   _(RXT_PENDING, "Retransmit pending")                \
     127             :   _(FRXT_FIRST, "Retransmit first")           \
     128             :   _(DEQ_PENDING, "Dequeue pending ")          \
     129             :   _(PSH_PENDING, "PSH pending")                       \
     130             :   _(FINRCVD, "FIN received")                  \
     131             :   _(ZERO_RWND_SENT, "Zero RWND sent")         \
     132             : 
     133             : typedef enum tcp_connection_flag_bits_
     134             : {
     135             : #define _(sym, str) TCP_CONN_##sym##_BIT,
     136             :   foreach_tcp_connection_flag
     137             : #undef _
     138             :   TCP_CONN_N_FLAG_BITS
     139             : } tcp_connection_flag_bits_e;
     140             : 
     141             : typedef enum tcp_connection_flag_
     142             : {
     143             : #define _(sym, str) TCP_CONN_##sym = 1 << TCP_CONN_##sym##_BIT,
     144             :   foreach_tcp_connection_flag
     145             : #undef _
     146             :   TCP_CONN_N_FLAGS
     147             : } tcp_connection_flags_e;
     148             : 
     149             : #define TCP_SCOREBOARD_TRACE (0)
     150             : #define TCP_MAX_SACK_BLOCKS 255 /**< Max number of SACK blocks stored */
     151             : #define TCP_INVALID_SACK_HOLE_INDEX ((u32)~0)
     152             : #define TCP_MAX_SACK_REORDER 300
     153             : 
     154             : typedef struct _scoreboard_trace_elt
     155             : {
     156             :   u32 start;
     157             :   u32 end;
     158             :   u32 ack;
     159             :   u32 snd_nxt;
     160             :   u32 group;
     161             : } scoreboard_trace_elt_t;
     162             : 
     163             : typedef struct _sack_scoreboard_hole
     164             : {
     165             :   u32 next;             /**< Index for next entry in linked list */
     166             :   u32 prev;             /**< Index for previous entry in linked list */
     167             :   u32 start;            /**< Start sequence number */
     168             :   u32 end;              /**< End sequence number */
     169             :   u8 is_lost;           /**< Mark hole as lost */
     170             : } sack_scoreboard_hole_t;
     171             : 
     172             : typedef struct _sack_scoreboard
     173             : {
     174             :   sack_scoreboard_hole_t *holes;        /**< Pool of holes */
     175             :   u32 head;                             /**< Index of first entry */
     176             :   u32 tail;                             /**< Index of last entry */
     177             :   u32 sacked_bytes;                     /**< Number of bytes sacked in sb */
     178             :   u32 last_sacked_bytes;                /**< Number of bytes last sacked */
     179             :   u32 last_bytes_delivered;             /**< Sack bytes delivered to app */
     180             :   u32 rxt_sacked;                       /**< Rxt bytes last delivered */
     181             :   u32 high_sacked;                      /**< Highest byte sacked (fack) */
     182             :   u32 high_rxt;                         /**< Highest retransmitted sequence */
     183             :   u32 rescue_rxt;                       /**< Rescue sequence number */
     184             :   u32 lost_bytes;                       /**< Bytes lost as per RFC6675 */
     185             :   u32 last_lost_bytes;                  /**< Number of bytes last lost */
     186             :   u32 cur_rxt_hole;                     /**< Retransmitting from this hole */
     187             :   u32 reorder;                          /**< Estimate of segment reordering */
     188             :   u8 is_reneging;                       /**< Flag set if peer is reneging*/
     189             : 
     190             : #if TCP_SCOREBOARD_TRACE
     191             :   scoreboard_trace_elt_t *trace;
     192             : #endif
     193             : 
     194             : } sack_scoreboard_t;
     195             : 
     196             : #define TCP_BTS_INVALID_INDEX   ((u32)~0)
     197             : 
     198             : typedef enum tcp_bts_flags_
     199             : {
     200             :   TCP_BTS_IS_RXT = 1,
     201             :   TCP_BTS_IS_APP_LIMITED = 1 << 1,
     202             :   TCP_BTS_IS_SACKED = 1 << 2,
     203             :   TCP_BTS_IS_RXT_LOST = 1 << 3,
     204             : } __clib_packed tcp_bts_flags_t;
     205             : 
     206             : typedef struct tcp_bt_sample_
     207             : {
     208             :   u32 next;                     /**< Next sample index in list */
     209             :   u32 prev;                     /**< Previous sample index in list */
     210             :   u32 min_seq;                  /**< Min seq number in sample */
     211             :   u32 max_seq;                  /**< Max seq number. Set for rxt samples */
     212             :   u64 delivered;                /**< Total delivered bytes for sample */
     213             :   f64 delivered_time;           /**< Delivered time when sample taken */
     214             :   f64 tx_time;                  /**< Transmit time for the burst */
     215             :   f64 first_tx_time;            /**< Connection first tx time at tx */
     216             :   u64 tx_in_flight;             /**< In flight at tx time */
     217             :   u64 tx_lost;                  /**< Lost at tx time */
     218             :   tcp_bts_flags_t flags;        /**< Sample flag */
     219             : } tcp_bt_sample_t;
     220             : 
     221             : typedef struct tcp_rate_sample_
     222             : {
     223             :   u64 prior_delivered;          /**< Delivered of sample used for rate, i.e.,
     224             :                                      total bytes delivered at prior_time */
     225             :   f64 prior_time;               /**< Delivered time of sample used for rate */
     226             :   f64 interval_time;            /**< Time to ack the bytes delivered */
     227             :   f64 rtt_time;                 /**< RTT for sample */
     228             :   u64 tx_in_flight;             /**< In flight at (re)transmit time */
     229             :   u64 tx_lost;                  /**< Lost over interval */
     230             :   u32 delivered;                /**< Bytes delivered in interval_time */
     231             :   u32 acked_and_sacked;         /**< Bytes acked + sacked now */
     232             :   u32 last_lost;                /**< Bytes lost now */
     233             :   u32 lost;                     /**< Number of bytes lost over interval */
     234             :   tcp_bts_flags_t flags;        /**< Rate sample flags from bt sample */
     235             : } tcp_rate_sample_t;
     236             : 
     237             : typedef struct tcp_byte_tracker_
     238             : {
     239             :   tcp_bt_sample_t *samples;     /**< Pool of samples */
     240             :   rb_tree_t sample_lookup;      /**< Rbtree for sample lookup by min_seq */
     241             :   u32 head;                     /**< Head of samples linked list */
     242             :   u32 tail;                     /**< Tail of samples linked list */
     243             :   u32 last_ooo;                 /**< Cached last ooo sample */
     244             : } tcp_byte_tracker_t;
     245             : 
     246             : typedef enum _tcp_cc_algorithm_type
     247             : {
     248             :   TCP_CC_NEWRENO,
     249             :   TCP_CC_CUBIC,
     250             :   TCP_CC_LAST = TCP_CC_CUBIC
     251             : } tcp_cc_algorithm_type_e;
     252             : 
     253             : typedef struct _tcp_cc_algorithm tcp_cc_algorithm_t;
     254             : 
     255             : typedef enum _tcp_cc_ack_t
     256             : {
     257             :   TCP_CC_ACK,
     258             :   TCP_CC_DUPACK,
     259             :   TCP_CC_PARTIALACK
     260             : } tcp_cc_ack_t;
     261             : 
     262             : typedef enum tcp_cc_event_
     263             : {
     264             :   TCP_CC_EVT_START_TX,
     265             : } tcp_cc_event_t;
     266             : 
     267             : /*
     268             :  * As per RFC4898 tcpEStatsStackSoftErrors
     269             :  */
     270             : typedef struct tcp_errors_
     271             : {
     272             :   u32 below_data_wnd;   /**< All data in seg is below snd_una */
     273             :   u32 above_data_wnd;   /**< Some data in segment is above snd_wnd */
     274             :   u32 below_ack_wnd;    /**< Acks for data below snd_una */
     275             :   u32 above_ack_wnd;    /**< Acks for data not sent */
     276             : } tcp_errors_t;
     277             : 
     278             : typedef struct _tcp_connection
     279             : {
     280             :   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
     281             :   transport_connection_t connection;  /**< Common transport data. First! */
     282             : 
     283             :   u8 state;                     /**< TCP state as per tcp_state_t */
     284             :   u8 cfg_flags;                 /**< Connection configuration flags */
     285             :   u16 flags;                    /**< Connection flags (see tcp_conn_flags_e) */
     286             :   u32 timers[TCP_N_TIMERS];     /**< Timer handles into timer wheel */
     287             :   u32 pending_timers;           /**< Expired timers not yet handled */
     288             : 
     289             :   u64 segs_in;          /** RFC4022/4898 tcpHCInSegs/tcpEStatsPerfSegsIn */
     290             :   u64 bytes_in;         /** RFC4898 tcpEStatsPerfHCDataOctetsIn */
     291             :   u64 segs_out;         /** RFC4898 tcpEStatsPerfSegsOut */
     292             :   u64 bytes_out;        /** RFC4898 tcpEStatsPerfHCDataOctetsOut */
     293             : 
     294             :   /** Send sequence variables RFC793 */
     295             :   u32 snd_una;          /**< oldest unacknowledged sequence number */
     296             :   u32 snd_wnd;          /**< send window */
     297             :   u32 snd_wl1;          /**< seq number used for last snd.wnd update */
     298             :   u32 snd_wl2;          /**< ack number used for last snd.wnd update */
     299             :   u32 snd_nxt;          /**< next seq number to be sent */
     300             :   u16 snd_mss;          /**< Effective send max seg (data) size */
     301             : 
     302             :   u64 data_segs_in;     /** RFC4898 tcpEStatsPerfDataSegsIn */
     303             :   u64 data_segs_out;    /** RFC4898 tcpEStatsPerfDataSegsOut */
     304             : 
     305             :   /** Receive sequence variables RFC793 */
     306             :   u32 rcv_nxt;          /**< next sequence number expected */
     307             :   u32 rcv_wnd;          /**< receive window we expect */
     308             : 
     309             :   u32 rcv_las;          /**< rcv_nxt at last ack sent/rcv_wnd update */
     310             : 
     311             :   /* Options */
     312             :   u8 snd_opts_len;              /**< Tx options len */
     313             :   u8 snd_sack_pos;              /**< Position in vec of first block to send */
     314             :   u8 rcv_wscale;                /**< Window scale to advertise to peer */
     315             :   u8 snd_wscale;                /**< Window scale to use when sending */
     316             :   u32 tsval_recent;             /**< Last timestamp received */
     317             :   u32 tsval_recent_age;         /**< When last updated tstamp_recent*/
     318             :   u32 timestamp_delta;          /**< Offset for timestamp */
     319             :   tcp_options_t snd_opts;       /**< Tx options for connection */
     320             :   tcp_options_t rcv_opts;       /**< Rx options for connection */
     321             : 
     322             :   sack_block_t *snd_sacks;      /**< Vector of SACKs to send. XXX Fixed size? */
     323             :   sack_block_t *snd_sacks_fl;   /**< Vector for building new list */
     324             :   sack_scoreboard_t sack_sb;    /**< SACK "scoreboard" that tracks holes */
     325             : 
     326             :   u16 rcv_dupacks;      /**< Number of recent DUPACKs received */
     327             :   u32 dupacks_in;       /**< RFC4898 tcpEStatsStackDupAcksIn*/
     328             :   u8 pending_dupacks;   /**< Number of DUPACKs to be sent */
     329             :   u32 dupacks_out;      /**< RFC4898 tcpEStatsPathDupAcksOut */
     330             : 
     331             :   /* Congestion control */
     332             :   u32 cwnd;             /**< Congestion window */
     333             :   u32 cwnd_acc_bytes;   /**< Bytes accumulated for cwnd increment */
     334             :   u32 ssthresh;         /**< Slow-start threshold */
     335             :   u32 prev_ssthresh;    /**< ssthresh before congestion */
     336             :   u32 prev_cwnd;        /**< ssthresh before congestion */
     337             :   u32 bytes_acked;      /**< Bytes acknowledged by current segment */
     338             :   u32 burst_acked;      /**< Bytes acknowledged in current burst */
     339             :   u32 snd_rxt_bytes;    /**< Retransmitted bytes during current cc event */
     340             :   u32 snd_rxt_ts;       /**< Timestamp when first packet is retransmitted */
     341             :   u32 prr_delivered;    /**< RFC6937 bytes delivered during current event */
     342             :   u32 prr_start;        /**< snd_una when prr starts */
     343             :   u32 rxt_delivered;    /**< Rxt bytes delivered during current cc event */
     344             :   u32 rxt_head;         /**< snd_una last time we re rxted the head */
     345             :   u32 tsecr_last_ack;   /**< Timestamp echoed to us in last healthy ACK */
     346             :   u32 snd_congestion;   /**< snd_nxt when congestion is detected */
     347             :   u32 tx_fifo_size;     /**< Tx fifo size. Used to constrain cwnd */
     348             :   tcp_cc_algorithm_t *cc_algo;  /**< Congestion control algorithm */
     349             :   u8 cc_data[TCP_CC_DATA_SZ];   /**< Congestion control algo private data */
     350             : 
     351             :   u32 fr_occurences;    /**< fast-retransmit occurrences RFC4898
     352             :                              tcpEStatsStackFastRetran */
     353             :   u32 tr_occurences;    /**< timer-retransmit occurrences */
     354             :   u64 bytes_retrans;    /**< RFC4898 tcpEStatsPerfOctetsRetrans */
     355             :   u64 segs_retrans;     /**< RFC4898 tcpEStatsPerfSegsRetrans*/
     356             : 
     357             :   /* RTT and RTO */
     358             :   u32 rto;              /**< Retransmission timeout */
     359             :   u32 rto_boff;         /**< Index for RTO backoff */
     360             :   u32 srtt;             /**< Smoothed RTT measured in @ref TCP_TICK */
     361             :   u32 rttvar;           /**< Smoothed mean RTT difference. Approximates variance */
     362             :   u32 rtt_seq;          /**< Sequence number for tracked ACK */
     363             :   f64 rtt_ts;           /**< Timestamp for tracked ACK */
     364             :   f64 mrtt_us;          /**< High precision mrtt from tracked acks */
     365             : 
     366             :   u32 psh_seq;          /**< Add psh header for seg that includes this */
     367             :   u32 next_node_index;  /**< Can be used to control next node in output */
     368             :   u32 next_node_opaque; /**< Opaque to pass to next node */
     369             :   u32 limited_transmit; /**< snd_nxt when limited transmit starts */
     370             :   u32 sw_if_index;      /**< Interface for the connection */
     371             : 
     372             :   /* Delivery rate estimation */
     373             :   u64 delivered;                /**< Total bytes delivered to peer */
     374             :   u64 app_limited;              /**< Delivered when app-limited detected */
     375             :   f64 delivered_time;           /**< Time last bytes were acked */
     376             :   f64 first_tx_time;            /**< Send time for recently delivered/sent */
     377             :   u64 lost;                     /**< Total bytes lost */
     378             :   tcp_byte_tracker_t *bt;       /**< Tx byte tracker */
     379             : 
     380             :   tcp_errors_t errors;  /**< Soft connection errors */
     381             : 
     382             :   u32 iss;              /**< initial sent sequence */
     383             :   u32 irs;              /**< initial remote sequence */
     384             :   f64 start_ts;         /**< Timestamp when connection initialized */
     385             :   u32 last_fib_check;   /**< Last time we checked fib route for peer */
     386             :   u16 mss;              /**< Our max seg size that includes options */
     387             :   u32 ipv6_flow_label;  /**< flow label for ipv6 header */
     388             : 
     389             : #define rst_state snd_wl1
     390             : } tcp_connection_t;
     391             : 
     392             : /* *INDENT-OFF* */
     393             : struct _tcp_cc_algorithm
     394             : {
     395             :   const char *name;
     396             :   uword (*unformat_cfg) (unformat_input_t * input);
     397             :   void (*init) (tcp_connection_t * tc);
     398             :   void (*cleanup) (tcp_connection_t * tc);
     399             :   void (*rcv_ack) (tcp_connection_t * tc, tcp_rate_sample_t *rs);
     400             :   void (*rcv_cong_ack) (tcp_connection_t * tc, tcp_cc_ack_t ack,
     401             :                         tcp_rate_sample_t *rs);
     402             :   void (*congestion) (tcp_connection_t * tc);
     403             :   void (*loss) (tcp_connection_t * tc);
     404             :   void (*recovered) (tcp_connection_t * tc);
     405             :   void (*undo_recovery) (tcp_connection_t * tc);
     406             :   void (*event) (tcp_connection_t *tc, tcp_cc_event_t evt);
     407             :   u64 (*get_pacing_rate) (tcp_connection_t *tc);
     408             : };
     409             : /* *INDENT-ON* */
     410             : 
     411             : #define tcp_fastrecovery_on(tc) (tc)->flags |= TCP_CONN_FAST_RECOVERY
     412             : #define tcp_fastrecovery_off(tc) (tc)->flags &= ~TCP_CONN_FAST_RECOVERY
     413             : #define tcp_recovery_on(tc) (tc)->flags |= TCP_CONN_RECOVERY
     414             : #define tcp_recovery_off(tc) (tc)->flags &= ~TCP_CONN_RECOVERY
     415             : #define tcp_in_fastrecovery(tc) ((tc)->flags & TCP_CONN_FAST_RECOVERY)
     416             : #define tcp_in_recovery(tc) ((tc)->flags & (TCP_CONN_RECOVERY))
     417             : #define tcp_in_slowstart(tc) (tc->cwnd < tc->ssthresh)
     418             : #define tcp_disconnect_pending(tc) ((tc)->flags & TCP_CONN_DCNT_PENDING)
     419             : #define tcp_disconnect_pending_on(tc) ((tc)->flags |= TCP_CONN_DCNT_PENDING)
     420             : #define tcp_disconnect_pending_off(tc) ((tc)->flags &= ~TCP_CONN_DCNT_PENDING)
     421             : #define tcp_fastrecovery_first(tc) ((tc)->flags & TCP_CONN_FRXT_FIRST)
     422             : #define tcp_fastrecovery_first_on(tc) ((tc)->flags |= TCP_CONN_FRXT_FIRST)
     423             : #define tcp_fastrecovery_first_off(tc) ((tc)->flags &= ~TCP_CONN_FRXT_FIRST)
     424             : 
     425             : #define tcp_in_cong_recovery(tc) ((tc)->flags &          \
     426             :           (TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY))
     427             : 
     428             : always_inline void
     429           4 : tcp_cong_recovery_off (tcp_connection_t * tc)
     430             : {
     431           4 :   tc->flags &= ~(TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY);
     432           4 :   tcp_fastrecovery_first_off (tc);
     433           4 : }
     434             : 
     435             : #define tcp_csum_offload(tc) (!((tc)->cfg_flags & TCP_CFG_F_NO_CSUM_OFFLOAD))
     436             : 
     437             : #define tcp_zero_rwnd_sent(tc) ((tc)->flags & TCP_CONN_ZERO_RWND_SENT)
     438             : #define tcp_zero_rwnd_sent_on(tc) (tc)->flags |= TCP_CONN_ZERO_RWND_SENT
     439             : #define tcp_zero_rwnd_sent_off(tc) (tc)->flags &= ~TCP_CONN_ZERO_RWND_SENT
     440             : 
     441             : always_inline tcp_connection_t *
     442     1063170 : tcp_get_connection_from_transport (transport_connection_t * tconn)
     443             : {
     444     1063170 :   return (tcp_connection_t *) tconn;
     445             : }
     446             : 
     447             : /*
     448             :  * Define custom timer wheel geometry
     449             :  */
     450             : 
     451             : #undef TW_TIMER_WHEELS
     452             : #undef TW_SLOTS_PER_RING
     453             : #undef TW_RING_SHIFT
     454             : #undef TW_RING_MASK
     455             : #undef TW_TIMERS_PER_OBJECT
     456             : #undef LOG2_TW_TIMERS_PER_OBJECT
     457             : #undef TW_SUFFIX
     458             : #undef TW_OVERFLOW_VECTOR
     459             : #undef TW_FAST_WHEEL_BITMAP
     460             : #undef TW_TIMER_ALLOW_DUPLICATE_STOP
     461             : #undef TW_START_STOP_TRACE_SIZE
     462             : 
     463             : #define TW_TIMER_WHEELS 2
     464             : #define TW_SLOTS_PER_RING 1024
     465             : #define TW_RING_SHIFT 10
     466             : #define TW_RING_MASK (TW_SLOTS_PER_RING -1)
     467             : #define TW_TIMERS_PER_OBJECT 16
     468             : #define LOG2_TW_TIMERS_PER_OBJECT 4
     469             : #define TW_SUFFIX _tcp_twsl
     470             : #define TW_FAST_WHEEL_BITMAP 0
     471             : #define TW_TIMER_ALLOW_DUPLICATE_STOP 1
     472             : 
     473             : #include <vppinfra/tw_timer_template.h>
     474             : 
     475             : typedef tw_timer_wheel_tcp_twsl_t tcp_timer_wheel_t;
     476             : 
     477             : #endif /* SRC_VNET_TCP_TCP_TYPES_H_ */
     478             : 
     479             : /*
     480             :  * fd.io coding-style-patch-verification: ON
     481             :  *
     482             :  * Local Variables:
     483             :  * eval: (c-set-style "gnu")
     484             :  * End:
     485             :  */

Generated by: LCOV version 1.14