original files of m241
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
/* Copyright 2005-2007 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright 1998 Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby
|
||||
* granted, provided that both the above copyright notice and this
|
||||
* permission notice appear in all copies, that both the above
|
||||
* copyright notice and this permission notice appear in all
|
||||
* supporting documentation, and that the name of M.I.T. not be used
|
||||
* in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission. M.I.T. makes
|
||||
* no representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
|
||||
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
||||
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/net/if_vlan_var.h,v 1.5.2.4 2004/09/09 16:57:33 yar Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01e,11jul07,kch Restore vlan priority support to vlanreq structure.
|
||||
01d,12dec06,kch Cleanup for IPNet integration.
|
||||
01c,27aug05,kch Added vlr_upriority and vlr_flags to vlanreq structure.
|
||||
01b,19aug05,kch Removed vlan tag macros.
|
||||
01a,28jul05,kch Ported from FreeBSD.
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_VLAN_VAR_H_
|
||||
#define _NET_IF_VLAN_VAR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls.
|
||||
*/
|
||||
struct vlanreq {
|
||||
char vlr_parent[IFNAMSIZ];
|
||||
u_short vlr_tag; /* 12-bit vlan id, 1..4094, 0 for priority-tagged */
|
||||
u_short vlr_pri; /* 3-bit vlan priority, 0..7 */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _NET_IF_VLAN_VAR_H_ */
|
||||
@@ -0,0 +1,166 @@
|
||||
/* jobQueueLib.h - header file for the prioritized job queueing library */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005-2007, 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
|
||||
--------------------
|
||||
01f,10nov10,dlk Move extern "C" after last header file include. WIND00240828.
|
||||
01e,11oct07,dlk Added _func_netDaemonIxToQId and _func_netDaemonQIdToIx
|
||||
declarations.
|
||||
01d,22jun06,dlk Add jobQueueUtilInit() prototype.
|
||||
01c,25aug05,dlk Add section tags.
|
||||
01b,13jul05,dlk Added member_to_object() and QJOB_IS_BUSY() definitions.
|
||||
Added 'extern' on prototypes, and jobQueueTask() prototype.
|
||||
01a,14may05,dlk Written.
|
||||
*/
|
||||
|
||||
#ifndef __INCjobQueueLibh
|
||||
#define __INCjobQueueLibh
|
||||
|
||||
#include <taskLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* macros */
|
||||
|
||||
#define member_to_object(pMember, type, memberName) \
|
||||
((type *)((char *)(pMember) - offsetof (type, memberName)))
|
||||
|
||||
#define JOBQ_PRI_MASKABLE /* enable priority masking */
|
||||
|
||||
/*
|
||||
* The QJOB_BUSY bit in the priInfo member of a pre-allocated QJOB may be
|
||||
* used for any purpose by the jobLib client. jobLib does not modify this
|
||||
* bit, and is not affected by it.
|
||||
*/
|
||||
|
||||
#define QJOB_BUSY 0x20 /* managed by client */
|
||||
|
||||
#define QJOB_IS_BUSY(pJob) ((pJob)->priInfo & QJOB_BUSY)
|
||||
#define QJOB_SET_BUSY(pJob) ((pJob)->priInfo |= QJOB_BUSY)
|
||||
#define QJOB_CLEAR_BUSY(pJob) ((pJob)->priInfo &= ~QJOB_BUSY)
|
||||
|
||||
#define QJOB_PRI_LOWEST 0 /* minimum, least urgent priority */
|
||||
#define QJOB_PRI_HIGHEST 31 /* maximum, most urgent priority */
|
||||
#define QJOB_NUM_PRI 32 /* Number of prioritiies */
|
||||
#define QJOB_PRI_MASK 0x1f /* Mask for priority bits */
|
||||
|
||||
#define QJOB_SET_PRI(pJob, pri) \
|
||||
((pJob)->priInfo = ((pJob)->priInfo & ~QJOB_PRI_MASK) | \
|
||||
((pri) & QJOB_PRI_MASK))
|
||||
|
||||
#define QJOB_GET_PRI(pJob) ((pJob)->priInfo & QJOB_PRI_MASK)
|
||||
|
||||
/* types */
|
||||
|
||||
typedef void (* QJOB_FUNC) (void *);
|
||||
|
||||
|
||||
/*
|
||||
* A QJOB is typically a member of a larger structure with information
|
||||
* used by the handler function 'func'. func() is passed a pointer to
|
||||
* the QJOB as its only argument.
|
||||
*/
|
||||
|
||||
typedef struct _QJOB
|
||||
{
|
||||
struct _QJOB * pNext;
|
||||
UINT32 priInfo; /* modify with QJOB_SET_PRI () */
|
||||
QJOB_FUNC func; /* function to execute */
|
||||
} QJOB;
|
||||
|
||||
typedef struct _QJOB_STANDARD
|
||||
{
|
||||
QJOB job;
|
||||
void * arg1;
|
||||
void * arg2;
|
||||
void * arg3;
|
||||
void * arg4;
|
||||
void * arg5;
|
||||
} QJOB_STANDARD;
|
||||
|
||||
struct _JOB_QUEUE;
|
||||
|
||||
typedef struct _JOB_QUEUE * JOB_QUEUE_ID;
|
||||
|
||||
struct _QJOB_STD_POOL;
|
||||
|
||||
typedef struct _QJOB_STD_POOL * QJOB_STD_POOL_ID;
|
||||
|
||||
/*
|
||||
* Functions to convert network daemon index to a job queue ID,
|
||||
* and vice-versa.
|
||||
* Set by daemon.c or possibly other facility.
|
||||
*/
|
||||
|
||||
extern JOB_QUEUE_ID (*_func_netDaemonIxToQId) (int index);
|
||||
|
||||
/* This one returns -1 for failure: */
|
||||
extern int (*_func_netDaemonQIdToIx) (JOB_QUEUE_ID qId);
|
||||
|
||||
/*
|
||||
* Variant of jobQueueProcess() to use. By default this
|
||||
* function pointer points at jobQueueProcess(), but if
|
||||
* jobQueueAdvLib() is included, it may be
|
||||
* point at jobQueueProcessWrapper().
|
||||
*/
|
||||
extern int (* jobQueueProcessFunc) (JOB_QUEUE_ID pJobQ);
|
||||
|
||||
/* function declarations */
|
||||
|
||||
_WRS_INITTEXT
|
||||
extern void jobQueueLibInit (void);
|
||||
_WRS_FASTTEXT
|
||||
extern STATUS jobQueuePost (JOB_QUEUE_ID jobQueueId, QJOB * pJob);
|
||||
_WRS_FASTTEXT
|
||||
extern STATUS jobQueueStdPost (JOB_QUEUE_ID jobQueueId, int pri,
|
||||
VOIDFUNCPTR pFunc, void * arg1, void * arg2,
|
||||
void * arg3, void * arg4, void * arg5);
|
||||
|
||||
extern JOB_QUEUE_ID jobQueueCreate (QJOB_STD_POOL_ID stdPoolId);
|
||||
extern STATUS jobQueueInit (JOB_QUEUE_ID jobQueueId,
|
||||
QJOB_STD_POOL_ID stdPoolId);
|
||||
|
||||
_WRS_FASTTEXT
|
||||
extern int jobQueueProcess (JOB_QUEUE_ID jobQId);
|
||||
extern TASK_ID jobQueueTask (JOB_QUEUE_ID jobQueueId);
|
||||
|
||||
|
||||
#ifdef JOBQ_PRI_MASKABLE
|
||||
extern UINT32 jobQueuePriorityMask (JOB_QUEUE_ID jobQId, UINT32 disablePri,
|
||||
UINT32 enablePri);
|
||||
#endif /* JOBQ_PRI_MASKABLE */
|
||||
|
||||
/* standard pools */
|
||||
extern STATUS jobQueueStdPoolInit (QJOB_STD_POOL_ID stdPoolId);
|
||||
extern STATUS jobQueueStdJobsAlloc (QJOB_STD_POOL_ID stdPoolId,
|
||||
int nStdJobs);
|
||||
|
||||
/* in jobQueueUtilLib */
|
||||
|
||||
extern void jobQueueUtilInit (void);
|
||||
extern STATUS jobQueueQuit (JOB_QUEUE_ID jobQId, int pri, int quitValue,
|
||||
VOIDFUNCPTR pFunc, void * arg1, void * arg2);
|
||||
extern int jobQueueProcessWrapper (JOB_QUEUE_ID jobQId);
|
||||
|
||||
extern STATUS jobQueueDelete (JOB_QUEUE_ID jobQId);
|
||||
extern STATUS jobQueueTerminate (JOB_QUEUE_ID jobQId);
|
||||
|
||||
extern STATUS jobQueueStdPoolJobsFree (QJOB_STD_POOL_ID pStdPool);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCjobQueueLibh */
|
||||
@@ -0,0 +1,32 @@
|
||||
/* l2config.h - header file for l2config utility */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 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
|
||||
--------------------
|
||||
01b,26aug05,kch Added l2configInit() prototype.
|
||||
01a,12aug05,kch written.
|
||||
*/
|
||||
|
||||
#ifndef __INCl2configh
|
||||
#define __INCl2configh
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
IMPORT STATUS l2configInit (void);
|
||||
IMPORT int l2config (char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! __INCl2configh */
|
||||
@@ -0,0 +1,288 @@
|
||||
/* muxL2Lib.h - definitions for the L2 MUX library */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2005 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
|
||||
--------------------
|
||||
01l,30sep05,kch Added cfi to MUX_L2_PORT_VLAN.
|
||||
01k,27sep05,kch Fixed documentation. Also removed the unsupported (unused)
|
||||
MUXL2IOCSFLAGS and MUXL2IOCGFLAGS defines (SPR #112935).
|
||||
01j,15sep05,kch Added MAX_VID, MIN_VID, MAX_VID, MIN_USER_PRIORITY,
|
||||
MAX_USER_PRIORITY, IS_VALID_VID and IS_VALID_PRORITY macros
|
||||
(SPR #112513).
|
||||
01i,31aug05,kch Removed the non-standard global vlan id ioctl commands. Added
|
||||
MUXL2IOCGPORTINFO ioctl command and MUX_L2_PORT_PARAMS
|
||||
structure definition (SPR #112068).
|
||||
01h,26aug05,kch Added EGRESS_FRAME_TYPE enum. Renamed MUX_L2_VLAN structure
|
||||
to MUX_L2_PORT_VLAN. Replaced isEgressUntagged boolean with
|
||||
etype EGRESS_FRAME_TYPE enumeration to handle the default
|
||||
egress tagging state for pvid and other vids correctly.
|
||||
01g,25aug05,kch Added prototypes muxL2PortAltAttach() and
|
||||
muxL2PortTos2UpriorityRegister() for backward compatibility.
|
||||
01f,24aug05,kch Added muxL2StatShow() and muxL2VlanStatShow() prototypes.
|
||||
01e,23aug05,kch Added vlan tag related macros.
|
||||
01d,18aug05,kch Added MUXL2IOCSGLOBALVIDJOIN and MUXL2IOCSGLOBALVIDLEAVE
|
||||
commands.
|
||||
01c,17aug05,kch Added muxL2VlanShow() prototype. Removed argument
|
||||
'verbose' from muxL2Show() prototype.
|
||||
01b,17aug05,kch Added argument 'verbose' to muxL2Show() prototype.
|
||||
01a,28jul05,kch written.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This file includes function prototypes for the Layer 2 MUX.
|
||||
|
||||
INCLUDE FILES:
|
||||
*/
|
||||
|
||||
#ifndef __INCmuxL2Libh
|
||||
#define __INCmuxL2Libh
|
||||
|
||||
#include <cfgDefs.h>
|
||||
#include <muxLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct mux_l2_config_params {
|
||||
CFG_DATA_HDR cfgh;
|
||||
|
||||
/* the number of ports that the device has */
|
||||
int cfg_priv_muxL2NumPorts;
|
||||
|
||||
/* maximum number of 802.1Q VLANs that the device supports */
|
||||
int cfg_priv_muxL2MaxVlanSupport;
|
||||
|
||||
} MUX_L2_CONFIG_PARAMS;
|
||||
|
||||
/*
|
||||
* The length of 802.1Q VAN encapsulation
|
||||
*/
|
||||
#define ETHER_VLAN_ENCAP_LEN 4
|
||||
|
||||
#define VLAN_ID_MASK 0x0fff /* 12 bits vlan id */
|
||||
#define PRIORITY_BITS 0xe000 /* bits 15..13 in the tag */
|
||||
#define PRIORITY_MASK 0x0007 /* 3 bit priority field */
|
||||
|
||||
#define GET_VLAN_ID(qTag) ((qTag) & VLAN_ID_MASK)
|
||||
#define GET_VLAN_USER_PRIORITY(qTag) (((qTag) >> 13) & PRIORITY_MASK)
|
||||
|
||||
/*
|
||||
* 802.1Q VLAN definitions
|
||||
*/
|
||||
#define NULL_VID 0 /* for priority-tagged frame */
|
||||
/*#define MIN_VID 1*/
|
||||
#define MIN_VID 0
|
||||
#define MAX_VID 4094
|
||||
|
||||
/*
|
||||
* The following defines defines the acceptable priority-level for 802.1Q
|
||||
* priority-tagged frame
|
||||
*/
|
||||
#define MIN_USER_PRIORITY 0
|
||||
#define MAX_USER_PRIORITY 7
|
||||
|
||||
/*
|
||||
* Macros for 802.1Q vlan-tag boundary checking
|
||||
*/
|
||||
#define IS_VALID_VID(pvid) ((pvid) <= MAX_VID)
|
||||
#define IS_VALID_PRORITY(up) ((up) <= MAX_USER_PRIORITY)
|
||||
|
||||
/*
|
||||
* Ingress Acceptable Frame Type
|
||||
*/
|
||||
typedef enum {
|
||||
ADMIT_ALL_FRAMES = 1, /* default */
|
||||
ADMIT_TAGGED_ONLY_FRAMES
|
||||
} ACCEPT_FRAME_TYPE;
|
||||
|
||||
/*
|
||||
* Per 802.1Q 8.11.9 (note 2), the default tagging state for the pvid
|
||||
* is untagged, and for all other vids are tagged, unless otherwise
|
||||
* configured.
|
||||
*/
|
||||
typedef enum {
|
||||
EGRESS_NOT_SPECIFIED = 0, /* not specified */
|
||||
EGRESS_TAGGED_FRAMES, /* send vlan-tagged frame for the given vlan */
|
||||
EGRESS_UNTAGGED_FRAMES /* send untagged frame for the given vlan */
|
||||
} EGRESS_FRAME_TYPE;
|
||||
|
||||
/*
|
||||
* <l2Attached> sets to true if a port is attached to the layer 2, false
|
||||
* if the port is detached from layer 2. If <l2Attached> is true for END
|
||||
* device, the interface's if_output routine is expected to use the
|
||||
* pEnd->pFuncTable->formAddress to construct its ethernet header. For
|
||||
* NPT-style device, the <l2Attached> should be ignore for now (actual
|
||||
* bahavior is currently not defined).
|
||||
*
|
||||
* <newMtu> indicates the mtu size upper layer protocols (e.g. IP) should
|
||||
* apply to the interface. The value of the <newMtu>will be set to the
|
||||
* existing hardware mtu size if one of the following applies:
|
||||
* 1) hardware indicates it supports hardware VLAN tagging (e.g. the
|
||||
* IFCAP_VLAN_HWTAGGING in if_capabilities is set), or
|
||||
* 2) hardware doesn't support hardware VLAN tagging but capable of handling
|
||||
* larger mtu that may include a software-appended VLAN header (e.g. the
|
||||
* IFCAP_VLAN_MTU flag is set in if_capabilities)
|
||||
* If none of the above is true, the existing hardware mtu size will be
|
||||
* reduced by 4 bytes and reflects in <newMtu>.
|
||||
*/
|
||||
typedef struct mux_l2_port_params {
|
||||
BOOL l2Attached; /* true if port is attached to layer 2, false if detach */
|
||||
unsigned long newMtu;
|
||||
} MUX_L2_PORT_PARAMS;
|
||||
|
||||
typedef struct mux_l2_port_vlan {
|
||||
unsigned short vid; /* Valid Vid: 1..4094 */
|
||||
unsigned short upriority; /* User Priority, Valid Priority: 0..7 */
|
||||
unsigned short cfi; /* canonical format indicator, 0 or 1 */
|
||||
EGRESS_FRAME_TYPE etype; /* default to untagged if not specified */
|
||||
} MUX_L2_PORT_VLAN;
|
||||
|
||||
typedef struct mux_l2_port_vlan_membership {
|
||||
unsigned short vid; /* VLAN to join/leave/modify */
|
||||
EGRESS_FRAME_TYPE etype; /* default to vlan-tagged if not specified */
|
||||
} MUX_L2_PORT_VLAN_MEMBERSHIP;
|
||||
|
||||
typedef struct mux_l2_port_vlan_member_info {
|
||||
unsigned short vid;
|
||||
BOOL isMember; /* TRUE if port is a member of the vlan */
|
||||
EGRESS_FRAME_TYPE etype; /* egress frame type, tagged or untagged */
|
||||
} MUX_L2_PORT_VLAN_MEMBER_INFO;
|
||||
|
||||
/*
|
||||
* structure passed for SIOCMUXL2PASSTRHU ioctl.
|
||||
*
|
||||
* Required data field for MUX L2 SET ioctl commands:
|
||||
*
|
||||
* MUXL2IOCSPORTATTACH - none
|
||||
* MUXL2IOCSPORTDETACH - none
|
||||
* MUXL2IOCSPORTVLAN - portDefaultVlan.vid, portDefaultVlan.upriority,
|
||||
* portDefaultVlan.etype (optional)
|
||||
* MUXL2IOCSINGRESSFRAMETYPE - portIngressAcceptFrameType
|
||||
* MUXL2IOCSINGRESSFILTER - portIngressFilter
|
||||
* MUXL2IOCSEGRESSFRAMETYPE - portVlanMember.vid, portVlanMember.etype
|
||||
* MUXL2IOCSVLANJOIN - portVlanMember.vid, portVlanMember.etype
|
||||
* MUXL2IOCSVLANLEAVE - portVlanMember.vid, portVlanMember.etype not used
|
||||
*
|
||||
* The following data field(s) are required and will be filled in by the
|
||||
* MUX L2 GET ioctl commands:
|
||||
*
|
||||
* MUXL2IOCGPORTINFO - portInfo.l2Attached portInfo.newMtu
|
||||
* MUXL2IOCGPORTVLAN - portDefaultVlan.vid, portDefaultVlan.upriority,
|
||||
* portDefaultVlan.etype
|
||||
* MUXL2IOCGINGRESSFRAMETYPE - portIngressAcceptFrameType
|
||||
* MUXL2IOCGINGRESSFILTER - portIngressFilter
|
||||
* MUXL2IOCGVLANINFO - portVlanInfo.isMember, portVlanInfo.etype if port is
|
||||
* a member of the specified vid (portVlanInfo.vid
|
||||
* must be provided)
|
||||
*/
|
||||
typedef struct mux_l2_ioctl_req {
|
||||
union {
|
||||
/* layer 2 port parameters */
|
||||
MUX_L2_PORT_PARAMS portInfo;
|
||||
|
||||
/* port-based vlan configuration */
|
||||
MUX_L2_PORT_VLAN portDefaultVlan;
|
||||
|
||||
/* per-port Ingress Acceptable Frame Type */
|
||||
ACCEPT_FRAME_TYPE portIngressAcceptFrameType;
|
||||
|
||||
/* per-port Ingress Rules */
|
||||
BOOL portIngressFilter;
|
||||
|
||||
/* per-port per-VLAN membership configuration */
|
||||
MUX_L2_PORT_VLAN_MEMBERSHIP portVlanMember;
|
||||
|
||||
/* per-port per-VLAN membership information */
|
||||
MUX_L2_PORT_VLAN_MEMBER_INFO portVlanInfo;
|
||||
} data;
|
||||
} MUX_L2_IOCTL_REQ;
|
||||
|
||||
/*
|
||||
* Supported MUX ioctl command for L2 on a per-port basis
|
||||
*
|
||||
* MUXL2IOCSPORTATTACH - create a binding between an END device and L2 MUX
|
||||
* MUXL2IOCSPORTDETACH - detach the specified END device from L2 MUX
|
||||
* MUXL2IOCGPORTINFO - get the device layer 2 port information
|
||||
* MUXL2IOCSPORTVLAN - set the per-port default vid and user priority
|
||||
* MUXL2IOCGPORTVID - get the per-port default vid and user priority
|
||||
* MUXL2IOCSINGRESSFRAMETYPE - set the port Ingress Acceptable Frame Type
|
||||
* MUXL2IOCGINGRESSFRAMETYPE - get the port Ingress Acceptable Frame Type
|
||||
* MUXL2IOCSINGRESSFILTER - set the port Ingress Frame Filtering state
|
||||
* MUXL2IOCGINGRESSFILTER - get the port Ingress Frame Filtering state
|
||||
* MUXL2IOCSEGRESSFRAMETYPE - set Egress Acceptable Frame Type
|
||||
* MUXL2IOCSVLANJOIN - join VLAN membership on a port
|
||||
* MUXL2IOCSVLANLEAVE - leave VLAN membership on a port
|
||||
* MUXL2IOCGVLANINFO - get VLAN membership for a port
|
||||
*/
|
||||
|
||||
#define MUXL2IOCSPORTATTACH _IOW('m', 1, MUX_L2_IOCTL_REQ)
|
||||
#define MUXL2IOCSPORTDETACH _IOW('m', 2, MUX_L2_IOCTL_REQ)
|
||||
#define MUXL2IOCGPORTINFO _IOR('m', 3, MUX_L2_IOCTL_REQ)
|
||||
|
||||
/* port-based vlan get and set commands */
|
||||
#define MUXL2IOCSPORTVLAN _IOW('m', 4, MUX_L2_IOCTL_REQ)
|
||||
#define MUXL2IOCGPORTVLAN _IOR('m', 5, MUX_L2_IOCTL_REQ)
|
||||
|
||||
/* per-port ingress acceptable frame type get and set commands */
|
||||
#define MUXL2IOCSINGRESSFRAMETYPE _IOW('m', 6, MUX_L2_IOCTL_REQ)
|
||||
#define MUXL2IOCGINGRESSFRAMETYPE _IOR('m', 7, MUX_L2_IOCTL_REQ)
|
||||
|
||||
/* per-port ingress filter get and set commands */
|
||||
#define MUXL2IOCSINGRESSFILTER _IOW('m', 8, MUX_L2_IOCTL_REQ)
|
||||
#define MUXL2IOCGINGRESSFILTER _IOR('m', 9, MUX_L2_IOCTL_REQ)
|
||||
|
||||
#define MUXL2IOCSEGRESSFRAMETYPE _IOW('m', 10, MUX_L2_IOCTL_REQ)
|
||||
|
||||
/* per-port vlan membership join/leave get and set commands */
|
||||
#define MUXL2IOCSVLANJOIN _IOW('m', 11, MUX_L2_IOCTL_REQ)
|
||||
#define MUXL2IOCSVLANLEAVE _IOW('m', 12, MUX_L2_IOCTL_REQ)
|
||||
#define MUXL2IOCGVLANINFO _IOR('m', 13, MUX_L2_IOCTL_REQ)
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
|
||||
/* globals */
|
||||
IMPORT MUX_FUNCS _func_mux_l2;
|
||||
IMPORT MUX_L2_CONFIG_PARAMS muxL2DefaultConfigParams;
|
||||
|
||||
|
||||
/* prototypes */
|
||||
|
||||
IMPORT STATUS muxL2LibInit (void *muxL2InitValues);
|
||||
IMPORT STATUS muxL2Ioctl (void* pCookie, int cmd, caddr_t data);
|
||||
IMPORT void * muxL2EndTake (const char * pDevName, int unit);
|
||||
IMPORT void muxL2EndGive (void * pCookie);
|
||||
IMPORT STATUS muxL2PortAttach (char * pDevName, int unit);
|
||||
IMPORT STATUS muxL2PortDetach (char * pDevName, int unit);
|
||||
IMPORT void muxL2Show (char *pDevName, int unit);
|
||||
IMPORT void muxL2VlanShow (unsigned short vid);
|
||||
IMPORT void muxL2StatShow (char *pDevName, int unit);
|
||||
IMPORT void muxL2VlanStatShow (unsigned short vid);
|
||||
|
||||
/* the following prototypes are provided for backward compatibility */
|
||||
IMPORT STATUS muxL2PortAltAttach (char * pDevName, int unit,
|
||||
BOOL updateNetFuncs,
|
||||
M_BLK_ID (*formAddress)(),
|
||||
STATUS (*packetDataGet)(),
|
||||
STATUS (*ingressVlanTagCheck)());
|
||||
#ifdef VLAN_TAG
|
||||
IMPORT STATUS muxL2PortTos2UpriorityRegister (char * pDevName, int unit,
|
||||
unsigned char (*tos2UpriorityConvRtn) (unsigned char));
|
||||
#endif /* VLAN_TAG */
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCmuxL2Libh */
|
||||
@@ -0,0 +1,348 @@
|
||||
/* muxLib.h - definitions for the MUX library */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2008, 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
|
||||
--------------------
|
||||
03w,10nov10,dlk Move extern "C" after last header file include. WIND00240828.
|
||||
03v,28mar08,dlk Added muxProtoInfoGet()/muxProtoListGet().
|
||||
Pass the PROTO_COOKIE also to mux2Bind() protocol shutdown
|
||||
routines.
|
||||
03u,26feb08,dlk MUX2 redesign.
|
||||
03t,12oct07,dlk Made muxEndRxJobQueue() public. Added muxEndQnumGet().
|
||||
Added muxErrorPost(). muxIfFuncBase scalability.
|
||||
03s,20sep07,dlk Added muxLinkUpNotify() and muxLinkDownNotify().
|
||||
03r,02jan07,kch Added muxIterate() prototype.
|
||||
03q,05aug06,kch Cleanup.
|
||||
03p,25aug05,dlk Add section tags.
|
||||
03o,28jul05,dlk Added muxErrorSkip() declaration.
|
||||
03n,20feb05,dlk Added MUX_FUNCS, muxEndTake(), muxEndGive(), MUX_PASSTHRU.
|
||||
03m,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
03l,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/1)
|
||||
03k,24nov03,wap Merge in changes from Snowflake
|
||||
03j,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
03i,04nov03,rlm Ran batch header path update for header re-org.
|
||||
03h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
03g,27oct03,cdw update include statements post header re-org.
|
||||
03f,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE
|
||||
03e,06feb03,vvv merged from tor2_2-patch.alameda, ver02c (SPR #83258)
|
||||
03d,03feb02,ham renamed dummyend.h to end.h.
|
||||
03c,20feb02,ham changed for tornado build.
|
||||
03b,09jan02,ann adding the field for the output function in MUX_ADDR_REC
|
||||
03a,15may01,ann major changes as per MUX design doc for clarinet.
|
||||
added some prototypes. code inherited from AE ver 02c.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This file includes function prototypes for the MUX.
|
||||
|
||||
INCLUDE FILES:
|
||||
*/
|
||||
|
||||
#ifndef __INCmuxLibh
|
||||
#define __INCmuxLibh
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <vsbConfig.h>
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
#include <end.h>
|
||||
#else
|
||||
#include <endCommon.h>
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defints */
|
||||
|
||||
/* MUX_MAX_IFTYPE associates with IFT_MAX_TYPE as default. If the user wants
|
||||
* to add a resource function, verify it's smaller than MUX_MAX_IFTYPE.
|
||||
*/
|
||||
|
||||
#define MUX_MAX_IFTYPE M2_ifType_pmp
|
||||
|
||||
/* Error defines. */
|
||||
#define S_muxLib_LOAD_FAILED (M_muxLib | 1)
|
||||
#define S_muxLib_NO_DEVICE (M_muxLib | 2)
|
||||
#define S_muxLib_INVALID_ARGS (M_muxLib | 3)
|
||||
#define S_muxLib_ALLOC_FAILED (M_muxLib | 4)
|
||||
#define S_muxLib_ALREADY_BOUND (M_muxLib | 5)
|
||||
#define S_muxLib_UNLOAD_FAILED (M_muxLib | 6)
|
||||
#define S_muxLib_NOT_A_TK_DEVICE (M_muxLib | 7)
|
||||
#define S_muxLib_NO_TK_DEVICE (M_muxLib | 8)
|
||||
#define S_muxLib_END_BIND_FAILED (M_muxLib | 9)
|
||||
#define S_muxLib_MISSING_WRAPPERS (M_muxLib | 10)
|
||||
|
||||
|
||||
/* These are above all SAPs but still in the ethernet size range */
|
||||
/* so won't interfere with RFC 1700 */
|
||||
#define MUX_PROTO_PROMISC 0x100
|
||||
#define MUX_PROTO_SNARF 0x101
|
||||
#define MUX_PROTO_OUTPUT 0x102
|
||||
|
||||
/*
|
||||
* Note that these bind styles are correlated in number
|
||||
* and order with the END styles in endCommon.h
|
||||
*/
|
||||
#define BIND_STYLE_MUX2BIND 0
|
||||
#define BIND_STYLE_MUXBIND 1
|
||||
#define BIND_STYLE_MUXTKBIND 2
|
||||
|
||||
/* NUM_BIND_STYLES is defined as 3 in end.h */
|
||||
|
||||
/*
|
||||
* The following defines are used for the various if-protocol functions
|
||||
* that are maintained by the MUX function table.
|
||||
*/
|
||||
|
||||
#define ADDR_RES_FUNC 1
|
||||
#define IF_OUTPUT_FUNC 2
|
||||
#define MULTI_ADDR_RES_FUNC 4
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/* structure passed for SIOCMUXPASSTRHU ioctl */
|
||||
|
||||
typedef struct _MUX_PASSTHRU
|
||||
{
|
||||
char name[END_NAME_MAX]; /* device name, without unit number */
|
||||
int unit; /* unit number. */
|
||||
u_int cmd; /* Tunnelled ioctl command. Must properly
|
||||
encode size and IOC_IN/IOC_OUT/IOC_VOID,
|
||||
and IOC_USER must be set if RTP access is
|
||||
allowed. */
|
||||
void * pData; /* Tunnelled ioctl data argument */
|
||||
} MUX_PASSTHRU;
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
|
||||
/*
|
||||
* These data structures define the 2D list of address resolution
|
||||
* functions. This list is ordered by ifType and the protocol.
|
||||
*/
|
||||
typedef struct mux_addr_rec
|
||||
{
|
||||
NODE node;
|
||||
long protocol;
|
||||
int setFuncs;
|
||||
FUNCPTR addrResFunc;
|
||||
FUNCPTR ifOutputFunc;
|
||||
FUNCPTR multiAddrResFunc;
|
||||
} MUX_ADDR_REC;
|
||||
|
||||
/* function pointers for scalability */
|
||||
|
||||
typedef struct _MUX_FUNCS
|
||||
{
|
||||
void * (*endTake) (const char * pName, int unit);
|
||||
void (*endGive) (void * pCookie);
|
||||
int (*ioctl) (void* pCookie, int cmd, caddr_t data);
|
||||
/* ADD MORE HERE AS NEEDED */
|
||||
} MUX_FUNCS;
|
||||
|
||||
/*
|
||||
* PROTO_COOKIE is the opaque pointer type returned by mux2Bind(),
|
||||
* muxBind(), and muxTkBind(). It represents the binding of a protocol
|
||||
* to a network device. It is used in calls to muxIoctl(), muxUnbind(),
|
||||
* muxSend(), muxPollSend(), muxPollReceive(), muxTkSend(), muxTkPollSend(),
|
||||
* muxTkPollReceive(), muxMCastAddrAdd(), muxMCastAddrDel(),
|
||||
* muxMCastAddrGet(), muxLinkHeaderCreate(), muxAddressForm(),
|
||||
* muxPacketDataGet(), and muxPacketAddrGet().
|
||||
*
|
||||
* Note that mux2Send(), mux2PollSend(), and mux2PollReceive() require
|
||||
* a DEV_COOKIE, not a PROTO_COOKIE.
|
||||
*/
|
||||
typedef void * PROTO_COOKIE;
|
||||
|
||||
/*
|
||||
* DEV_COOKIE is the opaque pointer type returned by muxDevLoad() and
|
||||
* muxDevAcquire(), and passed to muxDevRelease(), muxDevStart(), and
|
||||
* muxDevStop(), muxError(), mux2Send(), mux2PollSend(), and mux2PollReceive().
|
||||
* It represents the network device. (Pssst: it's an END_OBJ *)
|
||||
*
|
||||
* For VxWorks 6.7 and later: a DEV_COOKIE may be used a fake
|
||||
* PROTO_COOKIE, for the purposes of calling muxSend(), muxIoctl(),
|
||||
* muxPollSend(), muxPollReceive(), muxTkSend(), muxTkPollSend(),
|
||||
* muxMCastAddrAdd(), muxMCastAddrDel(), muxMCastAddrGet(),
|
||||
* muxLinkHeaderCreate(), muxAddressForm(), muxPacketDataGet(), and
|
||||
* muxPacketAddrGet().
|
||||
*
|
||||
* Don't use a DEV_COOKIE for a call to muxUnbind() or muxTkPollReceive();
|
||||
* they work only with a real PROTO_COOKIE.
|
||||
*/
|
||||
typedef void * DEV_COOKIE;
|
||||
|
||||
/*
|
||||
* Protocol information. Returned by muxProtoInfoGet(). Note that
|
||||
* the actual signatures of the callback functions depends upon the
|
||||
* binding style.
|
||||
*/
|
||||
typedef struct _MUX_PROTO_INFO
|
||||
{
|
||||
char name[END_PROTO_NAME_MAX]; /* String name for this protocol */
|
||||
int netSvcType; /* Network service type */
|
||||
int bindStyle; /* MUX bind style (BIND_STYLE_* above) */
|
||||
BOOL (*stackRcvRtn) (); /* Protocol's receive routine */
|
||||
STATUS (*stackTxRestartRtn) (); /* Callback for restarting blocked tx. */
|
||||
STATUS (*stackShutdownRtn) (); /* The routine to call to shut down */
|
||||
void (*stackErrorRtn) (); /* Callback for device errors/events */
|
||||
DEV_COOKIE pEnd;
|
||||
void * callbackArg;
|
||||
} MUX_PROTO_INFO;
|
||||
|
||||
typedef struct _MUX_PROTOS_INFO
|
||||
{
|
||||
int nprotos; /* Number of PROTO_INFOs in plist */
|
||||
MUX_PROTO_INFO * plist; /* Array of PROTO_INFO structures */
|
||||
} MUX_PROTOS_INFO;
|
||||
|
||||
struct Ipcom_pkt_struct; /* declaration in ipcom_pkt.h */
|
||||
|
||||
/* globals */
|
||||
|
||||
IMPORT MUX_FUNCS _func_mux;
|
||||
|
||||
/* locals */
|
||||
|
||||
/* function declarations */
|
||||
|
||||
/* common routines shared by all device styles and protocol binding styles */
|
||||
|
||||
IMPORT STATUS muxCommonInit (void);
|
||||
IMPORT DEV_COOKIE muxDevAcquire (const char * name, int unit);
|
||||
IMPORT void muxDevRelease (DEV_COOKIE pEnd);
|
||||
|
||||
IMPORT END_OBJ * endFindByName (char* pName, int unit);
|
||||
|
||||
IMPORT DEV_COOKIE muxDevLoad (int unit, END_OBJ* (*endLoad) (char *, void*),
|
||||
char *initString, BOOL loaning, void*pBSP);
|
||||
IMPORT STATUS muxDevUnload (char* pName, int unit);
|
||||
|
||||
IMPORT STATUS muxDevStart (DEV_COOKIE pEnd);
|
||||
IMPORT STATUS muxDevStop (DEV_COOKIE pEnd);
|
||||
IMPORT STATUS muxDevStopAll (int timeout);
|
||||
|
||||
IMPORT int muxEndListGet (END_OBJ ** pEnds, int nSlots);
|
||||
IMPORT void muxShow (char* pDevName, int unit);
|
||||
|
||||
IMPORT STATUS muxUnbind(PROTO_COOKIE cookie, long type,
|
||||
FUNCPTR stackShutdownRtn);
|
||||
|
||||
IMPORT STATUS muxIoctl (PROTO_COOKIE cookie, int cmd, caddr_t data);
|
||||
|
||||
IMPORT STATUS muxMCastAddrAdd (PROTO_COOKIE cookie, char* pAddress);
|
||||
IMPORT STATUS muxMCastAddrDel (PROTO_COOKIE cookie, char* pAddress);
|
||||
IMPORT STATUS muxMCastAddrGet (PROTO_COOKIE cookie, MULTI_TABLE* pTable);
|
||||
|
||||
IMPORT void muxTxRestart(void * pEnd);
|
||||
|
||||
IMPORT void muxErrorSkip (DEV_COOKIE pEnd, END_ERR * pError,
|
||||
PROTO_COOKIE skipProtoCookie);
|
||||
IMPORT void muxErrorPost(END_OBJ * pEnd, INT32 errCode,
|
||||
char * pMesg, void * pSpare);
|
||||
|
||||
IMPORT JOB_QUEUE_ID muxEndRxJobQueue (END_OBJ * pEnd);
|
||||
IMPORT int muxEndQnumGet (char * instName, int unit);
|
||||
|
||||
IMPORT int muxProtoListGet (END_OBJ * pEnd, MUX_PROTOS_INFO * pInfo);
|
||||
IMPORT STATUS muxProtoInfoGet (PROTO_COOKIE cookie, MUX_PROTO_INFO * pInfo);
|
||||
|
||||
/* routines for END-style devices and muxBind() protocols */
|
||||
|
||||
IMPORT STATUS muxLibInit (void);
|
||||
IMPORT PROTO_COOKIE muxBind (char * pName, int unit,
|
||||
BOOL (*stackRcvRtn) (void*, long,M_BLK_ID, LL_HDR_INFO *,
|
||||
void*),
|
||||
STATUS (*stackShutdownRtn) (void*, void*),
|
||||
STATUS (*stackTxRestartRtn) (void*, void*),
|
||||
void (*stackErrorRtn) (END_OBJ*, END_ERR*, void*),
|
||||
long type, char* pProtoName, void* pSpare);
|
||||
|
||||
IMPORT STATUS muxSend (PROTO_COOKIE cookie, M_BLK_ID pMblk);
|
||||
IMPORT STATUS muxPollSend (PROTO_COOKIE cookie, M_BLK_ID pMblk);
|
||||
IMPORT STATUS muxPollReceive (PROTO_COOKIE cookie, M_BLK_ID pMblk);
|
||||
|
||||
IMPORT M_BLK_ID muxLinkHeaderCreate(PROTO_COOKIE cookie, M_BLK_ID pPacket,
|
||||
M_BLK_ID pSrcAddr, M_BLK_ID pDstAddr,
|
||||
BOOL bcastFlag);
|
||||
|
||||
IMPORT M_BLK_ID muxAddressForm (PROTO_COOKIE cookie, M_BLK_ID pMblk,
|
||||
M_BLK_ID pSrcAddr, M_BLK_ID pDstAddr);
|
||||
IMPORT STATUS muxPacketDataGet(PROTO_COOKIE cookie, M_BLK_ID pMblk,
|
||||
LL_HDR_INFO *);
|
||||
IMPORT STATUS muxPacketAddrGet (PROTO_COOKIE cookie, M_BLK_ID pMblk,
|
||||
M_BLK_ID pSrc,
|
||||
M_BLK_ID pDst,
|
||||
M_BLK_ID pESrc,
|
||||
M_BLK_ID pEDst);
|
||||
|
||||
IMPORT BOOL muxDevExists (char* pName, int unit);
|
||||
|
||||
/* These functions are deprecated */
|
||||
IMPORT STATUS muxAddrResFuncDel (long ifType, long protocol);
|
||||
IMPORT FUNCPTR muxAddrResFuncGet (long ifType, long protocol);
|
||||
IMPORT STATUS muxAddrResFuncAdd (long ifType, long protocol,
|
||||
FUNCPTR addrResFunc);
|
||||
|
||||
IMPORT STATUS muxIfFuncBaseInit (void);
|
||||
IMPORT STATUS muxIfFuncDel (long ifType, long protocol, int funcType);
|
||||
IMPORT FUNCPTR muxIfFuncGet (long ifType, long protocol, int funcType);
|
||||
IMPORT STATUS muxIfFuncAdd (long ifType, long protocol, int funcType,
|
||||
FUNCPTR ifFunc);
|
||||
IMPORT END_OBJ* endFirstUnitFind (char* pDevName);
|
||||
|
||||
/* Routines for mux2Bind() protocols and END2-style devices */
|
||||
|
||||
void mux2LibInit (void);
|
||||
void * mux2Bind (char * name, int unit,
|
||||
BOOL (*stackRcvRtn) (void * callbackArg,
|
||||
struct Ipcom_pkt_struct * pkt),
|
||||
STATUS (*stackShutdownRtn) (PROTO_COOKIE cookie, void * callbackArg),
|
||||
STATUS (*stackTxRestartRtn) (void * callbackArg),
|
||||
void (*stackErrorRtn) (void * callbackArg, END_ERR * err),
|
||||
unsigned short type, char * pProtoName, void * callbackArg);
|
||||
|
||||
IMPORT int mux2Send (END_OBJ * pEnd, struct Ipcom_pkt_struct * pkt);
|
||||
IMPORT int mux2PollSend (END_OBJ * pEnd, struct Ipcom_pkt_struct * pkt);
|
||||
IMPORT int mux2PollReceive (END_OBJ * pEnd, struct Ipcom_pkt_struct * pkt);
|
||||
|
||||
/* Routines called (mostly) by network device drivers */
|
||||
|
||||
IMPORT void mux2Receive (END_OBJ * pEnd, struct Ipcom_pkt_struct * pkt);
|
||||
IMPORT STATUS muxReceive (void * pEnd, M_BLK_ID pMblk);
|
||||
|
||||
IMPORT void muxError (DEV_COOKIE pEnd, END_ERR * pError);
|
||||
IMPORT void muxLinkUpNotify (END_OBJ * pEnd);
|
||||
IMPORT void muxLinkDownNotify (END_OBJ * pEnd);
|
||||
|
||||
/* utility routines (deprecate these?) */
|
||||
|
||||
IMPORT STATUS muxIterate (FUNCPTR pCallbackRtn, void * pCallbackArg);
|
||||
IMPORT STATUS muxIterateByName (char * pName, FUNCPTR pCallbackRtn,
|
||||
void * pCallbackArg);
|
||||
|
||||
/* cross protocol / device */
|
||||
|
||||
IMPORT void muxOverEnd2Init (void);
|
||||
IMPORT void mux2OverEndInit (void);
|
||||
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCmuxLibh */
|
||||
@@ -0,0 +1,106 @@
|
||||
/* muxTkLib.h - definitions for muxTkLib.c */
|
||||
|
||||
/*
|
||||
* Copyright 1998-2003, 2005, 2008, 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
|
||||
--------------------
|
||||
02l,10nov10,dlk Move extern "C" after last header file include. WIND00240828.
|
||||
02k,03mar08,dlk Update for MUX2.
|
||||
02j,25aug05,dlk Add section tags.
|
||||
02i,16may05,dlk Remove unsupported routine muxTkPktsReceive() unless
|
||||
END_STYLE_MULTI_SUPPORT is defined.
|
||||
02h,24nov03,wap Merge in changes from Snowflake
|
||||
02g,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
02f,04nov03,rlm Ran batch header path update for header re-org.
|
||||
02e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
02d,22jul03,ann changed 6th argument of muxTkBind to VOIDFUNCPTR.
|
||||
02c,01may03,spm Tornado 2.2 CP1 merge (from version 01k,14nov02,wap:
|
||||
TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB)
|
||||
02b,06feb03,vvv merged from tor2_2-patch.alameda, ver01k (SPR #83032)
|
||||
02a,02may01,ann made major changes for Clarinet based on MUX design doc
|
||||
01i,19apr00,ham merged TOR2_0-NPT-FCS(01h,29apr99,pul).
|
||||
01h,29apr99,pul Upgraded NPT phase3 code to tor2.0.0
|
||||
01g,30mar99,pul removed all muxMCastMap and muxSvcFunc function declarations
|
||||
01f,24feb99,sj added muxTkPollReceive
|
||||
01e,23feb99,sj added spare data last argument for muxTkSend and muxTkPollSend
|
||||
01d,06nov98,sj removed prototypes for muxTkReceive and nptHookRtn
|
||||
01c,27oct98,pul changed nptHookRtn declaration to return STATUS.
|
||||
01b,09oct98,sj fixed bad prototype for muxMCastMapFuncGet
|
||||
01a,07oct98,pul written.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This file includes function prototypes for the MUX.
|
||||
|
||||
INCLUDE FILES: muxLib.h
|
||||
*/
|
||||
|
||||
#ifndef __INCmuxTkLibh
|
||||
#define __INCmuxTkLibh
|
||||
|
||||
/* includes */
|
||||
#include <muxLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* defines */
|
||||
|
||||
/* typedefs */
|
||||
|
||||
/* locals */
|
||||
|
||||
/* globals */
|
||||
IMPORT int muxMaxBinds;
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
/* Toolkit functions */
|
||||
IMPORT STATUS muxTkLibInit (void);
|
||||
IMPORT int muxTkDrvCheck (char * pDevName);
|
||||
|
||||
IMPORT PROTO_COOKIE muxTkBind (char * pName, int unit,
|
||||
FUNCPTR stackRcvRtn,
|
||||
FUNCPTR stackShutdownRtn,
|
||||
FUNCPTR stackTxRestartRtn,
|
||||
VOIDFUNCPTR stackErrorRtn,
|
||||
long type, char * pProtoName,
|
||||
void * pNetCallbackId,
|
||||
void * pNetSvcInfo, void * pNetDrvInfo);
|
||||
|
||||
IMPORT STATUS muxTkSend (PROTO_COOKIE cookie, M_BLK_ID pNBuff, char *,
|
||||
USHORT, void *);
|
||||
IMPORT STATUS muxTkPollSend (PROTO_COOKIE cookie, M_BLK_ID pNBuff, char *,
|
||||
USHORT, void *);
|
||||
IMPORT STATUS muxTkPollReceive (PROTO_COOKIE cookie, M_BLK_ID pNBuff,
|
||||
void *pSpare);
|
||||
|
||||
STATUS muxTkReceive (void * pEndCookie, M_BLK_ID pMblk, long netSvcOffset,
|
||||
long netSvcType, BOOL uniPromiscuous, void * pSpareData);
|
||||
|
||||
IMPORT STATUS muxTkPollReceive2 (void *, M_BLK_ID pNBuff);
|
||||
|
||||
IMPORT void * muxTkCookieGet (char *, int);
|
||||
|
||||
#ifdef END_STYLE_MULTI_SUPPORT
|
||||
STATUS muxTkPktsReceive (void* pEndCookie, M_BLK_ID pMblk);
|
||||
#endif
|
||||
|
||||
IMPORT void muxTkOverEndInit (void);
|
||||
IMPORT void muxTkOverEnd2Init (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCmuxTkLibh */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,94 @@
|
||||
/* netLib.h - header file for the tNetTask */
|
||||
|
||||
/*
|
||||
* Copyright 2001-2003, 2005-2007, 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
|
||||
--------------------
|
||||
01u,10nov10,dlk Move extern "C" after last header file include. WIND00240828.
|
||||
01t,12oct07,dlk Changed netDaemonQ() to take an signed int argument;
|
||||
add the inverse function netDaemonQnum().
|
||||
01s,09jun07,dlk Make netDaemonQ() public. Add netDaemonsCount().
|
||||
netLibInitialize() takes additional netTaskFunc() argument.
|
||||
01r,06mar07,dlk Remove references to netJobInfo.
|
||||
01q,09sep06,kch Added string.h include.
|
||||
01p,20jun06,jpb Removed I960 check.
|
||||
01o,25aug05,dlk Added section tags.
|
||||
01n,08jul05,dlk Implement netJobAdd() using jobQueueLib.
|
||||
01m,25nov03,wap Merge in changes for Snowflake
|
||||
01l,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01k,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01j,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01i,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01h,15aug03,nee Merging from ACCORDION_BASE6_MERGE_BASELINE
|
||||
01g,10jun03,vvv include netVersion.h
|
||||
01f,13may03,vvv deleted TCP_MSL_CFG to avoid duplicate definitions
|
||||
01e,01may03,spm Tornado 2.2 CP1 merge (from ver 01p,22jan03,wap:
|
||||
TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB)
|
||||
01d,30dec02,ann changing the value of IP_PROTO_NUM_MAX to 16
|
||||
01c,26feb02,ham renamed to netLib.h
|
||||
01b,23aug01,ann correcting the references to netlibh after the rename
|
||||
01a,15aug01,ann ported to clarinet from AE1.1 version 01o.
|
||||
*/
|
||||
|
||||
#ifndef __INCnetLibh
|
||||
#define __INCnetLibh
|
||||
|
||||
#include <netVersion.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <jobQueueLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NET_TASK_QJOB_PRI 16
|
||||
|
||||
/* For convenience only. Using &netJobInfo avoids a dereference. */
|
||||
|
||||
extern JOB_QUEUE_ID netJobQueueId;
|
||||
|
||||
extern void * netGtfTickInformation; /* read only */
|
||||
|
||||
/* function declarations */
|
||||
|
||||
extern STATUS netJobAdd (FUNCPTR routine,
|
||||
_Vx_usr_arg_t param1,
|
||||
_Vx_usr_arg_t param2,
|
||||
_Vx_usr_arg_t param3,
|
||||
_Vx_usr_arg_t param4,
|
||||
_Vx_usr_arg_t param5);
|
||||
|
||||
extern STATUS netLibInitialize (unsigned int numDaemons, BOOL affinityLock,
|
||||
int (*netTaskFunc) (JOB_QUEUE_ID qId, int qIndex));
|
||||
extern unsigned int netDaemonsCount (void);
|
||||
extern JOB_QUEUE_ID netDaemonQ (int i);
|
||||
extern int netDaemonQnum (JOB_QUEUE_ID qId);
|
||||
|
||||
extern void netErrnoSet (int status);
|
||||
extern void mbinit (void * pNetPoolCfg);
|
||||
extern STATUS netJobAlloc (u_int numJobs);
|
||||
_WRS_FASTTEXT
|
||||
extern void netGtfTickFunc (void * pTm, void * arg);
|
||||
|
||||
|
||||
/* backwards compatibility */
|
||||
#define netJobAdd(f, a1, a2, a3, a4, a5) \
|
||||
(jobQueueStdPost (netJobQueueId, NET_TASK_QJOB_PRI, \
|
||||
(VOIDFUNCPTR)(f), (void *)(a1), (void *)(a2), \
|
||||
(void *)(a3), (void *)(a4), (void *)(a5)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCnetLibh */
|
||||
|
||||
@@ -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 */
|
||||
@@ -0,0 +1,80 @@
|
||||
/* vx_list.h - simple circular doubly-linked list type and macros */
|
||||
|
||||
#ifndef VX_LIST_H
|
||||
#define VX_LIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct Circ_list_struct Circ_list;
|
||||
|
||||
struct Circ_list_struct
|
||||
{
|
||||
Circ_list * prev;
|
||||
Circ_list * next;
|
||||
};
|
||||
|
||||
/*
|
||||
* CIRC_LIST_INIT(l) initializes the list node l as a list
|
||||
* containing a single node (itself). Used for list heads/sentinels.
|
||||
*/
|
||||
#define CIRC_LIST_INIT(l) \
|
||||
do { \
|
||||
Circ_list * l_ = (l); \
|
||||
l_->prev = l_; \
|
||||
l_->next = l_; \
|
||||
} while ((0))
|
||||
|
||||
/*
|
||||
* CIRC_LIST_REMOVE(n) removes the node n from the list
|
||||
* that it is in. (n must be in a list).
|
||||
* n is left with dangling references to the list.
|
||||
* If n is alone in the list, this is a no-op.
|
||||
*/
|
||||
#define CIRC_LIST_REMOVE(n) \
|
||||
do { \
|
||||
Circ_list * n_ = (n); \
|
||||
Circ_list * nxt_ = n_->next; \
|
||||
n_->prev->next = nxt_; \
|
||||
nxt_->prev = n_->prev; \
|
||||
} while ((0))
|
||||
|
||||
/*
|
||||
* CIRC_LIST_INSERT_AFTER(l, n) inserts node n after node l
|
||||
* in the list that l currently belongs to. n should
|
||||
* be a free node. If l represents the 'head' of the list
|
||||
* rather than an 'item', this operation inserts n as the
|
||||
* first item in list.
|
||||
*/
|
||||
#define CIRC_LIST_INSERT_AFTER(l, n) \
|
||||
do { \
|
||||
Circ_list * l_ = (l); \
|
||||
Circ_list * n_ = (n); \
|
||||
n_->prev = l_; \
|
||||
n_->next = l_->next; \
|
||||
l_->next->prev = n_; \
|
||||
l_->next = n_; \
|
||||
} while ((0))
|
||||
|
||||
/*
|
||||
* CIRC_LIST_INSERT_BEFORE(l, n) inserts node n before node l
|
||||
* in the list that l currently belongs to. n should
|
||||
* be a free node. If l represents the head of the list,
|
||||
* this operation corresponds to inserting n at the tail.
|
||||
*/
|
||||
#define CIRC_LIST_INSERT_BEFORE(l, n) \
|
||||
do { \
|
||||
Circ_list * l_ = (l); \
|
||||
Circ_list * n_ = (n); \
|
||||
n_->next = l_; \
|
||||
n_->prev = l_->prev; \
|
||||
l_->prev->next = n_; \
|
||||
l_->prev = n_; \
|
||||
} while ((0))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VX_LIST_H */
|
||||
@@ -0,0 +1,360 @@
|
||||
/* vxmux_pkt.h - vxmux packet handling API */
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK API HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: vxmux_pkt.h,v $ $Revision: 1.5 $
|
||||
* $Source: /home/interpeak/CVSRoot/vxmux/include/vxmux_pkt.h,v $
|
||||
* $Author: ulf $ $Date: 2009-10-29 13:05:32 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef VXMUX_PKT_H
|
||||
#define VXMUX_PKT_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
* VXMUX packet manipulation routines. Used by VxWorks MUX2/END2 code
|
||||
* to enable selection between full ipnet_pkt_pool library when IPNET
|
||||
* is configured in the image, and the more restricted vxmux_pkt_pool_min
|
||||
* library, supporting END2 drivers when IPNET is not included in the
|
||||
* VxWorks image.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains the API for IPCOM packets, used by VxWorks MUX2/END2
|
||||
code to enable selection between full ipnet_pkt_pool library when IPNET
|
||||
is configured in the image, and the more restricted vxmux_pkt_pool_min
|
||||
library, supporting END2 drivers when IPNET is not included in the
|
||||
VxWorks image.
|
||||
INCLUDE FILES: ipcom_atomic.h, ipcom_cstyle.h, ipcom_type.h
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include <vxmux_config.h>
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include <ipcom_pkt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Ipcom_pkt_done_func
|
||||
*===========================================================================
|
||||
* Function to free a packet from VxWorks code, possibly calling an output
|
||||
* done function.
|
||||
*/
|
||||
#ifdef IP_DEBUG
|
||||
|
||||
#define VXIPCOM_PKT_DONE(p) \
|
||||
do { \
|
||||
Ipcom_port_pkt * p_ = (Ipcom_port_pkt *)(p); \
|
||||
p_->pkt.done (&p_->pkt, __FILE__, __LINE__); \
|
||||
} while ((0))
|
||||
#define VXIPCOM_PKT_FREE vxipcom_pkt_dfree
|
||||
#else
|
||||
|
||||
#define VXIPCOM_PKT_DONE(p) \
|
||||
do { \
|
||||
Ipcom_port_pkt * p_ = (Ipcom_port_pkt *)(p); \
|
||||
p_->pkt.done (&p_->pkt); \
|
||||
} while ((0))
|
||||
#define VXIPCOM_PKT_FREE vxipcom_pkt_free
|
||||
#endif /* IP_DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* The vxipcom* macros are the APIs called by MUX2/END2 code.
|
||||
* They expand either to the vxmux_* functions or the ipcom_*
|
||||
* functions. The corresponding functions must be declared
|
||||
* equivalently.
|
||||
*/
|
||||
|
||||
#ifdef VXMUX_USE_PKT_POOL_MIN
|
||||
#define vxipcom_pkt_create vxmux_pkt_create
|
||||
#define vxipcom_pkt_malloc vxmux_pkt_malloc
|
||||
#define vxipcom_pkt_free vxmux_pkt_free
|
||||
#define vxipcom_pkt_dfree vxmux_pkt_dfree
|
||||
#define vxipcom_pktbuf_free vxmux_pktbuf_free
|
||||
#define vxipcom_conf_pkt_pool_buffer_alignment \
|
||||
vxmux_conf_pkt_pool_buffer_alignment
|
||||
#define vxipcom_conf_pkt_pool_buffer_extra_space \
|
||||
vxmux_conf_pkt_pool_buffer_extra_space
|
||||
#else
|
||||
#define vxipcom_pkt_create ipcom_pkt_create
|
||||
#define vxipcom_pkt_malloc ipcom_pkt_malloc
|
||||
#define vxipcom_pkt_free ipcom_pkt_free
|
||||
#define vxipcom_pkt_dfree ipcom_pkt_dfree
|
||||
#define vxipcom_pktbuf_free ipcom_pktbuf_free
|
||||
#define vxipcom_conf_pkt_pool_buffer_alignment \
|
||||
ipcom_conf_pkt_pool_buffer_alignment
|
||||
#define vxipcom_conf_pkt_pool_buffer_extra_space \
|
||||
ipcom_conf_pkt_pool_buffer_extra_space
|
||||
#endif
|
||||
|
||||
IP_EXTERN Ip_size_t vxmux_conf_pkt_pool_buffer_alignment;
|
||||
IP_EXTERN Ip_size_t vxmux_conf_pkt_pool_buffer_extra_space;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* vxmux_pktbuf_free - free packet buffer disassociated from Ipcom_pkt packet
|
||||
*
|
||||
* This routine frees a buffer that was previously allocated along with
|
||||
* an Ipcom_pkt structure using a vxmux_pkt_malloc() call with non-zero
|
||||
* <mtu> argument.
|
||||
*
|
||||
* The <buf> argument to this routine is the <data> member from the previously
|
||||
* allocated Ipcom_pkt packet, and the <cookie> argument is the packet's
|
||||
* <data_freefunc_cookie> member. After recording the original packet's
|
||||
* <data> and <data_freefunc_cookie> members, the packet's <data> member
|
||||
* should be cleared to disassociate it from the packet buffer and prevent a
|
||||
* double-free of the buffer when the original Ipcom_pkt is freed using
|
||||
* vxmux_pkt_free().
|
||||
*
|
||||
* This function is intended to support limited cases in which it is
|
||||
* convenient to allocate both an Ipcom_pkt packet header and a packet buffer
|
||||
* in an vxmux_pkt_malloc() call, but to separate the parts for different
|
||||
* uses with different lifetimes. This kind of separation can increase
|
||||
* cache efficiency in some network drivers that allocate RX packets out of
|
||||
* the ipnet packet pool; the disassociated buffer can be put into the device's
|
||||
* RX ring to receive a packet off the wire at some time in the future,
|
||||
* while the disassociated and still cache-hot Ipcom_pkt can be reassociated
|
||||
* with a filled buffer that holds a received packet for immediate delivery to
|
||||
* the stack.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <pkt>
|
||||
* A pointer to the packet to free.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: \&N/A.
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
IP_PUBLIC void vxmux_pktbuf_free
|
||||
(
|
||||
Ip_u8 *buf,
|
||||
void * cookie
|
||||
);
|
||||
|
||||
#ifdef IP_DEBUG
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_pkt_dfree
|
||||
*===========================================================================
|
||||
* Description: Frees a packet that was allocated with vxmux_pkt_malloc().
|
||||
* Parameters: pkt - The packet to free.
|
||||
* file - The file the packet was freed in.
|
||||
* line - The line the packet was freed at.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC void vxmux_pkt_dfree(Ipcom_pkt *pkt, char *file, int line);
|
||||
#define vxmux_pkt_free(pkt) vxmux_pkt_dfree(pkt, __FILE__, __LINE__)
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_pkt_dmalloc
|
||||
*===========================================================================
|
||||
* Description: Allocates the requested amount of MTU data. MTU data is
|
||||
* defined as IP + transport + application (not link header).
|
||||
* Parameters: size - The size of the data MTU in bytes.
|
||||
* fcflags - function call flags (see ipcom_cstyle.h)
|
||||
* file - The file the packet was allocated in.
|
||||
* line - The line the packet was allocated at.
|
||||
* Returns: A IPCOM packet.
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ipcom_pkt *vxmux_pkt_dmalloc(Ip_size_t size, int fcflags, char *file, int line);
|
||||
#define vxmux_pkt_malloc(size, fcflags) vxmux_pkt_dmalloc(size, fcflags, __FILE__, __LINE__)
|
||||
|
||||
#else /* ifndef IP_DEBUG */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* vxmux_pkt_free - free memory used by the 'Ipcom_pkt' structure
|
||||
*
|
||||
* This routine frees the memory used by the 'Ipcom_pkt' structure. The packet
|
||||
* data buffer freefunc() function is called, if the packet was allocated with
|
||||
* vxmux_pkt_create().
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <pkt>
|
||||
* A pointer to the packet to free.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: \&N/A.
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
IP_FASTTEXT IP_PUBLIC void vxmux_pkt_free
|
||||
(
|
||||
Ipcom_pkt *pkt
|
||||
);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* vxmux_pkt_malloc - allocate memory for 'Ipcom_pkt' structures
|
||||
*
|
||||
* This routine is used to allocate memory for 'Ipcom_pkt' structures and
|
||||
* associated packet buffers. The <size> parameter specifies the number of
|
||||
* octets to allocate in the buffer for the IP header, transport header and
|
||||
* application data. The TCP/IP stack adds space for the link-layer header, and
|
||||
* reserves additional space for additional headers and alignment. This means
|
||||
* that the full size of the data buffer will be greater than <size>.
|
||||
*
|
||||
* The total amount of memory allocated by vxipcom_pkt_malloc() can never exceed
|
||||
* the predefined TCP/IP stack packet buffer pool <maxsize>.
|
||||
*
|
||||
* The <fcflags> parameter must be set based on blocking mode and the context of
|
||||
* the process that calls ipcom_pkt_malloc(). Available flags are:
|
||||
* \is
|
||||
* \i 'IP_FLAG_FC_BLOCKOK'
|
||||
* Ok for function call to block (used when default is non-blocking).
|
||||
* \i 'IP_FLAG_FC_NOBLOCK'
|
||||
* Function call may not block (used when default is blocking).
|
||||
* \ie
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <size>
|
||||
* Size of the packet data buffer in bytes.
|
||||
* \i <fcflags>
|
||||
* Function call flags.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: A pointer to a newly allocated packet structure, or 'IP_NULL', if no
|
||||
* buffer was available.
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
IP_FASTTEXT IP_PUBLIC Ipcom_pkt *vxmux_pkt_malloc
|
||||
(
|
||||
Ip_size_t size,
|
||||
int fcflags
|
||||
);
|
||||
|
||||
#endif /* IP_DEBUG */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* vxipcom_pkt_create - create a valid 'ipcom_pkt' structure from user allocated
|
||||
* memory
|
||||
*
|
||||
* This routine creates a valid 'Ipcom_pkt' structure from user allocated
|
||||
* memory. This routine can be used to avoid doing memory copy of data from
|
||||
* a device driver buffer into an 'Ipcom_pkt' structure.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <pkt>
|
||||
* Pointer to a buffer which is large enough to hold an 'ipcom_pkt' structure.
|
||||
* \i <data>
|
||||
* Pointer to the buffer which contains the packet <data>.
|
||||
* \i <data_len>
|
||||
* The length of the data buffer.
|
||||
* \i <freefunc>
|
||||
* A routine that is called when the stack is finished using the packet.
|
||||
* \i <cookie>
|
||||
* User-defined data that is passed as the second argument to <freefunc>.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: \&N/A.
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
IP_FASTTEXT IP_PUBLIC void vxmux_pkt_create
|
||||
(
|
||||
Ipcom_pkt *pkt,
|
||||
void *data,
|
||||
Ip_size_t data_len,
|
||||
Ipcom_pkt_freefunc freefunc,
|
||||
void *cookie
|
||||
);
|
||||
|
||||
#ifdef IPCOM_USE_HW_CHECKSUM_TX
|
||||
/***************************************************************************
|
||||
*
|
||||
* vxmux_calculate_transport_checksum - complete transport checksum on packet
|
||||
*
|
||||
* This routine may be called by IPNET-native drivers that support transport
|
||||
* checksum offload on transmit, but for one reason or another cannot enable
|
||||
* TX checksum offload on the current packet, for which it is requested.
|
||||
* (For example, some devices cannot support transmit checksum offload
|
||||
* over IPv4 for packets with IP options.) Instead, this routine may
|
||||
* be called to complete the transport layer checksum on the packet.
|
||||
* This routine also clears the IPCOM_PKT_FLAG_HW_CHECKSUM flag, to mark
|
||||
* the checksum as already complete, in case the driver send routine returns
|
||||
* -IP_ERRNO_EWOULDBLOCK, the packet
|
||||
*
|
||||
* RETURNS: N/A
|
||||
*
|
||||
* ERRNO: None
|
||||
*/
|
||||
IP_PUBLIC void vxmux_calculate_transport_checksum
|
||||
(
|
||||
Ipcom_pkt *pkt
|
||||
);
|
||||
#endif /* IPCOM_USE_HW_CHECKSUM_TX */
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 VARIABLES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VXMUX_PKT_H */
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: vxmux_slab.h,v $ $Revision: 1.4 $
|
||||
* $Source: /home/interpeak/CVSRoot/vxmux/include/vxmux_slab.h,v $
|
||||
* $Author: ulf $ $Date: 2009-10-29 13:05:32 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef VXMUX_SLAB_H
|
||||
#define VXMUX_SLAB_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* Fixed size allocator.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <vx_list.h>
|
||||
#include <vxAtomicLib.h>
|
||||
|
||||
#include <ipcom_cstyle.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/* Slab cache flags */
|
||||
#define VXMUX_SLAB_F_NO_LOCKING (1U << 0) /* Do not lock/unlock the
|
||||
slab cache in alloc/free
|
||||
operations. The caller
|
||||
must make sure that
|
||||
alloc/free is run by only
|
||||
one context at any
|
||||
specific moment in time. Does
|
||||
not affect garbage collection. */
|
||||
|
||||
#define VXMUX_SLAB_F_ZERO (1U << 1) /* Buffers are cleared before
|
||||
in ipcom_slab_alloc() */
|
||||
#define VXMUX_SLAB_F_POISON (1U << 2) /* Buffer are fill with a
|
||||
pattern when freed */
|
||||
|
||||
#define VXMUX_SLAB_F_AVERAGE (0U << 30) /* Allocate an average
|
||||
amount of objects per
|
||||
slab, this is the
|
||||
default */
|
||||
#define VXMUX_SLAB_F_ONE (1U << 30) /* Allocate one object per
|
||||
slab, this should only be
|
||||
used for very big objects
|
||||
that are used very
|
||||
seldom */
|
||||
#define VXMUX_SLAB_F_FEW (2U << 30) /* Allocate just a few
|
||||
objects per slab */
|
||||
#define VXMUX_SLAB_F_MANY (3U << 30) /* Allocate a large amount
|
||||
of objects, use this for
|
||||
objects that are
|
||||
performance critical and
|
||||
used in great numbers */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct Vxmux_memory_pool_struct
|
||||
{
|
||||
Circ_list list; /* node to link into list of pools */
|
||||
const char *name; /* Human readable name of the memory
|
||||
limit */
|
||||
const size_t limit; /* Maximum number of bytes that can be
|
||||
allocated from this memory pool */
|
||||
atomic_t low; /* low water mark: the smallest number of bytes
|
||||
remaining in this pool at any time so far */
|
||||
atomic_t bytes; /* Bytes left in this pool */
|
||||
Circ_list memory_caches; /* List of all slab caches using
|
||||
this pool */
|
||||
}
|
||||
Vxmux_memory_pool;
|
||||
|
||||
/* Incomplete type. Full definition is hidden (see vxmux_slab_h.h) */
|
||||
typedef struct Vxmux_memory_cache_struct Vxmux_memory_cache;
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Vxmux_slab_ctor
|
||||
*===========================================================================
|
||||
* Description: Constructor for slab objects. Is run once per object when
|
||||
* objects are added to the memory cache.
|
||||
* Parameters: mc - The slab cache the object is going to be part of.
|
||||
* obj - The object to initialize.
|
||||
* Returns: IP_TRUE - the object was initialized successfully
|
||||
* IP_FALSE - the initialization failed, this will make the
|
||||
* adding any object to the slab cache fail.
|
||||
*/
|
||||
typedef BOOL (*Vxmux_slab_ctor)(Vxmux_memory_cache *mc, void *obj);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Vxmux_slab_dtor
|
||||
*===========================================================================
|
||||
* Description: Destructor for slab objects. Is run once per object when
|
||||
* objects are removed from the memory cache.
|
||||
* Parameters: mc - The slab cache the object was part of.
|
||||
* obj - The object to destroy.
|
||||
* Returns:
|
||||
*/
|
||||
typedef void (*Vxmux_slab_dtor)(Vxmux_memory_cache *mc, void *obj);
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_memory_pool_new
|
||||
*===========================================================================
|
||||
* Description: Allocates a new memory pool. The slab caches uses a
|
||||
* specific memory pool will in total never exceed the
|
||||
* limit of the pool
|
||||
* Parameters: name - User defined memory pool name.
|
||||
* limit - Maximum number of bytes that can be allocated
|
||||
* from this pool.
|
||||
* Returns: A newly created memory pool.
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Vxmux_memory_pool *
|
||||
vxmux_memory_pool_new(const char *name, size_t limit);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_slab_cache_new
|
||||
*===========================================================================
|
||||
* Description: Creates a new memory cache
|
||||
* Parameters: name - User defined name if the cache
|
||||
* flags - VXMUX_SLAB_F_xxx flags.
|
||||
* lock - pointer to spinlock used by this cache
|
||||
* (type depends upon _WRS_CONFIG_DETERMINISTIC)
|
||||
* obj_size - size of the objects stored in this
|
||||
* obj_alignment - minimal alignment of objects returned
|
||||
* from this slab cache
|
||||
* ctor - Constructor for objects added to this slab.
|
||||
* dtor - Desctructor for objects deleted from this slab.
|
||||
* memory_pool - a memory pool from which this slab cache
|
||||
* will allocate its memory
|
||||
* Returns: The newly create slab cache object.
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Vxmux_memory_cache *
|
||||
vxmux_slab_cache_new(const char *name,
|
||||
uint32_t flags,
|
||||
void * lock,
|
||||
size_t obj_size,
|
||||
size_t obj_alignment,
|
||||
Vxmux_slab_ctor ctor,
|
||||
Vxmux_slab_dtor dtor,
|
||||
Vxmux_memory_pool *memory_pool);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_slab_add
|
||||
*===========================================================================
|
||||
* Description: Allocates a new slab for a memory cache. Returns the new
|
||||
* slab, does not actually add it to the memory cache.
|
||||
* Parameters: mc - memory cache the slab can be added to.
|
||||
* Returns: A pointer to the new slab to be added, or IP_NULL if
|
||||
* allocation fails.
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC void *
|
||||
vxmux_slab_add(Vxmux_memory_cache *mc);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_slab_alloc_try
|
||||
*===========================================================================
|
||||
* Description: Allocates an object from the slab cache
|
||||
* Parameters: mc - slab cache to allocate from.
|
||||
* retry - if true, attempt to allocate more memory
|
||||
* from underlying pool if initial allocation attempt
|
||||
* fails.
|
||||
* Returns: The newly created object or IP_NULL if out of memory.
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC void *
|
||||
vxmux_slab_alloc_try(Vxmux_memory_cache *mc, BOOL retry);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_slab_alloc
|
||||
*===========================================================================
|
||||
* Description: Allocates an object from the slab cache, retrying if necessary
|
||||
* Parameters: mc - slab cache to allocate from.
|
||||
* Returns: The newly created object or IP_NULL if out of memory.
|
||||
*
|
||||
*/
|
||||
IP_INLINE void *
|
||||
vxmux_slab_alloc(Vxmux_memory_cache *mc)
|
||||
{
|
||||
return vxmux_slab_alloc_try (mc, TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_slab_alloc_from
|
||||
*===========================================================================
|
||||
* Description: Allocate an object from new slab, add slab to memory cache.
|
||||
* Do not use slab subsequently, it has been added to the cache.
|
||||
* Parameters: mc - memory cache to add slab to (minus one object)
|
||||
* slab - new slab returned from vxmux_slab_add()
|
||||
* Returns: A pointer to the object allocated out of slab.
|
||||
*/
|
||||
IP_PUBLIC void *
|
||||
vxmux_slab_alloc_from(Vxmux_memory_cache *mc, void * slab);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_slab_free
|
||||
*===========================================================================
|
||||
* Description: Returns an object to a slab cache
|
||||
* Parameters: mc - slab cache to return the object to
|
||||
* obj - the object to free
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC void
|
||||
vxmux_slab_free(Vxmux_memory_cache *mc, void *obj);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* vxmux_slab_get_objects_per_slab
|
||||
*===========================================================================
|
||||
* Description: Returns the number of objects per slab in the passed slab
|
||||
* cache.
|
||||
* Parameters: mc - a slab cache
|
||||
* Returns: Number of objects per slab
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC unsigned
|
||||
vxmux_slab_get_objects_per_slab(Vxmux_memory_cache *mc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VXMUX_SLAB_H */
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,35 @@
|
||||
/* vxmux_util.h - conventional utility macros for VxWorks */
|
||||
|
||||
#ifndef VXMUX_UTIL_H
|
||||
#define VXMUX_UTIL_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define member_to_object(pMember, type, memberName) \
|
||||
((type *)((char *)(pMember) - offsetof (type, memberName)))
|
||||
|
||||
|
||||
#ifdef VXMUX_NDEBUG
|
||||
#define VXMUX_ASSERT(x) ((void)0)
|
||||
#else
|
||||
void __vxmux_assert(const char *msg);
|
||||
|
||||
#define _MKSTRING(s) _MKSTRING2(s)
|
||||
#define _MKSTRING2(s) #s
|
||||
|
||||
#define VXMUX_ASSERT(x) \
|
||||
((void)((x) ? ((void)0) : \
|
||||
__vxmux_assert("Assertion failed: "#x", file " __FILE__ \
|
||||
", line "_MKSTRING(__LINE__)"\n")))
|
||||
#endif /* VXMUX_NDEBUG */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VXMUX_UTIL_H */
|
||||
Reference in New Issue
Block a user