17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5410734d4SPhilip Kirk * Common Development and Distribution License (the "License"). 6410734d4SPhilip Kirk * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*66cd0f60SKacheong Poon * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 237c478bd9Sstevel@tonic-gate */ 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate #ifndef _INET_TCP_SACK_H 267c478bd9Sstevel@tonic-gate #define _INET_TCP_SACK_H 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifdef __cplusplus 297c478bd9Sstevel@tonic-gate extern "C" { 307c478bd9Sstevel@tonic-gate #endif 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate /* Maximum num of receiver's SACK blocks */ 337c478bd9Sstevel@tonic-gate #define MAX_SACK_BLK 5 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate /* Receiver's SACK blk structure */ 367c478bd9Sstevel@tonic-gate typedef struct sack_blk 377c478bd9Sstevel@tonic-gate { 387c478bd9Sstevel@tonic-gate tcp_seq begin; 397c478bd9Sstevel@tonic-gate tcp_seq end; 407c478bd9Sstevel@tonic-gate } sack_blk_t; 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate /* Sender's notsack'ed blk structure */ 437c478bd9Sstevel@tonic-gate typedef struct notsack_blk 447c478bd9Sstevel@tonic-gate { 457c478bd9Sstevel@tonic-gate struct notsack_blk *next; 467c478bd9Sstevel@tonic-gate tcp_seq begin; 477c478bd9Sstevel@tonic-gate tcp_seq end; 487c478bd9Sstevel@tonic-gate uint32_t sack_cnt; /* Dup SACK count */ 497c478bd9Sstevel@tonic-gate } notsack_blk_t; 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* SACK information in the tcp_t structure. */ 537c478bd9Sstevel@tonic-gate typedef struct 547c478bd9Sstevel@tonic-gate { 557c478bd9Sstevel@tonic-gate int32_t tcp_pipe; /* # of bytes in network */ 567c478bd9Sstevel@tonic-gate tcp_seq tcp_fack; /* highest sack'ed seq num */ 577c478bd9Sstevel@tonic-gate tcp_seq tcp_sack_snxt; /* next seq num to be rexmited using SACK. */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate int32_t tcp_max_sack_blk; /* max # of SACK info blk in a segment */ 607c478bd9Sstevel@tonic-gate int32_t tcp_num_sack_blk; /* num of blks in sack list */ 617c478bd9Sstevel@tonic-gate sack_blk_t tcp_sack_list[MAX_SACK_BLK]; /* the sack list */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* num of blks in notsack list */ 647c478bd9Sstevel@tonic-gate int32_t tcp_num_notsack_blk; 657c478bd9Sstevel@tonic-gate /* # of bytes represented in blks in notsack list */ 667c478bd9Sstevel@tonic-gate uint32_t tcp_cnt_notsack_list; 677c478bd9Sstevel@tonic-gate /* the notsack list */ 687c478bd9Sstevel@tonic-gate notsack_blk_t *tcp_notsack_list; 697c478bd9Sstevel@tonic-gate } tcp_sack_info_t; 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate extern void tcp_sack_insert(sack_blk_t *, tcp_seq, tcp_seq, int32_t *); 727c478bd9Sstevel@tonic-gate extern void tcp_sack_remove(sack_blk_t *, tcp_seq, int32_t *); 737c478bd9Sstevel@tonic-gate extern void tcp_notsack_insert(notsack_blk_t **, tcp_seq, tcp_seq, 747c478bd9Sstevel@tonic-gate int32_t *, uint32_t *); 757c478bd9Sstevel@tonic-gate extern void tcp_notsack_remove(notsack_blk_t **, tcp_seq, int32_t *, 767c478bd9Sstevel@tonic-gate uint32_t *); 777c478bd9Sstevel@tonic-gate extern void tcp_notsack_update(notsack_blk_t **, tcp_seq, tcp_seq, 787c478bd9Sstevel@tonic-gate int32_t *, uint32_t *); 797c478bd9Sstevel@tonic-gate 80*66cd0f60SKacheong Poon /* Defined in tcp_sack.c */ 81*66cd0f60SKacheong Poon extern kmem_cache_t *tcp_notsack_blk_cache; 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* 847c478bd9Sstevel@tonic-gate * Macro to remove all the notsack'ed blks in sender. 857c478bd9Sstevel@tonic-gate * 867c478bd9Sstevel@tonic-gate * Param: 877c478bd9Sstevel@tonic-gate * notsack_blk_t *head: pointer to the head of the list of notsack'ed blks. 887c478bd9Sstevel@tonic-gate */ 89410734d4SPhilip Kirk #define TCP_NOTSACK_REMOVE_ALL(head, tcp) \ 907c478bd9Sstevel@tonic-gate { \ 91*66cd0f60SKacheong Poon if ((head) != NULL) { \ 927c478bd9Sstevel@tonic-gate notsack_blk_t *prev, *tmp; \ 937c478bd9Sstevel@tonic-gate tmp = (head); \ 947c478bd9Sstevel@tonic-gate do { \ 957c478bd9Sstevel@tonic-gate prev = tmp; \ 967c478bd9Sstevel@tonic-gate tmp = tmp->next; \ 97*66cd0f60SKacheong Poon kmem_cache_free(tcp_notsack_blk_cache, prev); \ 987c478bd9Sstevel@tonic-gate } while (tmp != NULL); \ 997c478bd9Sstevel@tonic-gate (head) = NULL; \ 100410734d4SPhilip Kirk (tcp)->tcp_cnt_notsack_list = 0; \ 101410734d4SPhilip Kirk (tcp)->tcp_num_notsack_blk = 0; \ 102*66cd0f60SKacheong Poon } else { \ 103*66cd0f60SKacheong Poon ASSERT((tcp)->tcp_cnt_notsack_list == 0); \ 104*66cd0f60SKacheong Poon ASSERT((tcp)->tcp_num_notsack_blk == 0); \ 105*66cd0f60SKacheong Poon } \ 1067c478bd9Sstevel@tonic-gate } 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1097c478bd9Sstevel@tonic-gate } 1107c478bd9Sstevel@tonic-gate #endif 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #endif /* _INET_TCP_SACK_H */ 113