vsw.h revision 34b64c01c6a2242177691e1420a386e2789f79dc
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This header file contains the data structures which the
* virtual switch (vsw) uses to communicate with its clients and
* the outside world.
*/
#ifndef _VSW_H
#define _VSW_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/vio_mailbox.h>
#include <sys/vnet_common.h>
#include <sys/ethernet.h>
#include <sys/mac_client.h>
#include <sys/vio_util.h>
#include <sys/vgen_stats.h>
#define DRV_NAME "vsw"
/*
* Only support ETHER mtu at moment.
*/
/* ID of the source of a frame being switched */
/*
* Number of hash chains in the multicast forwarding database.
*/
#define VSW_NCHAINS 8
/* Number of transmit descriptors - must be power of 2 */
#define VSW_RING_NUM_EL 512
/*
* State of interface if switch plumbed as network device.
*/
/*
* Switching modes.
*/
typedef enum {
VSW_SWTHR_STOP = 0x1
typedef enum {
PROG_init = 0x00,
PROG_locks = 0x01,
PROG_readmd = 0x02,
PROG_fdb = 0x04,
PROG_mfdb = 0x08,
PROG_taskq = 0x10,
PROG_rxp_taskq = 0x20,
PROG_swmode = 0x40,
PROG_macreg = 0x80,
PROG_mdreg = 0x100
/*
* vlan-id information.
*/
typedef struct vsw_vlanid {
} vsw_vlanid_t;
/*
* vsw instance state information.
*/
typedef struct vsw {
int instance; /* instance # */
int mac_open_retries; /* mac_open() retry count */
void (*vsw_switch_frame)
/* mac layer */
/* mac layer switching flag */
/* Machine Description updates */
/* if configured as an ethernet interface */
/* multicast addresses when configured as eth interface */
/* HybridIO related fields */
/* Link-state related fields */
} vsw_t;
/*
* The flags that are used by vsw_mac_rx().
*/
typedef enum {
VSW_MACRX_PROMISC = 0x01,
VSW_MACRX_COPYMSG = 0x02,
VSW_MACRX_FREEMSG = 0x04
#ifdef DEBUG
extern int vswdbg;
#define D1(...) \
if (vswdbg & 0x01) \
#define D2(...) \
if (vswdbg & 0x02) \
#define D3(...) \
if (vswdbg & 0x04) \
#define DWARN(...) \
if (vswdbg & 0x08) \
#define DERR(...) \
if (vswdbg & 0x10) \
#else
#define DERR(...) if (0) do { } while (0)
#define DWARN(...) if (0) do { } while (0)
#define D1(...) if (0) do { } while (0)
#define D2(...) if (0) do { } while (0)
#define D3(...) if (0) do { } while (0)
#endif /* DEBUG */
#ifdef __cplusplus
}
#endif
#endif /* _VSW_H */