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 * SPDX-License-Identifier: BSD-3-Clause
18 * -- End of Copyright Notice --
22 * @defgroup IxEthDBPortDefs IXP400 Ethernet Database Port Definitions (IxEthDBPortDefs)
24 * @brief IXP400 Public definition of the ports and port capabilities
29 #ifndef IxEthDBPortDefs_H
30 #define IxEthDBPortDefs_H
33 * @brief Port types - currently only Ethernet NPEs are recognized as specific types
34 * All other (user-defined) ports must be specified as IX_ETH_GENERIC
38 IX_ETH_GENERIC = 0, /**< generic ethernet port */
39 IX_ETH_NPE /**< specific Ethernet NPE */
43 * @brief Port capabilities - used by ixEthAccDatabaseMaintenance to decide whether it
44 * should manually age entries or not depending on the port capabilities.
46 * Ethernet NPEs have aging capabilities, meaning that they will age the entries
47 * automatically (by themselves).*/
50 IX_ETH_NO_CAPABILITIES = 0, /**< no aging capabilities */
51 IX_ETH_ENTRY_AGING = 0x1 /**< aging capabilities present */
52 } IxEthDBPortCapability;
55 * @brief Port Definition - a structure contains the Port type and capabilities
60 IxEthDBPortCapability capabilities;
61 } IxEthDBPortDefinition;
64 * @brief Port definitions structure, indexed on the port ID
65 * @warning Ports 0 and 1 are used by the Ethernet access component therefore
66 * it is essential to be left untouched. Port 2 here (WAN) is given as
67 * an example port. The NPE firmware also assumes the NPE B to be
68 * the port 0 and NPE C to be the port 1.
70 * @note that only 32 ports (0..31) are supported by EthDB
72 static const IxEthDBPortDefinition ixEthDBPortDefinitions[] =
74 /* id type capabilities */
75 { /* 0 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE B */
76 { /* 1 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE C */
77 { /* 2 */ IX_ETH_NPE, IX_ETH_NO_CAPABILITIES }, /* Ethernet NPE A */
78 { /* 3 */ IX_ETH_GENERIC, IX_ETH_NO_CAPABILITIES }, /* WAN port */
82 * @def IX_ETH_DB_NUMBER_OF_PORTS
83 * @brief number of supported ports
85 #define IX_ETH_DB_NUMBER_OF_PORTS ARRAY_SIZE(ixEthDBPortDefinitions)
88 * @def IX_ETH_DB_UNKNOWN_PORT
89 * @brief definition of an unknown port
91 #define IX_ETH_DB_UNKNOWN_PORT (0xff)
94 * @def IX_ETH_DB_ALL_PORTS
95 * @brief Special port ID indicating all the ports
96 * @note This port ID can be used only by a subset of the EthDB API; each
97 * function specifically mentions whether this is a valid parameter as the port ID
99 #define IX_ETH_DB_ALL_PORTS (IX_ETH_DB_NUMBER_OF_PORTS + 1)
102 * @def IX_ETH_DB_PORTS_ASSERTION
103 * @brief catch invalid port definitions (<2) with a
104 * compile-time assertion resulting in a duplicate case error.
106 #define IX_ETH_DB_PORTS_ASSERTION { switch(0) { case 0 : ; case 1 : ; case IX_ETH_DB_NUMBER_OF_PORTS : ; }}
109 * @def IX_ETH_DB_CHECK_PORT(portID)
110 * @brief safety checks to verify whether the port is invalid or uninitialized
112 #define IX_ETH_DB_CHECK_PORT(portID) \
114 if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \
116 return IX_ETH_DB_INVALID_PORT; \
119 if (!ixEthDBPortInfo[(portID)].enabled) \
121 return IX_ETH_DB_PORT_UNINITIALIZED; \
126 * @def IX_ETH_DB_CHECK_PORT_ALL(portID)
127 * @brief safety checks to verify whether the port is invalid or uninitialized;
128 * tolerates the use of IX_ETH_DB_ALL_PORTS
130 #define IX_ETH_DB_CHECK_PORT_ALL(portID) \
132 if ((portID) != IX_ETH_DB_ALL_PORTS) \
133 IX_ETH_DB_CHECK_PORT(portID) \
136 #endif /* IxEthDBPortDefs_H */