source: SVN/cambria/redboot/packages/devs/eth/intel/npe/common/current/include/IxEthDBPortDefs.h @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 5.0 KB
Line 
1/**
2 * @file IxEthDBPortDefs.h
3 *
4 * @brief Public definition of the ports and port capabilities
5 *
6 * @par
7 * IXP400 SW Release version 2.3
8 *
9 * -- Copyright Notice --
10 *
11 * @par
12 * Copyright (c) 2001-2005, Intel Corporation.
13 * All rights reserved.
14 *
15 * @par
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
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.
27 *
28 *
29 * @par
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
31 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE.
41 *
42 *
43 * @par
44 * -- End of Copyright Notice --
45 */
46
47/**
48 * @defgroup IxEthDBPortDefs Intel (R) IXP400 Software Ethernet Database Port Definitions (IxEthDBPortDefs)
49 *
50 * @brief IXP400 Public definition of the ports and port capabilities
51 *
52 * @{
53 */
54
55#ifndef IxEthDBPortDefs_H
56#define IxEthDBPortDefs_H
57
58/**
59 * @brief Port types - currently only Ethernet NPEs are recognized as specific types
60 * All other (user-defined) ports must be specified as IX_ETH_GENERIC
61 */
62typedef enum
63{
64    IX_ETH_GENERIC = 0, /**< generic ethernet port */
65    IX_ETH_NPE          /**< specific Ethernet NPE */
66} IxEthDBPortType;
67
68/**
69 * @brief Port capabilities - used by ixEthAccDatabaseMaintenance to decide whether it
70 * should manually age entries or not depending on the port capabilities.
71 *
72 * Ethernet NPEs have aging capabilities, meaning that they will age the entries
73 * automatically (by themselves).*/
74typedef enum
75{
76    IX_ETH_NO_CAPABILITIES = 0,   /**< no aging capabilities */
77    IX_ETH_ENTRY_AGING     = 0x1  /**< aging capabilities present */
78} IxEthDBPortCapability;
79
80/**
81 * @brief Port Definition - a structure contains the Port type and capabilities
82 */
83typedef struct
84{
85    IxEthDBPortType type;
86    IxEthDBPortCapability capabilities;
87} IxEthDBPortDefinition;
88
89
90/**
91 * @def IX_ETH_DB_NUMBER_OF_PORTS
92 * @brief number of supported ports
93 */
94#define IX_ETH_DB_NUMBER_OF_PORTS (3)
95
96/**
97 * @brief Port definitions structure, indexed on the port ID
98 * @warning Ports 0 and 1 are used by the Ethernet access component therefore
99 * it is essential to be left untouched. Port 2 can be Ethernet Port or
100 * WAN port. Port 3 here (WAN) is given as an example port. The NPE firmware
101 * also assumes the NPE B to be the port 0, NPE C to be the port 1, and
102 * NPE A to be port 2.
103 *
104 * @note that only 32 ports (0..31) are supported by EthDB
105 */
106extern IxEthDBPortDefinition ixEthDBPortDefinitions[IX_ETH_DB_NUMBER_OF_PORTS];
107
108/**
109 * @def IX_ETH_DB_UNKNOWN_PORT
110 * @brief definition of an unknown port
111 */
112#define IX_ETH_DB_UNKNOWN_PORT (0xff)
113
114/**
115 * @def IX_ETH_DB_ALL_PORTS
116 * @brief Special port ID indicating all the ports
117 * @note This port ID can be used only by a subset of the EthDB API; each
118 * function specifically mentions whether this is a valid parameter as the port ID
119 */
120#define IX_ETH_DB_ALL_PORTS (IX_ETH_DB_NUMBER_OF_PORTS + 1)
121
122/**
123 * @def IX_ETH_DB_PORTS_ASSERTION
124 * @brief catch invalid port definitions (<2) with a
125 * compile-time assertion resulting in a duplicate case error.
126 */
127#define IX_ETH_DB_PORTS_ASSERTION { switch(0) { case 0 : ; case 1 : ; case IX_ETH_DB_NUMBER_OF_PORTS : ; }}
128
129/**
130 * @def IX_ETH_DB_CHECK_PORT(portID)
131 * @brief safety checks to verify whether the port is invalid or uninitialized
132 */
133#define IX_ETH_DB_CHECK_PORT(portID) \
134{ \
135  if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \
136  { \
137      return IX_ETH_DB_INVALID_PORT; \
138  } \
139  \
140  if (!ixEthDBPortInfo[(portID)].enabled) \
141  { \
142      return IX_ETH_DB_PORT_UNINITIALIZED; \
143  } \
144}
145
146/**
147 * @def IX_ETH_DB_CHECK_PORT_ALL(portID)
148 * @brief safety checks to verify whether the port is invalid or uninitialized;
149 * tolerates the use of IX_ETH_DB_ALL_PORTS
150 */
151#define IX_ETH_DB_CHECK_PORT_ALL(portID) \
152{ \
153  if ((portID) != IX_ETH_DB_ALL_PORTS) \
154    IX_ETH_DB_CHECK_PORT(portID) \
155}
156
157#endif /* IxEthDBPortDefs_H */
158/**
159 *@}
160 */
Note: See TracBrowser for help on using the repository browser.