original files of m241
This commit is contained in:
@@ -0,0 +1,267 @@
|
||||
/* gtf_core.h - general timer facility - core */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2007, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01r,10nov10,dlk Move extern "C" after last header file include. WIND00240828.
|
||||
01q,16apr07,dcc added _WRS_FASTDATA to the definition of netGtfSeconds.
|
||||
01p,20feb07,kch Merged from base6_iter12_smp-dev - Use spinlocks instead of
|
||||
intLock.
|
||||
01o,27dec06,kch Removed references to the obsolete coreip virtual stack.
|
||||
01n,10jul05,dlk Optimizations. Use L_NODE lists rather than DLL_LIST lists
|
||||
to avoid needing to reference the list head when removing
|
||||
a timer from the expire list. Replace timerMutex with
|
||||
intLock/intUnlock.
|
||||
01m,31jan05,sar Fix defects found in GTF code inspection of 10/26/2004
|
||||
as described in SPRs 106685 - 105688
|
||||
01l,17jan05,vvv osdep.h cleanup
|
||||
01k,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01j,02jul04,vvv changed vsnum from VSNUM to VSID
|
||||
01i,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/2)
|
||||
01h,25nov03,wap Merge changes from Snowflake
|
||||
01g,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01f,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01d,27oct03,rlm update include statements post header re-org.
|
||||
01c,07aug03,nee Merging to Base6 from ACCORDION_BASE6_MERGE_BASELINE label on
|
||||
Accordion codeline
|
||||
01b,03feb02,ham changed for tornado build.
|
||||
01a,06jun01,deg written.
|
||||
*/
|
||||
|
||||
#ifndef __INCgtf_coreh
|
||||
#define __INCgtf_coreh
|
||||
|
||||
#include <netVersion.h>
|
||||
#include <wdLib.h>
|
||||
#include <semLib.h>
|
||||
#include <sllLib.h>
|
||||
#include <dllLib.h>
|
||||
#include <spinLockLib.h>
|
||||
#include <private/gtf_util.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For virtual stack, the source files that include this header must
|
||||
* include vsNetCore.h to find splSemId and splTid
|
||||
*/
|
||||
|
||||
IMPORT SEM_ID splSemId; /* spl mutex semaphore id */
|
||||
IMPORT INT32 splTid; /* task which currently owns splSemId */
|
||||
|
||||
/* defines */
|
||||
|
||||
/* The LOCAL_ALLOC bit indicates if the GTF has allocated the memory for
|
||||
* the timer. It is set if GTF did so.
|
||||
* The ACTIVE bit indicates if the user has serviced this timer. It is cleared
|
||||
* by GTF when initializing a timer structure and then set when a timer is
|
||||
* activated (started or reset). It is cleared if the timer is stopped
|
||||
* (cancel or delete). It is left for the user to clear when the timer
|
||||
* expires.
|
||||
* The PENDING bit indicates if the timer is queued in the GTF timer wheels.
|
||||
* It is cleared by GTF when initializing a timer structure and then set when
|
||||
* a timer is activated (started or reset). It is cleared when the timer is
|
||||
* removed from the timer wheels (cancel, delete or expire).
|
||||
*/
|
||||
|
||||
#define TIMER_LOCAL_ALLOC 0x0001 /* true if GTF allocates timer memory */
|
||||
#define TIMER_ACTIVE 0x0002 /* true if timer has not been served */
|
||||
#define TIMER_PENDING 0x0004 /* true if timer is waiting for timeout */
|
||||
|
||||
#define TICKS tickGet()
|
||||
|
||||
#define TICK_LT(x,y) ((long)((x) - (y)) < 0)
|
||||
#define TICK_GT(x,y) ((long)((x) - (y)) > 0)
|
||||
#define TICK_LEQ(x,y) ((long)((x) - (y)) <= 0)
|
||||
#define TICK_GEQ(x,y) ((long)((x) - (y)) >= 0)
|
||||
|
||||
#define time_second netGtfSeconds
|
||||
|
||||
|
||||
/* typedefs */
|
||||
|
||||
struct gtfTimerManager;
|
||||
struct gtfTimer;
|
||||
|
||||
typedef int (*GTF_TIMER_HANDLER)(void*);
|
||||
typedef void (*GTF_TICK_FUNC) (struct gtfTimerManager *, void *);
|
||||
|
||||
/*
|
||||
* This structure is used both for the head and for nodes within
|
||||
* a circular list. We want to be able to remove a node without
|
||||
* referencing the list head, and to add quickly to the tail end
|
||||
* of a list, and fetch the first node quickly. When used as a
|
||||
* list head, pNext indicates the first entry of the list and
|
||||
* pPrev indicates the last entry.
|
||||
*/
|
||||
typedef struct L_NODE
|
||||
{
|
||||
struct L_NODE * pPrev;
|
||||
struct L_NODE * pNext;
|
||||
} L_NODE;
|
||||
|
||||
#define L_EMPTY(h) ((h) == (h)->pNext)
|
||||
|
||||
#define L_INIT(h) \
|
||||
do { \
|
||||
(h)->pPrev = (h); \
|
||||
(h)->pNext = (h); \
|
||||
} while ((0))
|
||||
|
||||
/*
|
||||
* Be careful. After L_REMOVE/L_GET, a node is left with dangling
|
||||
* references to the list it was in.
|
||||
*/
|
||||
#define L_REMOVE(n) \
|
||||
do { \
|
||||
L_NODE * _pPrev_ = (n)->pPrev; \
|
||||
L_NODE * _pNext_ = (n)->pNext; \
|
||||
_pPrev_->pNext = _pNext_; \
|
||||
_pNext_->pPrev = _pPrev_; \
|
||||
} while ((0))
|
||||
|
||||
#define L_GET(h, n) \
|
||||
do { \
|
||||
L_NODE * _pNext_; \
|
||||
(n) = (void *)((h)->pNext); \
|
||||
_pNext_ = ((L_NODE *)(n))->pNext; \
|
||||
(h)->pNext = _pNext_; \
|
||||
_pNext_->pPrev = (h); \
|
||||
} while ((0))
|
||||
|
||||
#define L_SPLICE(_prev, _next, n) \
|
||||
do { \
|
||||
(n)->pPrev = (_prev); \
|
||||
(n)->pNext = (_next); \
|
||||
(_prev)->pNext = (n); \
|
||||
(_next)->pPrev = (n); \
|
||||
} while ((0))
|
||||
|
||||
#define L_ADD(h, n) \
|
||||
do { \
|
||||
L_NODE * _pPrev_ = (h)->pPrev; \
|
||||
L_SPLICE (_pPrev_, (h), (n)); \
|
||||
} while ((0))
|
||||
|
||||
typedef struct gtfTimerUnitManager
|
||||
{
|
||||
L_NODE *timerWheel; /* array of timer slots */
|
||||
unsigned int fuzzyMask; /* lsb bits (error range) */
|
||||
unsigned int shiftBits; /* # bits of fuzzy mask */
|
||||
unsigned long nbrFiredTimer; /* # fired timer */
|
||||
unsigned int nbrOutstandTimer; /* # outstanding timer */
|
||||
} GTF_TIMER_UNIT_MANAGER;
|
||||
|
||||
typedef struct gtfTimerManager
|
||||
{
|
||||
GTF_TIMER_UNIT_MANAGER *timerUnitManager; /* array of timer units */
|
||||
unsigned int nbrTimerUnit; /* # of timer units */
|
||||
unsigned int nbrTimerSlot; /* # of timer slots */
|
||||
unsigned int timerUnitMask; /* mask to realize wrap-around array */
|
||||
unsigned int binPowGranScale; /* binary power of gran. scaling factor */
|
||||
unsigned long currTicks; /* current GTF tick number */
|
||||
unsigned int relSysClkTicks; /* # system ticks per clock delay */
|
||||
unsigned int maxTimerTicks; /* max timer tick value */
|
||||
SL_LIST timerQueue; /* timer free queue */
|
||||
unsigned int maxAllocTimer; /* # of timer in free queue */
|
||||
unsigned int currAllocTimer; /* # of allocated timer in free queue */
|
||||
WDOG_ID clock; /* clock */
|
||||
SEM_ID mngrMutex; /* manager lock */
|
||||
SEM_ID count; /* counting semaphore */
|
||||
GTF_TICK_FUNC tickFunc; /* external tick function */
|
||||
void * tickArg; /* second arg to external tick function */
|
||||
SL_LIST timerBlocks; /* blocks of memory for allocated timers */
|
||||
L_NODE * timerListMemory; /* Memory allocated for the heads of the */
|
||||
/* timer lists, for use when deleting the */
|
||||
/* manager */
|
||||
spinlockIsr_t lock; /* manager lock */
|
||||
} GTF_TIMER_MANAGER;
|
||||
|
||||
typedef struct gtfTimer
|
||||
{
|
||||
union
|
||||
{
|
||||
L_NODE expNode; /* node of expire list */
|
||||
SL_NODE freeNode; /* node of free queue */
|
||||
} timerLinking;
|
||||
unsigned int timerTicks; /* timer ticks */
|
||||
unsigned int timerUnit; /* timer unit */
|
||||
unsigned int timerFlags; /* timer flags */
|
||||
GTF_TIMER_HANDLER handler; /* timer handler */
|
||||
void* arg; /* argument to timer handler */
|
||||
} GTF_TIMER;
|
||||
|
||||
extern unsigned long _WRS_FASTDATA netGtfSeconds;
|
||||
|
||||
extern GTF_TIMER_MANAGER *
|
||||
gtfTimerManagerCreate(unsigned int nbrTimerUnit,
|
||||
unsigned int binPowTimerSlot,
|
||||
unsigned int binPowGranScale,
|
||||
unsigned int sizeTimerFreeQueue,
|
||||
unsigned int hertz,
|
||||
GTF_TICK_FUNC tickFunc,
|
||||
void * tickArg
|
||||
);
|
||||
|
||||
extern int gtfTimerManagerRun(GTF_TIMER_MANAGER *tm);
|
||||
|
||||
extern int gtfBookkeeping(GTF_TIMER_MANAGER *tm);
|
||||
|
||||
extern int gtfTimerManagerDelete(GTF_TIMER_MANAGER *tm);
|
||||
|
||||
extern GTF_TIMER *gtfTimerCreate(GTF_TIMER_MANAGER *tm);
|
||||
|
||||
extern int gtfTimerInit(GTF_TIMER_MANAGER* tm,
|
||||
GTF_TIMER *t,
|
||||
unsigned int toTicks,
|
||||
GTF_TIMER_HANDLER th,
|
||||
void* arg
|
||||
);
|
||||
|
||||
extern int gtfTimerDelete(GTF_TIMER_MANAGER *tm,
|
||||
GTF_TIMER *t);
|
||||
|
||||
extern int gtfTimerStart(GTF_TIMER_MANAGER *tm,
|
||||
GTF_TIMER *t
|
||||
);
|
||||
|
||||
extern int gtfTimerReset(GTF_TIMER_MANAGER* tm,
|
||||
GTF_TIMER *t,
|
||||
unsigned int toTicks,
|
||||
GTF_TIMER_HANDLER th,
|
||||
void* arg
|
||||
);
|
||||
|
||||
extern int gtfTimerCancel(GTF_TIMER_MANAGER *tm,
|
||||
GTF_TIMER *t
|
||||
);
|
||||
|
||||
extern int gtfShow(GTF_TIMER_MANAGER *tm);
|
||||
|
||||
extern int gtfGetNbrFiredTimer(GTF_TIMER_MANAGER *tm,
|
||||
unsigned int timerUnit
|
||||
);
|
||||
|
||||
extern int gtfGetNbrOutstandTimer(GTF_TIMER_MANAGER *tm,
|
||||
unsigned int timerUnit
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCgtf_coreh */
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/* gtf_util.h - general timer facility - utility */
|
||||
|
||||
/*
|
||||
* Copyright 1984-2005, 2010 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute or otherwise make use of this software
|
||||
* may be licensed only pursuant to the terms of an applicable Wind River
|
||||
* license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01k,10nov10,dlk Move extern "C" after last header file include. WIND00240828.
|
||||
01j,31jan05,sar Fix defects found in GTF code inspection of 10/26/2004
|
||||
as described in SPRs 106685 - 105688
|
||||
01i,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01h,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/1)
|
||||
01g,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01f,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01e,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01c,10jun03,vvv include netVersion.h
|
||||
01b,15jan02,pas GTF_REQUIRE[_2] should test the condition even if
|
||||
it's not logging the errors
|
||||
01a,06jun01,deg written.
|
||||
*/
|
||||
|
||||
#ifndef __INCgtf_utilh
|
||||
#define __INCgtf_utilh
|
||||
|
||||
#include <netVersion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
#ifdef GTF_WITH_DEBUG
|
||||
#define GTF_PRINT(s1,s2) PRINTF("**** %s : %10ld\n",s1, (unsigned long) s2)
|
||||
#else
|
||||
#define GTF_PRINT(s1,s2)
|
||||
#endif
|
||||
|
||||
#if ! defined (_FREE_VERSION)
|
||||
|
||||
#ifdef GTF_WITH_REQUIRE
|
||||
#define GTF_REQUIRE(cond, func, diag, retVal) if(!(cond)) \
|
||||
{ \
|
||||
GTF_ERROR_LOG(func, diag); \
|
||||
return (retVal); \
|
||||
}
|
||||
#define GTF_REQUIRE_2(cond, func, diag) if(!(cond)) \
|
||||
{ \
|
||||
GTF_ERROR_LOG(func, diag); \
|
||||
return; \
|
||||
}
|
||||
#else /* GTF_WITH_REQUIRE */
|
||||
#define GTF_REQUIRE(cond, func, diag, retVal) if(!(cond)) \
|
||||
{ \
|
||||
return (retVal); \
|
||||
}
|
||||
#define GTF_REQUIRE_2(cond, func, diag) if(!(cond)) \
|
||||
{ \
|
||||
return; \
|
||||
}
|
||||
#endif /* GTF_WITH_REQUIRE */
|
||||
|
||||
#else /* defined (_FREE_VERSION) */
|
||||
|
||||
#define GTF_REQUIRE(cond, func, diag, retVal) do {} while (0)
|
||||
#define GTF_REQUIRE_2(cond, func, diag) do {} while (0)
|
||||
|
||||
#endif /* defined (_FREE_VERSION) */
|
||||
|
||||
#define GTF_ERROR_LOG(func, diag) gtfErrorLog(__FILE__, func,__LINE__, diag);
|
||||
|
||||
|
||||
|
||||
extern void gtfErrorLog(char *file,
|
||||
char *function,
|
||||
int line,
|
||||
char *diagnose
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCgtf_utilh */
|
||||
@@ -0,0 +1,58 @@
|
||||
/* gtf_wrapper.h - general timer facility - wrapper */
|
||||
|
||||
/* Copyright 2001-2003, 2005, 2010 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01i,10nov10,dlk Move extern "C" after last header file include. WIND00240828.
|
||||
01h,31jan05,sar Fix defects found in GTF code inspection of 10/26/2004
|
||||
as described in SPRs 106685 - 105688
|
||||
01g,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01f,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01d,23oct03,rlm updated #includes for header re-org
|
||||
01c,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE
|
||||
01b,02feb02,ham changed for tornado build
|
||||
01a,06jun01,deg written.
|
||||
*/
|
||||
|
||||
#ifndef __INCgtf_wrapperh
|
||||
#define __INCgtf_wrapperh
|
||||
|
||||
#include <private/gtf_core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern GTF_TIMER *gtfTimeout(GTF_TIMER_HANDLER th,
|
||||
void* arg,
|
||||
unsigned int toTicks,
|
||||
GTF_TIMER_MANAGER *tm
|
||||
);
|
||||
|
||||
extern void gtfUntimeout(GTF_TIMER_HANDLER th,
|
||||
void* arg,
|
||||
GTF_TIMER *t,
|
||||
GTF_TIMER_MANAGER *tm
|
||||
);
|
||||
|
||||
extern void gtfCalloutReset(GTF_TIMER *t,
|
||||
unsigned int toTicks,
|
||||
GTF_TIMER_HANDLER th,
|
||||
void* arg,
|
||||
GTF_TIMER_MANAGER *tm
|
||||
);
|
||||
|
||||
extern void gtfCalloutStop(GTF_TIMER *t,
|
||||
GTF_TIMER_MANAGER *tm
|
||||
);
|
||||
|
||||
extern void gtfCalloutInit(GTF_TIMER *t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCgtf_wrapperh */
|
||||
@@ -0,0 +1,149 @@
|
||||
/* jobQueueLibP.h - private header file for jobQueueLib */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2007-2008 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01h,15jun12,xhs WIND00137567 - Network job queues can stall if a posting
|
||||
task is deleted at just the wrong time
|
||||
01g,30jul09,dlk WIND00168645 - use deterministic spin locks by default.
|
||||
01f,18jun08,jpb Renamed _WRS_VX_SMP to _WRS_CONFIG_SMP. Added include path
|
||||
for kernel configurations options set in vsb.
|
||||
01e,16jan08,dlk Rename spinLockFastLib --> spinlockIsrNdLib.
|
||||
01d,10dec07,dlk Use fast spin locks.
|
||||
01c,20feb07,kch Merged from base6_iter12_smp-dev - Use spinlocks instead of
|
||||
intLock.
|
||||
01b,13jul05,dlk Added taskId member to JOB_QUEUE.
|
||||
01a,06may05,dlk Written.
|
||||
*/
|
||||
|
||||
/* Note, jobQueueLib.h should be included before this private header */
|
||||
|
||||
#ifndef __INCjobQueueLibPh
|
||||
#define __INCjobQueueLibPh
|
||||
|
||||
#include <vsbConfig.h>
|
||||
|
||||
#include <semLib.h>
|
||||
#include <private/semLibP.h>
|
||||
#include <setjmp.h>
|
||||
#include <intLib.h>
|
||||
|
||||
#ifdef _WRS_CONFIG_SMP
|
||||
#ifdef _WRS_CONFIG_DETERMINISTIC
|
||||
#include <spinLockLib.h>
|
||||
|
||||
#define JOBQ_LOCK(x, key) \
|
||||
do { (void)(key); SPIN_LOCK_ISR_TAKE (x); } while ((0))
|
||||
#define JOBQ_UNLOCK(x, key) \
|
||||
do { SPIN_LOCK_ISR_GIVE (x); (void)(key); } while ((0))
|
||||
#define JOBQ_LOCK_INIT(x) \
|
||||
do { SPIN_LOCK_ISR_INIT (x, 0); } while ((0))
|
||||
#else
|
||||
#include <spinlockIsrNdLib.h>
|
||||
|
||||
#define JOBQ_LOCK(x, key) \
|
||||
do { key = spinLockIsrNdTake (x); } while ((0))
|
||||
#define JOBQ_UNLOCK(x, key) \
|
||||
do { spinLockIsrNdGive ((x), (key)); } while ((0))
|
||||
#define JOBQ_LOCK_INIT(x) \
|
||||
do { spinLockIsrNdInit (x); } while ((0))
|
||||
#endif /* _WRS_CONFIG_DETERMINISTIC */
|
||||
|
||||
#else /* Uniprocessor */
|
||||
|
||||
#define JOBQ_LOCK(x, key) \
|
||||
do { key = INT_CPU_LOCK( ); } while ((0))
|
||||
#define JOBQ_UNLOCK(x, key) \
|
||||
do { INT_CPU_UNLOCK(key); } while ((0))
|
||||
#define JOBQ_LOCK_INIT(x) do { } while ((0))
|
||||
|
||||
#endif /* _WRS_CONFIG_SMP */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define QJOB_ENQUEUED 0x100
|
||||
#define QJOB_POOL_ALLOC 0x200
|
||||
|
||||
typedef struct _QJOB_QUEUE_HEAD
|
||||
{
|
||||
QJOB * pHead;
|
||||
QJOB ** ppTail;
|
||||
} QJOB_QUEUE_HEAD;
|
||||
|
||||
typedef struct _QJOB_FREE_HEAD
|
||||
{
|
||||
QJOB_STANDARD * pHead;
|
||||
} QJOB_FREE_HEAD;
|
||||
|
||||
typedef QJOB_FREE_HEAD QJOB_BLOCK_HEAD; /* [;^] */
|
||||
|
||||
typedef struct _QJOB_STD_POOL
|
||||
{
|
||||
QJOB_FREE_HEAD free; /* The free list of standard jobs */
|
||||
QJOB_BLOCK_HEAD blocks; /* The list of blocks of std. jobs */
|
||||
#ifdef _WRS_CONFIG_SMP
|
||||
#ifdef _WRS_CONFIG_DETERMINISTIC
|
||||
spinlockIsr_t * qLock;
|
||||
#else
|
||||
spinlockIsrNd_t * qLock;
|
||||
#endif
|
||||
#endif
|
||||
UINT32 refCount; /* How many attached job queues? */
|
||||
} QJOB_STD_POOL;
|
||||
|
||||
typedef struct _QUIT_QJOB
|
||||
{
|
||||
QJOB job;
|
||||
volatile int * pQuitValue;
|
||||
jmp_buf * pJmpBuf;
|
||||
VOIDFUNCPTR qFunc;
|
||||
void * arg1;
|
||||
void * arg2;
|
||||
} QUIT_QJOB;
|
||||
|
||||
typedef struct _JOB_QUEUE
|
||||
{
|
||||
QJOB_QUEUE_HEAD jobs [32]; /* The enqueued jobs */
|
||||
UINT32 activePri; /* which queues hold jobs? */
|
||||
#ifdef JOBQ_PRI_MASKABLE
|
||||
UINT32 priMask; /* which priorities are enabled? */
|
||||
#endif
|
||||
QJOB_STD_POOL * pStdPool; /* pool for standard jobs */
|
||||
SEMAPHORE sem; /* binary semaphore */
|
||||
QJOB_BLOCK_HEAD blocks; /* list of blocks of standard jobs */
|
||||
UINT32 flags; /* Is queue in use? */
|
||||
#define JOBQ_FLG_RUNNING 0x1
|
||||
#define JOBQ_FLG_CREATED 0x2
|
||||
#define JOBQ_FLG_AWAKE 0x4
|
||||
TASK_ID taskId; /* Task currently running */
|
||||
/* jobQueueProcess(). */
|
||||
|
||||
QUIT_QJOB quitJob;
|
||||
void * userVal; /* reserved for queue creator */
|
||||
#ifdef _WRS_CONFIG_SMP
|
||||
#ifdef _WRS_CONFIG_DETERMINISTIC
|
||||
spinlockIsr_t qLock;
|
||||
#else
|
||||
spinlockIsrNd_t qLock;
|
||||
#endif
|
||||
#endif
|
||||
} JOB_QUEUE;
|
||||
|
||||
#define QUIT_JOB_TO_JOB_QUEUE(q) \
|
||||
((JOB_QUEUE *)((char *)(q) - offsetof (JOB_QUEUE, quitJob)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCjobQueueLibPh */
|
||||
@@ -0,0 +1,299 @@
|
||||
/* muxL2VlanLibP.h - private definitions for the L2 VLAN MUX library */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2007 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01i,30jul07,kch Added MUX-L2 hardware capabilities macros.
|
||||
01h,30sep05,kch Added portCfi member to MUX_L2_PORT.
|
||||
01g,15sep05,kch Moved MAX_VID, MIN_VID, MAX_VID, MIN_USER_PRIORITY,
|
||||
MAX_USER_PRIORITY, IS_VALID_VID and IS_VALID_PRORITY macros
|
||||
to muxL2Lib.h (SPR #112513).
|
||||
01f,14sep05,kch Changed MUX_L2_VLAN_STATISTICS define to MUX_L2_VLAN_STAT.
|
||||
Also renamed MUX_L2_VLAN_STAT structure tag to
|
||||
MUX_L2_VLAN_PORT_STAT (SPR #112513).
|
||||
01e,07sep05,kch Replaced vlanHwTaggingSupport and vlanMtuSupport booleans
|
||||
with hwCaps that uses bit fields.
|
||||
01d,27aug05,kch Renamed vlan id defines to reflect its actual usage.
|
||||
01c,24aug05,kch Added MUX_L2_VLAN_STAT data structure and related macros.
|
||||
Also added muxL2PortInDiscards and muxL2PortOutDiscards
|
||||
to MUX_L2_PORT.
|
||||
01b,23aug05,kch Added hwMtu as well as pointer to END_OBJ and NET_FUNCS
|
||||
to MUX_L2_PORT. Moved vlan tag related macros to muxL2Lib.h.
|
||||
01a,20jul05,kch written.
|
||||
*/
|
||||
|
||||
#ifndef __INCmuxL2VlanLibPh
|
||||
#define __INCmuxL2VlanLibPh
|
||||
|
||||
#include <muxL2Lib.h>
|
||||
#include <endLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
|
||||
/* possible ethernet frame format */
|
||||
typedef enum {
|
||||
ETHER_TYPE2_FRAME_FORMAT = 0x01,
|
||||
ETHER_8023_FRAME_FORMAT,
|
||||
UNKNOWN_FRAME_FORMAT
|
||||
} ETHER_FRAME_FORMAT;
|
||||
|
||||
typedef enum {
|
||||
VLAN_TAGGED_FRAME = 1,
|
||||
PRIORITY_TAGGED_FRAME,
|
||||
UNTAGGED_FRAME,
|
||||
INVALID_TAGGED_FRAME
|
||||
} ETHER_FRAME_TYPE;
|
||||
|
||||
/* defines */
|
||||
#define LLC_SNAP_FRAME_LEN 8
|
||||
|
||||
/*
|
||||
* LLC with DSAP and SSAP of 0x42 is reserved for IEEE 802.1 use.
|
||||
* These 802.3 ethernet encapsulation is used by Layer 2 protocols
|
||||
* such as STP, GVRP, and GMRP.
|
||||
*/
|
||||
#define LLC_SAP 0x42
|
||||
|
||||
#define RESERVED_VID 4095 /* for internal use */
|
||||
|
||||
|
||||
/*
|
||||
* The following defines are the default port-base vlan setting maintained
|
||||
* by the Layer 2 MUX.
|
||||
*/
|
||||
#define DEFAULT_PORT_VID 1
|
||||
#define DEFAULT_PORT_USER_PRIORITY 0
|
||||
#define DEFAULT_PORT_INGRESS_TYPE ADMIT_ALL_FRAMES
|
||||
#define DEFAULT_PORT_INGRESS_FILTER FALSE
|
||||
#define DEFAULT_PORT_EGRESS_TYPE UNTAGGED_FRAME
|
||||
|
||||
/*
|
||||
* Marco for MUX-L2 Hardware L2 capabilities (used internally). These
|
||||
* hardware capabilities macros are added to provide additional flexbility
|
||||
* to MUX-L2 to distinguish the hardware (vlan tagging) capabilities for
|
||||
* ingress and egress.
|
||||
*/
|
||||
|
||||
/* hardware supports VLAN-compatible MTU */
|
||||
#define MUX_L2_HW_CAP_VLAN_MTU 0x01
|
||||
|
||||
/*
|
||||
* hardware supports extracting vlan tag from the received frame and stores
|
||||
* the vlan tag information in m_pkthdr.vlan in host-byte order with the
|
||||
* CSUM_VLAN CSUM flags set. The ethernet header from the received frame will
|
||||
* be untagged.
|
||||
*/
|
||||
#define MUX_L2_HW_CAP_TAGGING_RX 0x02
|
||||
|
||||
/*
|
||||
* hardware supports inserting vlan tag to ethernet header on egress using
|
||||
* vlan tag information that is stored in m_pkthdr.vlan (in host-byte order)
|
||||
* if the CSUM_VLAN CSUM flags is set.
|
||||
*/
|
||||
#define MUX_L2_HW_CAP_TAGGING_TX 0x04
|
||||
|
||||
#ifdef MUX_L2_VLAN_STATS
|
||||
typedef struct mux_l2_vlan_port_stat
|
||||
{
|
||||
/*
|
||||
* The number of valid frames received by this port which were classified
|
||||
* as belonging to this vlan.
|
||||
* RFC2674 MIB object: dot1qTpVlanPortInFrames
|
||||
*/
|
||||
unsigned long muxL2VlanPortInFrames;
|
||||
|
||||
/*
|
||||
* The number of valid frames transmitted by this port for this vlan.
|
||||
* RFC2674 MIB object: dot1qTpVlanPortOutFrames
|
||||
*/
|
||||
unsigned long muxL2VlanPortOutFrames;
|
||||
|
||||
/*
|
||||
* The number of valid frames received by this port which were classified
|
||||
* as belonging to this vlan but were discarded due to vlan related
|
||||
* reasons. Specifically, the IEEE 802.1Q counters for Discard Inbound.
|
||||
* RFC2674 MIB object: dot1qTpVlanPortInDiscards
|
||||
* The description for the MIB object specifies that this object also
|
||||
* implements the IEEE 802.1Q counter for Discard Ingress Filtering.
|
||||
* We don't keep track that here because if a frame is discarded by
|
||||
* ingress filtering, the port is not a member of the vlan, hence,
|
||||
* the MUX_L2_VLAN_STAT is not allocated for that vlan for the port.
|
||||
*/
|
||||
unsigned long muxL2VlanPortInDiscards;
|
||||
|
||||
} MUX_L2_VLAN_PORT_STAT;
|
||||
|
||||
#endif /* MUX_L2_VLAN_STATS */
|
||||
|
||||
|
||||
/*
|
||||
* L2 per-port configuration
|
||||
*/
|
||||
typedef struct mux_l2_port
|
||||
{
|
||||
END_OBJ *pEnd; /* pointer back to the device's (END_OBJ *) */
|
||||
|
||||
/*
|
||||
* The Port VLAN ID that is assigned to untagged frames or priority-tagged
|
||||
* frames received on this port. Default: 1
|
||||
* RFC2674 MIB object: dot1qPvid
|
||||
*/
|
||||
unsigned short portVid; /* Valid Vid: 1..4094 */
|
||||
|
||||
/*
|
||||
* The default ingress User Priority for this port (assuming Ethernet
|
||||
* media). Default: 0
|
||||
* RFC2674 MIB object: dot1dPortDefaultUserPriority
|
||||
*/
|
||||
unsigned short portUpriority; /* Valid Priority: 0..7 */
|
||||
|
||||
/*
|
||||
* Canonical format indicator (CFI), 0 or 1.
|
||||
* - in token ring/source-routed FDDI MAC methods, this field is used
|
||||
* to signal the bit order of address information carried in the
|
||||
* encapsulated frame;
|
||||
* - in 802.3/Ethernet and transparent FDDI MAC methods, this field is
|
||||
* used to signal the presence or absence of an Embedded Souce-Routing
|
||||
* Information Field (E-RIF), and in combination with the Non-canonical
|
||||
* Format Indicator (NCFI) carried in the RIF, to signal the bit order
|
||||
* of address information carried in the encapsulated frame.
|
||||
* NOTE: For 802.3/Ethernet, MUX-L2 assumes this bit is always 0. That
|
||||
* is, the received/transmitted tagged frame does not carry any
|
||||
* embedded source routing information.
|
||||
*/
|
||||
unsigned short portCfi;
|
||||
|
||||
/*
|
||||
* When set to ADMIT_TAGGED_ONLY_FRAMES(2), the device will discard
|
||||
* untagged frames or priority-tagged frames received on this port.
|
||||
* When set to ADMIT_ALL_FRAMES(1), untagged frames or priority-tagged
|
||||
* frames received on this port will be accepted and assigned to the
|
||||
* portPvid for this port.
|
||||
* The setting does not affect VLAN independent BPDU frames, such as
|
||||
* GVRP and STP but it does affect VLAN dependent BPDU frames, such as
|
||||
* GMRP. Default: ADMIT_ALL_FRAMES(1)
|
||||
* RFC2674 MIB object: dot1qPortAcceptableFrameTypes
|
||||
*/
|
||||
ACCEPT_FRAME_TYPE portIngressAcceptFrameType;
|
||||
|
||||
/*
|
||||
* When this is true(1) the device will discard incoming frame for
|
||||
* VLANs which do not include this Port in its Member set. When
|
||||
* false(2), the port will accept all incoming frames. Default: false
|
||||
* RFC2674 MIB object: dot1qPortIngressFiltering.
|
||||
*/
|
||||
BOOL portIngressFilter;
|
||||
|
||||
#ifdef VLAN_TAG
|
||||
/* Function pointer for user-defined conversion function to convert
|
||||
* IP TOS field to the 3-bit 802.1Q user priority. The conversion
|
||||
* routine takes the IP TOS value as its input and returns the vlan
|
||||
* user priority value (0-7) that needs to be inserted to the outgoing
|
||||
* vlan tag header.
|
||||
*/
|
||||
unsigned char (*portTos2UpConvRtn) (unsigned char);
|
||||
#endif /* VLAN_TAG */
|
||||
|
||||
/*
|
||||
* VLAN membership for this L2 port. Each array element is a bit map
|
||||
* represents a set of 8 unique VLAN IDs, with the first octet specifies
|
||||
* VID 1 through 8, the second octet specifying VID 9 through 16, etc.
|
||||
* Within each octet, the most significant bit represents the highest
|
||||
* numbered VID. Thus, each VID is represented by a single bit. If that
|
||||
* bit has a value of 1, then this L2 port is the member for that VID;
|
||||
* the port is not a member its bit has a value of 0.
|
||||
*/
|
||||
unsigned char portVidMemberMap[512];
|
||||
|
||||
unsigned int numVid; /* number of vids configured for this port */
|
||||
|
||||
/* hardware layer 2 capabilities flags */
|
||||
unsigned long hwCapabilities;
|
||||
|
||||
/* original driver's NET_FUNCS table */
|
||||
NET_FUNCS *pEndNetFuncs;
|
||||
|
||||
/* driver's address format - Ethernet Type 2 or 802.3 addressing */
|
||||
ETHER_FRAME_FORMAT endAddressFormat;
|
||||
|
||||
int hwMtu; /* hardware mtu size */
|
||||
|
||||
#ifdef MUX_L2_VLAN_STATS
|
||||
MUX_L2_VLAN_PORT_STAT **muxL2VlanStat;
|
||||
|
||||
/*
|
||||
* The number of valid frames received by this port which were discarded
|
||||
* due to reasons such as vlan membership problem or invalid ingress
|
||||
* frame type. Specifically, this implements the IEEE 802.1Q counter for
|
||||
* Discard Ingress Filtering.
|
||||
*/
|
||||
unsigned long muxL2PortInDiscards;
|
||||
|
||||
/*
|
||||
* The number of valid frames transmitted by this port which were
|
||||
* discarded due to reasons such as vlan membership problem or invalid
|
||||
* egress frame type
|
||||
*/
|
||||
unsigned long muxL2PortOutDiscards;
|
||||
#endif /* MUX_L2_VLAN_STATS */
|
||||
|
||||
} MUX_L2_PORT;
|
||||
|
||||
#ifdef MUX_L2_VLAN_STATS
|
||||
|
||||
/*
|
||||
* Macros for MUX_L2_VLAN_STAT statistics that apply to the port/vlan pairing
|
||||
*/
|
||||
#define MUX_L2_VLAN_PORT_IN_FRAMES_COUNT(vlps) \
|
||||
{ \
|
||||
if ((vlps) != NULL) \
|
||||
(vlps)->muxL2VlanPortInFrames++; \
|
||||
}
|
||||
|
||||
#define MUX_L2_VLAN_PORT_OUT_FRAMES_COUNT(vlps) \
|
||||
{ \
|
||||
if ((vlps) != NULL) \
|
||||
(vlps)->muxL2VlanPortOutFrames++; \
|
||||
}
|
||||
|
||||
#define MUX_L2_VLAN_PORT_IN_DISCARDS_COUNT(vlps) \
|
||||
{ \
|
||||
if ((vlps) != NULL) \
|
||||
(vlps)->muxL2VlanPortInDiscards++; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Macro for MUX_L2_PORT statistics that apply to the port
|
||||
*/
|
||||
#define MUX_L2_PORT_IN_DISCARDS_COUNT(vlp) vlp->muxL2PortInDiscards++;
|
||||
#define MUX_L2_PORT_OUT_DISCARDS_COUNT(vlp) vlp->muxL2PortOutDiscards++
|
||||
|
||||
#else /* MUX_L2_VLAN_STATS not defined */
|
||||
|
||||
#define MUX_L2_VLAN_PORT_IN_FRAMES_COUNT(vlps)
|
||||
#define MUX_L2_VLAN_PORT_OUT_FRAMES_COUNT(vlps)
|
||||
#define MUX_L2_VLAN_PORT_IN_DISCARDS_COUNT(vlps)
|
||||
#define MUX_L2_PORT_IN_DISCARDS_COUNT(vlp)
|
||||
#define MUX_L2_PORT_OUT_DISCARDS_COUNT(vlp)
|
||||
|
||||
#endif /* MUX_L2_VLAN_STATS */
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCmuxL2VlanLibPh */
|
||||
@@ -0,0 +1,259 @@
|
||||
/* muxLibP.h - private definitions for the MUX library */
|
||||
|
||||
/* Copyright 1998-2001, 2003, 2005, 2007-2008, 2010 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
02n,29may12,xhs Fix memory leak, defect WIND00340041
|
||||
02m,10nov10,dlk Move extern "C" after last header file include. WIND00240828.
|
||||
02l,28mar08,dlk Moved BIND_STYLE_* macros to muxLib.h for muxProtoInfoGet().
|
||||
02k,22mar08,dlk MUX2 redesign. 1st checkin.
|
||||
02j,12oct07,dlk Made muxEndRxJobQueue() public.
|
||||
02i,25aug05,dlk Add section tags.
|
||||
02h,27jul05,dlk Added muxEndRxJobQueue(). May be temporary.
|
||||
02g,21nov03,wap Merge in changes from Snowflake
|
||||
02f,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
02e,04nov03,rlm Ran batch header path update for header re-org.
|
||||
02d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
02c,01jul03,ann removed obsoleted code
|
||||
02b,10sep01,ann correcting the directory paths
|
||||
02a,15may01,ann major changes as per the MUX design doc for clarinet
|
||||
- obsoleted the BIB and all its associated routines.
|
||||
01r,25feb01,rae RFC2233 changes
|
||||
01q,19apr00,ham merged TOR2_0-NPT-FCS (01a,06oct98,sj-01p,05oct99,pul).
|
||||
01p,05oct99,pul removing rtRequest and mCastMap
|
||||
01o,29apr99,pul Upgraded NPT phase3 code to tor2.0.0
|
||||
01n,24mar99,sj changed tkFlag field in muxBindEntry to flags; added defines
|
||||
01m,24mar99,sj added defines for flags field of NET_PROTOCOL structure
|
||||
01l,18mar99,sj cleaned up: completed the cleanup postponed in 01j,05mar99,sj
|
||||
01k,08mar99,sj added place holder for stackrcv routine in BIB entry
|
||||
01j,05mar99,sj eliminated hooks; not cleanly though. next version will do that
|
||||
01i,24feb99,sj added netSvcType and netDrvType fields to the BIB entry
|
||||
01h,26jan99,sj moved BIB entry definition from muxTkLib.c to here
|
||||
01g,05nov98,sj PCOOKIE_TO_ENDOBJ must check if pCookie is NULL
|
||||
01f,03nov98,pul modified IPPROTO_MCAST_MAP_GET
|
||||
01e,03nov98,sj doc update
|
||||
01d,20oct98,pul don't return ERROR if hook is not valid
|
||||
01c,15oct98,pul added ipProto Hooks
|
||||
01b,12oct98,sj changed MUX_TK_ADDR_RES_FUNC_UPDATE, added WRS_*_MODULE
|
||||
01a,06oct98,sj written.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This file includes macros used by muxLib to avail features of the NPT
|
||||
architecture if it is installed.
|
||||
|
||||
|
||||
INCLUDE FILES:
|
||||
*/
|
||||
|
||||
#ifndef __INCmuxLibPh
|
||||
#define __INCmuxLibPh
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <muxLib.h>
|
||||
|
||||
#ifndef MUX_NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
#define MUX_ASSERT(x) \
|
||||
do { \
|
||||
if (!(x)) \
|
||||
__assert("Assertion failed: "#x", file " \
|
||||
__FILE__ ", line "_ASSERT_STR(__LINE__)"\n"); \
|
||||
} while ((0))
|
||||
#else
|
||||
#define MUX_ASSERT(x) do {} while ((0))
|
||||
#endif /* MUX_NDEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _MUX_END_STYLE_INFO
|
||||
{
|
||||
void * sendWrappers [NUM_BIND_STYLES];
|
||||
void * pollSendWrappers [NUM_BIND_STYLES];
|
||||
void * pollReceiveWrappers [NUM_BIND_STYLES];
|
||||
void * rxRtn;
|
||||
} MUX_END_STYLE_INFO;
|
||||
|
||||
extern MUX_END_STYLE_INFO muxEndStyles [NUM_END_STYLES];
|
||||
|
||||
|
||||
typedef struct _MUX_BIND_STYLE_INFO
|
||||
{
|
||||
void * sendFilter [NUM_END_STYLES];
|
||||
void * rxWrappers [NUM_END_STYLES];
|
||||
void * snarfWrappers [NUM_END_STYLES];
|
||||
} MUX_BIND_STYLE_INFO;
|
||||
|
||||
extern MUX_BIND_STYLE_INFO muxBindStyles [NUM_BIND_STYLES];
|
||||
|
||||
/*
|
||||
* This structure is a row in our run time END table.
|
||||
* Each row contains all the units started on a particular named device.
|
||||
* I.e. all devices that are Lance 7990 Ethernet will be in the list
|
||||
* off of the row with the name "ln".
|
||||
*/
|
||||
|
||||
typedef struct end_tbl_row
|
||||
{
|
||||
NODE node; /* Needed by our list processing library. */
|
||||
char name[END_NAME_MAX]; /* Name of the devices in row. (ln, etc.) */
|
||||
LIST units; /* List of devices, i.e. 0, 1, etc.. */
|
||||
} END_TBL_ROW;
|
||||
|
||||
/* MUX-private bit flags for the muxFlags member in a DEV_OBJ: */
|
||||
|
||||
#define MUX_END_FLAG_LOADING 0x00000001
|
||||
#define MUX_END_FLAG_UNLOADING 0x00000002
|
||||
|
||||
/* we steal these defines from a END driver */
|
||||
|
||||
#define END_IOCTL(pEnd) \
|
||||
(pEnd->pFuncTable->ioctl)
|
||||
|
||||
#define END_ALT_HADDR(pEnd) \
|
||||
((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.phyAddress)
|
||||
#define END_ALT_HADDR_LEN(pEnd) \
|
||||
((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.addrLength)
|
||||
|
||||
|
||||
#define END_HADDR(pEnd) \
|
||||
((pEnd)->mib2Tbl.ifPhysAddress.phyAddress)
|
||||
|
||||
#define END_HADDR_LEN(pEnd) \
|
||||
((pEnd)->mib2Tbl.ifPhysAddress.addrLength)
|
||||
|
||||
#define END_MIB2_TYPE(pEnd) \
|
||||
((pEnd)->mib2Tbl.ifType)
|
||||
|
||||
typedef struct proto_entry PROTO_ENTRY; /* forward declaration typedef */
|
||||
|
||||
struct Ipcom_pkt_struct;
|
||||
|
||||
typedef int (*MUX_END_JOBQ_DO_FUNC) (END_OBJ * pEnd, void * arg);
|
||||
|
||||
typedef BOOL (* MUXBIND_PROTO_RX_RTN) (PROTO_COOKIE cookie, long type,
|
||||
M_BLK_ID pMblk,
|
||||
LL_HDR_INFO * pLinkHdrInfo,
|
||||
void * callbackArg);
|
||||
typedef BOOL (* MUXTKBIND_PROTO_RX_RTN) (void * callbackArg, long type,
|
||||
M_BLK_ID pMblk, void * pSpareData);
|
||||
typedef BOOL (* MUX2BIND_PROTO_RX_RTN) (void * callbackArg,
|
||||
struct Ipcom_pkt_struct * pkt);
|
||||
|
||||
/*
|
||||
* The PROTOCOL_BINDING structure represents the binding of a protocol to
|
||||
* an END or NPT device. Additional or duplicate information, particularly
|
||||
* that needed for receive, is stored in the PROTO_ENTRY structure in the
|
||||
* interface's protocol table. The PROTO_ENTRY structure in turn contains
|
||||
* a pointer back to this structure.
|
||||
*/
|
||||
typedef struct protocol_binding
|
||||
{
|
||||
END_OBJ * pEnd; /* Interface to which protocol is bound */
|
||||
PROTO_ENTRY * pEntry; /* information needed by receive */
|
||||
UINT16 netSvcType; /* Network service type */
|
||||
UINT8 flags;
|
||||
UINT8 bindStyle; /* BIND_STYLE_{MUXBIND|MUXTKBIND|MUX2} */
|
||||
void * netCallbackId; /* Callback ID passed to muxBind */
|
||||
BOOL (*stackRcvRtn) (); /* protocol's receive routine */
|
||||
STATUS (*stackTxRestartRtn) (); /* Callback for restarting blocked tx. */
|
||||
STATUS (*stackShutdownRtn) (); /* The routine to call to shutdown */
|
||||
/* the protocol stack. */
|
||||
void (*stackErrorRtn) (); /* Callback for device errors/events */
|
||||
long netIfType; /* Interface type */
|
||||
END_OUTPUT_FILTER outFilter; /* Used for MUX_PROTO_OUTPUT protocols */
|
||||
char name[END_PROTO_NAME_MAX]; /* String name for this protocol. */
|
||||
} PROTOCOL_BINDING;
|
||||
|
||||
/*
|
||||
* Each device has a table of PROTO_ENTRY structures corresponding to
|
||||
* the protocols bound to it. This structure contains information needed
|
||||
* for receive, as well as a pointer to the corresponding PROTOCOL_BINDING
|
||||
* structure. The caching of information needed for receive in the small
|
||||
* PROTO_ENTRY structure is done purely for performance reasons.
|
||||
*
|
||||
* The protocol receive routine stored in the PROTO_ENTRY is in certain
|
||||
* cases a wrapper function around the actual protocol receive routine.
|
||||
*/
|
||||
|
||||
struct proto_entry
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 reserved;
|
||||
|
||||
union /* protocol receive routine */
|
||||
{
|
||||
void * generic;
|
||||
MUXBIND_PROTO_RX_RTN endRcv;
|
||||
MUXTKBIND_PROTO_RX_RTN nptRcv;
|
||||
MUX2BIND_PROTO_RX_RTN end2Rcv;
|
||||
} rr;
|
||||
|
||||
void * recvRtnArg;
|
||||
|
||||
PROTOCOL_BINDING * pBinding;
|
||||
};
|
||||
|
||||
/* A little bit of backwards compatibility */
|
||||
|
||||
typedef PROTOCOL_BINDING * MUX_ID;
|
||||
|
||||
/*
|
||||
* Convert from a void * cookie (which is a PROTOCOL_BINDING) to an
|
||||
* END_OBJ pointer:
|
||||
*/
|
||||
|
||||
#define PCOOKIE_TO_ENDOBJ(pCookie) ((pCookie) ? ((MUX_ID)pCookie)->pEnd : NULL)
|
||||
|
||||
/*
|
||||
* Note, a device cookie returned by muxDevLoad(), passed to muxDevStart(),
|
||||
* etc., is not the same as a binding cookie returned by muxBind().
|
||||
* Presently, a device cookie is just a pointer to the END_OBJ.
|
||||
*/
|
||||
|
||||
#define PDEVCOOKIE_TO_ENDOBJ(pCookie) ((END_OBJ *)(pCookie))
|
||||
|
||||
/*
|
||||
* These macros are used by muxAddrRecFuncXXX functions
|
||||
*/
|
||||
#define TK_ADDR_RES_GET 1
|
||||
#define TK_ADDR_RES_ADD 2
|
||||
#define TK_ADDR_RES_DEL 3
|
||||
|
||||
/* global variables */ /* XXX dlk - needed? */
|
||||
|
||||
extern SEM_ID muxLock;
|
||||
|
||||
/* prototypes */
|
||||
|
||||
extern STATUS muxTkLibInit (void);
|
||||
extern void * muxBindCommon (int bindStyle, char * pName, int unit,
|
||||
BOOL (*stackRcvRtn) (),
|
||||
STATUS (*stackShutdownRtn) (),
|
||||
STATUS (*stackTxRestartRtn) (),
|
||||
void (*stackErrorRtn) (), long type,
|
||||
char * pProtoName, void * pNetCallbackId,
|
||||
void * pNetSvcInfo, void * pNetDrvInfo);
|
||||
|
||||
extern long muxIfTypeGet (END_OBJ * pEnd);
|
||||
extern int muxEndJobQDo (END_OBJ * pEnd, MUX_END_JOBQ_DO_FUNC func,
|
||||
void * arg);
|
||||
|
||||
extern struct Ipcom_pkt_struct * muxMblkToIpcomPktTx (M_BLK * pMblk);
|
||||
extern M_BLK * muxIpcomPktToMblkTx (struct Ipcom_pkt_struct * pkt);
|
||||
extern void muxRestoreIpcomPktFromMblkTx(M_BLK * pMblk, struct Ipcom_pkt_struct *pkt);
|
||||
extern void muxIpcomPktFreeMblk (void * buf, M_BLK * pMblk);
|
||||
extern void vxmux_mux_mblk_init (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCmuxLibPh */
|
||||
Reference in New Issue
Block a user