tcp_impl.h revision 4117443759eb8485e3cfd93459f86a41ea241d20
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _INET_TCP_IMPL_H
#define _INET_TCP_IMPL_H
/*
* TCP implementation private declarations. These interfaces are
* used to build the IP module and are not meant to be accessed
* by any modules except IP itself. They are undocumented and are
* subject to change without notice.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#define TCP_MOD_ID 5105
/*
* Was this tcp created via socket() interface?
*/
/*
* Is this tcp not attached to any upper client?
*/
/*
* To restart the TCP retransmission timer.
*/
if ((tcp)->tcp_timer_tid != 0) \
MSEC_TO_TICK(intvl)); \
}
/*
* This stops synchronous streams for a fused tcp endpoint
* and prevents tcp_fuse_rrw() from pulling data from it.
*/
#define TCP_FUSE_SYNCSTR_STOP(tcp) { \
if ((tcp)->tcp_direct_sockfs) { \
} \
}
/*
* This causes all calls to tcp_fuse_rrw() to block until
* TCP_FUSE_SYNCSTR_UNPLUG_DRAIN() is called.
*/
#define TCP_FUSE_SYNCSTR_PLUG_DRAIN(tcp) { \
if ((tcp)->tcp_direct_sockfs) { \
} \
}
/*
* This unplugs the draining of data through tcp_fuse_rrw(); see
* the comments in tcp_fuse_rrw() for how we preserve ordering.
*/
#define TCP_FUSE_SYNCSTR_UNPLUG_DRAIN(tcp) { \
if ((tcp)->tcp_direct_sockfs) { \
} \
}
/*
* Before caching the conn IRE, we need to make sure certain TCP
* states are in sync with the ire. The mismatch could occur if the
* TCP state has been set in tcp_adapt_ire() using a different IRE,
* e.g if an address was not present during an initial connect(),
* tcp_adapt_ire() will set the state using the interface route.
* Subsequently, if the address is added to the local machine, the
* retransmitted SYN will get the correct (loopback) IRE, but the TCP
* state (tcp_loopback and tcp_localnet) will remain out of sync.
* This is especially an issue with TCP fusion which relies on the
* TCP state to be accurate.
*
* the established state, else it would lead to inconsistencies.
*/
} else if ((tcp)->tcp_loopback && \
} \
(tcp)->tcp_localnet = \
((ire)->ire_gateway_addr == 0); \
} else { \
(tcp)->tcp_localnet = \
&(ire)->ire_gateway_addr_v6); \
} \
} \
}
/*
* Write-side flow-control is implemented via the per instance STREAMS
* write-side Q by explicitly setting QFULL to stop the flow of mblk_t(s)
* and clearing QFULL and calling qbackenable() to restart the flow based
* on the number of TCP unsent bytes (i.e. those not on the wire waiting
* for a remote ACK).
*
* This is different than a standard STREAMS kmod which when using the
* STREAMS Q the framework would automatictly flow-control based on the
*
* As of FireEngine TCP write-side flow-control needs to take into account
* both the unsent tcp_xmit list bytes but also any squeue_t enqueued bytes
* (i.e. from tcp_wput() -> tcp_output()).
*
* This is accomplished by adding a new tcp_t fields, tcp_squeue_bytes, to
* count the number of bytes enqueued by tcp_wput() and the number of bytes
* dequeued and processed by tcp_output().
*
* So, the total number of bytes unsent is (squeue_bytes + unsent) with all
* flow-control uses of unsent replaced with the macro TCP_UNSENT_BYTES.
*/
extern void tcp_clrqfull(tcp_t *);
extern void tcp_setqfull(tcp_t *);
#define TCP_UNSENT_BYTES(tcp) \
/* Named Dispatch Parameter Management Structure */
typedef struct tcpparam_s {
char *tcp_param_name;
} tcpparam_t;
extern boolean_t do_tcp_fusion;
extern void tcp_timers_stop(tcp_t *);
extern void tcp_push_timer(void *);
extern void tcp_unfuse(tcp_t *);
extern void tcp_fuse_syncstr_enable_pair(tcp_t *);
extern int tcp_fuse_maxpsz_set(tcp_t *);
/*
* Object to represent database of options to search passed to
* {sock,tpi}optcom_req() interface routine to take care of option
* management and associated methods.
*/
extern optdb_obj_t tcp_opt_obj;
extern uint_t tcp_max_optsize;
extern sock_downcalls_t sock_tcp_downcalls;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _INET_TCP_IMPL_H */