mac.h revision 98b1442a0c93823c4eb547288dc55de7a294ee73
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_MAC_H
#define _SYS_MAC_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* MAC Services Module
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Module name.
*/
#define MAC_MODULE_NAME "mac"
/*
* MAC Information (text emitted by modinfo(1m))
*/
#define MAC_INFO "MAC Services v%I%"
/*
* Statistics
*/
#define XCVR_UNDEFINED 0
#define XCVR_NONE 1
#define XCVR_10 2
#define XCVR_100T4 3
#define XCVR_100X 4
#define XCVR_100T2 5
#define XCVR_1000X 6
#define XCVR_1000T 7
typedef enum {
LINK_STATE_UNKNOWN = -1,
} link_state_t;
typedef enum {
LINK_DUPLEX_UNKNOWN = 0,
#ifdef _KERNEL
enum mac_stat {
/*
* PSARC 1997/198 (MIB-II kstats)
*/
/*
* PSARC 1997/247 (RFC 1643 kstats)
*/
/*
*/
MAC_NSTAT /* must be the last entry */
};
/*
* Maximum MAC address length
*/
#define MAXADDRLEN 20
/*
* Immutable information. (This may not be modified after registration).
*/
typedef struct mac_info_s {
} mac_info_t;
#define MAC_STAT_MIB(_mi_stat) \
{ \
}
#define MAC_STAT_ETHER(_mi_stat) \
{ \
}
#define MAC_STAT_MII(_mi_stat) \
{ \
}
/*
* MAC version identifer (for debugging)
*/
#define MAC_IDENT "%I%"
/*
* MAC driver entry point types.
*/
typedef int (*mac_start_t)(void *);
typedef void (*mac_stop_t)(void *);
typedef int (*mac_promisc_t)(void *, boolean_t);
typedef int (*mac_unicst_t)(void *, const uint8_t *);
typedef void (*mac_resources_t)(void *);
/*
* MAC extensions. (Currently there are non defined).
*/
/*
* MAC implementation private data.
*/
typedef struct mac_impl_s mac_impl_t;
/*
* MAC structure: supplied by the driver.
*/
typedef struct mac {
const char *m_ident; /* MAC_IDENT */
void *m_driver; /* Driver private data */
} mac_t;
/*
* Construct the name of a MAC interface.
*/
/*
* Opaque handle types.
*/
typedef struct __mac_handle *mac_handle_t;
typedef struct __mac_notify_handle *mac_notify_handle_t;
typedef struct __mac_rx_handle *mac_rx_handle_t;
typedef struct __mac_txloop_handle *mac_txloop_handle_t;
typedef struct __mac_resource_handle *mac_resource_handle_t;
/*
* MAC interface callback types.
*/
typedef enum {
MAC_NNOTE /* must be the last entry */
typedef void (*mac_notify_t)(void *, mac_notify_type_t);
typedef void (*mac_txloop_t)(void *, mblk_t *);
/*
* MAC promiscuous types
*/
typedef enum {
/*
* MAC resource types
*/
typedef enum {
MAC_RX_FIFO = 1
typedef struct mac_rx_fifo_s {
void *mrf_arg;
typedef struct mac_txinfo_s {
void *mt_arg;
} mac_txinfo_t;
typedef union mac_resource_u {
/*
* Client interface functions.
*/
extern void mac_close(mac_handle_t);
extern int mac_start(mac_handle_t);
extern void mac_stop(mac_handle_t);
extern int mac_multicst_remove(mac_handle_t,
const uint8_t *);
extern void mac_resources(mac_handle_t);
void *);
extern void mac_notify_remove(mac_handle_t,
extern void mac_notify(mac_handle_t);
void *);
extern void mac_txloop_remove(mac_handle_t,
extern void mac_active_clear(mac_handle_t);
extern void mac_resource_set(mac_handle_t,
mac_resource_add_t, void *);
/*
* Driver interface functions.
*/
extern int mac_register(mac_t *);
extern int mac_unregister(mac_t *);
mblk_t *);
extern void mac_tx_update(mac_t *);
extern void mac_resource_update(mac_t *);
void *, boolean_t);
void *);
void *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MAC_H */