10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 59864SPhil.Kirk@Sun.COM * Common Development and Distribution License (the "License"). 69864SPhil.Kirk@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*12056SKacheong.Poon@Sun.COM * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate #ifndef _INET_TCP_SACK_H 260Sstevel@tonic-gate #define _INET_TCP_SACK_H 270Sstevel@tonic-gate 280Sstevel@tonic-gate #ifdef __cplusplus 290Sstevel@tonic-gate extern "C" { 300Sstevel@tonic-gate #endif 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* Maximum num of receiver's SACK blocks */ 330Sstevel@tonic-gate #define MAX_SACK_BLK 5 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* Receiver's SACK blk structure */ 360Sstevel@tonic-gate typedef struct sack_blk 370Sstevel@tonic-gate { 380Sstevel@tonic-gate tcp_seq begin; 390Sstevel@tonic-gate tcp_seq end; 400Sstevel@tonic-gate } sack_blk_t; 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* Sender's notsack'ed blk structure */ 430Sstevel@tonic-gate typedef struct notsack_blk 440Sstevel@tonic-gate { 450Sstevel@tonic-gate struct notsack_blk *next; 460Sstevel@tonic-gate tcp_seq begin; 470Sstevel@tonic-gate tcp_seq end; 480Sstevel@tonic-gate uint32_t sack_cnt; /* Dup SACK count */ 490Sstevel@tonic-gate } notsack_blk_t; 500Sstevel@tonic-gate 510Sstevel@tonic-gate 520Sstevel@tonic-gate /* SACK information in the tcp_t structure. */ 530Sstevel@tonic-gate typedef struct 540Sstevel@tonic-gate { 550Sstevel@tonic-gate int32_t tcp_pipe; /* # of bytes in network */ 560Sstevel@tonic-gate tcp_seq tcp_fack; /* highest sack'ed seq num */ 570Sstevel@tonic-gate tcp_seq tcp_sack_snxt; /* next seq num to be rexmited using SACK. */ 580Sstevel@tonic-gate 590Sstevel@tonic-gate int32_t tcp_max_sack_blk; /* max # of SACK info blk in a segment */ 600Sstevel@tonic-gate int32_t tcp_num_sack_blk; /* num of blks in sack list */ 610Sstevel@tonic-gate sack_blk_t tcp_sack_list[MAX_SACK_BLK]; /* the sack list */ 620Sstevel@tonic-gate 630Sstevel@tonic-gate /* num of blks in notsack list */ 640Sstevel@tonic-gate int32_t tcp_num_notsack_blk; 650Sstevel@tonic-gate /* # of bytes represented in blks in notsack list */ 660Sstevel@tonic-gate uint32_t tcp_cnt_notsack_list; 670Sstevel@tonic-gate /* the notsack list */ 680Sstevel@tonic-gate notsack_blk_t *tcp_notsack_list; 690Sstevel@tonic-gate } tcp_sack_info_t; 700Sstevel@tonic-gate 710Sstevel@tonic-gate extern void tcp_sack_insert(sack_blk_t *, tcp_seq, tcp_seq, int32_t *); 720Sstevel@tonic-gate extern void tcp_sack_remove(sack_blk_t *, tcp_seq, int32_t *); 730Sstevel@tonic-gate extern void tcp_notsack_insert(notsack_blk_t **, tcp_seq, tcp_seq, 740Sstevel@tonic-gate int32_t *, uint32_t *); 750Sstevel@tonic-gate extern void tcp_notsack_remove(notsack_blk_t **, tcp_seq, int32_t *, 760Sstevel@tonic-gate uint32_t *); 770Sstevel@tonic-gate extern void tcp_notsack_update(notsack_blk_t **, tcp_seq, tcp_seq, 780Sstevel@tonic-gate int32_t *, uint32_t *); 790Sstevel@tonic-gate 80*12056SKacheong.Poon@Sun.COM /* Defined in tcp_sack.c */ 81*12056SKacheong.Poon@Sun.COM extern kmem_cache_t *tcp_notsack_blk_cache; 820Sstevel@tonic-gate 830Sstevel@tonic-gate /* 840Sstevel@tonic-gate * Macro to remove all the notsack'ed blks in sender. 850Sstevel@tonic-gate * 860Sstevel@tonic-gate * Param: 870Sstevel@tonic-gate * notsack_blk_t *head: pointer to the head of the list of notsack'ed blks. 880Sstevel@tonic-gate */ 89*12056SKacheong.Poon@Sun.COM #define TCP_NOTSACK_REMOVE_ALL(head, tcp) \ 90*12056SKacheong.Poon@Sun.COM { \ 91*12056SKacheong.Poon@Sun.COM if ((head) != NULL) { \ 92*12056SKacheong.Poon@Sun.COM notsack_blk_t *prev, *tmp; \ 93*12056SKacheong.Poon@Sun.COM tmp = (head); \ 94*12056SKacheong.Poon@Sun.COM do { \ 95*12056SKacheong.Poon@Sun.COM prev = tmp; \ 96*12056SKacheong.Poon@Sun.COM tmp = tmp->next; \ 97*12056SKacheong.Poon@Sun.COM kmem_cache_free(tcp_notsack_blk_cache, prev); \ 98*12056SKacheong.Poon@Sun.COM } while (tmp != NULL); \ 99*12056SKacheong.Poon@Sun.COM (head) = NULL; \ 100*12056SKacheong.Poon@Sun.COM (tcp)->tcp_cnt_notsack_list = 0; \ 101*12056SKacheong.Poon@Sun.COM (tcp)->tcp_num_notsack_blk = 0; \ 102*12056SKacheong.Poon@Sun.COM } else { \ 103*12056SKacheong.Poon@Sun.COM ASSERT((tcp)->tcp_cnt_notsack_list == 0); \ 104*12056SKacheong.Poon@Sun.COM ASSERT((tcp)->tcp_num_notsack_blk == 0); \ 105*12056SKacheong.Poon@Sun.COM } \ 1060Sstevel@tonic-gate } 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate #ifdef __cplusplus 1090Sstevel@tonic-gate } 1100Sstevel@tonic-gate #endif 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate #endif /* _INET_TCP_SACK_H */ 113