2 * @file IxEthDBDBNPEAdaptor.c
4 * @brief Routines that read and write learning/search trees in NPE-specific format
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 --
45 #include "IxEthDB_p.h"
46 #include "IxEthDBLog_p.h"
48 /* forward prototype declarations */
49 IX_ETH_DB_PUBLIC void ixEthDBELTShow(IxEthDBPortId portID);
50 IX_ETH_DB_PUBLIC void ixEthDBShowNpeMsgHistory(void);
53 UINT8* ixEthDBNPEUpdateArea[IX_ETH_DB_NUMBER_OF_PORTS];
57 IX_ETH_DB_PRIVATE IxEthDBNoteWriteFn ixEthDBNPENodeWrite[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1];
59 #define IX_ETH_DB_MAX_DELTA_ZONES (6) /* at most 6 EP Delta zones, according to NPE FS */
60 IX_ETH_DB_PRIVATE UINT32 ixEthDBEPDeltaOffset[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1][IX_ETH_DB_MAX_DELTA_ZONES];
61 IX_ETH_DB_PRIVATE UINT32 ixEthDBEPDelta[IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1][IX_ETH_DB_MAX_DELTA_ZONES];
64 * @brief allocates non-cached or contiguous NPE tree update areas for all the ports
66 * This function is called only once at initialization time from
69 * @warning do not call manually
76 void ixEthDBNPEUpdateAreasInit(void)
79 PortUpdateMethod *update;
81 for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
83 update = &ixEthDBPortInfo[portIndex].updateMethod;
85 if (ixEthDBPortDefinitions[portIndex].type == IX_ETH_NPE)
87 update->npeUpdateZone = IX_OSAL_CACHE_DMA_MALLOC(FULL_ELT_BYTE_SIZE);
88 update->npeGwUpdateZone = IX_OSAL_CACHE_DMA_MALLOC(FULL_GW_BYTE_SIZE);
89 update->vlanUpdateZone = IX_OSAL_CACHE_DMA_MALLOC(FULL_VLAN_BYTE_SIZE);
91 if (update->npeUpdateZone == NULL
92 || update->npeGwUpdateZone == NULL
93 || update->vlanUpdateZone == NULL)
95 ERROR_LOG("Fatal error: IX_ACC_DRV_DMA_MALLOC() returned NULL, no NPE update zones available\n");
99 memset(update->npeUpdateZone, 0, FULL_ELT_BYTE_SIZE);
100 memset(update->npeGwUpdateZone, 0, FULL_GW_BYTE_SIZE);
101 memset(update->vlanUpdateZone, 0, FULL_VLAN_BYTE_SIZE);
107 update->npeUpdateZone = NULL;
108 update->npeGwUpdateZone = NULL;
109 update->vlanUpdateZone = NULL;
115 * @brief deallocates the NPE update areas for all the ports
117 * This function is called at component de-initialization time
118 * by @ref ixEthDBUnload().
120 * @warning do not call manually
125 void ixEthDBNPEUpdateAreasUnload(void)
129 for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
131 if (ixEthDBPortDefinitions[portIndex].type == IX_ETH_NPE)
133 IX_OSAL_CACHE_DMA_FREE(ixEthDBPortInfo[portIndex].updateMethod.npeUpdateZone);
134 IX_OSAL_CACHE_DMA_FREE(ixEthDBPortInfo[portIndex].updateMethod.npeGwUpdateZone);
135 IX_OSAL_CACHE_DMA_FREE(ixEthDBPortInfo[portIndex].updateMethod.vlanUpdateZone);
141 * @brief general-purpose NPE callback function
143 * @param npeID NPE ID
144 * @param msg NPE message
146 * This function will unblock the caller by unlocking
147 * the npeAckLock mutex defined for each NPE port
152 void ixEthDBNpeMsgAck(IxNpeMhNpeId npeID, IxNpeMhMessage msg)
154 IxEthDBPortId portID = IX_ETH_DB_NPE_TO_PORT_ID(npeID);
157 if (portID >= IX_ETH_DB_NUMBER_OF_PORTS)
163 if (ixEthDBPortDefinitions[portID].type != IX_ETH_NPE)
169 portInfo = &ixEthDBPortInfo[portID];
171 ixOsalMutexUnlock(&portInfo->npeAckLock);
175 * @brief synchronizes the database with tree
177 * @param portID port ID of the NPE whose tree is to be scanned
178 * @param eltBaseAddress memory base address of the NPE serialized tree
179 * @param eltSize size in bytes of the NPE serialized tree
181 * Scans the NPE learning tree and resets the age of active database records.
186 void ixEthDBNPESyncScan(IxEthDBPortId portID, void *eltBaseAddress, UINT32 eltSize)
188 UINT32 eltEntryOffset;
191 /* invalidate cache */
192 IX_OSAL_CACHE_INVALIDATE(eltBaseAddress, eltSize);
194 for (eltEntryOffset = ELT_ROOT_OFFSET ; eltEntryOffset < eltSize ; eltEntryOffset += ELT_ENTRY_SIZE)
196 /* (eltBaseAddress + eltEntryOffset) points to a valid NPE tree node
198 * the format of the node is MAC[6 bytes]:PortID[1 byte]:Reserved[6 bits]:Active[1 bit]:Valid[1 bit]
199 * therefore we can just use the pointer for database searches as only the first 6 bytes are checked
201 void *eltNodeAddress = (void *) ((UINT32) eltBaseAddress + eltEntryOffset);
204 IX_ETH_DB_NPE_VERBOSE_TRACE("DB: (NPEAdaptor) checking node at offset %d...\n", eltEntryOffset / ELT_ENTRY_SIZE);
206 if (IX_EDB_NPE_NODE_VALID(eltNodeAddress) != TRUE)
208 IX_ETH_DB_NPE_VERBOSE_TRACE("\t... node is empty\n");
210 else if (eltEntryOffset == ELT_ROOT_OFFSET)
212 IX_ETH_DB_NPE_VERBOSE_TRACE("\t... node is root\n");
215 if (IX_EDB_NPE_NODE_VALID(eltNodeAddress))
217 entryPortID = IX_ETH_DB_NPE_LOGICAL_ID_TO_PORT_ID(IX_EDB_NPE_NODE_PORT_ID(eltNodeAddress));
219 /* check only active entries belonging to this port */
220 if (ixEthDBPortInfo[portID].agingEnabled && IX_EDB_NPE_NODE_ACTIVE(eltNodeAddress) && (portID == entryPortID)
221 && ((ixEthDBPortDefinitions[portID].capabilities & IX_ETH_ENTRY_AGING) == 0))
224 HashNode *node = ixEthDBSearch((IxEthDBMacAddr *) eltNodeAddress, IX_ETH_DB_ALL_FILTERING_RECORDS);
226 /* safety check, maybe user deleted record right before sync? */
230 MacDescriptor *descriptor = (MacDescriptor *) node->data;
232 IX_ETH_DB_NPE_VERBOSE_TRACE("DB: (NPEAdaptor) synced entry [%s] already in the database, updating fields\n", mac2string(eltNodeAddress));
234 /* reset age - set to -1 so that maintenance will restore it to 0 (or more) when incrementing */
235 if (!descriptor->recordData.filteringData.staticEntry)
237 if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)
239 descriptor->recordData.filteringData.age = AGE_RESET;
241 else if (descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD)
243 descriptor->recordData.filteringVlanData.age = AGE_RESET;
247 /* end transaction */
248 ixEthDBReleaseHashNode(node);
253 IX_ETH_DB_NPE_VERBOSE_TRACE("\t... found portID %d, we check only port %d\n", entryPortID, portID);
260 * @brief writes a search tree in NPE format
262 * @param type type of records to be written into the NPE update zone
263 * @param totalSize maximum size of the linearized tree
264 * @param baseAddress memory base address where to write the NPE tree into
265 * @param tree search tree to write in NPE format
266 * @param blocks number of written 64-byte blocks
267 * @param startIndex optimal binary search start index
269 * Serializes the given tree in NPE linear format
276 void ixEthDBNPETreeWrite(IxEthDBRecordType type, UINT32 totalSize, void *baseAddress, MacTreeNode *tree, UINT32 *epDelta, UINT32 *blocks)
278 MacTreeNodeStack *stack;
279 UINT32 maxOffset = 0;
282 stack = ixOsalCacheDmaMalloc(sizeof (MacTreeNodeStack));
286 ERROR_LOG("DB: (NPEAdaptor) failed to allocate the node stack for learning tree linearization, out of memory?\n");
290 /* zero out empty root */
291 memset(baseAddress, 0, ELT_ENTRY_SIZE);
293 NODE_STACK_INIT(stack);
297 /* push tree root at offset 1 */
298 NODE_STACK_PUSH(stack, tree, 1);
303 while (NODE_STACK_NONEMPTY(stack))
308 NODE_STACK_POP(stack, node, offset);
310 /* update maximum offset */
311 if (offset > maxOffset)
316 IX_ETH_DB_NPE_VERBOSE_TRACE("DB: (NPEAdaptor) writing MAC [%s] at offset %d\n", mac2string(node->descriptor->macAddress), offset);
318 /* add node to NPE ELT at position indicated by offset */
319 if (offset < MAX_ELT_SIZE)
321 ixEthDBNPENodeWrite[type]((void *) (((UINT32) baseAddress) + offset * ELT_ENTRY_SIZE), node);
324 if (node->left != NULL)
326 NODE_STACK_PUSH(stack, node->left, LEFT_CHILD_OFFSET(offset));
330 /* ensure this entry is zeroed */
331 memset((void *) ((UINT32) baseAddress + LEFT_CHILD_OFFSET(offset) * ELT_ENTRY_SIZE), 0, ELT_ENTRY_SIZE);
334 if (node->right != NULL)
336 NODE_STACK_PUSH(stack, node->right, RIGHT_CHILD_OFFSET(offset));
340 /* ensure this entry is zeroed */
341 memset((void *) ((UINT32) baseAddress + RIGHT_CHILD_OFFSET(offset) * ELT_ENTRY_SIZE), 0, ELT_ENTRY_SIZE);
345 emptyOffset = maxOffset + 1;
347 /* zero out rest of the tree */
348 IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Emptying tree from offset %d, address 0x%08X, %d bytes\n",
349 emptyOffset, ((UINT32) baseAddress) + emptyOffset * ELT_ENTRY_SIZE, totalSize - (emptyOffset * ELT_ENTRY_SIZE));
351 if (emptyOffset < MAX_ELT_SIZE - 1)
353 memset((void *) (((UINT32) baseAddress) + (emptyOffset * ELT_ENTRY_SIZE)), 0, totalSize - (emptyOffset * ELT_ENTRY_SIZE));
357 IX_OSAL_CACHE_FLUSH(baseAddress, totalSize);
360 IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Ethernet learning/filtering tree XScale wrote at address 0x%08X (max %d bytes):\n\n",
361 (UINT32) baseAddress, FULL_ELT_BYTE_SIZE);
363 IX_ETH_DB_NPE_DUMP_ELT(baseAddress, FULL_ELT_BYTE_SIZE);
365 /* compute number of 64-byte blocks */
368 *blocks = maxOffset != 0 ? 1 + maxOffset / 8 : 0;
370 IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Wrote %d 64-byte blocks\n", *blocks);
373 /* compute epDelta - start index for binary search */
376 UINT32 deltaIndex = 0;
380 for (; deltaIndex < IX_ETH_DB_MAX_DELTA_ZONES ; deltaIndex ++)
382 if (ixEthDBEPDeltaOffset[type][deltaIndex] >= maxOffset)
384 *epDelta = ixEthDBEPDelta[type][deltaIndex];
389 IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Computed epDelta %d (based on maxOffset %d)\n", *epDelta, maxOffset);
392 ixOsalCacheDmaFree(stack);
396 * @brief implements a dummy node serialization function
398 * @param address address of where the node is to be serialized (unused)
399 * @param node tree node to be serialized (unused)
401 * This function is registered for safety reasons and should
402 * never be called. It will display an error message if this
403 * function is called.
410 void ixEthDBNullSerialize(void *address, MacTreeNode *node)
412 IX_ETH_DB_NPE_TRACE("DB: (NPEAdaptor) Warning, the NullSerialize function was called, wrong record type?\n");
416 * @brief writes a filtering entry in NPE linear format
418 * @param address memory address to write node to
419 * @param node node to be written
421 * Used by @ref ixEthDBNPETreeWrite to liniarize a search tree
422 * in NPE-readable format.
427 void ixEthDBNPELearningNodeWrite(void *address, MacTreeNode *node)
429 /* copy mac address */
430 memcpy(address, node->descriptor->macAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
433 NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_PORT_ID_OFFSET) = IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(node->descriptor->portID);
435 /* copy flags (valid and not active, as the NPE sets it to active) and clear reserved section (bits 2-7) */
436 NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_ELT_FLAGS_OFFSET) = (UINT8) IX_EDB_FLAGS_INACTIVE_VALID;
438 IX_ETH_DB_NPE_VERBOSE_TRACE("DB: (NPEAdaptor) writing ELT node 0x%08x:0x%08x\n", * (UINT32 *) address, * (((UINT32 *) (address)) + 1));
442 * @brief writes a WiFi header conversion record in
445 * @param address memory address to write node to
446 * @param node node to be written
448 * Used by @ref ixEthDBNPETreeWrite to liniarize a search tree
449 * in NPE-readable format.
454 void ixEthDBNPEWiFiNodeWrite(void *address, MacTreeNode *node)
456 /* copy mac address */
457 memcpy(address, node->descriptor->macAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
460 NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_WIFI_INDEX_OFFSET) = node->descriptor->recordData.wifiData.gwAddressIndex;
462 /* copy flags (type and valid) */
463 NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_WIFI_FLAGS_OFFSET) = node->descriptor->recordData.wifiData.type << 1 | IX_EDB_FLAGS_VALID;
467 * @brief writes a WiFi gateway header conversion record in
470 * @param address memory address to write node to
471 * @param node node to be written
473 * Used by @ref ixEthDBNPETreeWrite to liniarize a search tree
474 * in NPE-readable format.
479 void ixEthDBNPEGatewayNodeWrite(void *address, MacTreeNode *node)
481 /* copy mac address */
482 memcpy(address, node->descriptor->recordData.wifiData.gwMacAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
484 /* set reserved field, two bytes */
485 NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_RESERVED_OFFSET) = 0;
486 NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_RESERVED_OFFSET + 1) = 0;
490 * @brief writes a firewall record in
493 * @param address memory address to write node to
494 * @param node node to be written
496 * Used by @ref ixEthDBNPETreeWrite to liniarize a search tree
497 * in NPE-readable format.
502 void ixEthDBNPEFirewallNodeWrite(void *address, MacTreeNode *node)
504 /* set reserved field */
505 NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_RESERVED_OFFSET) = 0;
508 NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_FLAGS_OFFSET) = IX_EDB_FLAGS_VALID;
510 /* copy mac address */
511 memcpy((void *) ((UINT32) address + IX_EDB_NPE_NODE_FW_ADDR_OFFSET), node->descriptor->macAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
515 * @brief registers the NPE serialization methods
517 * This functions registers NPE serialization methods
518 * for writing the following types of records in NPE
519 * readable linear format:
520 * - filtering records
521 * - WiFi header conversion records
522 * - WiFi gateway header conversion records
525 * Note that this function should be called by the
526 * component initialization function.
528 * @return number of registered record types
533 UINT32 ixEthDBRecordSerializeMethodsRegister()
537 /* safety - register a blank method for everybody first */
538 for ( i = 0 ; i < IX_ETH_DB_MAX_RECORD_TYPE_INDEX + 1 ; i++)
540 ixEthDBNPENodeWrite[i] = ixEthDBNullSerialize;
543 /* register real methods */
544 ixEthDBNPENodeWrite[IX_ETH_DB_FILTERING_RECORD] = ixEthDBNPELearningNodeWrite;
545 ixEthDBNPENodeWrite[IX_ETH_DB_FILTERING_VLAN_RECORD] = ixEthDBNPELearningNodeWrite;
546 ixEthDBNPENodeWrite[IX_ETH_DB_WIFI_RECORD] = ixEthDBNPEWiFiNodeWrite;
547 ixEthDBNPENodeWrite[IX_ETH_DB_FIREWALL_RECORD] = ixEthDBNPEFirewallNodeWrite;
548 ixEthDBNPENodeWrite[IX_ETH_DB_GATEWAY_RECORD] = ixEthDBNPEGatewayNodeWrite;
550 /* EP Delta arrays */
551 memset(ixEthDBEPDeltaOffset, 0, sizeof (ixEthDBEPDeltaOffset));
552 memset(ixEthDBEPDelta, 0, sizeof (ixEthDBEPDelta));
554 /* filtering records */
555 ixEthDBEPDeltaOffset[IX_ETH_DB_FILTERING_RECORD][0] = 1;
556 ixEthDBEPDelta[IX_ETH_DB_FILTERING_RECORD][0] = 0;
558 ixEthDBEPDeltaOffset[IX_ETH_DB_FILTERING_RECORD][1] = 3;
559 ixEthDBEPDelta[IX_ETH_DB_FILTERING_RECORD][1] = 7;
561 ixEthDBEPDeltaOffset[IX_ETH_DB_FILTERING_RECORD][2] = 511;
562 ixEthDBEPDelta[IX_ETH_DB_FILTERING_RECORD][2] = 14;
565 ixEthDBEPDeltaOffset[IX_ETH_DB_WIFI_RECORD][0] = 1;
566 ixEthDBEPDelta[IX_ETH_DB_WIFI_RECORD][0] = 0;
568 ixEthDBEPDeltaOffset[IX_ETH_DB_WIFI_RECORD][1] = 3;
569 ixEthDBEPDelta[IX_ETH_DB_WIFI_RECORD][1] = 7;
571 ixEthDBEPDeltaOffset[IX_ETH_DB_WIFI_RECORD][2] = 511;
572 ixEthDBEPDelta[IX_ETH_DB_WIFI_RECORD][2] = 14;
574 /* firewall records */
575 ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][0] = 0;
576 ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][0] = 0;
578 ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][1] = 1;
579 ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][1] = 5;
581 ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][2] = 3;
582 ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][2] = 13;
584 ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][3] = 7;
585 ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][3] = 21;
587 ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][4] = 15;
588 ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][4] = 29;
590 ixEthDBEPDeltaOffset[IX_ETH_DB_FIREWALL_RECORD][5] = 31;
591 ixEthDBEPDelta[IX_ETH_DB_FIREWALL_RECORD][5] = 37;
593 return 5; /* 5 methods registered */
598 IX_ETH_DB_PUBLIC UINT32 npeMsgHistory[IX_ETH_DB_NPE_MSG_HISTORY_DEPTH][2];
599 IX_ETH_DB_PUBLIC UINT32 npeMsgHistoryLen = 0;
602 * When compiled in DEBUG mode, this function can be used to display
603 * the history of messages sent to the NPEs (up to 100).
606 void ixEthDBShowNpeMsgHistory()
611 if (npeMsgHistoryLen <= IX_ETH_DB_NPE_MSG_HISTORY_DEPTH)
614 len = npeMsgHistoryLen;
618 base = npeMsgHistoryLen % IX_ETH_DB_NPE_MSG_HISTORY_DEPTH;
619 len = IX_ETH_DB_NPE_MSG_HISTORY_DEPTH;
622 printf("NPE message history [last %d messages, from least to most recent]:\n", len);
624 for (; i < len ; i++)
626 UINT32 pos = (base + i) % IX_ETH_DB_NPE_MSG_HISTORY_DEPTH;
627 printf("msg[%d]: 0x%08x:0x%08x\n", i, npeMsgHistory[pos][0], npeMsgHistory[pos][1]);
632 void ixEthDBELTShow(IxEthDBPortId portID)
634 IxNpeMhMessage message;
637 /* send EDB_GetMACAddressDatabase message */
638 FILL_GETMACADDRESSDATABASE(message,
640 IX_OSAL_MMU_VIRT_TO_PHYS(ixEthDBPortInfo[portID].updateMethod.npeUpdateZone));
642 IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
644 if (result == IX_SUCCESS)
646 /* analyze NPE copy */
647 UINT32 eltEntryOffset;
650 UINT32 eltBaseAddress = (UINT32) ixEthDBPortInfo[portID].updateMethod.npeUpdateZone;
651 UINT32 eltSize = FULL_ELT_BYTE_SIZE;
653 /* invalidate cache */
654 IX_OSAL_CACHE_INVALIDATE((void *) eltBaseAddress, eltSize);
656 printf("Listing records in main learning tree for port %d\n", portID);
658 for (eltEntryOffset = ELT_ROOT_OFFSET ; eltEntryOffset < eltSize ; eltEntryOffset += ELT_ENTRY_SIZE)
660 /* (eltBaseAddress + eltEntryOffset) points to a valid NPE tree node
662 * the format of the node is MAC[6 bytes]:PortID[1 byte]:Reserved[6 bits]:Active[1 bit]:Valid[1 bit]
663 * therefore we can just use the pointer for database searches as only the first 6 bytes are checked
665 void *eltNodeAddress = (void *) ((UINT32) eltBaseAddress + eltEntryOffset);
667 if (IX_EDB_NPE_NODE_VALID(eltNodeAddress))
671 entryPortID = IX_ETH_DB_NPE_LOGICAL_ID_TO_PORT_ID(IX_EDB_NPE_NODE_PORT_ID(eltNodeAddress));
674 node = ixEthDBSearch((IxEthDBMacAddr *) eltNodeAddress, IX_ETH_DB_ALL_RECORD_TYPES);
676 printf("%s - port %d - %s ", mac2string((unsigned char *) eltNodeAddress), entryPortID,
677 IX_EDB_NPE_NODE_ACTIVE(eltNodeAddress) ? "active" : "inactive");
679 /* safety check, maybe user deleted record right before sync? */
683 MacDescriptor *descriptor = (MacDescriptor *) node->data;
686 descriptor->type == IX_ETH_DB_FILTERING_RECORD ? "filtering" :
687 descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD ? "vlan" :
688 descriptor->type == IX_ETH_DB_WIFI_RECORD ? "wifi" : "other (check main DB)");
690 if (descriptor->type == IX_ETH_DB_FILTERING_RECORD) printf("- age %d - %s ",
691 descriptor->recordData.filteringData.age,
692 descriptor->recordData.filteringData.staticEntry ? "static" : "dynamic");
694 if (descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD) printf("- age %d - %s - tci %d ",
695 descriptor->recordData.filteringVlanData.age,
696 descriptor->recordData.filteringVlanData.staticEntry ? "static" : "dynamic",
697 descriptor->recordData.filteringVlanData.ieee802_1qTag);
699 /* end transaction */
700 ixEthDBReleaseHashNode(node);
704 printf("- not synced");
713 ixOsalLog(IX_OSAL_LOG_LVL_FATAL, IX_OSAL_LOG_DEV_STDOUT,
714 "EthDB: (ShowELT) Could not complete action (communication failure)\n",
715 portID, 0, 0, 0, 0, 0);