source: SVN/cambria/redboot/packages/devs/eth/intel/npe/ethDB/current/include/IxEthDBMessages_p.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: 10.1 KB
Line 
1/**
2 * @file IxEthDBMessages_p.h 
3 *
4 * @brief Definitions of NPE messages
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#ifndef IxEthDBMessages_p_H
48#define IxEthDBMessages_p_H
49
50#include <IxAccCommon.h>
51#include <IxEthNpe.h>
52#include <IxOsCacheMMU.h>
53#include "IxEthDB_p.h"
54
55/* events watched by the Eth event processor */
56#define IX_ETH_DB_MIN_EVENT_ID        (IX_ETHNPE_EDB_GETMACADDRESSDATABASE)
57#define IX_ETH_DB_MAX_EVENT_ID        (IX_ETHNPE_PC_SETBSSIDTABLE)
58
59/* macros to fill and extract data from NPE messages - place any endian conversions here */ 
60#define RESET_ELT_MESSAGE(message) { ixOsalMemSet((void *) &(message), 0, sizeof((message))); }
61#define NPE_MSG_ID(msg) ((msg).data[0] >> 24)
62
63#define FILL_SETPORTVLANTABLEENTRY_MSG(message, portID, setOffset, vlanMembershipSet, ttiSet) \
64    do { \
65        message.data[0] = (IX_ETHNPE_VLAN_SETPORTVLANTABLEENTRY << 24) | (portID << 16) | (setOffset * 2); \
66        message.data[1] = (vlanMembershipSet << 8) | ttiSet; \
67    } while (0);
68
69#define FILL_SETPORTVLANTABLERANGE_MSG(message, portID, offset, length, zone) \
70    do { \
71        message.data[0] = IX_ETHNPE_VLAN_SETPORTVLANTABLERANGE << 24 | portID << 16 | offset << 9 | length << 1; \
72        message.data[1] = (UINT32) zone; \
73    } while (0);
74
75#define FILL_SETDEFAULTRXVID_MSG(message, portID, tpid, vlanTag) \
76    do { \
77        message.data[0] = (IX_ETHNPE_VLAN_SETDEFAULTRXVID << 24) \
78            | (portID << 16); \
79        \
80        message.data[1] = (tpid << 16) | vlanTag; \
81    } while (0);
82
83#define FILL_SETRXTAGMODE_MSG(message, portID, filterMode, tagMode) \
84    do { \
85        message.data[0] = IX_ETHNPE_VLAN_SETRXTAGMODE << 24 \
86            | portID << 16 \
87            | (tagMode & 0x4) << 2 \
88            | filterMode << 2 \
89            | (tagMode & 0x3); \
90        \
91        message.data[1] = 0; \
92    } while (0);
93
94#define FILL_SETRXQOSENTRY(message, portID, classIndex, trafficClass, aqmQueue) \
95    do { \
96        message.data[0] = IX_ETHNPE_VLAN_SETRXQOSENTRY << 24 \
97            | portID << 16 \
98            | classIndex; \
99        \
100        message.data[1] = trafficClass << 24 \
101            | 0x1 << 23 \
102            | aqmQueue << 16 \
103            | aqmQueue << 4; \
104    } while (0);
105
106#define FILL_SETPORTIDEXTRACTIONMODE(message, portID, enable) \
107    do { \
108        message.data[0] = IX_ETHNPE_VLAN_SETPORTIDEXTRACTIONMODE << 24 \
109            | portID << 16 \
110            | (enable ? 0x1 : 0x0); \
111        \
112        message.data[1] = 0; \
113    } while (0);
114
115
116#define FILL_SETBLOCKINGSTATE_MSG(message, portID, blocked) \
117    do { \
118        message.data[0] = IX_ETHNPE_STP_SETBLOCKINGSTATE << 24 \
119            | portID << 16 \
120            | (blocked ? 0x1 : 0x0); \
121        \
122        message.data[1] = 0; \
123    } while (0);
124
125#define FILL_SETFRAMECONTROLDURATIONID(message, portID, frameControlDurationID) \
126    do { \
127        message.data[0] = (IX_ETHNPE_PC_SETFRAMECONTROLDURATIONID << 24) | (portID << 16); \
128        message.data[1] = frameControlDurationID; \
129    } while (0);
130
131#define FILL_SETAPMACTABLE_MSG(message, zone) \
132    do { \
133        message.data[0] = IX_ETHNPE_PC_SETAPMACTABLE << 24 \
134            | 0 << 8      /* always use index 0 */ \
135            | 80;         /* 40 entries, 8 bytes each, 4 bytes in a word */ \
136        message.data[1] = (UINT32) zone; \
137    } while (0);
138
139#define FILL_SETBSSIDTABLE_MSG(message, zone) \
140    do { \
141        message.data[0] = IX_ETHNPE_PC_SETBSSIDTABLE << 24 \
142            | 0 << 8      /* always use index 0 */ \
143            | 80;         /* 40 entries, 8 bytes each, 4 bytes in a word */ \
144        message.data[1] = (UINT32) zone; \
145    } while (0);
146
147#define FILL_SETFIREWALLMODE_MSG(message, portID, epDelta, mode, address) \
148    do { \
149        message.data[0] = IX_ETHNPE_FW_SETFIREWALLMODE << 24 \
150            | portID << 16 \
151            | (epDelta & 0xFF) << 8 \
152            | mode; \
153        \
154        message.data[1] = (UINT32) address; \
155    } while (0);
156
157#define FILL_SETMACADDRESSDATABASE_MSG(message, portID, epDelta, blockCount, address) \
158    do { \
159        message.data[0] = IX_ETHNPE_EDB_SETMACADDRESSSDATABASE << 24 \
160                | (epDelta & 0xFF) << 8 \
161                | (blockCount & 0xFF); \
162        \
163        message.data[1] = (UINT32) address; \
164    } while (0);
165
166#define FILL_GETMACADDRESSDATABASE(message, npeId, zone) \
167    do { \
168        message.data[0] = IX_ETHNPE_EDB_GETMACADDRESSDATABASE << 24; \
169        message.data[1] = (UINT32) zone; \
170    } while (0);
171
172#define FILL_SETMAXFRAMELENGTHS_MSG(message, portID, maxRxFrameSize, maxTxFrameSize) \
173    do { \
174        message.data[0] = IX_ETHNPE_SETMAXFRAMELENGTHS << 24 \
175            | portID << 16 \
176            | ((maxRxFrameSize + 63) / 64) << 8  /* max Rx 64-byte blocks */ \
177            | (maxTxFrameSize + 63) / 64; /* max Tx 64-byte blocks */ \
178        \
179        message.data[1] = maxRxFrameSize << 16 | maxTxFrameSize; \
180    } while (0);
181
182#define FILL_SETPORTADDRESS_MSG(message, portID, macAddress) \
183    do { \
184        message.data[0] = IX_ETHNPE_EDB_SETPORTADDRESS << 24 \
185            | portID << 16 \
186            | macAddress[0] << 8 \
187            | macAddress[1]; \
188        \
189        message.data[1] = macAddress[2] << 24 \
190            | macAddress[3] << 16 \
191            | macAddress[4] << 8 \
192            | macAddress[5]; \
193    } while (0);
194
195/* access to a MAC node in the NPE tree */
196#define NPE_NODE_BYTE(eltNodeAddr, offset)      (((UINT8 *) (eltNodeAddr))[offset])
197
198/* browsing of the implicit linear binary tree structure of the NPE tree */
199#define LEFT_CHILD_OFFSET(offset)   ((offset) << 1)
200#define RIGHT_CHILD_OFFSET(offset)  (((offset) << 1) + 1)
201
202#define IX_EDB_FLAGS_ACTIVE         (0x2)
203#define IX_EDB_FLAGS_VALID          (0x1)
204#define IX_EDB_FLAGS_RESERVED       (0xfc)
205#define IX_EDB_FLAGS_INACTIVE_VALID (0x1)
206
207#define IX_EDB_NPE_NODE_ELT_PORT_ID_OFFSET (6)
208#define IX_EDB_NPE_NODE_ELT_FLAGS_OFFSET   (7)
209#define IX_EDB_NPE_NODE_WIFI_INDEX_OFFSET  (6)
210#define IX_EDB_NPE_NODE_WIFI_FLAGS_OFFSET  (7)
211#define IX_EDB_NPE_NODE_FW_FLAGS_OFFSET    (1)
212#define IX_EDB_NPE_NODE_FW_ADDR_OFFSET     (2)
213#define IX_EDB_NPE_NODE_FW_RESERVED_OFFSET (8)
214#define IX_EDB_NPE_NODE_FW_MASK_OFFSET     (10)
215#define IX_EDB_NPE_NODE_GW_RESERVED_OFFSET (6)
216#define IX_EDB_NPE_NODE_BSSID_DEST_PORT_OFFSET (6)
217#define IX_EDB_NPE_NODE_BSSID_RESERVED_OFFSET  (7)
218
219#define IX_EDB_NPE_NODE_VALID(address)     ((NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_FLAGS_OFFSET) & IX_EDB_FLAGS_VALID) != 0)
220#define IX_EDB_NPE_NODE_ACTIVE(address)    ((NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_FLAGS_OFFSET) & IX_EDB_FLAGS_ACTIVE) != 0)
221#define IX_EDB_NPE_NODE_PORT_ID(address)   (NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_PORT_ID_OFFSET))
222
223/* macros to send messages to the NPEs */
224#define IX_ETHDB_ASYNC_SEND_NPE_MSG(npeId, msg, result) \
225    do { \
226        result = ixNpeMhMessageSend(npeId, msg, IX_NPEMH_SEND_RETRIES_DEFAULT); \
227        \
228        if (result != IX_SUCCESS) \
229        { \
230            ERROR_LOG("DB: Failed to send NPE message\n"); \
231        } \
232    } while (0);
233
234#define IX_ETHDB_SYNC_SEND_NPE_MSG(npeId, msg, result) \
235    do { \
236        result = ixNpeMhMessageWithResponseSend(npeId, msg, msg.data[0] >> 24, ixEthDBNpeMsgAck, IX_NPEMH_SEND_RETRIES_DEFAULT); \
237        \
238        if (result == IX_SUCCESS) \
239        { \
240            result = ixOsalMutexLock(&ixEthDBPortInfo[IX_ETHNPE_NODE_AND_PORT_TO_PHYSICAL_ID(npeId,0)].npeAckLock, IX_ETH_DB_NPE_TIMEOUT); \
241            \
242            if (result != IX_SUCCESS) \
243            { \
244                ERROR_LOG("DB: NPE failed to respond to MSG ID 0x%02X within %dms\n",(msg.data[0] >> 24), IX_ETH_DB_NPE_TIMEOUT); \
245            } \
246        } \
247        else \
248        { \
249            ERROR_LOG("DB: Failed to send NPE message\n"); \
250        } \
251    } while (0);
252
253#ifndef IX_NDEBUG
254#define IX_ETH_DB_NPE_MSG_HISTORY_DEPTH (100)
255extern IX_ETH_DB_PUBLIC UINT32 npeMsgHistory[IX_ETH_DB_NPE_MSG_HISTORY_DEPTH][2];
256extern IX_ETH_DB_PUBLIC UINT32 npeMsgHistoryLen;
257#endif
258
259#if defined(IX_NPEDL_NPEIMAGE_NPEA_ETH_MACFILTERLEARN_HSSCHAN_COEXIST) \
260        && defined(IX_NPEDL_NPEIMAGE_NPEA_ETH_HDRCONV_HSSCHAN_COEXIST)
261#define IX_ETHDB_SEND_NPE_MSG(npeId, msg, result) \
262    do { \
263        LOG_NPE_MSG(msg); \
264        if (ixEthHssAccCoexistEnable) \
265        { \
266                IX_ETH_HSS_COM_MUT_LOCK(result); \
267        } \
268        IX_ETHDB_SYNC_SEND_NPE_MSG(npeId, msg, result); \
269    } while (0);
270#else
271#define IX_ETHDB_SEND_NPE_MSG(npeId, msg, result) \
272    do { \
273        LOG_NPE_MSG(msg); \
274        IX_ETHDB_SYNC_SEND_NPE_MSG(npeId, msg, result); \
275    } while (0);
276#endif
277
278#endif /* IxEthDBMessages_p_H */
Note: See TracBrowser for help on using the repository browser.