1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * llc1 - an LLC Class 1 MUX compatible with SunConnect LLC2 uses DLPI 24*7c478bd9Sstevel@tonic-gate * interface. 25*7c478bd9Sstevel@tonic-gate * 26*7c478bd9Sstevel@tonic-gate * Copyrighted as an unpublished work. 27*7c478bd9Sstevel@tonic-gate * Copyright 1992-2002 Sun Microsystems, Inc. All rights reserved. 28*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 29*7c478bd9Sstevel@tonic-gate */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifndef _SYS_LLC1_H 32*7c478bd9Sstevel@tonic-gate #define _SYS_LLC1_H 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 37*7c478bd9Sstevel@tonic-gate extern "C" { 38*7c478bd9Sstevel@tonic-gate #endif 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate struct llc_stats { 41*7c478bd9Sstevel@tonic-gate long llcs_nobuffer; 42*7c478bd9Sstevel@tonic-gate long llcs_multixmt; 43*7c478bd9Sstevel@tonic-gate long llcs_multircv; /* multicast but note broadcast */ 44*7c478bd9Sstevel@tonic-gate long llcs_brdcstxmt; 45*7c478bd9Sstevel@tonic-gate long llcs_brdcstrcv; 46*7c478bd9Sstevel@tonic-gate long llcs_blocked; /* discard due to upstream being flow */ 47*7c478bd9Sstevel@tonic-gate /* controlled */ 48*7c478bd9Sstevel@tonic-gate long llcs_pktxmt; 49*7c478bd9Sstevel@tonic-gate long llcs_pktrcv; 50*7c478bd9Sstevel@tonic-gate long llcs_bytexmt; 51*7c478bd9Sstevel@tonic-gate long llcs_bytercv; 52*7c478bd9Sstevel@tonic-gate long llcs_xidxmt; 53*7c478bd9Sstevel@tonic-gate long llcs_xidrcv; 54*7c478bd9Sstevel@tonic-gate long llcs_testxmt; 55*7c478bd9Sstevel@tonic-gate long llcs_testrcv; 56*7c478bd9Sstevel@tonic-gate long llcs_ierrors; 57*7c478bd9Sstevel@tonic-gate long llcs_oerrors; 58*7c478bd9Sstevel@tonic-gate }; 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate #define LLCS_NOBUFFER 0 61*7c478bd9Sstevel@tonic-gate #define LLCS_MULTIXMT 1 62*7c478bd9Sstevel@tonic-gate #define LLCS_MULTIRCV 2 63*7c478bd9Sstevel@tonic-gate #define LLCS_BRDCSTXMT 3 64*7c478bd9Sstevel@tonic-gate #define LLCS_BRDCSTRCV 4 65*7c478bd9Sstevel@tonic-gate #define LLCS_BLOCKED 5 66*7c478bd9Sstevel@tonic-gate #define LLCS_PKTXMT 6 67*7c478bd9Sstevel@tonic-gate #define LLCS_PKTRCV 7 68*7c478bd9Sstevel@tonic-gate #define LLCS_BYTEXMT 8 69*7c478bd9Sstevel@tonic-gate #define LLCS_BYTERCV 9 70*7c478bd9Sstevel@tonic-gate #define LLCS_XIDXMT 10 71*7c478bd9Sstevel@tonic-gate #define LLCS_XIDRCV 11 72*7c478bd9Sstevel@tonic-gate #define LLCS_TESTXMT 12 73*7c478bd9Sstevel@tonic-gate #define LLCS_TESTRCV 13 74*7c478bd9Sstevel@tonic-gate #define LLCS_IERRORS 14 75*7c478bd9Sstevel@tonic-gate #define LLCS_OERRORS 15 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* multicast structures */ 78*7c478bd9Sstevel@tonic-gate typedef struct llc1_multicast_addr { 79*7c478bd9Sstevel@tonic-gate int llcm_refcnt; /* number of streams referring to */ 80*7c478bd9Sstevel@tonic-gate /* entry */ 81*7c478bd9Sstevel@tonic-gate unsigned char llcm_addr[ETHERADDRL]; 82*7c478bd9Sstevel@tonic-gate } llc_mcast_t; 83*7c478bd9Sstevel@tonic-gate #define LLC1_MAX_MULTICAST 16 /* default max multicast table size */ 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate typedef 86*7c478bd9Sstevel@tonic-gate struct llc_mac_info { 87*7c478bd9Sstevel@tonic-gate struct llc_mac_info *llcp_next, *llcp_prev; 88*7c478bd9Sstevel@tonic-gate long llcp_flags; 89*7c478bd9Sstevel@tonic-gate long llcp_maxpkt; 90*7c478bd9Sstevel@tonic-gate long llcp_minpkt; 91*7c478bd9Sstevel@tonic-gate long llcp_type; 92*7c478bd9Sstevel@tonic-gate long llcp_addrlen; /* usually 6 but could be 2 */ 93*7c478bd9Sstevel@tonic-gate unsigned char llcp_macaddr[ETHERADDRL]; 94*7c478bd9Sstevel@tonic-gate unsigned char llcp_broadcast[ETHERADDRL]; 95*7c478bd9Sstevel@tonic-gate queue_t *llcp_queue; /* queue to MAC device */ 96*7c478bd9Sstevel@tonic-gate long llcp_lindex; /* link index for unlink */ 97*7c478bd9Sstevel@tonic-gate long llcp_ppa; /* the PPA number */ 98*7c478bd9Sstevel@tonic-gate long llcp_sap; /* when doing auto bind on lower */ 99*7c478bd9Sstevel@tonic-gate /* stream */ 100*7c478bd9Sstevel@tonic-gate mblk_t *llcp_data; /* temporarily hold data */ 101*7c478bd9Sstevel@tonic-gate queue_t *llcp_lqtop; /* queue for ioctls */ 102*7c478bd9Sstevel@tonic-gate mblk_t *llcp_mb; 103*7c478bd9Sstevel@tonic-gate long llcp_nstreams; 104*7c478bd9Sstevel@tonic-gate llc_mcast_t *llcp_mcast; /* per device multicast table */ 105*7c478bd9Sstevel@tonic-gate struct llc_stats llcp_stats; 106*7c478bd9Sstevel@tonic-gate kstat_t *llcp_kstatp; 107*7c478bd9Sstevel@tonic-gate uint_t llcp_iocid; /* outstanding ioc_id */ 108*7c478bd9Sstevel@tonic-gate } llc_mac_info_t; 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate /* flags for mac info (link) status */ 111*7c478bd9Sstevel@tonic-gate #define LLC1_LINKED 0x0001 /* there is a stream linked but not ready */ 112*7c478bd9Sstevel@tonic-gate #define LLC1_AVAILABLE 0x0002 /* linked stream is now ready */ 113*7c478bd9Sstevel@tonic-gate #define LLC1_INFO_WAIT 0x0004 /* waiting on info_ack */ 114*7c478bd9Sstevel@tonic-gate #define LLC1_DEF_PPA 0x0008 /* default (system assigned PPA) */ 115*7c478bd9Sstevel@tonic-gate #define LLC1_RAW_WAIT 0x0010 /* waiting for DLIOCRAW to happen */ 116*7c478bd9Sstevel@tonic-gate #define LLC1_USING_RAW 0x0020 /* lower driver is using DLIOCRAW mode */ 117*7c478bd9Sstevel@tonic-gate #define LLC1_AUTO_XID 0x0040 /* automatically respond to XID */ 118*7c478bd9Sstevel@tonic-gate #define LLC1_AUTO_TEST 0x0080 /* automatically respond to TEST */ 119*7c478bd9Sstevel@tonic-gate #define LLC1_BINDING 0x0100 /* autmatically binding the lower stream */ 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate typedef struct llc1 { 122*7c478bd9Sstevel@tonic-gate struct llc1 *llc_next, *llc_prev; 123*7c478bd9Sstevel@tonic-gate mblk_t *llc_mb; 124*7c478bd9Sstevel@tonic-gate long llc_state; 125*7c478bd9Sstevel@tonic-gate long llc_style; 126*7c478bd9Sstevel@tonic-gate long llc_minor; 127*7c478bd9Sstevel@tonic-gate long llc_type; 128*7c478bd9Sstevel@tonic-gate long llc_sap; 129*7c478bd9Sstevel@tonic-gate uchar_t llc_snap[5]; /* SNAP header */ 130*7c478bd9Sstevel@tonic-gate long llc_waiting_for; /* DL request to lower layer */ 131*7c478bd9Sstevel@tonic-gate long llc_flags; /* flags used for controlling things */ 132*7c478bd9Sstevel@tonic-gate long llc_multicnt; /* number of multicast addresses for */ 133*7c478bd9Sstevel@tonic-gate /* stream */ 134*7c478bd9Sstevel@tonic-gate llc_mcast_t **llc_mcast; /* multicast table if multicast is */ 135*7c478bd9Sstevel@tonic-gate /* enabled */ 136*7c478bd9Sstevel@tonic-gate queue_t *llc_qptr; 137*7c478bd9Sstevel@tonic-gate kmutex_t llc_lock; 138*7c478bd9Sstevel@tonic-gate struct llc_mac_info *llc_mac_info; 139*7c478bd9Sstevel@tonic-gate struct llc_stats *llc_stats; 140*7c478bd9Sstevel@tonic-gate } llc1_t; 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate /* llc_flag bits */ 143*7c478bd9Sstevel@tonic-gate #define LLC_RAW 0x0001 /* lower stream is in RAW mode */ 144*7c478bd9Sstevel@tonic-gate #define LLC_FAST 0x0002 /* use "fast" path */ 145*7c478bd9Sstevel@tonic-gate #define LLC_PROM 0x0004 /* stream is in physical promiscuous mode */ 146*7c478bd9Sstevel@tonic-gate #define LLC_SNAP 0x0008 /* stream is using SNAP header */ 147*7c478bd9Sstevel@tonic-gate #define LLC_SNAP_OID 0x0010 /* stream is SNAP, OID is defined */ 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate typedef struct llc1device { 151*7c478bd9Sstevel@tonic-gate long llc1_status; 152*7c478bd9Sstevel@tonic-gate krwlock_t llc1_rwlock; /* used to serialize read/write locks */ 153*7c478bd9Sstevel@tonic-gate int llc1_minors; 154*7c478bd9Sstevel@tonic-gate int llc1_multisize; 155*7c478bd9Sstevel@tonic-gate llc_mac_info_t *llc1_mac_next, *llc1_mac_prev; /* the various mac */ 156*7c478bd9Sstevel@tonic-gate /* layers */ 157*7c478bd9Sstevel@tonic-gate int llc1_ndevice; /* number of devices linked */ 158*7c478bd9Sstevel@tonic-gate int llc1_nextppa; /* number to use for next PPA default */ 159*7c478bd9Sstevel@tonic-gate llc1_t *llc1_str_next, *llc1_str_prev; /* open streams */ 160*7c478bd9Sstevel@tonic-gate } llc1dev_t; 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate #define LLC1_ATTACHED 0x0001 /* board is attached so mutexes are */ 163*7c478bd9Sstevel@tonic-gate /* initialized */ 164*7c478bd9Sstevel@tonic-gate 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate /* 167*7c478bd9Sstevel@tonic-gate * definitions for debug tracing 168*7c478bd9Sstevel@tonic-gate */ 169*7c478bd9Sstevel@tonic-gate #define LLCTRACE 0x0001 /* basic procedure level tracing */ 170*7c478bd9Sstevel@tonic-gate #define LLCERRS 0x0002 /* trace errors */ 171*7c478bd9Sstevel@tonic-gate #define LLCRECV 0x0004 /* trace receive path */ 172*7c478bd9Sstevel@tonic-gate #define LLCSEND 0x0008 /* trace send path */ 173*7c478bd9Sstevel@tonic-gate #define LLCPROT 0x0010 /* trace DLPI protocol */ 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate /* 176*7c478bd9Sstevel@tonic-gate * other definitions 177*7c478bd9Sstevel@tonic-gate */ 178*7c478bd9Sstevel@tonic-gate #define LLCE_OK -1 /* internal procedure status is OK */ 179*7c478bd9Sstevel@tonic-gate #define LLCE_NOBUFFER 0x1001 /* couldn't allocate a buffer */ 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate /* 183*7c478bd9Sstevel@tonic-gate * definitions for module_info 184*7c478bd9Sstevel@tonic-gate */ 185*7c478bd9Sstevel@tonic-gate #define LLC1IDNUM 0x8022 186*7c478bd9Sstevel@tonic-gate #define LLC1_HIWATER 32000 /* high water mark for flow control */ 187*7c478bd9Sstevel@tonic-gate #define LLC1_LOWATER 4096 /* low water mark for flow control */ 188*7c478bd9Sstevel@tonic-gate #define LLC1_DEFMAX 4096 /* default max packet size */ 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate /* address format for unitdata */ 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate struct llcaddr { 193*7c478bd9Sstevel@tonic-gate unsigned char llca_addr[ETHERADDRL]; 194*7c478bd9Sstevel@tonic-gate unsigned char llca_sap; 195*7c478bd9Sstevel@tonic-gate }; 196*7c478bd9Sstevel@tonic-gate #define LLCADDR(p, offset) ((struct llcaddr *)(((caddr_t)(p))+(offset))) 197*7c478bd9Sstevel@tonic-gate 198*7c478bd9Sstevel@tonic-gate struct llcsaddr { 199*7c478bd9Sstevel@tonic-gate unsigned char llca_saddr[ETHERADDRL]; 200*7c478bd9Sstevel@tonic-gate unsigned short llca_ssap; 201*7c478bd9Sstevel@tonic-gate }; 202*7c478bd9Sstevel@tonic-gate #define LLCSADDR(p, offset) ((struct llcsaddr *)(((caddr_t)(p))+(offset))) 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate /* 205*7c478bd9Sstevel@tonic-gate * 802.2 specific declarations 206*7c478bd9Sstevel@tonic-gate */ 207*7c478bd9Sstevel@tonic-gate struct llchdr { 208*7c478bd9Sstevel@tonic-gate unsigned char llc_dsap; 209*7c478bd9Sstevel@tonic-gate unsigned char llc_ssap; 210*7c478bd9Sstevel@tonic-gate unsigned char llc_ctl; 211*7c478bd9Sstevel@tonic-gate }; 212*7c478bd9Sstevel@tonic-gate struct llchdr_xid { 213*7c478bd9Sstevel@tonic-gate unsigned char llcx_format; 214*7c478bd9Sstevel@tonic-gate unsigned char llcx_class; 215*7c478bd9Sstevel@tonic-gate unsigned char llcx_window; 216*7c478bd9Sstevel@tonic-gate }; 217*7c478bd9Sstevel@tonic-gate struct snaphdr { 218*7c478bd9Sstevel@tonic-gate uchar_t snap_oid[3]; 219*7c478bd9Sstevel@tonic-gate uchar_t snap_type[2]; 220*7c478bd9Sstevel@tonic-gate }; 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate #define LLC_UI 0x3 223*7c478bd9Sstevel@tonic-gate #define LLC_XID 0xAF 224*7c478bd9Sstevel@tonic-gate #define LLC_TEST 0xE3 225*7c478bd9Sstevel@tonic-gate #define LLC_P 0x10 /* P bit for use with XID/TEST */ 226*7c478bd9Sstevel@tonic-gate #define LLC_XID_FMTID 0x81 /* XID format identifier */ 227*7c478bd9Sstevel@tonic-gate #define LLC_SERVICES 0x01 /* Services supported */ 228*7c478bd9Sstevel@tonic-gate #define LLC_GLOBAL_SAP 0XFF /* Global SAP address */ 229*7c478bd9Sstevel@tonic-gate #define LLC_NULL_SAP 0x00 230*7c478bd9Sstevel@tonic-gate #define LLC_SNAP_SAP 0xAA /* SNAP SAP */ 231*7c478bd9Sstevel@tonic-gate #define LLC_GROUP_ADDR 0x01 /* indication in DSAP of a group address */ 232*7c478bd9Sstevel@tonic-gate #define LLC_RESPONSE 0x01 /* indication in SSAP of a response */ 233*7c478bd9Sstevel@tonic-gate #define LLC_NOVELL_SAP -1 /* indicator that Novell 802.3 mode is used */ 234*7c478bd9Sstevel@tonic-gate 235*7c478bd9Sstevel@tonic-gate #define LLC_XID_INFO_SIZE 3 /* length of the INFO field */ 236*7c478bd9Sstevel@tonic-gate #define LLC_XID_CLASS_I (0x01) /* Class I */ 237*7c478bd9Sstevel@tonic-gate #define LLC_XID_CLASS_II (0x03) /* Class II */ 238*7c478bd9Sstevel@tonic-gate #define LLC_XID_CLASS_III (0x05) /* Class III */ 239*7c478bd9Sstevel@tonic-gate #define LLC_XID_CLASS_IV (0x07) /* Class IV */ 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate /* Types can be or'd together */ 242*7c478bd9Sstevel@tonic-gate #define LLC_XID_TYPE_1 (0x01) /* Type 1 */ 243*7c478bd9Sstevel@tonic-gate #define LLC_XID_TYPE_2 (0x02) /* Type 2 */ 244*7c478bd9Sstevel@tonic-gate #define LLC_XID_TYPE_3 (0x04) /* Type 3 */ 245*7c478bd9Sstevel@tonic-gate 246*7c478bd9Sstevel@tonic-gate #define LLC1_CSMACD_HDR_SIZE (2*ETHERADDRL+2) 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate #define ismulticast(cp) ((*(caddr_t)(cp)) & 0x01) 249*7c478bd9Sstevel@tonic-gate 250*7c478bd9Sstevel@tonic-gate /* 251*7c478bd9Sstevel@tonic-gate * special ioctl calls for SunSelect LLC2 conformance 252*7c478bd9Sstevel@tonic-gate */ 253*7c478bd9Sstevel@tonic-gate #define L_GETPPA (('L'<<8)|1) 254*7c478bd9Sstevel@tonic-gate #define L_SETPPA (('L'<<8)|2) 255*7c478bd9Sstevel@tonic-gate #define L_GETSTATS (('L'<<8)|5) 256*7c478bd9Sstevel@tonic-gate #define L_ZEROSTATS (('L'<<8)|6) 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate #define LI_SPPA 0x02 /* type of snioc structure */ 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate struct ll_snioc { 261*7c478bd9Sstevel@tonic-gate uchar_t lli_type; 262*7c478bd9Sstevel@tonic-gate uchar_t lli_spare[3]; 263*7c478bd9Sstevel@tonic-gate int lli_ppa; 264*7c478bd9Sstevel@tonic-gate int lli_index; 265*7c478bd9Sstevel@tonic-gate }; 266*7c478bd9Sstevel@tonic-gate 267*7c478bd9Sstevel@tonic-gate /* 268*7c478bd9Sstevel@tonic-gate * version of insque/remque for use by this driver 269*7c478bd9Sstevel@tonic-gate */ 270*7c478bd9Sstevel@tonic-gate struct qelem { 271*7c478bd9Sstevel@tonic-gate struct qelem *q_forw; 272*7c478bd9Sstevel@tonic-gate struct qelem *q_back; 273*7c478bd9Sstevel@tonic-gate /* rest of structure */ 274*7c478bd9Sstevel@tonic-gate }; 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 277*7c478bd9Sstevel@tonic-gate } 278*7c478bd9Sstevel@tonic-gate #endif 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate #endif /* _SYS_LLC1_H */ 281