10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * sppp.h - Solaris STREAMS PPP multiplexing pseudo-driver definitions 30Sstevel@tonic-gate * 4*9751Sjames.d.carlson@sun.com * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 50Sstevel@tonic-gate * Use is subject to license terms. 60Sstevel@tonic-gate * 70Sstevel@tonic-gate * Permission to use, copy, modify, and distribute this software and its 80Sstevel@tonic-gate * documentation is hereby granted, provided that the above copyright 90Sstevel@tonic-gate * notice appears in all copies. 100Sstevel@tonic-gate * 110Sstevel@tonic-gate * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF 120Sstevel@tonic-gate * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 130Sstevel@tonic-gate * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 140Sstevel@tonic-gate * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR 150Sstevel@tonic-gate * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR 160Sstevel@tonic-gate * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES 170Sstevel@tonic-gate * 180Sstevel@tonic-gate * Copyright (c) 1994 The Australian National University. 190Sstevel@tonic-gate * All rights reserved. 200Sstevel@tonic-gate * 210Sstevel@tonic-gate * Permission to use, copy, modify, and distribute this software and its 220Sstevel@tonic-gate * documentation is hereby granted, provided that the above copyright 230Sstevel@tonic-gate * notice appears in all copies. This software is provided without any 240Sstevel@tonic-gate * warranty, express or implied. The Australian National University 250Sstevel@tonic-gate * makes no representations about the suitability of this software for 260Sstevel@tonic-gate * any purpose. 270Sstevel@tonic-gate * 280Sstevel@tonic-gate * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY 290Sstevel@tonic-gate * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 300Sstevel@tonic-gate * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 310Sstevel@tonic-gate * THE AUSTRALIAN NATIONAL UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY 320Sstevel@tonic-gate * OF SUCH DAMAGE. 330Sstevel@tonic-gate * 340Sstevel@tonic-gate * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, 350Sstevel@tonic-gate * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 360Sstevel@tonic-gate * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 370Sstevel@tonic-gate * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO 380Sstevel@tonic-gate * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, 390Sstevel@tonic-gate * OR MODIFICATIONS. 400Sstevel@tonic-gate * 410Sstevel@tonic-gate * This driver is derived from the original SVR4 STREAMS PPP driver 420Sstevel@tonic-gate * originally written by Paul Mackerras <paul.mackerras@cs.anu.edu.au>. 430Sstevel@tonic-gate * 440Sstevel@tonic-gate * Adi Masputra <adi.masputra@sun.com> rewrote and restructured the code 450Sstevel@tonic-gate * for improved performance and scalability. 460Sstevel@tonic-gate * 470Sstevel@tonic-gate * $Id: sppp.h,v 1.0 2000/05/08 01:10:12 masputra Exp $ 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate 500Sstevel@tonic-gate #ifndef __SPPP_H 510Sstevel@tonic-gate #define __SPPP_H 520Sstevel@tonic-gate 530Sstevel@tonic-gate #include <sys/dlpi.h> 540Sstevel@tonic-gate #include <net/ppp_defs.h> 550Sstevel@tonic-gate 560Sstevel@tonic-gate #ifdef __cplusplus 570Sstevel@tonic-gate extern "C" { 580Sstevel@tonic-gate #endif 590Sstevel@tonic-gate 600Sstevel@tonic-gate #if !defined(ETHERTYPE_IP) 610Sstevel@tonic-gate #define ETHERTYPE_IP 0x800 620Sstevel@tonic-gate #endif 630Sstevel@tonic-gate 640Sstevel@tonic-gate #if !defined(ETHERTYPE_IPV6) 650Sstevel@tonic-gate #define ETHERTYPE_IPV6 0x86dd 660Sstevel@tonic-gate #endif 670Sstevel@tonic-gate 680Sstevel@tonic-gate #if !defined(ETHERTYPE_PPP) 690Sstevel@tonic-gate #define ETHERTYPE_PPP 0x880b 700Sstevel@tonic-gate #endif 710Sstevel@tonic-gate 720Sstevel@tonic-gate #if !defined(ETHERTYPE_ALLSAP) 730Sstevel@tonic-gate #define ETHERTYPE_ALLSAP 0 740Sstevel@tonic-gate #endif 750Sstevel@tonic-gate 760Sstevel@tonic-gate #if !defined(PPP_ALLSAP) 770Sstevel@tonic-gate #define PPP_ALLSAP PPP_ALLSTATIONS 780Sstevel@tonic-gate #endif 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* 810Sstevel@tonic-gate * DLPI handler (function table item). 820Sstevel@tonic-gate */ 830Sstevel@tonic-gate struct sppp_dlpi_pinfo_t { 840Sstevel@tonic-gate int pi_minlen; /* minimum primitive length */ 85*9751Sjames.d.carlson@sun.com int pi_state; /* acceptable starting state */ 860Sstevel@tonic-gate int (*pi_funcp)(); /* function() to call */ 870Sstevel@tonic-gate }; 880Sstevel@tonic-gate 890Sstevel@tonic-gate #ifndef DL_MAXPRIM 900Sstevel@tonic-gate #define DL_MAXPRIM DL_GET_STATISTICS_ACK 910Sstevel@tonic-gate #endif 920Sstevel@tonic-gate 930Sstevel@tonic-gate /* 940Sstevel@tonic-gate * Per-attachment kstats. 950Sstevel@tonic-gate */ 960Sstevel@tonic-gate typedef struct sppp_kstats { 970Sstevel@tonic-gate kstat_named_t allocbfail; 980Sstevel@tonic-gate kstat_named_t rbytes; 990Sstevel@tonic-gate kstat_named_t ierrors; 1000Sstevel@tonic-gate kstat_named_t ierrors_lower; 1010Sstevel@tonic-gate kstat_named_t ioctlsfwd; 1020Sstevel@tonic-gate kstat_named_t ioctlsfwdok; 1030Sstevel@tonic-gate kstat_named_t ioctlsfwderr; 1040Sstevel@tonic-gate kstat_named_t ipackets; 1050Sstevel@tonic-gate kstat_named_t ipackets_ctl; 1060Sstevel@tonic-gate kstat_named_t iqdropped; 1070Sstevel@tonic-gate kstat_named_t irunts; 1080Sstevel@tonic-gate kstat_named_t itoolongs; 1090Sstevel@tonic-gate kstat_named_t lsneedup; 1100Sstevel@tonic-gate kstat_named_t lsdown; 1110Sstevel@tonic-gate kstat_named_t mctlsfwd; 1120Sstevel@tonic-gate kstat_named_t mctlsfwderr; 1130Sstevel@tonic-gate kstat_named_t mctlsknown; 1140Sstevel@tonic-gate kstat_named_t mctlsunknown; 1150Sstevel@tonic-gate kstat_named_t obytes; 1160Sstevel@tonic-gate kstat_named_t oerrors; 1170Sstevel@tonic-gate kstat_named_t oerrors_lower; 1180Sstevel@tonic-gate kstat_named_t opackets; 1190Sstevel@tonic-gate kstat_named_t opackets_ctl; 1200Sstevel@tonic-gate kstat_named_t oqdropped; 1210Sstevel@tonic-gate kstat_named_t otoolongs; 1220Sstevel@tonic-gate kstat_named_t orunts; 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* 64 bit entries */ 1250Sstevel@tonic-gate kstat_named_t ipackets64; 1260Sstevel@tonic-gate kstat_named_t opackets64; 1270Sstevel@tonic-gate kstat_named_t rbytes64; 1280Sstevel@tonic-gate kstat_named_t obytes64; 1290Sstevel@tonic-gate } sppp_kstats_t; 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate /* 1320Sstevel@tonic-gate * Same order as above. Note that for netstat -i to work, there needs 1330Sstevel@tonic-gate * to be "ipackets", "opackets", "ierrors", and "oerrors" kstat named 1340Sstevel@tonic-gate * variables. 1350Sstevel@tonic-gate */ 1360Sstevel@tonic-gate #define SPPP_KSTATS_NAMES \ 1370Sstevel@tonic-gate "allocbfail", "rbytes", "ierrors", "ierrors_lower", "ioctlsfwd", \ 1380Sstevel@tonic-gate "ioctlsfwdok", "ioctlsfwderr", "ipackets", "ipkts_ctl", \ 1390Sstevel@tonic-gate "ipkts_qdropped", "ipkts_runts", "ipkts_toolong", "lsneedup", \ 1400Sstevel@tonic-gate "lsdown", "mctlsfwd", "mctlsfwderr", "mctlsknown", "mctlsunknown", \ 1410Sstevel@tonic-gate "obytes", "oerrors", "oerrors_lower", "opackets", "opkts_ctl", \ 1420Sstevel@tonic-gate "opkts_qdropped", "opkts_toolong", "opkts_runts" 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate #define SPPP_KSTATS64_NAMES \ 1450Sstevel@tonic-gate "ipackets64", "opackets64", "rbytes64", "obytes64" 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate /* 1480Sstevel@tonic-gate * dl_addr_length needs to be equal to the absolute value of dl_sap_length, 1490Sstevel@tonic-gate * in order for IP to derive a default setting for IFF_POINTOPOINT flag. 1500Sstevel@tonic-gate */ 1510Sstevel@tonic-gate typedef t_uscalar_t spppreqsap_t; 1520Sstevel@tonic-gate #define SPPP_SAPL sizeof (spppreqsap_t) 1530Sstevel@tonic-gate #define SPPP_ADDRL SPPP_SAPL 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate /* 1560Sstevel@tonic-gate * Per-Stream instance state information. 1570Sstevel@tonic-gate * 1580Sstevel@tonic-gate * Each instance is dynamically allocated at open() and free'd at close(). 1590Sstevel@tonic-gate * Each per-Stream instance points to at most one per-attachment structure 1600Sstevel@tonic-gate * using the sps_ppa field. All instances are threaded together into one 1610Sstevel@tonic-gate * list of active instances ordered on minor device number, using the 1620Sstevel@tonic-gate * sps_nextmn field. 1630Sstevel@tonic-gate */ 1640Sstevel@tonic-gate typedef struct spppstr { 1650Sstevel@tonic-gate /* 1660Sstevel@tonic-gate * Note that EX_st_nextmn field should never be referenced other 1670Sstevel@tonic-gate * than by the routines manipulating the global upper streams list, 1680Sstevel@tonic-gate * by first obtaining exclusive access at the outer perimeter. 1690Sstevel@tonic-gate */ 1700Sstevel@tonic-gate struct spppstr *sps_nextmn; /* next minor in global list */ 1710Sstevel@tonic-gate /* 1720Sstevel@tonic-gate * These fields are common to all upper streams. If this stream 1730Sstevel@tonic-gate * is attached to a ppa, then the sps_ppa field will point to the 1740Sstevel@tonic-gate * ppa structure associated with this particular upper stream. 1750Sstevel@tonic-gate */ 1760Sstevel@tonic-gate minor_t sps_mn_id; /* minor device number of this stream */ 1770Sstevel@tonic-gate queue_t *sps_rq; /* pointer to the read queue */ 1780Sstevel@tonic-gate uint32_t sps_flags; /* miscellaneous flags */ 1790Sstevel@tonic-gate uint32_t sps_ioc_id; /* last ioctl ID for this stream */ 1800Sstevel@tonic-gate struct sppa *sps_ppa; /* pointer to ppa structure */ 1810Sstevel@tonic-gate /* 1820Sstevel@tonic-gate * sps_nextsib is protected by the ppa's sibling lock (ppa_sib_lock), 1830Sstevel@tonic-gate * and access made to it should only be done by first ensuring that 1840Sstevel@tonic-gate * the sps_ppa field is valid, i.e., this stream has been attached. 1850Sstevel@tonic-gate */ 1860Sstevel@tonic-gate struct spppstr *sps_nextsib; /* next stream of same ppa (sibling) */ 1870Sstevel@tonic-gate /* 1880Sstevel@tonic-gate * These fields are common to all non-control streams, i.e., those 1890Sstevel@tonic-gate * in which a PPPIO_NEWPPA has not been issued on. Non-control 1900Sstevel@tonic-gate * streams are valid candidates for network streams, and they can 1910Sstevel@tonic-gate * only be considered network streams (ones which carry IP packets) 1920Sstevel@tonic-gate * if they are attached and bound. The only mandatory requirement 1930Sstevel@tonic-gate * for control stream is that its sps_npmode field should always 1940Sstevel@tonic-gate * be equal to NPMODE_PASS, as we obviously will never block the 1950Sstevel@tonic-gate * control stream from sending or receiving packets. 1960Sstevel@tonic-gate */ 1970Sstevel@tonic-gate t_scalar_t sps_sap; /* bound sap */ 1980Sstevel@tonic-gate spppreqsap_t sps_req_sap; /* requested sap */ 1990Sstevel@tonic-gate enum NPmode sps_npmode; /* network protocol mode */ 2000Sstevel@tonic-gate /* 2010Sstevel@tonic-gate * sps_dlstate is only valid for network streams in which DLPI 2020Sstevel@tonic-gate * is intended to be used to transfer network-layer data. It is set 2030Sstevel@tonic-gate * to DL_UNATTACHED for all other streams. 2040Sstevel@tonic-gate */ 2050Sstevel@tonic-gate t_uscalar_t sps_dlstate; /* current DLPI state */ 2060Sstevel@tonic-gate mblk_t *sps_hangup; /* preallocated M_HANGUP message */ 207*9751Sjames.d.carlson@sun.com 208*9751Sjames.d.carlson@sun.com zoneid_t sps_zoneid; /* zone in which we were opened */ 2090Sstevel@tonic-gate } spppstr_t; 2100Sstevel@tonic-gate 2110Sstevel@tonic-gate /* 2120Sstevel@tonic-gate * Values for sps_flags, and their descriptions. 2130Sstevel@tonic-gate */ 2140Sstevel@tonic-gate /* 0x00000001 unused */ 2150Sstevel@tonic-gate #define SPS_CONTROL 0x00000002 /* stream is a control stream */ 2160Sstevel@tonic-gate #define SPS_FASTPATH 0x00000004 /* stream uses IP fastpath */ 2170Sstevel@tonic-gate #define SPS_PROMISC 0x00000008 /* stream is promiscuous */ 2180Sstevel@tonic-gate #define SPS_RAWDATA 0x00000010 /* raw M_DATA, no DLPI header */ 2190Sstevel@tonic-gate #define SPS_PIOATTACH 0x00000020 /* attached using PPPIO_ATTACH */ 2200Sstevel@tonic-gate #define SPS_KDEBUG 0x00000040 /* stream has kdebug turned on */ 2210Sstevel@tonic-gate #define SPS_CACHED 0x00000080 /* network stream pointer is cached */ 2227643Sanil.udupa@sun.com #define SPS_IOCQ 0x00000100 /* queue ioctls */ 2230Sstevel@tonic-gate 2240Sstevel@tonic-gate #define IS_SPS_CONTROL(x) \ 2250Sstevel@tonic-gate ((x)->sps_flags & SPS_CONTROL) 2260Sstevel@tonic-gate #define IS_SPS_FASTPATH(x) \ 2270Sstevel@tonic-gate ((x)->sps_flags & SPS_FASTPATH) 2280Sstevel@tonic-gate #define IS_SPS_PROMISC(x) \ 2290Sstevel@tonic-gate ((x)->sps_flags & SPS_PROMISC) 2300Sstevel@tonic-gate #define IS_SPS_RAWDATA(x) \ 2310Sstevel@tonic-gate ((x)->sps_flags & SPS_RAWDATA) 2320Sstevel@tonic-gate #define IS_SPS_PIOATTACH(x) \ 2330Sstevel@tonic-gate ((x)->sps_flags & SPS_PIOATTACH) 2340Sstevel@tonic-gate #define IS_SPS_KDEBUG(x) \ 2350Sstevel@tonic-gate ((x)->sps_flags & SPS_KDEBUG) 2360Sstevel@tonic-gate #define IS_SPS_CACHED(x) \ 2370Sstevel@tonic-gate ((x)->sps_flags & SPS_CACHED) 2387643Sanil.udupa@sun.com #define IS_SPS_IOCQ(x) \ 2397643Sanil.udupa@sun.com ((x)->sps_flags & SPS_IOCQ) 2400Sstevel@tonic-gate 2410Sstevel@tonic-gate /* 2420Sstevel@tonic-gate * Bit format (octal based) string for cmn_err, which represents the flags. 2430Sstevel@tonic-gate */ 2440Sstevel@tonic-gate #define SPS_FLAGS_STR \ 2450Sstevel@tonic-gate "\020" \ 2460Sstevel@tonic-gate "\1priv" \ 2470Sstevel@tonic-gate "\2control" \ 2480Sstevel@tonic-gate "\3fastpath" \ 2490Sstevel@tonic-gate "\4promisc" \ 2500Sstevel@tonic-gate "\5rawdata" \ 2510Sstevel@tonic-gate "\6pioattach" \ 2520Sstevel@tonic-gate "\7kdebug" \ 2530Sstevel@tonic-gate "\10cached" 2540Sstevel@tonic-gate 2550Sstevel@tonic-gate /* 2560Sstevel@tonic-gate * Per-Attachment instance state information. 2570Sstevel@tonic-gate * 2580Sstevel@tonic-gate * Each instance is dynamically allocated on first attach (PPPIO_NEWPPA). 2590Sstevel@tonic-gate * Allocation of this structure is only done once per control stream. A ppa 2600Sstevel@tonic-gate * instance may be shared by two or more upper streams, and it is always 2610Sstevel@tonic-gate * linked to the upper stream marked as the control stream (SPS_CONTROL) 2620Sstevel@tonic-gate * via the ppa_ctl field. Non-control streams are linked to ppa_streams. 2630Sstevel@tonic-gate */ 2640Sstevel@tonic-gate typedef struct sppa { 2650Sstevel@tonic-gate /* 2660Sstevel@tonic-gate * Note that EX_st_nextppa field should only be accessed (walked) 2670Sstevel@tonic-gate * by the ppa manipulation routines, i.e, those which affect 2680Sstevel@tonic-gate * the global ppa list, e.g: open, close, new_ppa, and XX_attach_upper. 2690Sstevel@tonic-gate */ 2700Sstevel@tonic-gate struct sppa *ppa_nextppa; /* next attachment instance */ 2710Sstevel@tonic-gate /* 2720Sstevel@tonic-gate * ppa_sib_lock guards the linkages between all upper streams related 2730Sstevel@tonic-gate * to this ppa. Walking the sps_nextsib of any upper streams should 2740Sstevel@tonic-gate * be done by first holding this lock. 2750Sstevel@tonic-gate */ 2760Sstevel@tonic-gate krwlock_t ppa_sib_lock; /* lock for sibling upper streams */ 2770Sstevel@tonic-gate uint32_t ppa_flags; /* miscellaneous flags */ 2780Sstevel@tonic-gate int32_t ppa_refcnt; /* upper stream reference count */ 2790Sstevel@tonic-gate uint32_t ppa_ppa_id; /* unique attachment id */ 2800Sstevel@tonic-gate spppstr_t *ppa_streams; /* list of all non-control streams */ 2810Sstevel@tonic-gate spppstr_t *ppa_ctl; /* back pointer to control stream */ 2820Sstevel@tonic-gate queue_t *ppa_lower_wq; /* pointer to lower write queue */ 2830Sstevel@tonic-gate uint16_t ppa_mru; /* link layer maximum receive unit */ 2840Sstevel@tonic-gate uint16_t ppa_mtu; /* link layer maximum transmit unit */ 2850Sstevel@tonic-gate hrtime_t ppa_lasttx; /* last transmit time for a packet */ 2860Sstevel@tonic-gate hrtime_t ppa_lastrx; /* last receive time for a packet */ 2870Sstevel@tonic-gate int32_t ppa_promicnt; /* promiscous stream count */ 2880Sstevel@tonic-gate /* 2890Sstevel@tonic-gate * ppa_sta_lock mutex guards the statistic fields of this ppa, since 2900Sstevel@tonic-gate * this structure is shared by upper streams of the same ppa. 2910Sstevel@tonic-gate */ 2920Sstevel@tonic-gate kmutex_t ppa_sta_lock; /* mutex to lock structure */ 2930Sstevel@tonic-gate struct ppp_stats64 ppa_stats; /* legacy stats structure */ 2940Sstevel@tonic-gate uint32_t ppa_allocbfail; /* memory allocation failure count */ 2950Sstevel@tonic-gate uint32_t ppa_ierr_low; /* errors from below during receive */ 2960Sstevel@tonic-gate uint32_t ppa_ioctlsfwd; /* total ioctl forwarded down */ 2970Sstevel@tonic-gate uint32_t ppa_ioctlsfwdok; /* and the reply sent upward */ 2980Sstevel@tonic-gate uint32_t ppa_ioctlsfwderr; /* or discarded replies */ 2990Sstevel@tonic-gate uint32_t ppa_ipkt_ctl; /* received control pkts */ 3000Sstevel@tonic-gate uint32_t ppa_iqdropped; /* msg dropped due to putq error */ 3010Sstevel@tonic-gate uint32_t ppa_irunts; /* packet rcvd is too short */ 3020Sstevel@tonic-gate uint32_t ppa_itoolongs; /* packet rcvd is larger than MRU */ 3030Sstevel@tonic-gate uint32_t ppa_lsneedup; /* total LINKSTAT_NEEDUP msg sent up */ 3040Sstevel@tonic-gate uint32_t ppa_lsdown; /* total LINKSTAT_DOWN msg sent up */ 3050Sstevel@tonic-gate uint32_t ppa_mctlsfwd; /* total M_{PC}PROTO forwarded down */ 3060Sstevel@tonic-gate uint32_t ppa_mctlsfwderr; /* and discarded count */ 3070Sstevel@tonic-gate uint32_t ppa_mctlsknown; /* total known M_CTL messages */ 3080Sstevel@tonic-gate uint32_t ppa_mctlsunknown; /* total unknown M_CTL messages */ 3090Sstevel@tonic-gate uint32_t ppa_oerr_low; /* errors from below during transmit */ 3100Sstevel@tonic-gate uint32_t ppa_opkt_ctl; /* transmitted control pkts */ 3110Sstevel@tonic-gate uint32_t ppa_oqdropped; /* msg dropped due to putq error */ 3120Sstevel@tonic-gate uint32_t ppa_orunts; /* packet sent is too short */ 3130Sstevel@tonic-gate uint32_t ppa_otoolongs; /* packet sent is larger than MTU */ 3140Sstevel@tonic-gate kstat_t *ppa_kstats; /* pointer to kstats structure */ 3150Sstevel@tonic-gate /* 3160Sstevel@tonic-gate * We keep the following pointers for performance reasons. Instead 3170Sstevel@tonic-gate * of walking the list of attached upper streams to find the 3180Sstevel@tonic-gate * destination upper stream everytime we need to send a packet up, 3190Sstevel@tonic-gate * we keep them here for easy access. 3200Sstevel@tonic-gate */ 3210Sstevel@tonic-gate spppstr_t *ppa_ip_cache; /* ptr to PPP_IP upper stream */ 3220Sstevel@tonic-gate spppstr_t *ppa_ip6_cache; /* ptr to PPP_IPV6 upper stream */ 3230Sstevel@tonic-gate 3240Sstevel@tonic-gate kmutex_t ppa_npmutex; /* protects the 2 fields below */ 3250Sstevel@tonic-gate uint32_t ppa_npflag; /* network protocols blocked */ 3260Sstevel@tonic-gate uint32_t ppa_holdpkts[3]; /* # of packets blocked per np */ 327*9751Sjames.d.carlson@sun.com 328*9751Sjames.d.carlson@sun.com zoneid_t ppa_zoneid; /* zone where PPA is in use */ 3290Sstevel@tonic-gate } sppa_t; 3300Sstevel@tonic-gate 3310Sstevel@tonic-gate /* bit position (in ppa_npflag) for each ppp_protocol that can be blocked */ 3320Sstevel@tonic-gate #define NP_IP 1 3330Sstevel@tonic-gate #define NP_IPV6 2 3340Sstevel@tonic-gate 3350Sstevel@tonic-gate /* 3360Sstevel@tonic-gate * Values for ppa_flags, and their descriptions. 3370Sstevel@tonic-gate */ 3380Sstevel@tonic-gate #define PPA_LASTMOD 0x00000001 /* last PPP entity on the stream */ 3390Sstevel@tonic-gate #define PPA_TIMESTAMP 0x00000002 /* time-stamp each packet */ 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate #define IS_PPA_LASTMOD(x) \ 3420Sstevel@tonic-gate ((x)->ppa_flags & PPA_LASTMOD) 3430Sstevel@tonic-gate #define IS_PPA_TIMESTAMP(x) \ 3440Sstevel@tonic-gate ((x)->ppa_flags & PPA_TIMESTAMP) 3450Sstevel@tonic-gate 3460Sstevel@tonic-gate /* 3470Sstevel@tonic-gate * Bit format (octal based) string for cmn_err, which represents the flags. 3480Sstevel@tonic-gate */ 3490Sstevel@tonic-gate #define PPA_FLAGS_STR \ 3500Sstevel@tonic-gate "\020" \ 3510Sstevel@tonic-gate "\1lastmod" \ 3520Sstevel@tonic-gate "\2timestamp" 3530Sstevel@tonic-gate 3540Sstevel@tonic-gate /* 3550Sstevel@tonic-gate * General macros. 3560Sstevel@tonic-gate */ 3570Sstevel@tonic-gate #define SPDEBUG printf 3580Sstevel@tonic-gate 3590Sstevel@tonic-gate /* 3600Sstevel@tonic-gate * Function declarations. 3610Sstevel@tonic-gate */ 3620Sstevel@tonic-gate extern int sppp_close(queue_t *); 3630Sstevel@tonic-gate extern mblk_t *sppp_dladdud(spppstr_t *, mblk_t *, t_scalar_t, boolean_t); 3640Sstevel@tonic-gate extern void sppp_dlpi_pinfoinit(void); 3650Sstevel@tonic-gate extern void sppp_dlprsendup(spppstr_t *, mblk_t *, t_scalar_t, boolean_t); 3665640Scarlsonj extern void sppp_lrput(queue_t *, mblk_t *); 367*9751Sjames.d.carlson@sun.com extern void sppp_lrsrv(queue_t *); 3685640Scarlsonj extern void sppp_lwsrv(queue_t *); 3690Sstevel@tonic-gate extern int sppp_mproto(queue_t *, mblk_t *, spppstr_t *); 3700Sstevel@tonic-gate extern int sppp_open(queue_t *, dev_t *, int, int, cred_t *); 3715640Scarlsonj extern void sppp_uwput(queue_t *, mblk_t *); 3725640Scarlsonj extern void sppp_uwsrv(queue_t *); 3730Sstevel@tonic-gate extern void sppp_remove_ppa(spppstr_t *sps); 3740Sstevel@tonic-gate extern sppa_t *sppp_find_ppa(uint32_t ppa_id); 375*9751Sjames.d.carlson@sun.com extern sppa_t *sppp_create_ppa(uint32_t ppa_id, zoneid_t zoneid); 3760Sstevel@tonic-gate 3770Sstevel@tonic-gate #ifdef __cplusplus 3780Sstevel@tonic-gate } 3790Sstevel@tonic-gate #endif 3800Sstevel@tonic-gate 3810Sstevel@tonic-gate #endif /* __SPPP_H */ 382