]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netinet/tcp_lro.h
2 * Copyright (c) 2011 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 #ifdef BSD_KERNEL_PRIVATE
34 #define TCP_LRO_NUM_FLOWS (16) /* must be <= 255 for char lro_flow_map */
35 #define TCP_LRO_FLOW_MAP (1024)
38 struct mbuf
*lr_mhead
; /* coalesced mbuf chain head */
39 struct mbuf
*lr_mtail
; /* coalesced mbuf chain tail */
40 struct tcphdr
*lr_tcphdr
; /* ptr to TCP hdr in frame */
41 u_int32_t
*lr_tsval
; /* address of tsval in frame */
42 u_int32_t
*lr_tsecr
; /* tsecr field in TCP header */
43 tcp_seq lr_seq
; /* next expected seq num */
44 unsigned int lr_len
; /* length of LRO frame */
45 struct in_addr lr_faddr
; /* foreign address */
46 struct in_addr lr_laddr
; /* local address */
47 unsigned short int lr_fport
; /* foreign port */
48 unsigned short int lr_lport
; /* local port */
49 u_int32_t lr_timestamp
; /* for ejecting the flow */
50 unsigned short int lr_hash_map
; /* back pointer to hash map */
51 unsigned short int lr_flags
; /* pad */
52 } __attribute__((aligned(8)));
54 /* lr_flags - only 16 bits available */
55 #define LRO_EJECT_REQ 0x1
58 #define TCP_LRO_FLOW_UNINIT TCP_LRO_NUM_FLOWS+1
59 #define TCP_LRO_FLOW_NOTFOUND TCP_LRO_FLOW_UNINIT
61 /* Max packets to be coalesced before pushing to app */
62 #define LRO_MX_COALESCE_PKTS (8)
65 * Min num of bytes in a packet to trigger coalescing
67 #define LRO_MIN_COALESC_SZ (1300)
70 * Max amount of time to wait before flushing flows in msecs.
72 * This number has been carefully chosen and should be altered with care.
74 #define LRO_MX_TIME_TO_BUFFER 10
76 /* similar to INP_PCBHASH */
77 #define LRO_HASH(faddr, laddr, fport, lport, mask) \
78 (((faddr) ^ ((laddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask))
81 #endif /* TCP_LRO_H_ */