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

📄 ixethdb.h

📁 AMCC POWERPC 44X系列的U-BOOT文件
💻 H
📖 第 1 页 / 共 5 页
字号:
/** @file IxEthDB.h * * @brief this file contains the public API of @ref IxEthDB component * *  * @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 -- * */ #ifndef IxEthDB_H#define IxEthDB_H#include <IxOsBuffMgt.h>#include <IxTypes.h>/** * @defgroup IxEthDB IXP400 Ethernet Database (IxEthDB) API * * @brief ethDB is a library that does provides a MAC address database learning/filtering capability * *@{ */#define INLINE __inline__#define IX_ETH_DB_PRIVATE PRIVATE /* imported from IxTypes.h */#define IX_ETH_DB_PUBLIC PUBLIC/** * @brief port ID => message handler NPE id conversion (0 => NPE_B, 1 => NPE_C) */#define IX_ETH_DB_PORT_ID_TO_NPE(id) (id == 0 ? 1 : (id == 1 ? 2 : (id == 2 ? 0 : -1)))/** * @def IX_ETH_DB_NPE_TO_PORT_ID(npe) * @brief message handler NPE id => port ID conversion (NPE_B => 0, NPE_C => 1) */#define IX_ETH_DB_NPE_TO_PORT_ID(npe) (npe == 0 ? 2 : (npe == 1 ? 0 : (npe == 2 ? 1 : -1)))/* temporary define - won't work for Azusa */#define IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(id) (IX_ETH_DB_PORT_ID_TO_NPE(id) << 4)#define IX_ETH_DB_NPE_LOGICAL_ID_TO_PORT_ID(id) (IX_ETH_DB_NPE_TO_PORT_ID(id >> 4))/** * @def IX_IEEE803_MAC_ADDRESS_SIZE * @brief The size of the MAC address */#define IX_IEEE803_MAC_ADDRESS_SIZE (6)/** * @def IX_IEEE802_1Q_QOS_PRIORITY_COUNT * @brief Number of QoS priorities defined by IEEE802.1Q */#define IX_IEEE802_1Q_QOS_PRIORITY_COUNT (8)/** * @enum IxEthDBStatus * @brief Ethernet Database API return values */typedef enum /* IxEthDBStatus */{  IX_ETH_DB_SUCCESS = IX_SUCCESS,   /**< Success */  IX_ETH_DB_FAIL = IX_FAIL,         /**< Failure */  IX_ETH_DB_INVALID_PORT,           /**< Invalid port */  IX_ETH_DB_PORT_UNINITIALIZED,     /**< Port not initialized */  IX_ETH_DB_MAC_UNINITIALIZED,      /**< MAC not initialized */  IX_ETH_DB_INVALID_ARG,            /**< Invalid argument */  IX_ETH_DB_NO_SUCH_ADDR,           /**< Address not found for search or delete operations */  IX_ETH_DB_NOMEM,                  /**< Learning database memory full */  IX_ETH_DB_BUSY,                   /**< Learning database cannot complete operation, access temporarily blocked */  IX_ETH_DB_END,                    /**< Database browser passed the end of the record set */  IX_ETH_DB_INVALID_VLAN,           /**< Invalid VLAN ID (valid range is 0..4094, 0 signifies no VLAN membership, used for priority tagged frames) */  IX_ETH_DB_INVALID_PRIORITY,       /**< Invalid QoS priority/traffic class (valid range for QoS priority is 0..7, valid range for traffic class depends on run-time configuration) */  IX_ETH_DB_NO_PERMISSION,          /**< No permission for attempted operation */  IX_ETH_DB_FEATURE_UNAVAILABLE,    /**< Feature not available (or not enabled) */  IX_ETH_DB_INVALID_KEY,            /**< Invalid search key */  IX_ETH_DB_INVALID_RECORD_TYPE     /**< Invalid record type */} IxEthDBStatus;    /** @brief VLAN ID type, valid range is 0..4094, 0 signifying no VLAN membership */typedef UINT32 IxEthDBVlanId;/** @brief 802.1Q VLAN tag, contains 3 bits user priority, 1 bit CFI, 12 bits VLAN ID */typedef UINT32 IxEthDBVlanTag;/** @brief QoS priority/traffic class type, valid range is 0..7, 0 being the lowest */typedef UINT32 IxEthDBPriority;/** @brief Priority mapping table; 0..7 QoS priorities used to index, table contains traffic classes */typedef UINT8 IxEthDBPriorityTable[8];/** @brief A 4096 bit array used to map the complete VLAN ID range */typedef UINT8 IxEthDBVlanSet[512];#define IX_ETH_DB_802_1Q_VLAN_MASK (0xFFF)#define IX_ETH_DB_802_1Q_QOS_MASK  (0x7)#define IX_ETH_DB_802_1Q_MAX_VLAN_ID (0xFFE)/** * @def IX_ETH_DB_SET_VLAN_ID * @brief returns the given 802.1Q tag with the VLAN ID field substituted with the given VLAN ID * * This macro is used to change the VLAN ID in a 802.1Q tag. * * Example:  *  *  tag = IX_ETH_DB_SET_VLAN_ID(tag, 32) * * inserts the VLAN ID "32" in the given tag. */#define IX_ETH_DB_SET_VLAN_ID(vlanTag, vlanID) (((vlanTag) & 0xF000) | ((vlanID) & IX_ETH_DB_802_1Q_VLAN_MASK))/*** @def IX_ETH_DB_GET_VLAN_ID* @brief returns the VLAN ID from the given 802.1Q tag*/#define IX_ETH_DB_GET_VLAN_ID(vlanTag) ((vlanTag) & IX_ETH_DB_802_1Q_VLAN_MASK)#define IX_ETH_DB_GET_QOS_PRIORITY(vlanTag) (((vlanTag) >> 13) & IX_ETH_DB_802_1Q_QOS_MASK)#define IX_ETH_DB_SET_QOS_PRIORITY(vlanTag, priority) (((vlanTag) & 0x1FFF) | (((priority) & IX_ETH_DB_802_1Q_QOS_MASK) << 13))#define IX_ETH_DB_CHECK_VLAN_TAG(vlanTag) { if(((vlanTag & 0xFFFF0000) != 0) || (IX_ETH_DB_GET_VLAN_ID(vlanTag) > 4094)) return IX_ETH_DB_INVALID_VLAN; }#define IX_ETH_DB_CHECK_VLAN_ID(vlanId) { if (vlanId > IX_ETH_DB_802_1Q_MAX_VLAN_ID) return IX_ETH_DB_INVALID_VLAN; }#define IX_IEEE802_1Q_VLAN_TPID (0x8100)    typedef enum{  IX_ETH_DB_UNTAGGED_FRAMES        = 0x1, /**< Accepts untagged frames */  IX_ETH_DB_VLAN_TAGGED_FRAMES     = 0x2, /**< Accepts tagged frames */  IX_ETH_DB_PRIORITY_TAGGED_FRAMES = 0x4, /**< Accepts tagged frames with VLAN ID set to 0 (no VLAN membership) */  IX_ETH_DB_ACCEPT_ALL_FRAMES      =       IX_ETH_DB_UNTAGGED_FRAMES | IX_ETH_DB_VLAN_TAGGED_FRAMES /**< Accepts all the frames */} IxEthDBFrameFilter;typedef enum{  IX_ETH_DB_PASS_THROUGH = 0x1, /**< Leave frame as-is */  IX_ETH_DB_ADD_TAG      = 0x2, /**< Add default port VLAN tag */  IX_ETH_DB_REMOVE_TAG   = 0x3  /**< Remove VLAN tag from frame */} IxEthDBTaggingAction;typedef enum{  IX_ETH_DB_FIREWALL_WHITE_LIST = 0x1,  /**< Firewall operates in white-list mode (MAC address based admission) */  IX_ETH_DB_FIREWALL_BLACK_LIST = 0x2   /**< Firewall operates in black-list mode (MAC address based blocking) */} IxEthDBFirewallMode;  typedef enum{  IX_ETH_DB_FILTERING_RECORD        = 0x01, /**< <table><caption> Filtering record </caption>                                              *      <tr><td> MAC address <td> static/dynamic type <td> age                                              *   </table>                                              */  IX_ETH_DB_FILTERING_VLAN_RECORD   = 0x02, /**< <table><caption> VLAN-enabled filtering record </caption>                                             *      <tr><td> MAC address <td> static/dynamic type <td> age <td> 802.1Q tag                                              *   </table>                                              */  IX_ETH_DB_WIFI_RECORD             = 0x04, /**< <table><caption> WiFi header conversion record </caption>                                             *      <tr><td> MAC address <td> optional gateway MAC address <td>                                              *   </table>                                             */  IX_ETH_DB_FIREWALL_RECORD         = 0x08, /**< <table><caption> Firewall record </caption>                                             *      <tr><td> MAC address                                              *   </table>                                             */  IX_ETH_DB_GATEWAY_RECORD          = 0x10, /**< <i>For internal use only</i> */  IX_ETH_DB_MAX_RECORD_TYPE_INDEX   = 0x10, /**< <i>For internal use only</i> */  IX_ETH_DB_NO_RECORD_TYPE          = 0,    /**< None of the registered record types */  IX_ETH_DB_ALL_FILTERING_RECORDS   = IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD, /**< All the filtering records */  IX_ETH_DB_ALL_RECORD_TYPES        = IX_ETH_DB_FILTERING_RECORD | IX_ETH_DB_FILTERING_VLAN_RECORD |      IX_ETH_DB_WIFI_RECORD | IX_ETH_DB_FIREWALL_RECORD /**< All the record types registered within EthDB */    } IxEthDBRecordType;  typedef enum{  IX_ETH_DB_LEARNING                = 0x01, /**< Learning feature; enables EthDB to learn MAC address (filtering) records, including 802.1Q enabled records */  IX_ETH_DB_FILTERING               = 0x02, /**< Filtering feature; enables EthDB to communicate with the NPEs for downloading filtering information in the NPEs; depends on the learning feature */  IX_ETH_DB_VLAN_QOS                = 0x04, /**< VLAN/QoS feature; enables EthDB to configure NPEs to operate in VLAN/QoS aware modes */  IX_ETH_DB_FIREWALL                = 0x08, /**< Firewall feature; enables EthDB to configure NPEs to operate in firewall mode, using white/black address lists */  IX_ETH_DB_SPANNING_TREE_PROTOCOL  = 0x10, /**< Spanning tree protocol feature; enables EthDB to configure the NPEs as STP nodes */  IX_ETH_DB_WIFI_HEADER_CONVERSION  = 0x20  /**< WiFi 802.3 to 802.11 header conversion feature; enables EthDB to handle WiFi conversion data */} IxEthDBFeature;  typedef UINT32 IxEthDBProperty;  /**< Property ID type */typedef enum{  IX_ETH_DB_INTEGER_PROPERTY  = 0x1, /**< 4 byte unsigned integer type */  IX_ETH_DB_STRING_PROPERTY   = 0x2, /**< NULL-terminated string type of maximum 255 characters (including the terminator) */  IX_ETH_DB_MAC_ADDR_PROPERTY = 0x3, /**< 6 byte MAC address type */  IX_ETH_DB_BOOL_PROPERTY     = 0x4  /**< 4 byte boolean type; can contain only TRUE and FALSE values */} IxEthDBPropertyType;/* list of supported properties for the IX_ETH_DB_VLAN_QOS feature */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_COUNT_PROPERTY   (0x01)     /**< Property identifying number the supported number of traffic classes */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_0_RX_QUEUE_PROPERTY (0x10)  /**< Rx queue assigned to traffic class 0 */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_1_RX_QUEUE_PROPERTY (0x11)  /**< Rx queue assigned to traffic class 1 */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_2_RX_QUEUE_PROPERTY (0x12)  /**< Rx queue assigned to traffic class 2 */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_3_RX_QUEUE_PROPERTY (0x13)  /**< Rx queue assigned to traffic class 3 */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_4_RX_QUEUE_PROPERTY (0x14)  /**< Rx queue assigned to traffic class 4 */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_5_RX_QUEUE_PROPERTY (0x15)  /**< Rx queue assigned to traffic class 5 */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_6_RX_QUEUE_PROPERTY (0x16)  /**< Rx queue assigned to traffic class 6 */#define IX_ETH_DB_QOS_TRAFFIC_CLASS_7_RX_QUEUE_PROPERTY (0x17)  /**< Rx queue assigned to traffic class 7 *//* private property used by EthAcc to indicate queue configuration complete */#define IX_ETH_DB_QOS_QUEUE_CONFIGURATION_COMPLETE (0x18)      /** * * @brief The IEEE 802.3 Ethernet MAC address structure. *  * The data should be packed with bytes xx:xx:xx:xx:xx:xx  * * @note The data must be packed in network byte order. */typedef struct  {   UINT8 macAddress[IX_IEEE803_MAC_ADDRESS_SIZE];} IxEthDBMacAddr;/** * @ingroup IxEthDB * * @brief Definition of an IXP400 port. */typedef UINT32 IxEthDBPortId;/** * @ingroup IxEthDB * * @brief Port dependency map definition */typedef UINT8 IxEthDBPortMap[32];    /** * @ingroup IxEthDB * * @fn IxEthDBStatus ixEthDBInit(void) * * @brief Initializes the Ethernet learning/filtering database * * @note calling this function multiple times does not constitute an error; * redundant calls will be ignored, returning IX_ETH_DB_SUCCESS * * @retval IX_ETH_DB_SUCCESS initialization was successful * @retval IX_ETH_DB_FAIL initialization failed (OS error) */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBInit(void); /** * @ingroup IxEthDB

⌨️ 快捷键说明

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