dld_impl.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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DLD_IMPL_H
#define _SYS_DLD_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/ethernet.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* dld_ppa_t object definition.
*/
typedef struct dld_node dld_node_t;
typedef struct dld_ppa {
/*
* Name of the data-link.
*/
/*
* The device and port of the MAC interface.
*/
char dp_dev[MAXNAMELEN];
/*
* The VLAN identifier of the data-link interface.
*/
/*
* Style 1 and style 2 provider nodes that reference the object.
*/
/*
* Style 2 PPA index number of the object.
*/
} dld_ppa_t;
/*
* dld_node_t object definition.
*/
struct dld_node {
/*
* Name of the node, this will be the name of the dev_t in the
* file system.
*/
/*
* DL_STYLE1 or DL_STYLE2.
*/
/*
* Minor number of the dev_t.
*/
/*
* Global hash table entries that reference the object.
*/
/*
* Number of dld_ppa_t objects referencing the object.
*/
/*
* For style 1 nodes there is only a single dld_ppa_t object reference.
* This field is used for that purpose.
*/
/*
* For style 2 nodes there may be many dld_ppa_t references, keyed
* by a PPA index number. The following hash table stores the
* references and the subsequent methods are used to manage the table.
*/
};
#define DLD_CONTROL 0x00000001
#define DLD_DLPI 0x00000002
typedef enum {
typedef enum {
/*
* dld_str_t object definition.
*/
struct dld_str {
/*
* Ephemeral minor number for the object.
*/
/*
*/
/*
* 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.
*/
/*
* dld_node_t of the node that was opened.
*/
/*
* Current DLPI state.
*/
/*
* Currently bound DLSAP.
*/
/*
* Handle of the data-link channel that is used by this object.
*/
/*
* Handle of the MAC that is used by the data-link interface.
*/
/*
* VLAN identifier of the data-link interface.
*/
/*
* Promiscuity level information.
*/
/*
* Immutable information of the MAC which the channel is using.
*/
const mac_info_t *ds_mip;
/*
* Current packet priority.
*/
/*
* Handle of our MAC notification callback.
*/
/*
* Set of enabled DL_NOTE... notifications. (See dlpi.h).
*/
/*
* Cached MAC unicast addresses.
*/
/*
* Mode: unitdata, fast-path or raw.
*/
/*
* IP polling is operational if this flag is set.
*/
/*
* State of DLPI user: may be active (regular network layer),
* passive (snoop-like monitoring), or unknown (not yet
* determined).
*/
/*
* Message handler jump tables.
*/
struct str_msg_info *ds_mi;
struct str_msg_info *ds_pmi;
} dld_str;
/*
* 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_tx_raw(dld_str_t *);
extern void dld_str_tx_fastpath(dld_str_t *);
extern void dld_str_tx_drop(dld_str_t *);
extern void dld_str_rx_raw(void *, mac_resource_handle_t,
extern void dld_str_rx_fastpath(void *, mac_resource_handle_t,
extern void dld_str_rx_unitdata(void *, mac_resource_handle_t,
extern void dld_str_notify_ind(dld_str_t *);
/*
*/
/*
* dld_ppa.c module.
*/
extern void dld_ppa_init(void);
extern int dld_ppa_fini(void);
extern int dld_ppa_create(const char *, const char *, uint_t,
uint16_t);
extern int dld_ppa_destroy(const char *);
extern int dld_ppa_attr(const char *, char *, uint_t *,
uint16_t *);
/*
* dld_node.c module.
*/
extern void dld_node_init(void);
extern int dld_node_fini(void);
extern void dld_node_rele(dld_node_t *);
dld_ppa_t *);
/*
* dld_minor.c module.
*/
extern void dld_minor_init(void);
extern int dld_minor_fini(void);
extern void dld_minor_rele(minor_t);
/*
* dld_ioc.c module.
*/
/*
* dld_drv.c module.
*/
extern dev_info_t *dld_dip;
/*
* Options: there should be a separate bit defined here for each
* DLD_PROP... defined in dld.h.
*/
#define DLD_OPT_NO_STYLE1 0x00000001
#define DLD_OPT_NO_FASTPATH 0x00000002
#define DLD_OPT_NO_POLL 0x00000004
#define DLD_OPT_NO_ZEROCOPY 0x00000008
/*
* Useful macros.
*/
#define IMPLY(p, c) (!(p) || (c))
#define AGGR_DEV "aggr0"
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DLD_IMPL_H */