tcp_lro.h revision 179737
1179737Sjfv/*******************************************************************************
2179737Sjfv
3179737SjfvCopyright (c) 2006, Myricom Inc.
4179737SjfvCopyright (c) 2008, Intel Corporation.
5179737SjfvAll rights reserved.
6179737Sjfv
7179737SjfvRedistribution and use in source and binary forms, with or without
8179737Sjfvmodification, are permitted provided that the following conditions are met:
9179737Sjfv
10179737Sjfv 1. Redistributions of source code must retain the above copyright notice,
11179737Sjfv    this list of conditions and the following disclaimer.
12179737Sjfv
13179737Sjfv 2. Neither the name of the Myricom Inc, nor the names of its
14179737Sjfv    contributors may be used to endorse or promote products derived from
15179737Sjfv    this software without specific prior written permission.
16179737Sjfv
17179737Sjfv 2. Neither the name of the Intel Corporation, nor the names of its
18179737Sjfv    contributors may be used to endorse or promote products derived from
19179737Sjfv    this software without specific prior written permission.
20179737Sjfv
21179737SjfvTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22179737SjfvAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23179737SjfvIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24179737SjfvARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25179737SjfvLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26179737SjfvCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27179737SjfvSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28179737SjfvINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29179737SjfvCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30179737SjfvARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31179737SjfvPOSSIBILITY OF SUCH DAMAGE.
32179737Sjfv
33179737Sjfv
34179737Sjfv$FreeBSD: head/sys/netinet/tcp_lro.h 179737 2008-06-11 22:12:50Z jfv $
35179737Sjfv
36179737Sjfv***************************************************************************/
37179737Sjfv#ifndef _TCP_LRO_H_
38179737Sjfv#define _TCP_LRO_H_
39179737Sjfv
40179737Sjfvstruct lro_entry;
41179737Sjfvstruct lro_entry
42179737Sjfv{
43179737Sjfv	SLIST_ENTRY(lro_entry) next;
44179737Sjfv	struct mbuf  	*m_head;
45179737Sjfv	struct mbuf	*m_tail;
46179737Sjfv	int		timestamp;
47179737Sjfv	struct ip	*ip;
48179737Sjfv	uint32_t	tsval;
49179737Sjfv	uint32_t	tsecr;
50179737Sjfv	uint32_t	source_ip;
51179737Sjfv	uint32_t	dest_ip;
52179737Sjfv	uint32_t	next_seq;
53179737Sjfv	uint32_t	ack_seq;
54179737Sjfv	uint32_t	len;
55179737Sjfv	uint32_t	data_csum;
56179737Sjfv	uint16_t	window;
57179737Sjfv	uint16_t	source_port;
58179737Sjfv	uint16_t	dest_port;
59179737Sjfv	uint16_t	append_cnt;
60179737Sjfv	uint16_t	mss;
61179737Sjfv
62179737Sjfv};
63179737SjfvSLIST_HEAD(lro_head, lro_entry);
64179737Sjfv
65179737Sjfvstruct lro_ctrl {
66179737Sjfv	struct ifnet	*ifp;
67179737Sjfv	int		lro_queued;
68179737Sjfv	int		lro_flushed;
69179737Sjfv	int		lro_bad_csum;
70179737Sjfv	int		lro_cnt;
71179737Sjfv
72179737Sjfv	struct lro_head	lro_active;
73179737Sjfv	struct lro_head	lro_free;
74179737Sjfv};
75179737Sjfv
76179737Sjfv
77179737Sjfvint tcp_lro_init(struct lro_ctrl *);
78179737Sjfvvoid tcp_lro_free(struct lro_ctrl *);
79179737Sjfvvoid tcp_lro_flush(struct lro_ctrl *, struct lro_entry *);
80179737Sjfvint tcp_lro_rx(struct lro_ctrl *, struct mbuf *, uint32_t);
81179737Sjfv
82179737Sjfv/* Number of LRO entries - these are per rx queue */
83179737Sjfv#define LRO_ENTRIES			8
84179737Sjfv
85179737Sjfv#endif /* _TCP_LRO_H_ */
86