10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*5895Syz147064 * Common Development and Distribution License (the "License"). 6*5895Syz147064 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*5895Syz147064 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * Data-Link Services Module 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <sys/types.h> 330Sstevel@tonic-gate #include <sys/modctl.h> 340Sstevel@tonic-gate #include <sys/mac.h> 350Sstevel@tonic-gate 360Sstevel@tonic-gate #include <sys/dls.h> 370Sstevel@tonic-gate #include <sys/dls_impl.h> 380Sstevel@tonic-gate 390Sstevel@tonic-gate static struct modlmisc i_dls_modlmisc = { 400Sstevel@tonic-gate &mod_miscops, 410Sstevel@tonic-gate DLS_INFO 420Sstevel@tonic-gate }; 430Sstevel@tonic-gate 440Sstevel@tonic-gate static struct modlinkage i_dls_modlinkage = { 450Sstevel@tonic-gate MODREV_1, 460Sstevel@tonic-gate &i_dls_modlmisc, 470Sstevel@tonic-gate NULL 480Sstevel@tonic-gate }; 490Sstevel@tonic-gate 500Sstevel@tonic-gate /* 510Sstevel@tonic-gate * Module initialization functions. 520Sstevel@tonic-gate */ 530Sstevel@tonic-gate 540Sstevel@tonic-gate static void 550Sstevel@tonic-gate i_dls_mod_init(void) 560Sstevel@tonic-gate { 570Sstevel@tonic-gate dls_init(); 580Sstevel@tonic-gate dls_vlan_init(); 590Sstevel@tonic-gate dls_link_init(); 60*5895Syz147064 dls_mgmt_init(); 610Sstevel@tonic-gate } 620Sstevel@tonic-gate 630Sstevel@tonic-gate static int 640Sstevel@tonic-gate i_dls_mod_fini(void) 650Sstevel@tonic-gate { 660Sstevel@tonic-gate int err; 670Sstevel@tonic-gate 680Sstevel@tonic-gate if ((err = dls_link_fini()) != 0) 690Sstevel@tonic-gate return (err); 700Sstevel@tonic-gate 71*5895Syz147064 dls_mgmt_fini(); 72*5895Syz147064 730Sstevel@tonic-gate err = dls_vlan_fini(); 740Sstevel@tonic-gate ASSERT(err == 0); 750Sstevel@tonic-gate 760Sstevel@tonic-gate err = dls_fini(); 770Sstevel@tonic-gate ASSERT(err == 0); 780Sstevel@tonic-gate 790Sstevel@tonic-gate return (0); 800Sstevel@tonic-gate } 810Sstevel@tonic-gate 820Sstevel@tonic-gate /* 830Sstevel@tonic-gate * modlinkage functions. 840Sstevel@tonic-gate */ 850Sstevel@tonic-gate 860Sstevel@tonic-gate int 870Sstevel@tonic-gate _init(void) 880Sstevel@tonic-gate { 890Sstevel@tonic-gate int err; 900Sstevel@tonic-gate 910Sstevel@tonic-gate i_dls_mod_init(); 920Sstevel@tonic-gate 930Sstevel@tonic-gate if ((err = mod_install(&i_dls_modlinkage)) != 0) { 940Sstevel@tonic-gate (void) i_dls_mod_fini(); 950Sstevel@tonic-gate return (err); 960Sstevel@tonic-gate } 970Sstevel@tonic-gate 980Sstevel@tonic-gate #ifdef DEBUG 990Sstevel@tonic-gate cmn_err(CE_NOTE, "!%s loaded", DLS_INFO); 1000Sstevel@tonic-gate #endif /* DEBUG */ 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate return (0); 1030Sstevel@tonic-gate } 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate int 1060Sstevel@tonic-gate _fini(void) 1070Sstevel@tonic-gate { 1080Sstevel@tonic-gate int err; 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate if ((err = i_dls_mod_fini()) != 0) 1110Sstevel@tonic-gate return (err); 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate if ((err = mod_remove(&i_dls_modlinkage)) != 0) 1140Sstevel@tonic-gate return (err); 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate #ifdef DEBUG 1170Sstevel@tonic-gate cmn_err(CE_NOTE, "!%s unloaded", DLS_INFO); 1180Sstevel@tonic-gate #endif /* DEBUG */ 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate return (0); 1210Sstevel@tonic-gate } 1220Sstevel@tonic-gate 1230Sstevel@tonic-gate int 1240Sstevel@tonic-gate _info(struct modinfo *modinfop) 1250Sstevel@tonic-gate { 1260Sstevel@tonic-gate return (mod_info(&i_dls_modlinkage, modinfop)); 1270Sstevel@tonic-gate } 128