?? ixethacc.h
字號:
/** @file IxEthAcc.h * * @brief this file contains the public API of @ref IxEthAcc component * * Design notes: * The IX_OSAL_MBUF address is to be specified on bits [31-5] and must * be cache aligned (bits[4-0] cleared) * * * @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 IxEthAcc_H#define IxEthAcc_H#include <IxOsBuffMgt.h>#include <IxTypes.h>/** * @defgroup IxEthAcc IXP400 Ethernet Access (IxEthAcc) API * * @brief ethAcc is a library that does provides access to the internal IXP400 10/100Bt Ethernet MACs. * *@{ *//** * @ingroup IxEthAcc * @brief Definition of the Ethernet Access status */typedef enum /* IxEthAccStatus */{ IX_ETH_ACC_SUCCESS = IX_SUCCESS, /**< return success*/ IX_ETH_ACC_FAIL = IX_FAIL, /**< return fail*/ IX_ETH_ACC_INVALID_PORT, /**< return invalid port*/ IX_ETH_ACC_PORT_UNINITIALIZED, /**< return uninitialized*/ IX_ETH_ACC_MAC_UNINITIALIZED, /**< return MAC uninitialized*/ IX_ETH_ACC_INVALID_ARG, /**< return invalid arg*/ IX_ETH_TX_Q_FULL, /**< return tx queue is full*/ IX_ETH_ACC_NO_SUCH_ADDR /**< return no such address*/} IxEthAccStatus;/** * @ingroup IxEthAcc * @enum IxEthAccPortId * @brief Definition of the IXP400 Mac Ethernet device. */typedef enum { IX_ETH_PORT_1 = 0, /**< Ethernet Port 1 */ IX_ETH_PORT_2 = 1 /**< Ethernet port 2 */ ,IX_ETH_PORT_3 = 2 /**< Ethernet port 3 */} IxEthAccPortId;/** * @ingroup IxEthAcc * * @def IX_ETH_ACC_NUMBER_OF_PORTS * * @brief Definition of the number of ports * */#ifdef __ixp46X#define IX_ETH_ACC_NUMBER_OF_PORTS (3)#else#define IX_ETH_ACC_NUMBER_OF_PORTS (2)#endif/** * @ingroup IxEthAcc * * @def IX_IEEE803_MAC_ADDRESS_SIZE * * @brief Definition of the size of the MAC address * */#define IX_IEEE803_MAC_ADDRESS_SIZE (6)/** * * @brief Definition of 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]; /**< MAC address */} IxEthAccMacAddr;/** * @ingroup IxEthAcc * @def IX_ETH_ACC_NUM_TX_PRIORITIES * @brief Definition of the number of transmit priorities * */#define IX_ETH_ACC_NUM_TX_PRIORITIES (8)/** * @ingroup IxEthAcc * @enum IxEthAccTxPriority * @brief Definition of the relative priority used to transmit a frame * */typedef enum { IX_ETH_ACC_TX_PRIORITY_0 = 0, /**<Lowest Priority submission */ IX_ETH_ACC_TX_PRIORITY_1 = 1, /**<submission prority of 1 (0 is lowest)*/ IX_ETH_ACC_TX_PRIORITY_2 = 2, /**<submission prority of 2 (0 is lowest)*/ IX_ETH_ACC_TX_PRIORITY_3 = 3, /**<submission prority of 3 (0 is lowest)*/ IX_ETH_ACC_TX_PRIORITY_4 = 4, /**<submission prority of 4 (0 is lowest)*/ IX_ETH_ACC_TX_PRIORITY_5 = 5, /**<submission prority of 5 (0 is lowest)*/ IX_ETH_ACC_TX_PRIORITY_6 = 6, /**<submission prority of 6 (0 is lowest)*/ IX_ETH_ACC_TX_PRIORITY_7 = 7, /**<Highest priority submission */ IX_ETH_ACC_TX_DEFAULT_PRIORITY = IX_ETH_ACC_TX_PRIORITY_0 /**< By default send all packets with lowest priority */} IxEthAccTxPriority;/** * @ingroup IxEthAcc * @enum IxEthAccRxFrameType * @brief Identify the type of a frame. * * @sa IX_ETHACC_NE_FLAGS * @sa IX_ETHACC_NE_LINKMASK */typedef enum { IX_ETHACC_RX_LLCTYPE = 0x00, /**< 802.3 - 8802, with LLC/SNAP */ IX_ETHACC_RX_ETHTYPE = 0x10, /**< 802.3 (Ethernet) without LLC/SNAP */ IX_ETHACC_RX_STATYPE = 0x20, /**< 802.11, AP <=> STA */ IX_ETHACC_RX_APTYPE = 0x30 /**< 802.11, AP <=> AP */} IxEthAccRxFrameType;/** * @ingroup IxEthAcc * @enum IxEthAccDuplexMode * @brief Definition to provision the duplex mode of the MAC. * */typedef enum{ IX_ETH_ACC_FULL_DUPLEX, /**< Full duplex operation of the MAC */ IX_ETH_ACC_HALF_DUPLEX /**< Half duplex operation of the MAC */} IxEthAccDuplexMode;/** * @ingroup IxEthAcc * @struct IxEthAccNe * @brief Definition of service-specific informations. * * This structure defines the Ethernet service-specific informations * and enable QoS and VLAN features. */typedef struct{ UINT32 ixReserved_next; /**< reserved for chaining */ UINT32 ixReserved_lengths; /**< reserved for buffer lengths */ UINT32 ixReserved_data; /**< reserved for buffer pointer */ UINT8 ixDestinationPortId; /**< Destination portId for this packet, if known by NPE */ UINT8 ixSourcePortId; /**< Source portId for this packet */ UINT16 ixFlags; /**< BitField of option for this frame */ UINT8 ixQoS; /**< QoS class of the frame */ UINT8 ixReserved; /**< reserved */ UINT16 ixVlanTCI; /**< Vlan TCI */ UINT8 ixDestMac[IX_IEEE803_MAC_ADDRESS_SIZE]; /**< Destination MAC address */ UINT8 ixSourceMac[IX_IEEE803_MAC_ADDRESS_SIZE]; /**< Source MAC address */} IxEthAccNe;/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_PORT_UNKNOWN * * @brief Contents of the field @a IX_ETHACC_NE_DESTPORTID when no * destination port can be found by the NPE for this frame. * */#define IX_ETHACC_NE_PORT_UNKNOWN (0xff)/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_DESTMAC * * @brief The location of the destination MAC address in the Mbuf header. * */#define IX_ETHACC_NE_DESTMAC(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixDestMac/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_SOURCEMAC * * @brief The location of the source MAC address in the Mbuf header. * */#define IX_ETHACC_NE_SOURCEMAC(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixSourceMac/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_VLANTCI * * @brief The VLAN Tag Control Information associated with this frame * * The VLAN Tag Control Information associated with this frame. On Rx * path, this field is extracted from the packet header. * On Tx path, the value of this field is inserted in the frame when * the port is configured to insert or replace vlan tags in the * egress frames. * * @sa IX_ETHACC_NE_FLAGS */#define IX_ETHACC_NE_VLANTCI(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixVlanTCI/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_SOURCEPORTID * * @brief The port where this frame came from. * * The port where this frame came from. This field is set on receive * with the port information. This field is ignored on Transmit path. */#define IX_ETHACC_NE_SOURCEPORTID(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixSourcePortId/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_DESTPORTID * * @brief The destination port where this frame should be sent. * * The destination port where this frame should be sent. * * @li In the transmit direction, this field contains the destination port * and is ignored unless @a IX_ETHACC_NE_FLAG_DST is set. * * @li In the receive direction, this field contains the port where the * destination MAC addresses has been learned. If the destination * MAC address is unknown, then this value is set to the reserved value * @a IX_ETHACC_NE_PORT_UNKNOWN * */#define IX_ETHACC_NE_DESTPORTID(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixDestinationPortId/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_QOS * * @brief QualityOfService class (QoS) for this received frame. * */#define IX_ETHACC_NE_QOS(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixQoS/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_FLAGS * * @brief Bit Mask of the different flags associated with a frame * * The flags are the bit-oring combination * of the following different fields : * * @li IP flag (Rx @a IX_ETHACC_NE_IPMASK) * @li Spanning Tree flag (Rx @a IX_ETHACC_NE_STMASK) * @li Link layer type (Rx and Tx @a IX_ETHACC_NE_LINKMASK) * @li VLAN Tagged Frame (Rx @a IX_ETHACC_NE_VLANMASK) * @li New source MAC address (Rx @a IX_ETHACC_NE_NEWSRCMASK) * @li Multicast flag (Rx @a IX_ETHACC_NE_MCASTMASK) * @li Broadcast flag (Rx @a IX_ETHACC_NE_BCASTMASK) * @li Destination port flag (Tx @a IX_ETHACC_NE_PORTMASK) * @li Tag/Untag Tx frame (Tx @a IX_ETHACC_NE_TAGMODEMASK) * @li Overwrite destination port (Tx @a IX_ETHACC_NE_PORTOVERMASK) * @li Filtered frame (Rx @a IX_ETHACC_NE_STMASK) * @li VLAN Enabled (Rx and Tx @a IX_ETHACC_NE_VLANENABLEMASK) */#define IX_ETHACC_NE_FLAGS(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixFlags/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_BCASTMASK * * @brief This mask defines if a received frame is a broadcast frame. * * This mask defines if a received frame is a broadcast frame. * The BCAST flag is set when the destination MAC address of * a frame is broadcast. * * @sa IX_ETHACC_NE_FLAGS * */#define IX_ETHACC_NE_BCASTMASK (0x1)/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_MCASTMASK * * @brief This mask defines if a received frame is a multicast frame. * * This mask defines if a received frame is a multicast frame. * The MCAST flag is set when the destination MAC address of * a frame is multicast. * * @sa IX_ETHACC_NE_FLAGS * */#define IX_ETHACC_NE_MCASTMASK (0x1 << 1)/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_IPMASK * * @brief This mask defines if a received frame is a IP frame. * * This mask applies to @a IX_ETHACC_NE_FLAGS and defines if a received * frame is a IP frame. The IP flag is set on Rx direction, depending on * the frame contents. The flag is set when the length/type field of a * received frame is 0x8000. * * @sa IX_ETHACC_NE_FLAGS * */#define IX_ETHACC_NE_IPMASK (0x1 << 2)/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_VLANMASK * * @brief This mask defines if a received frame is VLAN tagged. * * This mask defines if a received frame is VLAN tagged. * When set, the Rx frame is VLAN-tagged and the tag value * is available thru @a IX_ETHACC_NE_VLANID. * Note that when sending frames which are already tagged * this flag should be set, to avoid inserting another VLAN tag. * * @sa IX_ETHACC_NE_FLAGS * @sa IX_ETHACC_NE_VLANID * */#define IX_ETHACC_NE_VLANMASK (0x1 << 3)/** * @ingroup IxEthAcc * * @def IX_ETHACC_NE_LINKMASK * * @brief This mask is the link layer protocol indicator * * This mask applies to @a IX_ETHACC_NE_FLAGS. * It reflects the state of a frame as it exits an NPE on the Rx path * or enters an NPE on the Tx path. Its values are as follows: * @li 0x00 - IEEE802.3 - 8802 (Rx) / IEEE802.3 - 8802 (Tx)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -