⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ixethdbreports.c

📁 AMCC POWERPC 44X系列的U-BOOT文件
💻 C
📖 第 1 页 / 共 2 页
字号:
/** * @file IxEthDBAPI.c * * @brief Implementation of the public API *  * @par * IXP400 SW Release version 2.0 *  * -- Copyright Notice -- *  * @par * Copyright 2001-2005, Intel Corporation. * All rights reserved. *  * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. *  * @par * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *  * @par * -- End of Copyright Notice -- */#include "IxEthDB_p.h"extern HashTable dbHashtable;IX_ETH_DB_PRIVATE void ixEthDBPortInfoShow(IxEthDBPortId portID, IxEthDBRecordType recordFilter);IX_ETH_DB_PRIVATE IxEthDBStatus ixEthDBHeaderShow(IxEthDBRecordType recordFilter);IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBDependencyPortMapShow(IxEthDBPortId portID, IxEthDBPortMap map);/** * @brief displays a port dependency map * * @param portID ID of the port * @param map port map to display * * @return IX_ETH_DB_SUCCESS if the operation completed * successfully */ IX_ETH_DB_PUBLICIxEthDBStatus ixEthDBDependencyPortMapShow(IxEthDBPortId portID, IxEthDBPortMap map){    UINT32 portIndex;    BOOL mapSelf = TRUE, mapNone = TRUE, firstPort = TRUE;        /* dependency port maps */    printf("Dependency port map: ");        /* browse the port map */    for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)    {        if (IS_PORT_INCLUDED(portIndex, map))        {            mapNone   = FALSE;                        if (portIndex != portID)            {                mapSelf = FALSE;            }                        printf("%s%d", firstPort ? "{" : ", ", portIndex);                        firstPort = FALSE;        }    }        if (mapNone)    {        mapSelf = FALSE;    }        printf("%s (%s)\n", firstPort ? "" : "}", mapSelf ? "self" : mapNone ? "none" : "group");        return IX_ETH_DB_SUCCESS;}/** * @brief displays all the filtering records belonging to a port * * @param portID ID of the port to display * * Note that this function is documented in the main component * header file, IxEthDB.h. * * @warning deprecated, use @ref ixEthDBFilteringDatabaseShowRecords()  * instead. Calling this function is equivalent to calling * ixEthDBFilteringDatabaseShowRecords(portID, IX_ETH_DB_FILTERING_RECORD) */IX_ETH_DB_PUBLICIxEthDBStatus ixEthDBFilteringDatabaseShow(IxEthDBPortId portID){    IxEthDBStatus local_result;    HashIterator iterator;    PortInfo *portInfo;    UINT32 recordCount = 0;    IX_ETH_DB_CHECK_PORT(portID);    IX_ETH_DB_CHECK_SINGLE_NPE(portID);    portInfo = &ixEthDBPortInfo[portID];    /* display table header */    printf("Ethernet database records for port ID [%d]\n", portID);        ixEthDBDependencyPortMapShow(portID, portInfo->dependencyPortMap);        if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)    {        printf("NPE updates are %s\n\n", portInfo->updateMethod.updateEnabled ? "enabled" : "disabled");    }    else    {        printf("updates disabled (not an NPE)\n\n");    }    printf("    MAC address    |   Age  | Type \n");    printf("___________________________________\n");    /* browse database */    BUSY_RETRY(ixEthDBInitHashIterator(&dbHashtable, &iterator));    while (IS_ITERATOR_VALID(&iterator))    {      MacDescriptor *descriptor = (MacDescriptor *) iterator.node->data;      if (descriptor->portID == portID && descriptor->type == IX_ETH_DB_FILTERING_RECORD)      {          recordCount++;          /* display entry */          printf(" %02X:%02X:%02X:%02X:%02X:%02X | %5d  | %s\n",              descriptor->macAddress[0],              descriptor->macAddress[1],              descriptor->macAddress[2],              descriptor->macAddress[3],              descriptor->macAddress[4],              descriptor->macAddress[5],              descriptor->recordData.filteringData.age,              descriptor->recordData.filteringData.staticEntry ? "static" : "dynamic");      }      /* move to the next record */      BUSY_RETRY_WITH_RESULT(ixEthDBIncrementHashIterator(&dbHashtable, &iterator), local_result);      /* debug */      if (local_result == IX_ETH_DB_BUSY)      {          return IX_ETH_DB_FAIL;      }    }    /* display number of records */    printf("\nFound %d records\n", recordCount);    return IX_ETH_DB_SUCCESS;}/** * @brief displays all the filtering records belonging to all the ports * * Note that this function is documented in the main component * header file, IxEthDB.h. * * @warning deprecated, use @ref ixEthDBFilteringDatabaseShowRecords()  * instead. Calling this function is equivalent to calling * ixEthDBFilteringDatabaseShowRecords(IX_ETH_DB_ALL_PORTS, IX_ETH_DB_FILTERING_RECORD) */IX_ETH_DB_PUBLICvoid ixEthDBFilteringDatabaseShowAll(){    IxEthDBPortId portIndex;    printf("\nEthernet learning/filtering database: listing %d ports\n\n", (UINT32) IX_ETH_DB_NUMBER_OF_PORTS);    for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)    {        ixEthDBFilteringDatabaseShow(portIndex);        if (portIndex < IX_ETH_DB_NUMBER_OF_PORTS - 1)        {            printf("\n");        }    }}/** * @brief displays one record in a format depending on the record filter * * @param descriptor pointer to the record * @param recordFilter format filter * * This function will display the fields in a record depending on the * selected record filter. * * @internal */IX_ETH_DB_PRIVATEvoid ixEthDBRecordShow(MacDescriptor *descriptor, IxEthDBRecordType recordFilter){    if (recordFilter == IX_ETH_DB_FILTERING_VLAN_RECORD        || recordFilter == (IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD))    {        /* display VLAN record header - leave this commented code in place, its purpose is to align the print format with the header        printf("    MAC address    |   Age  |   Type   | VLAN ID | CFI | QoS class \n");        printf("___________________________________________________________________\n"); */        if (descriptor->type == IX_ETH_DB_FILTERING_VLAN_RECORD)        {            printf("%02X:%02X:%02X:%02X:%02X:%02X | %3d | %s | %d | %d | %d\n",                descriptor->macAddress[0],                descriptor->macAddress[1],                descriptor->macAddress[2],                descriptor->macAddress[3],                descriptor->macAddress[4],                descriptor->macAddress[5],                descriptor->recordData.filteringVlanData.age,                descriptor->recordData.filteringVlanData.staticEntry ? "static" : "dynamic",                IX_ETH_DB_GET_VLAN_ID(descriptor->recordData.filteringVlanData.ieee802_1qTag),                (descriptor->recordData.filteringVlanData.ieee802_1qTag & 0x1000) >> 12,                IX_ETH_DB_GET_QOS_PRIORITY(descriptor->recordData.filteringVlanData.ieee802_1qTag));         }         else if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)         {            printf("%02X:%02X:%02X:%02X:%02X:%02X | %3d | %s | - | - | -\n",                descriptor->macAddress[0],                descriptor->macAddress[1],                descriptor->macAddress[2],                descriptor->macAddress[3],                descriptor->macAddress[4],                descriptor->macAddress[5],                descriptor->recordData.filteringData.age,                descriptor->recordData.filteringData.staticEntry ? "static" : "dynamic");         }    }    else if (recordFilter == IX_ETH_DB_FILTERING_RECORD)    {        /* display filtering record header - leave this commented code in place, its purpose is to align the print format with the header        printf("    MAC address    |   Age  |   Type   \n");        printf("_______________________________________\n");  */        if (descriptor->type == IX_ETH_DB_FILTERING_RECORD)        {         printf("%02X:%02X:%02X:%02X:%02X:%02X | %3d | %s \n",             descriptor->macAddress[0],             descriptor->macAddress[1],             descriptor->macAddress[2],             descriptor->macAddress[3],             descriptor->macAddress[4],             descriptor->macAddress[5],             descriptor->recordData.filteringData.age,             descriptor->recordData.filteringData.staticEntry ? "static" : "dynamic");        }    }    else if (recordFilter == IX_ETH_DB_WIFI_RECORD)    {        /* display WiFi record header - leave this commented code in place, its purpose is to align the print format with the header         printf("    MAC address    |   GW MAC address  \n");        printf("_______________________________________\n"); */        if (descriptor->type == IX_ETH_DB_WIFI_RECORD)        {            if (descriptor->recordData.wifiData.type == IX_ETH_DB_WIFI_AP_TO_AP)            {                /* gateway address present */                printf("%02X:%02X:%02X:%02X:%02X:%02X | %02X:%02X:%02X:%02X:%02X:%02X \n",                    descriptor->macAddress[0],                    descriptor->macAddress[1],                    descriptor->macAddress[2],                    descriptor->macAddress[3],                    descriptor->macAddress[4],                    descriptor->macAddress[5],                    descriptor->recordData.wifiData.gwMacAddress[0],                    descriptor->recordData.wifiData.gwMacAddress[1],                    descriptor->recordData.wifiData.gwMacAddress[2],                    descriptor->recordData.wifiData.gwMacAddress[3],                    descriptor->recordData.wifiData.gwMacAddress[4],                    descriptor->recordData.wifiData.gwMacAddress[5]);            }            else            {                /* no gateway */                printf("%02X:%02X:%02X:%02X:%02X:%02X | ----no gateway----- \n",                    descriptor->macAddress[0],                    descriptor->macAddress[1],                    descriptor->macAddress[2],                    descriptor->macAddress[3],                    descriptor->macAddress[4],                    descriptor->macAddress[5]);            }        }    }    else if (recordFilter == IX_ETH_DB_FIREWALL_RECORD)    {        /* display Firewall record header - leave this commented code in place, its purpose is to align the print format with the header         printf("    MAC address   \n");        printf("__________________\n"); */        if (descriptor->type == IX_ETH_DB_FIREWALL_RECORD)        {            printf("%02X:%02X:%02X:%02X:%02X:%02X \n",                descriptor->macAddress[0],                descriptor->macAddress[1],                descriptor->macAddress[2],                descriptor->macAddress[3],                descriptor->macAddress[4],

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -