1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
/**
* @file IxEthDBPortDefs.h
*
* @brief Public definition of the ports and port capabilities
*
* @par
* IXP400 SW Release version 2.0
*
* -- Copyright Notice --
*
* @par
* Copyright 2001-2005, Intel Corporation.
* All rights reserved.
*
* @par
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* @par
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
* @par
* -- End of Copyright Notice --
*/
/**
* @defgroup IxEthDBPortDefs IXP400 Ethernet Database Port Definitions (IxEthDBPortDefs)
*
* @brief IXP400 Public definition of the ports and port capabilities
*
* @{
*/
#ifndef IxEthDBPortDefs_H
#define IxEthDBPortDefs_H
/**
* @brief Port types - currently only Ethernet NPEs are recognized as specific types
* All other (user-defined) ports must be specified as IX_ETH_GENERIC
*/
typedef enum
{
IX_ETH_GENERIC = 0, /**< generic ethernet port */
IX_ETH_NPE /**< specific Ethernet NPE */
} IxEthDBPortType;
/**
* @brief Port capabilities - used by ixEthAccDatabaseMaintenance to decide whether it
* should manually age entries or not depending on the port capabilities.
*
* Ethernet NPEs have aging capabilities, meaning that they will age the entries
* automatically (by themselves).*/
typedef enum
{
IX_ETH_NO_CAPABILITIES = 0, /**< no aging capabilities */
IX_ETH_ENTRY_AGING = 0x1 /**< aging capabilities present */
} IxEthDBPortCapability;
/**
* @brief Port Definition - a structure contains the Port type and capabilities
*/
typedef struct
{
IxEthDBPortType type;
IxEthDBPortCapability capabilities;
} IxEthDBPortDefinition;
/**
* @brief Port definitions structure, indexed on the port ID
* @warning Ports 0 and 1 are used by the Ethernet access component therefore
* it is essential to be left untouched. Port 2 here (WAN) is given as
* an example port. The NPE firmware also assumes the NPE B to be
* the port 0 and NPE C to be the port 1.
*
* @note that only 32 ports (0..31) are supported by EthDB
*/
static const IxEthDBPortDefinition ixEthDBPortDefinitions[] =
{
/* id type capabilities */
{ /* 0 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE B */
{ /* 1 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE C */
{ /* 2 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE A */
{ /* 3 */ IX_ETH_GENERIC, IX_ETH_NO_CAPABILITIES }, /* WAN port */
};
/**
* @def IX_ETH_DB_NUMBER_OF_PORTS
* @brief number of supported ports
*/
#define IX_ETH_DB_NUMBER_OF_PORTS (sizeof (ixEthDBPortDefinitions) / sizeof (ixEthDBPortDefinitions[0]))
/**
* @def IX_ETH_DB_UNKNOWN_PORT
* @brief definition of an unknown port
*/
#define IX_ETH_DB_UNKNOWN_PORT (0xff)
/**
* @def IX_ETH_DB_ALL_PORTS
* @brief Special port ID indicating all the ports
* @note This port ID can be used only by a subset of the EthDB API; each
* function specifically mentions whether this is a valid parameter as the port ID
*/
#define IX_ETH_DB_ALL_PORTS (IX_ETH_DB_NUMBER_OF_PORTS + 1)
/**
* @def IX_ETH_DB_PORTS_ASSERTION
* @brief catch invalid port definitions (<2) with a
* compile-time assertion resulting in a duplicate case error.
*/
#define IX_ETH_DB_PORTS_ASSERTION { switch(0) { case 0 : ; case 1 : ; case IX_ETH_DB_NUMBER_OF_PORTS : ; }}
/**
* @def IX_ETH_DB_CHECK_PORT(portID)
* @brief safety checks to verify whether the port is invalid or uninitialized
*/
#define IX_ETH_DB_CHECK_PORT(portID) \
{ \
if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \
{ \
return IX_ETH_DB_INVALID_PORT; \
} \
\
if (!ixEthDBPortInfo[(portID)].enabled) \
{ \
return IX_ETH_DB_PORT_UNINITIALIZED; \
} \
}
/**
* @def IX_ETH_DB_CHECK_PORT_ALL(portID)
* @brief safety checks to verify whether the port is invalid or uninitialized;
* tolerates the use of IX_ETH_DB_ALL_PORTS
*/
#define IX_ETH_DB_CHECK_PORT_ALL(portID) \
{ \
if ((portID) != IX_ETH_DB_ALL_PORTS) \
IX_ETH_DB_CHECK_PORT(portID) \
}
#endif /* IxEthDBPortDefs_H */
/**
*@}
*/
|