2 * Copyright (c) 2018-2019 Cavium, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
30 #ifndef __ECORE_TCP_IP_H
31 #define __ECORE_TCP_IP_H
33 #define VLAN_VID_MASK 0x0fff /* VLAN Identifier */
34 #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
35 #define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
36 #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
37 #define ETH_P_IP 0x0800 /* Internet Protocol packet */
38 #define ETH_HLEN 14 /* Total octets in header. */
39 #define VLAN_HLEN 4 /* additional bytes required by VLAN */
40 #define MAX_VLAN_PRIO 7 /* Max vlan priority value in 801.1Q tag */
42 #define MAX_DSCP 63 /* Max DSCP value in IP header */
46 #define htonl(val) OSAL_CPU_TO_BE32(val)
50 #define ntohl(val) OSAL_BE32_TO_CPU(val)
54 #define htons(val) OSAL_CPU_TO_BE16(val)
58 #define ntohs(val) OSAL_BE16_TO_CPU(val)
63 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
64 unsigned char h_source[ETH_ALEN]; /* source ether addr */
65 u16 h_proto; /* packet type ID field */
80 /*The options start here. */
83 struct ecore_vlan_ethhdr {
84 unsigned char h_dest[ETH_ALEN];
85 unsigned char h_source[ETH_ALEN];
88 u16 h_vlan_encapsulated_proto;
91 struct ecore_in6_addr {
99 struct ecore_ipv6hdr {
108 struct ecore_in6_addr saddr;
109 struct ecore_in6_addr daddr;
112 struct ecore_tcphdr {
133 INET_ECN_NOT_ECT = 0,