gldpriv.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* gldpriv.h - Private interfaces/structures needed by gld.c
*
* The definitions in this file are private to GLD and may change at any time.
* They must not be used by any driver.
*/
#ifndef _SYS_GLDPRIV_H
#define _SYS_GLDPRIV_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef DEBUG
#define GLD_DEBUG 1
#endif
/*
* The version number should not be changed.
*/
/* gld_global_options bits */
/* gld per instance options */
#define GLDOPT_FAST_RECV 0x40
#define GLDOPT_CANONICAL_ADDR 0x08
#define GLDOPT_MDT 0x100
/*
* This version of GLD allows a "Virtual-LAN-PPA" to be specified in
* the same manner as Cassini: the virtual PPA number is composed of
* the VLAN tag number (1-4094), multiplied by 1000(!), plus the real
* (hardware) PPA. Thus "bge23001" refers to the "device" which
* transports packets with tag VLAN "23" over the hardware of "bge1".
*
* This scheme limits the number of physical devices of a single type to
* 1000 e.g. bge0 .. bge999 (since bge1000 would instead be interpreted
* as VLAN1 over bge0).
*/
#define GLD_VLAN_SCALE 1000
/*
* Minor numbers:
*
* For each device type, GLD creates a single "style 2" node with minor 0.
* For each instance of that device type, GLD also creates a "style 1"
* node with minor number one greater than the PPA. Thus, nodes with
* minor numbers 0..1000 may exist in the /dev* filesystem.
*
* So, on open:
*
* Minor 0 implies DLPI "style 2": the STREAM is not intrinsically
* (and may be changed) dynamically, by DLPI_ATTACH/DETACH messages.
*
* Minors 1..1000 are "style 1", where the PPA is entirely defined by
* the minor; GLD defines the mapping as PPA=minor-1 (minor=PPA+1).
* Note that the upper bound of 1000 is (now) limited by the VLAN
* mapping scheme set out above.
*
* GLD devices are "self-cloning": each new open will cause a new minor
* number to be allocated; these are selected from the range 1001..0x3ffff.
* This minor number is only associated with the open stream and doesn't
* appear in the /dev* filesystem; manually created nodes with minors in
* this range will be rejected by gld_open().
*/
#define GLD_USE_STYLE2 0
#define GLD_MIN_STYLE1_MINOR 1
#define GLD_MAX_CLONE_MINOR 0x3ffff
/* gldm_GLD_flags */
/* This is the largest macaddr currently supported by GLD */
/* multicast structures */
typedef struct gld_multicast_addr {
int gldm_refcnt; /* number of streams referring */
/* to this per-mac entry */
unsigned char gldm_addr[GLD_MAX_ADDRLEN];
} gld_mcast_t;
/* gld_flag bits -- GLD PRIVATE */
#define GLD_PROM_SAP 0x0008
#define GLD_PROM_MULT 0x0010
/*
* gld structure. Used to define the per-stream information required to
* implement DLPI.
*/
typedef struct gld {
void *gld_vlan;
int (*gld_send)();
} gld_t;
/*
* definitions for the per driver class structure
*/
typedef struct glddevice {
int gld_ndevice; /* number of mac devices linked */
/* style 2 streams */
int gld_nextminor; /* next unused minor number for clone */
int gld_major; /* device's major number */
int gld_multisize; /* # of multicast entries to alloc */
int gld_type; /* for use before attach */
int gld_minsdu;
int gld_maxsdu;
int gld_addrlen; /* physical address length */
int gld_saplen; /* sap length, neg appends */
unsigned char *gld_broadcast; /* pointer to broadcast address */
int gld_styles; /* provider styles */
} glddev_t;
typedef struct pktinfo {
} pktinfo_t;
/*
* Flags input to the gld_interpret_*() interpreter routines.
*/
typedef enum packet_flag {
/*
* Flags input to the gld_interpret_mdt_*() interpreter routines.
*/
typedef enum mdt_packet_flag {
/*
* Describes characteristics of the Media Access Layer.
* The mtu_size is the size of the largest frame.
* The interpreter is the function that "knows" how to interpret the frame.
*/
typedef struct {
int hdr_size;
struct pdescinfo_s *, pktinfo_t *, int);
void (*init)(gld_mac_info_t *);
void (*uninit)(gld_mac_info_t *);
char *mac_string;
/*
* structure for names stat structure usage as required by "netstat"
*/
typedef union media_kstats {
struct dot3kstat {
} dot3;
struct dot5kstat {
} dot5;
struct fddikstat {
} fddi;
struct gldkstats {
/* control */
};
typedef struct gld_mac_pvt gld_mac_pvt_t;
typedef struct gld_vlan {
int gldv_nstreams;
struct gld *gldv_str_prev;
struct gld_stats *gldv_stats;
} gld_vlan_t;
#define IPQ_DISABLED 0x01
#define IPQ_FORBIDDEN 0x02
#define VLAN_HASHSZ 23
/* Per-mac info used by GLD */
struct gld_mac_pvt {
int nvlan; /* VLANs in use on this mac */
int nprom; /* num streams in promiscuous mode */
int nprom_multi; /* streams in promiscuous multicast */
unsigned char *curr_macaddr; /* Currently programmed mac address */
int rde_enabled; /* RDE (Source Routing) Enabled */
int rde_str_indicator_ste; /* use STE when no SR info */
int rde_timeout; /* route link inactivity timeout */
};
/* return values from gld_cmds */
/* caller argument to gld_start */
#define GLD_WPUT 0
#define GLD_WSRV 1
#define GLD_MAX_802_SAP 0xff
/*
* definitions for debug tracing
*/
/*
* Lock manipulation macros for GLDM_LOCK. Conceptually, the
* GLD layer treats the lock as a rw lock; for v0 binary and
* semantic compatibility, the underlying implementation still
* uses a mutex, whereas for v2 drivers, the more scalable rwlock
* is used instead. See notes in gld.h.
*/
#define GLDM_LOCK_INIT(macinfo) \
#define GLDM_LOCK_INITED(macinfo) \
#define GLDM_LOCK_DESTROY(macinfo) \
}
#define GLDM_UNLOCK(macinfo) \
/* lock held in read or write mode? */
#define GLDM_LOCK_HELD(macinfo) \
/* lock held in write mode? */
#define GLDM_LOCK_HELD_WRITE(macinfo) \
/*
* Note that unlike bcmp, we return zero if they are different.
*/
else \
mac_copy((a), (b), (l)); \
}
/*
* Macros to access possibly-unaligned variables
*/
#if (_ALIGNMENT_REQUIRED == 0)
#else /* ALIGNMENT_REQUIRED */
#define REF_NET_USHORT(lvalue) \
}
#if defined(_LITTLE_ENDIAN)
#define REF_HOST_USHORT(lvalue) \
#elif defined(_BIG_ENDIAN)
#define REF_HOST_USHORT(lvalue) \
#else /* unknown endian */
#error "what endian is this machine?"
#endif /* endian */
#endif /* ALIGNMENT_REQUIRED */
/* ================================================================ */
/* Route Determination Entity definitions (IEEE 802.2 1994 edition) */
/* ================================================================ */
struct rde_pdu {
};
/* ============================================================= */
/* Source Routing fields and definitions (IEEE 802.2 and 802.1D) */
/* ============================================================= */
/*
* Source Routing Route Information field.
*/
struct gld_ri {
#if defined(_BIT_FIELDS_LTOH)
struct tr_rd { /* route designator fields */
} rd[MAX_RDFLDS];
#elif defined(_BIT_FIELDS_HTOL)
struct tr_rd { /* route designator fields */
} rd[MAX_RDFLDS];
#else
#error "which way do bit fields get allocated?"
#endif
};
/*
* Source route table info
*/
struct srtab {
};
/* ================================================================= */
/* Media dependent defines for media dependent routines in gldutil.c */
/* ================================================================= */
/*
* Some "semi-generic" defines used by ether, token, and fddi,
* and probably anything else with addrlen == 6 && saplen == -2.
*/
struct gld_dlsap {
unsigned char glda_addr[ETHERADDRL];
unsigned short glda_sap;
};
struct llc_snap_hdr {
};
/* ============================ */
/* Ethernet related definitions */
/* ============================ */
struct ether_mac_frm {
};
/* ======================== */
/* FDDI related definitions */
/* ======================== */
struct fddi_mac_frm {
};
/* ============================== */
/* Token Ring related definitions */
/* ============================== */
struct tr_mac_frm_nori {
};
struct tr_mac_frm {
};
#ifdef __cplusplus
}
#endif
#endif /* _SYS_GLDPRIV_H */