vnet_gen.h revision 34f94fbc7a730740933e4776ade5f74009afe4ce
/*
* 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
*/
/*
*/
#ifndef _VNET_GEN_H
#define _VNET_GEN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/vgen_stats.h>
#define VGEN_SUCCESS (0) /* successful return */
/* vgen_t flags */
#define VGEN_STOPPED 0x0
#define VGEN_STARTED 0x1
/* channel flags */
#define CHANNEL_ATTACHED 0x1
#define CHANNEL_STARTED 0x2
/* transmit return values */
#define VGEN_TX_SUCCESS 0 /* transmit success */
/* private descriptor flags */
/* receive thread flags */
/*
* Number of rcv buffers in RxDringData mode
*/
static struct ether_addr etherbroadcastaddr = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
/*
*/
#define IS_BROADCAST(ehp) \
#define IS_MULTICAST(ehp) \
/*
* The handshake process consists of 5 phases defined below, with VH_PHASE0
* being the pre-handshake phase and VH_DONE is the phase to indicate
* successful completion of all phases. Each phase may have one to several
* handshake states which are required to complete successfully to move to the
* next phase. See functions vgen_handshake() and vgen_handshake_done() for
* more details.
*/
/* Handshake phases */
/* Handshake states */
enum {
VER_INFO_SENT = 0x1,
VER_ACK_RCVD = 0x2,
VER_INFO_RCVD = 0x4,
VER_ACK_SENT = 0x8,
ATTR_INFO_SENT = 0x10,
ATTR_ACK_RCVD = 0x20,
ATTR_INFO_RCVD = 0x40,
ATTR_ACK_SENT = 0x80,
DRING_INFO_SENT = 0x100,
DRING_ACK_RCVD = 0x200,
DRING_INFO_RCVD = 0x400,
DRING_ACK_SENT = 0x800,
RDX_INFO_SENT = 0x1000,
RDX_ACK_RCVD = 0x2000,
RDX_INFO_RCVD = 0x4000,
RDX_ACK_SENT = 0x8000,
};
/* reset flags */
typedef enum {
/* caller information needed in some code paths */
typedef enum {
/* get the address of next tbuf */
/* increment recv index */
/* decrement recv index */
/* increment tx index */
/* decrement tx index */
/* bounds check rx index */
/* bounds check tx index */
#ifdef DEBUG
/* Error injection codes */
#endif
/* private descriptor */
typedef struct vgen_priv_desc {
/*
* Handshake parameters (per vio_mailbox.h) of each ldc end point, used
* during handshake negotiation.
*/
typedef struct vgen_handshake_params {
/* version specific params */
/* attributes specific params */
/* descriptor ring params */
/* version info */
typedef struct vgen_ver {
} vgen_ver_t;
/*
* vnet-protocol-version dependent function prototypes.
*/
typedef int (*vgen_ldctx_t) (void *, mblk_t *);
typedef void (*vgen_ldcrx_pktdata_t) (void *, void *, uint32_t);
typedef int (*vgen_ldcrx_dringdata_t) (void *, void *);
/*
* LDC end point abstraction in vnet. This structure holds all the information
* that is required to configure and use the Channel for data transfers with
* the peer LDC end point (vnet or vswitch), using VIO Protocol.
*/
typedef struct vgen_ldc {
/*
* Locks:
* locking hierarchy when more than one lock is held concurrently:
* cblock > rxlock > txlock > tclock.
*/
/*
* Channel and Handshake Info
*/
int hphase; /* handshake phase */
int hstate; /* handshake state bits */
#ifdef VNET_IOC_DEBUG
#endif
/*
* Transmit Specific Fields
*/
/* TX-Common (Used in both TxDring and RxDringData modes) */
/* TX-TxDring mode */
/* TX-RxDringData mode */
/*
* Receive Specific Fields
*/
/* RX-Common (Used in both TxDring and RxDringData modes) */
/* RX-TxDring mode */
/* RX-RxDringData mode */
/* Channel Statistics */
} vgen_ldc_t;
/* port information structure */
typedef struct vgen_port {
int port_num; /* port number */
int num_ldcs; /* # of channels in this port */
} vgen_port_t;
/* port list structure */
typedef struct vgen_portlist {
/* vgen instance information */
typedef struct vgen {
int instance; /* vnet instance */
int flags; /* flags */
} vgen_t;
#ifdef __cplusplus
}
#endif
#endif /* _VNET_GEN_H */