5 * Common Development and Distribution License (the "License").
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) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 1990 Mentat Inc.
25 */
26
27 #include <sys/types.h>
28 #include <sys/stream.h>
29 #include <sys/dlpi.h>
30 #include <sys/stropts.h>
31 #include <sys/sysmacros.h>
32 #include <sys/strsubr.h>
33 #include <sys/strlog.h>
34 #include <sys/strsun.h>
35 #include <sys/zone.h>
36 #define _SUN_TPI_VERSION 2
37 #include <sys/tihdr.h>
38 #include <sys/xti_inet.h>
39 #include <sys/ddi.h>
40 #include <sys/suntpi.h>
41 #include <sys/cmn_err.h>
42 #include <sys/debug.h>
43 #include <sys/kobj.h>
44 #include <sys/modctl.h>
4629 ipst->ips_icmp_mibkp = icmp_kstat_init(stackid);
4630 ipst->ips_ip_kstat = ip_kstat2_init(stackid, &ipst->ips_ip_statistics);
4631 ipst->ips_ip6_kstat =
4632 ip6_kstat_init(stackid, &ipst->ips_ip6_statistics);
4633
4634 ipst->ips_ip_src_id = 1;
4635 rw_init(&ipst->ips_srcid_lock, NULL, RW_DEFAULT, NULL);
4636
4637 ipst->ips_src_generation = SRC_GENERATION_INITIAL;
4638
4639 ip_net_init(ipst, ns);
4640 ipv4_hook_init(ipst);
4641 ipv6_hook_init(ipst);
4642 arp_hook_init(ipst);
4643 ipmp_init(ipst);
4644 ipobs_init(ipst);
4645
4646 /*
4647 * Create the taskq dispatcher thread and initialize related stuff.
4648 */
4649 ipst->ips_capab_taskq_thread = thread_create(NULL, 0,
4650 ill_taskq_dispatch, ipst, 0, &p0, TS_RUN, minclsyspri);
4651 mutex_init(&ipst->ips_capab_taskq_lock, NULL, MUTEX_DEFAULT, NULL);
4652 cv_init(&ipst->ips_capab_taskq_cv, NULL, CV_DEFAULT, NULL);
4653
4654 major = mod_name_to_major(INET_NAME);
4655 (void) ldi_ident_from_major(major, &ipst->ips_ldi_ident);
4656 return (ipst);
4657 }
4658
4659 /*
4660 * Allocate and initialize a DLPI template of the specified length. (May be
4661 * called as writer.)
4662 */
4663 mblk_t *
4664 ip_dlpi_alloc(size_t len, t_uscalar_t prim)
4665 {
4666 mblk_t *mp;
4667
4668 mp = allocb(len, BPRI_MED);
4669 if (!mp)
4670 return (NULL);
4671
4672 /*
|
5 * Common Development and Distribution License (the "License").
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) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 1990 Mentat Inc.
25 * Copyright (c) 2011 Joyent, Inc. All rights reserved.
26 */
27
28 #include <sys/types.h>
29 #include <sys/stream.h>
30 #include <sys/dlpi.h>
31 #include <sys/stropts.h>
32 #include <sys/sysmacros.h>
33 #include <sys/strsubr.h>
34 #include <sys/strlog.h>
35 #include <sys/strsun.h>
36 #include <sys/zone.h>
37 #define _SUN_TPI_VERSION 2
38 #include <sys/tihdr.h>
39 #include <sys/xti_inet.h>
40 #include <sys/ddi.h>
41 #include <sys/suntpi.h>
42 #include <sys/cmn_err.h>
43 #include <sys/debug.h>
44 #include <sys/kobj.h>
45 #include <sys/modctl.h>
4630 ipst->ips_icmp_mibkp = icmp_kstat_init(stackid);
4631 ipst->ips_ip_kstat = ip_kstat2_init(stackid, &ipst->ips_ip_statistics);
4632 ipst->ips_ip6_kstat =
4633 ip6_kstat_init(stackid, &ipst->ips_ip6_statistics);
4634
4635 ipst->ips_ip_src_id = 1;
4636 rw_init(&ipst->ips_srcid_lock, NULL, RW_DEFAULT, NULL);
4637
4638 ipst->ips_src_generation = SRC_GENERATION_INITIAL;
4639
4640 ip_net_init(ipst, ns);
4641 ipv4_hook_init(ipst);
4642 ipv6_hook_init(ipst);
4643 arp_hook_init(ipst);
4644 ipmp_init(ipst);
4645 ipobs_init(ipst);
4646
4647 /*
4648 * Create the taskq dispatcher thread and initialize related stuff.
4649 */
4650 mutex_init(&ipst->ips_capab_taskq_lock, NULL, MUTEX_DEFAULT, NULL);
4651 cv_init(&ipst->ips_capab_taskq_cv, NULL, CV_DEFAULT, NULL);
4652 ipst->ips_capab_taskq_thread = thread_create(NULL, 0,
4653 ill_taskq_dispatch, ipst, 0, &p0, TS_RUN, minclsyspri);
4654
4655 major = mod_name_to_major(INET_NAME);
4656 (void) ldi_ident_from_major(major, &ipst->ips_ldi_ident);
4657 return (ipst);
4658 }
4659
4660 /*
4661 * Allocate and initialize a DLPI template of the specified length. (May be
4662 * called as writer.)
4663 */
4664 mblk_t *
4665 ip_dlpi_alloc(size_t len, t_uscalar_t prim)
4666 {
4667 mblk_t *mp;
4668
4669 mp = allocb(len, BPRI_MED);
4670 if (!mp)
4671 return (NULL);
4672
4673 /*
|