vnet.h revision 0dc2366f7b9f9f36e10909b1e95edbf2a261c2ac
/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _VNET_H
#define _VNET_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/vnet_res.h>
#include <sys/vnet_mailbox.h>
#include <sys/mac_client.h>
#define VNET_SUCCESS (0) /* successful return */
#define IS_BROADCAST(ehp) \
#define IS_MULTICAST(ehp) \
/*
* Flags used to indicate the state of the vnet device and its associated
* resources.
*/
typedef enum vnet_flags {
VNET_STOPPED = 0x0,
VNET_STARTED = 0x1,
VNET_STOPPING = 0x2
} vnet_flags_t;
typedef struct vnet_hio_stats {
/* MIB II variables */
typedef struct vnet_hio_kstats {
/* required by kstat for MIB II objects(RFC 1213) */
typedef struct vnet_tx_ring_stats {
/*
* A vnet resource structure.
*/
typedef struct vnet_res {
void *rx_ringp; /* assoc pseudo rx ring */
} vnet_res_t;
#define VNET_DDS_TASK_ADD_SHARE 0x01
#define VNET_DDS_TASK_DEL_SHARE 0x02
#define VNET_DDS_TASK_REL_SHARE 0x04
/* An instance specific DDS structure */
typedef struct vnet_dds_info {
#define VNET_NFDB_HASH 64
/* rwlock macros */
typedef enum {
AST_init_mdeg = 0x200
/*
* # of Pseudo TX Rings is defined based on the possible
* # of TX Hardware Rings from a Hybrid resource.
*/
/*
* # of Pseudo RX Rings that are reserved and exposed by default.
* 1 for LDC resource to vsw + 2 for RX rings of Hybrid resource.
*/
/* Pseudo RX Ring States */
typedef enum {
/* Pseudo TX Ring States */
typedef enum {
/*
* Psuedo TX Ring
*/
typedef struct vnet_pseudo_tx_ring {
void *grp; /* grp associated */
void *vnetp; /* vnet associated */
/* ring handle. Hybrid res: ring hdl */
/* of hardware rx ring; LDC res: hdl */
/* to the res itself (vnet_res_t) */
/*
* Psuedo RX Ring
*/
typedef struct vnet_pseudo_rx_ring {
void *grp; /* grp associated */
void *vnetp; /* vnet associated */
/* ring handle. Hybrid res: ring hdl */
/* of hardware tx ring; otherwise */
/* NULL */
/*
* Psuedo TX Ring Group
*/
typedef struct vnet_pseudo_tx_group {
void *vnetp; /* vnet associated */
void *tx_notify_handle; /* Tx ring notification */
/*
* Psuedo RX Ring Group
*/
typedef struct vnet_pseudo_rx_group {
int index; /* group index */
void *vnetp; /* vnet this grp belongs to */
/*
* vnet instance state information
*/
typedef struct vnet {
int instance; /* instance # */
void *vgenhdl; /* Handle for vgen */
/* pseudo ring groups */
} vnet_t;
#ifdef DEBUG
/*
* debug levels:
* DBG_LEVEL2: Info messages
* DBG_LEVEL3: Warning messages
* DBG_LEVEL4: Error messages
*/
DBG_ERR = 0x08 };
#define DBG1(...) do { \
if ((vnet_dbglevel & DBG_LEVEL1) != 0) { \
} \
#define DBG2(...) do { \
if ((vnet_dbglevel & DBG_LEVEL2) != 0) { \
} \
#define DWARN(...) do { \
if ((vnet_dbglevel & DBG_WARN) != 0) { \
} \
#define DERR(...) do { \
if ((vnet_dbglevel & DBG_ERR) != 0) { \
} \
#else
#define DBG1(...) if (0) do { } while (0)
#define DBG2(...) if (0) do { } while (0)
#define DWARN(...) if (0) do { } while (0)
#define DERR(...) if (0) do { } while (0)
#endif
#ifdef VNET_IOC_DEBUG /* Debug ioctls */
#define VNET_FORCE_LINK_DOWN 0x1
#define VNET_FORCE_LINK_UP 0x2
#endif
#ifdef __cplusplus
}
#endif
#endif /* _VNET_H */