dld_impl.h revision da14cebe459d3275048785f25bd869cb09b5307f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DLD_IMPL_H
#define _SYS_DLD_IMPL_H
#include <sys/ethernet.h>
#include <sys/dls_impl.h>
#ifdef __cplusplus
extern "C" {
#endif
#define DLD_CONTROL_MINOR_NAME "ctl"
#define DLD_CONTROL_MINOR 0
#define DLD_CONTROL 0x00000001
#define DLD_DLPI 0x00000002
typedef enum {
typedef enum {
/*
* The dld_str_t object definition and protection scheme for each member
* is described below. The framework locking mechanism details are described in
* mac_impl.h and mac.c
*
* Write Once Only (WO): Typically these are initialized when the end point
* is created or initialized and don't change subsequently
*
* Serializer (SL): Protected by the Serializer. All modify operations on an
* end point go through the serializer. Readers don't care about reading
* these fields atomically, or readers also use the serializer to see the
* values atomically.
*
* Lock: kmutex_t or kwrlock_t lock. Modify operations still go through the
* serializer, the lock helps synchronize readers with writers.
*/
struct dld_str_s { /* Protected by */
/*
* Major number of the device
*/
/*
* Ephemeral minor number for the object.
*/
/*
* PPA number this stream is attached to.
*/
/*
*/
/*
* Stream is open to DLD_CONTROL (control node) or
* DLD_DLPI (DLS provider) node.
*/
/*
* The following fields are only used for DLD_DLPI type objects.
*/
/*
* Current DLPI state.
*/
/*
* DLPI style
*/
/*
* Currently bound DLSAP.
*/
/*
* Handle of the MAC that is used by the data-link interface.
*/
/*
* Promiscuity level information.
*/
/*
* Immutable information of the MAC which the channel is using.
*/
/*
* Current packet priority.
*/
/*
* Handle of our MAC notification callback.
*/
/*
* Set of enabled DL_NOTE... notifications. (See dlpi.h).
*/
/*
* Mode: unitdata, fast-path or raw.
*/
/*
* Native mode state.
*/
/*
* IP polling is operational if this flag is set.
*/
/*
* LSO is enabled if ds_lso is set.
*/
/*
* State of DLPI user: may be active (regular network layer),
* passive (snoop-like monitoring), or unknown (not yet
* determined).
*/
/*
* Dummy mblk used for flow-control.
*/
/*
* List of queued DLPI requests. These will be processed
* by a taskq thread. This block is protected by ds_lock
*/
ds_local : 1,
void *ds_rx_arg; /* ds_lock */
};
#define DLD_DATATHR_INC(dsp) { \
dsp->ds_datathr_cnt++; \
}
#define DLD_DATATHR_DCR(dsp) { \
(dsp)->ds_datathr_cnt--; \
if ((dsp)->ds_datathr_cnt == 0) \
}
/*
* dld_str.c module.
*/
extern void dld_str_init(void);
extern int dld_str_fini(void);
extern void dld_str_destroy(dld_str_t *);
extern void dld_str_detach(dld_str_t *);
extern void dld_str_rx_raw(void *, mac_resource_handle_t,
mblk_t *, mac_header_info_t *);
extern void dld_str_rx_fastpath(void *, mac_resource_handle_t,
mblk_t *, mac_header_info_t *);
extern void dld_str_rx_unitdata(void *, mac_resource_handle_t,
mblk_t *, mac_header_info_t *);
extern void dld_str_notify_ind(dld_str_t *);
int (*func)(), void *);
/*
*/
extern void dld_capabilities_disable(dld_str_t *);
/*
*/
extern void flow_rx_pkt_chain(void *, void *, mblk_t *);
/*
*/
/*
* Options: there should be a separate bit defined here for each
* DLD_PROP... defined in dld.h.
*/
#define DLD_OPT_NO_FASTPATH 0x00000001
#define DLD_OPT_NO_POLL 0x00000002
#define DLD_OPT_NO_ZEROCOPY 0x00000004
#define DLD_OPT_NO_SOFTRING 0x00000008
/*
* autopush information
*/
typedef struct dld_ap {
struct dlautopush da_ap;
} dld_ap_t;
/*
* Useful macros.
*/
#define IMPLY(p, c) (!(p) || (c))
#define DLD_SETQFULL(dsp) { \
\
} \
}
#define DLD_CLRQFULL(dsp) { \
\
} \
}
#ifdef DEBUG
#else
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DLD_IMPL_H */