4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
25 #ifndef _INET_TCP_SACK_H
26 #define _INET_TCP_SACK_H
32 /* Maximum num of receiver's SACK blocks */
33 #define MAX_SACK_BLK 5
35 /* Receiver's SACK blk structure */
36 typedef struct sack_blk
42 /* Sender's notsack'ed blk structure */
43 typedef struct notsack_blk
45 struct notsack_blk
*next
;
48 uint32_t sack_cnt
; /* Dup SACK count */
52 /* SACK information in the tcp_t structure. */
55 int32_t tcp_pipe
; /* # of bytes in network */
56 tcp_seq tcp_fack
; /* highest sack'ed seq num */
57 tcp_seq tcp_sack_snxt
; /* next seq num to be rexmited using SACK. */
59 int32_t tcp_max_sack_blk
; /* max # of SACK info blk in a segment */
60 int32_t tcp_num_sack_blk
; /* num of blks in sack list */
61 sack_blk_t tcp_sack_list
[MAX_SACK_BLK
]; /* the sack list */
63 /* num of blks in notsack list */
64 int32_t tcp_num_notsack_blk
;
65 /* # of bytes represented in blks in notsack list */
66 uint32_t tcp_cnt_notsack_list
;
67 /* the notsack list */
68 notsack_blk_t
*tcp_notsack_list
;
71 extern void tcp_sack_insert(sack_blk_t
*, tcp_seq
, tcp_seq
, int32_t *);
72 extern void tcp_sack_remove(sack_blk_t
*, tcp_seq
, int32_t *);
73 extern void tcp_notsack_insert(notsack_blk_t
**, tcp_seq
, tcp_seq
,
74 int32_t *, uint32_t *);
75 extern void tcp_notsack_remove(notsack_blk_t
**, tcp_seq
, int32_t *,
77 extern void tcp_notsack_update(notsack_blk_t
**, tcp_seq
, tcp_seq
,
78 int32_t *, uint32_t *);
80 /* Defined in tcp_sack.c */
81 extern kmem_cache_t
*tcp_notsack_blk_cache
;
84 * Macro to remove all the notsack'ed blks in sender.
87 * notsack_blk_t *head: pointer to the head of the list of notsack'ed blks.
89 #define TCP_NOTSACK_REMOVE_ALL(head, tcp) \
91 if ((head) != NULL) { \
92 notsack_blk_t *prev, *tmp; \
97 kmem_cache_free(tcp_notsack_blk_cache, prev); \
98 } while (tmp != NULL); \
100 (tcp)->tcp_cnt_notsack_list = 0; \
101 (tcp)->tcp_num_notsack_blk = 0; \
103 ASSERT((tcp)->tcp_cnt_notsack_list == 0); \
104 ASSERT((tcp)->tcp_num_notsack_blk == 0); \
112 #endif /* _INET_TCP_SACK_H */