tcp_lro.h revision 235944
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 235944 2012-05-24 23:03:23Z bz $ 28235474Sbz */ 29179737Sjfv 30179737Sjfv#ifndef _TCP_LRO_H_ 31179737Sjfv#define _TCP_LRO_H_ 32179737Sjfv 33179737Sjfvstruct lro_entry 34179737Sjfv{ 35235944Sbz SLIST_ENTRY(lro_entry) next; 36235944Sbz struct mbuf *m_head; 37235944Sbz struct mbuf *m_tail; 38235944Sbz union { 39235944Sbz struct ip *ip4; 40235944Sbz struct ip6_hdr *ip6; 41235944Sbz } leip; 42235944Sbz union { 43235944Sbz in_addr_t s_ip4; 44235944Sbz struct in6_addr s_ip6; 45235944Sbz } lesource; 46235944Sbz union { 47235944Sbz in_addr_t d_ip4; 48235944Sbz struct in6_addr d_ip6; 49235944Sbz } ledest; 50235944Sbz uint16_t source_port; 51235944Sbz uint16_t dest_port; 52235944Sbz uint16_t eh_type; /* EthernetHeader type. */ 53235944Sbz uint16_t append_cnt; 54235944Sbz uint32_t p_len; /* IP header payload length. */ 55235944Sbz uint32_t ulp_csum; /* TCP, etc. checksum. */ 56235944Sbz uint32_t next_seq; /* tcp_seq */ 57235944Sbz uint32_t ack_seq; /* tcp_seq */ 58235944Sbz uint32_t tsval; 59235944Sbz uint32_t tsecr; 60235944Sbz uint16_t window; 61235944Sbz uint16_t timestamp; /* flag, not a TCP hdr field. */ 62179737Sjfv}; 63179737SjfvSLIST_HEAD(lro_head, lro_entry); 64179737Sjfv 65235944Sbz#define le_ip4 leip.ip4 66235944Sbz#define le_ip6 leip.ip6 67235944Sbz#define source_ip4 lesource.s_ip4 68235944Sbz#define dest_ip4 ledest.d_ip4 69235944Sbz#define source_ip6 lesource.s_ip6 70235944Sbz#define dest_ip6 ledest.d_ip6 71235944Sbz 72235944Sbz/* NB: This is part of driver structs. */ 73179737Sjfvstruct lro_ctrl { 74179737Sjfv struct ifnet *ifp; 75179737Sjfv int lro_queued; 76179737Sjfv int lro_flushed; 77179737Sjfv int lro_bad_csum; 78179737Sjfv int lro_cnt; 79179737Sjfv 80179737Sjfv struct lro_head lro_active; 81179737Sjfv struct lro_head lro_free; 82179737Sjfv}; 83179737Sjfv 84179737Sjfvint tcp_lro_init(struct lro_ctrl *); 85179737Sjfvvoid tcp_lro_free(struct lro_ctrl *); 86179737Sjfvvoid tcp_lro_flush(struct lro_ctrl *, struct lro_entry *); 87179737Sjfvint tcp_lro_rx(struct lro_ctrl *, struct mbuf *, uint32_t); 88179737Sjfv 89235944Sbz#define TCP_LRO_CANNOT -1 90235944Sbz#define TCP_LRO_NOT_SUPPORTED 1 91179737Sjfv 92179737Sjfv#endif /* _TCP_LRO_H_ */ 93