6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 *
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 */
27 /* Copyright (c) 1990 Mentat Inc. */
28
29 #include <sys/types.h>
30 #include <sys/stream.h>
31 #include <sys/dlpi.h>
32 #include <sys/stropts.h>
33 #include <sys/sysmacros.h>
34 #include <sys/strsubr.h>
35 #include <sys/strlog.h>
36 #include <sys/strsun.h>
37 #include <sys/zone.h>
38 #define _SUN_TPI_VERSION 2
39 #include <sys/tihdr.h>
40 #include <sys/xti_inet.h>
41 #include <sys/ddi.h>
42 #include <sys/sunddi.h>
43 #include <sys/cmn_err.h>
44 #include <sys/debug.h>
45 #include <sys/kobj.h>
129
130 static void ip_input_local_v4(ire_t *, mblk_t *, ipha_t *,
131 ip_recv_attr_t *);
132
133 static void ip_input_broadcast_v4(ire_t *, mblk_t *, ipha_t *,
134 ip_recv_attr_t *);
135 static void ip_input_multicast_v4(ire_t *, mblk_t *, ipha_t *,
136 ip_recv_attr_t *);
137
138 #pragma inline(ip_input_common_v4, ip_input_local_v4, ip_forward_xmit_v4)
139
140 /*
141 * Direct read side procedure capable of dealing with chains. GLDv3 based
142 * drivers call this function directly with mblk chains while STREAMS
143 * read side procedure ip_rput() calls this for single packet with ip_ring
144 * set to NULL to process one packet at a time.
145 *
146 * The ill will always be valid if this function is called directly from
147 * the driver.
148 *
149 * If ip_input() is called from GLDv3:
150 *
151 * - This must be a non-VLAN IP stream.
152 * - 'mp' is either an untagged or a special priority-tagged packet.
153 * - Any VLAN tag that was in the MAC header has been stripped.
154 *
155 * If the IP header in packet is not 32-bit aligned, every message in the
156 * chain will be aligned before further operations. This is required on SPARC
157 * platform.
158 */
159 void
160 ip_input(ill_t *ill, ill_rx_ring_t *ip_ring, mblk_t *mp_chain,
161 struct mac_header_info_s *mhip)
162 {
163 (void) ip_input_common_v4(ill, ip_ring, mp_chain, mhip, NULL, NULL,
164 NULL);
165 }
166
167 /*
168 * ip_accept_tcp() - This function is called by the squeue when it retrieves
169 * a chain of packets in the poll mode. The packets have gone through the
170 * data link processing but not IP processing. For performance and latency
171 * reasons, the squeue wants to process the chain in line instead of feeding
172 * it back via ip_input path.
173 *
174 * We set up the ip_recv_attr_t with IRAF_TARGET_SQP to that ip_fanout_v4
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 *
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2018 Joyent, Inc.
27 */
28 /* Copyright (c) 1990 Mentat Inc. */
29
30 #include <sys/types.h>
31 #include <sys/stream.h>
32 #include <sys/dlpi.h>
33 #include <sys/stropts.h>
34 #include <sys/sysmacros.h>
35 #include <sys/strsubr.h>
36 #include <sys/strlog.h>
37 #include <sys/strsun.h>
38 #include <sys/zone.h>
39 #define _SUN_TPI_VERSION 2
40 #include <sys/tihdr.h>
41 #include <sys/xti_inet.h>
42 #include <sys/ddi.h>
43 #include <sys/sunddi.h>
44 #include <sys/cmn_err.h>
45 #include <sys/debug.h>
46 #include <sys/kobj.h>
130
131 static void ip_input_local_v4(ire_t *, mblk_t *, ipha_t *,
132 ip_recv_attr_t *);
133
134 static void ip_input_broadcast_v4(ire_t *, mblk_t *, ipha_t *,
135 ip_recv_attr_t *);
136 static void ip_input_multicast_v4(ire_t *, mblk_t *, ipha_t *,
137 ip_recv_attr_t *);
138
139 #pragma inline(ip_input_common_v4, ip_input_local_v4, ip_forward_xmit_v4)
140
141 /*
142 * Direct read side procedure capable of dealing with chains. GLDv3 based
143 * drivers call this function directly with mblk chains while STREAMS
144 * read side procedure ip_rput() calls this for single packet with ip_ring
145 * set to NULL to process one packet at a time.
146 *
147 * The ill will always be valid if this function is called directly from
148 * the driver.
149 *
150 * If this chain is part of a VLAN stream, then the VLAN tag is
151 * stripped from the MAC header before being delivered to this
152 * function.
153 *
154 * If the IP header in packet is not 32-bit aligned, every message in the
155 * chain will be aligned before further operations. This is required on SPARC
156 * platform.
157 */
158 void
159 ip_input(ill_t *ill, ill_rx_ring_t *ip_ring, mblk_t *mp_chain,
160 struct mac_header_info_s *mhip)
161 {
162 (void) ip_input_common_v4(ill, ip_ring, mp_chain, mhip, NULL, NULL,
163 NULL);
164 }
165
166 /*
167 * ip_accept_tcp() - This function is called by the squeue when it retrieves
168 * a chain of packets in the poll mode. The packets have gone through the
169 * data link processing but not IP processing. For performance and latency
170 * reasons, the squeue wants to process the chain in line instead of feeding
171 * it back via ip_input path.
172 *
173 * We set up the ip_recv_attr_t with IRAF_TARGET_SQP to that ip_fanout_v4
|