nxge_serialize.h revision 1f8914d5f1bf694f037141564cb01af09a2d08f0
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_NXGE_NXGE_SERIALIZE_H
#define _SYS_NXGE_NXGE_SERIALIZE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define NXGE_TX_AVG_CNT 200000000
#ifdef _KERNEL
/*
* Thread state flags
*/
#else
static int p0 = 0;
#define TS_RUN 0
static int maxclsyspri = 99;
#include <atomic.h>
#include <thread.h>
#include <synch.h>
#include <assert.h>
#include <errno.h>
typedef void mblk_t;
typedef cond_t kcondvar_t;
#define MUTEX_DEFAULT USYNC_THREAD
#define mutex_init(a, b, c, d) mutex_init(a, b, c)
#define mutex_enter(a) mutex_lock(a)
#define mutex_tryenter(a) mutex_trylock(a)
#define mutex_exit(a) mutex_unlock(a)
#define cv_signal(c) cond_signal(c)
#define cv_timedwait(c, m, t) cond_timedwait(c, m, &t)
#define kmem_alloc(a, b) malloc(a)
#define cas32(a, b, c) atomic_cas_32(a, b, c)
#define thread_create(a, b, c, d, e, f, g, h) \
#endif
typedef int (onetrack_t)(mblk_t *, void *);
typedef struct {
int count;
void *cookie;
int owned;
/* Counter tracks the total time spent in serializer function */
/*
* Counter tracks the total number of time the serializer
* function was called.
*/
long totalcount;
/*
* Counter maintains the average time spent in the serializer function
* and is derived as (totaltime/totalcount).
*/
int avg;
/*
* The lenght of the queue to which the serializer function
* will append data.
*/
int length;
/*
* Prototypes definitions
*/
void nxge_serialize_destroy(nxge_serialize_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NXGE_NXGE_SERIALIZE_H */