Print this page
dccp: reset packet
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/inet/ip_impl.h
+++ new/usr/src/uts/common/inet/ip_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 #ifndef _INET_IP_IMPL_H
27 27 #define _INET_IP_IMPL_H
28 28
29 29 /*
30 30 * IP implementation private declarations. These interfaces are
31 31 * used to build the IP module and are not meant to be accessed
32 32 * by any modules except IP itself. They are undocumented and are
33 33 * subject to change without notice.
34 34 */
35 35
36 36 #ifdef __cplusplus
37 37 extern "C" {
38 38 #endif
39 39
40 40 #ifdef _KERNEL
41 41
42 42 #include <sys/sdt.h>
43 43 #include <sys/dld.h>
44 44 #include <inet/tunables.h>
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
45 45
46 46 #define IP_MOD_ID 5701
47 47
48 48 #define INET_NAME "ip"
49 49
50 50 #ifdef _BIG_ENDIAN
51 51 #define IP_HDR_CSUM_TTL_ADJUST 256
52 52 #define IP_TCP_CSUM_COMP IPPROTO_TCP
53 53 #define IP_UDP_CSUM_COMP IPPROTO_UDP
54 54 #define IP_ICMPV6_CSUM_COMP IPPROTO_ICMPV6
55 +#define IP_DCCP_CSUM_COMP IPPROTO_DCCP
55 56 #else
56 57 #define IP_HDR_CSUM_TTL_ADJUST 1
57 58 #define IP_TCP_CSUM_COMP (IPPROTO_TCP << 8)
58 59 #define IP_UDP_CSUM_COMP (IPPROTO_UDP << 8)
59 60 #define IP_ICMPV6_CSUM_COMP (IPPROTO_ICMPV6 << 8)
61 +#define IP_DCCP_CSUM_COMP (IPPROTO_DCCP << 8)
60 62 #endif
61 63
62 64 #define TCP_CHECKSUM_OFFSET 16
63 65 #define TCP_CHECKSUM_SIZE 2
64 66
65 67 #define UDP_CHECKSUM_OFFSET 6
66 68 #define UDP_CHECKSUM_SIZE 2
67 69
68 70 #define ICMPV6_CHECKSUM_OFFSET 2
69 71 #define ICMPV6_CHECKSUM_SIZE 2
70 72
73 +#define DCCP_CHECKSUM_OFFSET 6
74 +#define DCCP_CHECKSUM_SIZE 2
75 +
71 76 #define IPH_TCPH_CHECKSUMP(ipha, hlen) \
72 77 ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + TCP_CHECKSUM_OFFSET)))
73 78
74 79 #define IPH_UDPH_CHECKSUMP(ipha, hlen) \
75 80 ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + UDP_CHECKSUM_OFFSET)))
76 81
77 82 #define IPH_ICMPV6_CHECKSUMP(ipha, hlen) \
78 83 ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + ICMPV6_CHECKSUM_OFFSET)))
79 84
85 +#define IPH_DCCPH_CHECKSUMP(ipha, hlen) \
86 + ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + DCCP_CHECKSUM_OFFSET)))
87 +
80 88 #define ILL_HCKSUM_CAPABLE(ill) \
81 89 (((ill)->ill_capabilities & ILL_CAPAB_HCKSUM) != 0)
82 90
83 91 /*
84 92 * Macro to adjust a given checksum value depending on any prepended
85 93 * or postpended data on the packet. It expects the start offset to
86 94 * begin at an even boundary and that the packet consists of at most
87 95 * two mblks.
88 96 */
89 97 #define IP_ADJCKSUM_PARTIAL(cksum_start, mp, mp1, len, adj) { \
90 98 /* \
91 99 * Prepended extraneous data; adjust checksum. \
92 100 */ \
93 101 if ((len) > 0) \
94 102 (adj) = IP_BCSUM_PARTIAL(cksum_start, len, 0); \
95 103 else \
96 104 (adj) = 0; \
97 105 /* \
98 106 * len is now the total length of mblk(s) \
99 107 */ \
100 108 (len) = MBLKL(mp); \
101 109 if ((mp1) == NULL) \
102 110 (mp1) = (mp); \
103 111 else \
104 112 (len) += MBLKL(mp1); \
105 113 /* \
106 114 * Postpended extraneous data; adjust checksum. \
107 115 */ \
108 116 if (((len) = (DB_CKSUMEND(mp) - len)) > 0) { \
109 117 uint32_t _pad; \
110 118 \
111 119 _pad = IP_BCSUM_PARTIAL((mp1)->b_wptr, len, 0); \
112 120 /* \
113 121 * If the postpended extraneous data was odd \
114 122 * byte aligned, swap resulting checksum bytes. \
115 123 */ \
116 124 if ((uintptr_t)(mp1)->b_wptr & 1) \
117 125 (adj) += ((_pad << 8) & 0xFFFF) | (_pad >> 8); \
118 126 else \
119 127 (adj) += _pad; \
120 128 (adj) = ((adj) & 0xFFFF) + ((int)(adj) >> 16); \
121 129 } \
122 130 }
123 131
124 132 #define IS_SIMPLE_IPH(ipha) \
125 133 ((ipha)->ipha_version_and_hdr_length == IP_SIMPLE_HDR_VERSION)
126 134
127 135 /*
128 136 * Currently supported flags for LSO.
129 137 */
130 138 #define LSO_BASIC_TCP_IPV4 DLD_LSO_BASIC_TCP_IPV4
131 139 #define LSO_BASIC_TCP_IPV6 DLD_LSO_BASIC_TCP_IPV6
132 140
133 141 #define ILL_LSO_CAPABLE(ill) \
134 142 (((ill)->ill_capabilities & ILL_CAPAB_LSO) != 0)
135 143
136 144 #define ILL_LSO_USABLE(ill) \
137 145 (ILL_LSO_CAPABLE(ill) && \
138 146 ill->ill_lso_capab != NULL)
139 147
140 148 #define ILL_LSO_TCP_IPV4_USABLE(ill) \
141 149 (ILL_LSO_USABLE(ill) && \
142 150 ill->ill_lso_capab->ill_lso_flags & LSO_BASIC_TCP_IPV4)
143 151
144 152 #define ILL_LSO_TCP_IPV6_USABLE(ill) \
145 153 (ILL_LSO_USABLE(ill) && \
146 154 ill->ill_lso_capab->ill_lso_flags & LSO_BASIC_TCP_IPV6)
147 155
148 156 #define ILL_ZCOPY_CAPABLE(ill) \
149 157 (((ill)->ill_capabilities & ILL_CAPAB_ZEROCOPY) != 0)
150 158
151 159 #define ILL_ZCOPY_USABLE(ill) \
152 160 (ILL_ZCOPY_CAPABLE(ill) && (ill->ill_zerocopy_capab != NULL) && \
153 161 (ill->ill_zerocopy_capab->ill_zerocopy_flags != 0))
154 162
155 163
156 164 /* Macro that follows definitions of flags for mac_tx() (see mac_client.h) */
157 165 #define IP_DROP_ON_NO_DESC 0x01 /* Equivalent to MAC_DROP_ON_NO_DESC */
158 166
159 167 #define ILL_DIRECT_CAPABLE(ill) \
160 168 (((ill)->ill_capabilities & ILL_CAPAB_DLD_DIRECT) != 0)
161 169
162 170 /* This macro is used by the mac layer */
163 171 #define MBLK_RX_FANOUT_SLOWPATH(mp, ipha) \
164 172 (DB_TYPE(mp) != M_DATA || DB_REF(mp) != 1 || !OK_32PTR(ipha) || \
165 173 (((uchar_t *)ipha + IP_SIMPLE_HDR_LENGTH) >= (mp)->b_wptr))
166 174
167 175 /*
168 176 * In non-global zone exclusive IP stacks, data structures such as IRE
169 177 * entries pretend that they're in the global zone. The following
170 178 * macro evaluates to the real zoneid instead of a pretend
171 179 * GLOBAL_ZONEID.
172 180 */
173 181 #define IP_REAL_ZONEID(zoneid, ipst) \
174 182 (((zoneid) == GLOBAL_ZONEID) ? \
175 183 netstackid_to_zoneid((ipst)->ips_netstack->netstack_stackid) : \
176 184 (zoneid))
177 185
178 186 extern void ill_flow_enable(void *, ip_mac_tx_cookie_t);
179 187 extern zoneid_t ip_get_zoneid_v4(ipaddr_t, mblk_t *, ip_recv_attr_t *,
180 188 zoneid_t);
181 189 extern zoneid_t ip_get_zoneid_v6(in6_addr_t *, mblk_t *, const ill_t *,
182 190 ip_recv_attr_t *, zoneid_t);
183 191 extern void conn_ire_revalidate(conn_t *, void *);
184 192 extern void ip_ire_unbind_walker(ire_t *, void *);
185 193 extern void ip_ire_rebind_walker(ire_t *, void *);
186 194
187 195 /*
188 196 * flag passed in by IP based protocols to get a private ip stream with
189 197 * no conn_t. Note this flag has the same value as SO_FALLBACK
190 198 */
191 199 #define IP_HELPER_STR SO_FALLBACK
192 200
193 201 #define IP_MOD_MINPSZ 1
194 202 #define IP_MOD_MAXPSZ INFPSZ
195 203 #define IP_MOD_HIWAT 65536
196 204 #define IP_MOD_LOWAT 1024
197 205
198 206 #define DEV_IP "/devices/pseudo/ip@0:ip"
199 207 #define DEV_IP6 "/devices/pseudo/ip6@0:ip6"
200 208
201 209 #endif /* _KERNEL */
202 210
203 211 #ifdef __cplusplus
204 212 }
205 213 #endif
206 214
207 215 #endif /* _INET_IP_IMPL_H */
↓ open down ↓ |
118 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX