2 * @file IxEthDBPortDefs.h
4 * @brief Public definition of the ports and port capabilities
7 * IXP400 SW Release version 2.0
9 * -- Copyright Notice --
12 * Copyright 2001-2005, Intel Corporation.
13 * All rights reserved.
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. Neither the name of the Intel Corporation nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
30 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 * -- End of Copyright Notice --
46 * @defgroup IxEthDBPortDefs IXP400 Ethernet Database Port Definitions (IxEthDBPortDefs)
48 * @brief IXP400 Public definition of the ports and port capabilities
53 #ifndef IxEthDBPortDefs_H
54 #define IxEthDBPortDefs_H
57 * @brief Port types - currently only Ethernet NPEs are recognized as specific types
58 * All other (user-defined) ports must be specified as IX_ETH_GENERIC
62 IX_ETH_GENERIC = 0, /**< generic ethernet port */
63 IX_ETH_NPE /**< specific Ethernet NPE */
67 * @brief Port capabilities - used by ixEthAccDatabaseMaintenance to decide whether it
68 * should manually age entries or not depending on the port capabilities.
70 * Ethernet NPEs have aging capabilities, meaning that they will age the entries
71 * automatically (by themselves).*/
74 IX_ETH_NO_CAPABILITIES = 0, /**< no aging capabilities */
75 IX_ETH_ENTRY_AGING = 0x1 /**< aging capabilities present */
76 } IxEthDBPortCapability;
79 * @brief Port Definition - a structure contains the Port type and capabilities
84 IxEthDBPortCapability capabilities;
85 } IxEthDBPortDefinition;
88 * @brief Port definitions structure, indexed on the port ID
89 * @warning Ports 0 and 1 are used by the Ethernet access component therefore
90 * it is essential to be left untouched. Port 2 here (WAN) is given as
91 * an example port. The NPE firmware also assumes the NPE B to be
92 * the port 0 and NPE C to be the port 1.
94 * @note that only 32 ports (0..31) are supported by EthDB
96 static const IxEthDBPortDefinition ixEthDBPortDefinitions[] =
98 /* id type capabilities */
99 { /* 0 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE B */
100 { /* 1 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE C */
101 { /* 2 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE A */
102 { /* 3 */ IX_ETH_GENERIC, IX_ETH_NO_CAPABILITIES }, /* WAN port */
106 * @def IX_ETH_DB_NUMBER_OF_PORTS
107 * @brief number of supported ports
109 #define IX_ETH_DB_NUMBER_OF_PORTS (sizeof (ixEthDBPortDefinitions) / sizeof (ixEthDBPortDefinitions[0]))
112 * @def IX_ETH_DB_UNKNOWN_PORT
113 * @brief definition of an unknown port
115 #define IX_ETH_DB_UNKNOWN_PORT (0xff)
118 * @def IX_ETH_DB_ALL_PORTS
119 * @brief Special port ID indicating all the ports
120 * @note This port ID can be used only by a subset of the EthDB API; each
121 * function specifically mentions whether this is a valid parameter as the port ID
123 #define IX_ETH_DB_ALL_PORTS (IX_ETH_DB_NUMBER_OF_PORTS + 1)
126 * @def IX_ETH_DB_PORTS_ASSERTION
127 * @brief catch invalid port definitions (<2) with a
128 * compile-time assertion resulting in a duplicate case error.
130 #define IX_ETH_DB_PORTS_ASSERTION { switch(0) { case 0 : ; case 1 : ; case IX_ETH_DB_NUMBER_OF_PORTS : ; }}
133 * @def IX_ETH_DB_CHECK_PORT(portID)
134 * @brief safety checks to verify whether the port is invalid or uninitialized
136 #define IX_ETH_DB_CHECK_PORT(portID) \
138 if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \
140 return IX_ETH_DB_INVALID_PORT; \
143 if (!ixEthDBPortInfo[(portID)].enabled) \
145 return IX_ETH_DB_PORT_UNINITIALIZED; \
150 * @def IX_ETH_DB_CHECK_PORT_ALL(portID)
151 * @brief safety checks to verify whether the port is invalid or uninitialized;
152 * tolerates the use of IX_ETH_DB_ALL_PORTS
154 #define IX_ETH_DB_CHECK_PORT_ALL(portID) \
156 if ((portID) != IX_ETH_DB_ALL_PORTS) \
157 IX_ETH_DB_CHECK_PORT(portID) \
160 #endif /* IxEthDBPortDefs_H */