tcp_lro.h revision 235474
1235474Sbz/*-
2235474Sbz * Copyright (c) 2006, Myricom Inc.
3235474Sbz * Copyright (c) 2008, Intel Corporation.
4235474Sbz * All rights reserved.
5235474Sbz *
6235474Sbz * Redistribution and use in source and binary forms, with or without
7235474Sbz * modification, are permitted provided that the following conditions
8235474Sbz * are met:
9235474Sbz * 1. Redistributions of source code must retain the above copyright
10235474Sbz *    notice, this list of conditions and the following disclaimer.
11235474Sbz * 2. Redistributions in binary form must reproduce the above copyright
12235474Sbz *    notice, this list of conditions and the following disclaimer in the
13235474Sbz *    documentation and/or other materials provided with the distribution.
14235474Sbz *
15235474Sbz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16235474Sbz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17235474Sbz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18235474Sbz * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19235474Sbz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20235474Sbz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21235474Sbz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22235474Sbz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23235474Sbz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24235474Sbz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25235474Sbz * SUCH DAMAGE.
26235474Sbz *
27235474Sbz * $FreeBSD: head/sys/netinet/tcp_lro.h 235474 2012-05-15 13:23:44Z bz $
28235474Sbz */
29179737Sjfv
30179737Sjfv#ifndef _TCP_LRO_H_
31179737Sjfv#define _TCP_LRO_H_
32179737Sjfv
33179737Sjfvstruct lro_entry;
34179737Sjfvstruct lro_entry
35179737Sjfv{
36179737Sjfv	SLIST_ENTRY(lro_entry) next;
37217126Sjhb	struct mbuf	*m_head;
38179737Sjfv	struct mbuf	*m_tail;
39179737Sjfv	int		timestamp;
40179737Sjfv	struct ip	*ip;
41179737Sjfv	uint32_t	tsval;
42179737Sjfv	uint32_t	tsecr;
43179737Sjfv	uint32_t	source_ip;
44179737Sjfv	uint32_t	dest_ip;
45179737Sjfv	uint32_t	next_seq;
46179737Sjfv	uint32_t	ack_seq;
47179737Sjfv	uint32_t	len;
48179737Sjfv	uint32_t	data_csum;
49179737Sjfv	uint16_t	window;
50179737Sjfv	uint16_t	source_port;
51179737Sjfv	uint16_t	dest_port;
52179737Sjfv	uint16_t	append_cnt;
53179737Sjfv	uint16_t	mss;
54179737Sjfv
55179737Sjfv};
56179737SjfvSLIST_HEAD(lro_head, lro_entry);
57179737Sjfv
58179737Sjfvstruct lro_ctrl {
59179737Sjfv	struct ifnet	*ifp;
60179737Sjfv	int		lro_queued;
61179737Sjfv	int		lro_flushed;
62179737Sjfv	int		lro_bad_csum;
63179737Sjfv	int		lro_cnt;
64179737Sjfv
65179737Sjfv	struct lro_head	lro_active;
66179737Sjfv	struct lro_head	lro_free;
67179737Sjfv};
68179737Sjfv
69179737Sjfv
70179737Sjfvint tcp_lro_init(struct lro_ctrl *);
71179737Sjfvvoid tcp_lro_free(struct lro_ctrl *);
72179737Sjfvvoid tcp_lro_flush(struct lro_ctrl *, struct lro_entry *);
73179737Sjfvint tcp_lro_rx(struct lro_ctrl *, struct mbuf *, uint32_t);
74179737Sjfv
75179737Sjfv/* Number of LRO entries - these are per rx queue */
76179737Sjfv#define LRO_ENTRIES			8
77179737Sjfv
78179737Sjfv#endif /* _TCP_LRO_H_ */
79