10Sstevel@tonic-gate /* 28483Sjames.d.carlson@sun.com * CDDL HEADER START 38483Sjames.d.carlson@sun.com * 48483Sjames.d.carlson@sun.com * The contents of this file are subject to the terms of the 58483Sjames.d.carlson@sun.com * Common Development and Distribution License (the "License"). 68483Sjames.d.carlson@sun.com * You may not use this file except in compliance with the License. 78483Sjames.d.carlson@sun.com * 88483Sjames.d.carlson@sun.com * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 98483Sjames.d.carlson@sun.com * or http://www.opensolaris.org/os/licensing. 108483Sjames.d.carlson@sun.com * See the License for the specific language governing permissions 118483Sjames.d.carlson@sun.com * and limitations under the License. 120Sstevel@tonic-gate * 138483Sjames.d.carlson@sun.com * When distributing Covered Code, include this CDDL HEADER in each 148483Sjames.d.carlson@sun.com * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 158483Sjames.d.carlson@sun.com * If applicable, add the following below this CDDL HEADER, with the 168483Sjames.d.carlson@sun.com * fields enclosed by brackets "[]" replaced with your own identifying 178483Sjames.d.carlson@sun.com * information: Portions Copyright [yyyy] [name of copyright owner] 188483Sjames.d.carlson@sun.com * 198483Sjames.d.carlson@sun.com * CDDL HEADER END 208483Sjames.d.carlson@sun.com */ 218483Sjames.d.carlson@sun.com 228483Sjames.d.carlson@sun.com /* 23*9751Sjames.d.carlson@sun.com * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 278483Sjames.d.carlson@sun.com /* 288483Sjames.d.carlson@sun.com * sppptun_impl.h - Internal sppptun data exposed for adb/mdb macros. 298483Sjames.d.carlson@sun.com */ 308483Sjames.d.carlson@sun.com 310Sstevel@tonic-gate #ifndef _SPPPTUN_IMPL_H 320Sstevel@tonic-gate #define _SPPPTUN_IMPL_H 330Sstevel@tonic-gate 340Sstevel@tonic-gate #ifdef __cplusplus 350Sstevel@tonic-gate extern "C" { 360Sstevel@tonic-gate #endif 370Sstevel@tonic-gate 380Sstevel@tonic-gate /* For use with insque/remque (belongs in a system header!) */ 390Sstevel@tonic-gate struct qelem { 400Sstevel@tonic-gate struct qelem *q_forw; 410Sstevel@tonic-gate struct qelem *q_back; 420Sstevel@tonic-gate }; 430Sstevel@tonic-gate 440Sstevel@tonic-gate typedef struct tunll_s tunll_t; 450Sstevel@tonic-gate typedef struct tuncl_s tuncl_t; 460Sstevel@tonic-gate 470Sstevel@tonic-gate typedef struct { 480Sstevel@tonic-gate kstat_named_t lks_octrls; /* sent control messages */ 490Sstevel@tonic-gate kstat_named_t lks_octrl_drop; /* dropped control messages */ 500Sstevel@tonic-gate kstat_named_t lks_clients; /* number of clients (tcls) */ 510Sstevel@tonic-gate kstat_named_t lks_walks; /* PPPoE tcl walks */ 520Sstevel@tonic-gate kstat_named_t lks_in_nomatch; /* input without match */ 530Sstevel@tonic-gate kstat_named_t lks_indata; /* input data packets */ 540Sstevel@tonic-gate kstat_named_t lks_indata_drops; /* input data packet drops */ 550Sstevel@tonic-gate kstat_named_t lks_inctrls; /* input control packets */ 560Sstevel@tonic-gate kstat_named_t lks_inctrl_drops; /* input control pkt drops */ 570Sstevel@tonic-gate } tll_kstats_t; 580Sstevel@tonic-gate 590Sstevel@tonic-gate #define TLL_KSTATS_NAMES \ 600Sstevel@tonic-gate "octrls", "octrl_drop", "clients", "walks", "in_nomatch", \ 610Sstevel@tonic-gate "indata", "indata_drops", "inctrls", "inctrl_drops" 620Sstevel@tonic-gate 630Sstevel@tonic-gate typedef struct { 640Sstevel@tonic-gate kstat_named_t cks_octrls; /* sent control messages */ 650Sstevel@tonic-gate kstat_named_t cks_octrl_drop; /* dropped control messages */ 660Sstevel@tonic-gate kstat_named_t cks_octrl_spec; /* special control messages */ 670Sstevel@tonic-gate kstat_named_t cks_walks; /* PPPoE tcl walks */ 680Sstevel@tonic-gate kstat_named_t cks_inctrls; /* input control messages */ 690Sstevel@tonic-gate kstat_named_t cks_inctrl_drops; /* input control pkt drops */ 700Sstevel@tonic-gate } tcl_kstats_t; 710Sstevel@tonic-gate 720Sstevel@tonic-gate #define TCL_KSTATS_NAMES \ 730Sstevel@tonic-gate "octrls", "octrl_drop", "octrl_spec", "walks", "inctrls", \ 740Sstevel@tonic-gate "inctrl_drops" 750Sstevel@tonic-gate 760Sstevel@tonic-gate /* 770Sstevel@tonic-gate * Tunnel lower layer structure; module open; connects to output device. 780Sstevel@tonic-gate * 790Sstevel@tonic-gate * Note: tll_flags member carefully aligned to match with tcl_flags in 800Sstevel@tonic-gate * following structure so that we don't have to continually look at 810Sstevel@tonic-gate * q_next to determine context. Do not move these around. 820Sstevel@tonic-gate * 830Sstevel@tonic-gate * Note: this is also defined in uts/adb/common/tunll.dbg; if you change 840Sstevel@tonic-gate * this structure, don't forget to change the adb/mdb macro. 850Sstevel@tonic-gate */ 860Sstevel@tonic-gate struct tunll_s { 870Sstevel@tonic-gate uint32_t tll_flags; /* See TLLF_* below */ 880Sstevel@tonic-gate void *tll_next, *tll_prev; 890Sstevel@tonic-gate 900Sstevel@tonic-gate int tll_error; 910Sstevel@tonic-gate queue_t *tll_wq; /* Output data sent here */ 920Sstevel@tonic-gate tuncl_t *tll_defcl; /* Default client (daemon) */ 930Sstevel@tonic-gate ppptun_atype tll_lcladdr; /* Local address */ 940Sstevel@tonic-gate 950Sstevel@tonic-gate tuncl_t *tll_lastcl; /* Silly PPPoE optimization */ 960Sstevel@tonic-gate 970Sstevel@tonic-gate ppptun_lname tll_name; 980Sstevel@tonic-gate int tll_index; 990Sstevel@tonic-gate int tll_muxid; 1000Sstevel@tonic-gate int tll_style; /* Interface type; PTS_* */ 1010Sstevel@tonic-gate int tll_alen; /* Address length */ 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate int tll_msg_pending; 1040Sstevel@tonic-gate mblk_t *tll_msg_deferred; 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate mblk_t *tll_onclose; 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate tll_kstats_t tll_kstats; /* current statistics */ 1090Sstevel@tonic-gate kstat_t *tll_ksp; /* pointer to kstats allocation */ 110*9751Sjames.d.carlson@sun.com 111*9751Sjames.d.carlson@sun.com uint_t tll_sap; /* SAP for PPPoE */ 112*9751Sjames.d.carlson@sun.com 113*9751Sjames.d.carlson@sun.com zoneid_t tll_zoneid; 1140Sstevel@tonic-gate }; 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate /* 1170Sstevel@tonic-gate * Tunnel client structure; used for each device open. 1180Sstevel@tonic-gate * 1190Sstevel@tonic-gate * There is one of these for each PPP session plus (perhaps) one for 1200Sstevel@tonic-gate * each tunneling protocol server daemon. 1210Sstevel@tonic-gate * 1220Sstevel@tonic-gate * Note: this is also defined in uts/adb/common/tuncl.dbg; if you change 1230Sstevel@tonic-gate * this structure, don't forget to change the adb/mdb macro. 1240Sstevel@tonic-gate */ 1250Sstevel@tonic-gate struct tuncl_s { 1260Sstevel@tonic-gate uint32_t tcl_flags; /* TCLF_ flags below */ 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate tunll_t *tcl_data_tll; /* Pointer to data interface */ 1290Sstevel@tonic-gate tunll_t *tcl_ctrl_tll; /* Pointer to control */ 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate queue_t *tcl_rq; /* Received data sent here. */ 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate uint32_t tcl_seq; 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate uint32_t tcl_ctlval; /* Control distinguisher */ 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate uint_t tcl_style; /* Saved style */ 1380Sstevel@tonic-gate uint_t tcl_ltunid; /* Local Tunnel ID (L2F/L2TP) */ 1390Sstevel@tonic-gate uint_t tcl_rtunid; /* Remote Tunnel ID (L2F/L2TP) */ 1400Sstevel@tonic-gate uint_t tcl_lsessid; /* Local Session ID (minor node) */ 1410Sstevel@tonic-gate uint_t tcl_rsessid; /* Remote Session ID */ 1420Sstevel@tonic-gate ppptun_atype tcl_address; 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate int tcl_unit; /* PPP unit number (for debug) */ 1450Sstevel@tonic-gate struct pppstat64 tcl_stats; /* Standard PPP statistics */ 1460Sstevel@tonic-gate tcl_kstats_t tcl_kstats; /* current statistics */ 1470Sstevel@tonic-gate kstat_t *tcl_ksp; /* pointer to kstats allocation */ 148*9751Sjames.d.carlson@sun.com 149*9751Sjames.d.carlson@sun.com zoneid_t tcl_zoneid; 1500Sstevel@tonic-gate }; 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate #define TO_TLL(p) \ 1530Sstevel@tonic-gate ((tunll_t *)((caddr_t)(p) - offsetof(tunll_t, tll_next))) 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate #define TLLF_NOTLOWER 0x00000001 /* never set */ 1560Sstevel@tonic-gate #define TLLF_CLOSING 0x00000002 /* driver detach initiated */ 1570Sstevel@tonic-gate #define TLLF_CLOSE_DONE 0x00000004 /* detach sent; waiting */ 1580Sstevel@tonic-gate #define TLLF_SHUTDOWN_DONE 0x00000008 /* detach done */ 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate #define TCLF_ISCLIENT 0x00000001 /* always set */ 1610Sstevel@tonic-gate #define TCLF_FASTPATH 0x00000004 /* enable fast path recv */ 1620Sstevel@tonic-gate #define TCLF_DAEMON 0x00000010 /* server side; session 0 */ 1630Sstevel@tonic-gate #define TCLF_SPEER_DONE 0x00000020 /* SPEER ioctl done */ 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate #ifdef __cplusplus 1660Sstevel@tonic-gate } 1670Sstevel@tonic-gate #endif 1680Sstevel@tonic-gate 1690Sstevel@tonic-gate #endif /* _SPPPTUN_IMPL_H */ 170