📄 ixethdb_p.h
字号:
/** * @file IxEthDB_p.h * * @brief Private MAC learning API * * @par * IXP400 SW Release version 2.1 * * -- Copyright Notice -- * * @par * Copyright (c) 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_p_H#define IxEthDB_p_H#include <IxTypes.h>#include <IxOsal.h>#include <IxEthDB.h>#include <IxNpeMh.h>#include <IxEthDBPortDefs.h>#include "IxEthDBMessages_p.h"#include "IxEthDBLog_p.h"#if (CPU==SIMSPARCSOLARIS)/* when running unit tests intLock() won't protect the event queue so we lock it manually */#define TEST_FIXTURE_LOCK_EVENT_QUEUE { ixOsalMutexLock(&eventQueueLock, IX_OSAL_WAIT_FOREVER); }#define TEST_FIXTURE_UNLOCK_EVENT_QUEUE { ixOsalMutexUnlock(&eventQueueLock); }#else#define TEST_FIXTURE_LOCK_EVENT_QUEUE /* nothing */#define TEST_FIXTURE_UNLOCK_EVENT_QUEUE /* nothing */#endif /* #if(CPU==SIMSPARCSOLARIS) */#ifndef IX_UNIT_TEST#define TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER /* nothing */#define TEST_FIXTURE_MARK_OVERFLOW_EVENT /* nothing */#elseextern int dbAccessCounter;extern int overflowEvent;#define TEST_FIXTURE_INCREMENT_DB_CORE_ACCESS_COUNTER { dbAccessCounter++; }#define TEST_FIXTURE_MARK_OVERFLOW_EVENT { overflowEvent = 1; }#endif/* code readability markers */#define __mempool__ /* memory pool marker */#define __lock__ /* hash write locking marker */#define __smartpointer__ /* smart pointer marker - warning: use only clone() when duplicating! */#define __alignment__ /* marker for data used only as alignment zones *//* constants */#define IX_ETH_DB_NPE_TIMEOUT (100) /* NPE response timeout, in ms *//** * number of hash table buckets * it should be at least 8x the predicted number of entries for performance * each bucket needs 8 bytes */#define NUM_BUCKETS (8192)/** * number of hash table buckets to preload when incrementing bucket iterator * = two cache lines */#define IX_ETHDB_CACHE_LINE_AHEAD (2)#define IX_ETHDB_BUCKETPTR_AHEAD ((IX_ETHDB_CACHE_LINE_AHEAD * IX_OSAL_CACHE_LINE_SIZE)/sizeof(void *))#define IX_ETHDB_BUCKET_INDEX_MASK (((IX_OSAL_CACHE_LINE_SIZE)/sizeof(void *)) - 1)/* locks */#define MAX_LOCKS (20) /**< maximum number of locks used simultaneously, do not tamper with *//* learning tree constants */#define INITIAL_ELT_SIZE (8) /**< initial byte size of tree (empty unused root size) */#define MAX_ELT_SIZE (512) /**< maximum number of entries (includes unused root) */#define MAX_GW_SIZE (40) /**< maximum number of gateway entries (including unused root) */#define MAX_BSSID_SIZE (40) /**< maximum number of bssid entries (including unused root) */#define MAX_FW_SIZE (32) /**< maximum number of firewall entries (including unused root) */#define ELT_ENTRY_SIZE (8) /**< learning entry size, in bytes */#define FW_ENTRY_SIZE (8) /**< learning entry size, in bytes */#define FW_M_ENTRY_SIZE (16) /**< firewall entry size, in bytes */#define ELT_ROOT_OFFSET (ELT_ENTRY_SIZE) /**< tree root offset, in bytes - node preceeding root is unused */#define FULL_ELT_BYTE_SIZE (MAX_ELT_SIZE * ELT_ENTRY_SIZE) /**< full size of tree, in bytes, including unused root */#define FULL_GW_BYTE_SIZE (MAX_GW_SIZE * ELT_ENTRY_SIZE) /**< full size of gateway list, in bytes, including unused root */#define FULL_BSSID_BYTE_SIZE (MAX_BSSID_SIZE * ELT_ENTRY_SIZE)/**< full size of bssid list, in bytes, including unused root */#define FULL_FW_BYTE_SIZE (MAX_FW_SIZE * FW_ENTRY_SIZE) /**< full size of firewall table, in bytes, including unused root */#define FULL_FW_M_BYTE_SIZE (MAX_FW_SIZE * FW_M_ENTRY_SIZE) /**< full size of masked firewall table, in bytes, including unused root *//* maximum size of the VLAN table: * 4096 bits (one per VLAN) * 8 bits in one byte * interleaved VLAN membership and VLAN TTI (*2) */#define FULL_VLAN_BYTE_SIZE (4096 / 8 * 2) /* upper 9 bits used as set index, lower 3 bits as byte index */#define VLAN_SET_OFFSET(vlanID) ((vlanID) >> 3)#define VLAN_SET_MASK(vlanID) (0x7 - ((vlanID) & 0x7))/* Update zone definitions */#define NPE_TREE_MEM_SIZE (4096) /* ((511 entries + 1 unused root) * 8 bytes/entry) *//* check the above value, we rely on 4k */#if NPE_TREE_MEM_SIZE != 4096 #error NPE_TREE_MEM_SIZE is not defined to 4096 bytes!#endif/* Size Filtering limits (Jumbo frame filtering) */#define IX_ETHDB_MAX_FRAME_SIZE 65535 /* other ports than NPE ports */#define IX_ETHDB_MIN_FRAME_SIZE 1 /* other ports than NPE ports */#define IX_ETHDB_MAX_NPE_FRAME_SIZE 16320 /* NPE ports firmware limit */#define IX_ETHDB_MIN_NPE_FRAME_SIZE 1 /* NPE ports firmware limit */#define IX_ETHDB_DEFAULT_FRAME_SIZE 1522/* memory management pool sizes *//* * Note: * * NODE_POOL_SIZE controls the maximum number of elements in the database at any one time. * It should be large enough to cover all the search trees of all the ports simultaneously. * * MAC_POOL_SIZE should be higher than NODE_POOL_SIZE by at least the total number of MAC addresses * possible to be held at any time in all the ports. * * TREE_POOL_SIZE should follow the same guideline as for MAC_POOL_SIZE. * * The database structure described here (2000/4000/4000) is enough for two NPEs holding at most 511 * entries each plus one PCI NIC holding at most 900 entries. */#define NODE_POOL_SIZE (2000) /**< number of HashNode objects - also master number of elements in the database; each entry has 16 bytes */#define MAC_POOL_SIZE (4000) /**< number of MacDescriptor objects; each entry has 28 bytes */#define TREE_POOL_SIZE (4000) /**< number of MacTreeNode objects; each entry has 16 bytes *//* retry policies */#define BUSY_RETRY_ENABLED (TRUE) /**< if set to TRUE the API will retry automatically calls returning BUSY */#define FOREVER_RETRY (TRUE) /**< if set to TRUE the API will retry forever BUSY calls */#define MAX_RETRIES (400) /**< upper retry limit - used only when FOREVER_RETRY is FALSE */#define BUSY_RETRY_YIELD (5) /**< ticks to yield for every failed retry *//* event management */#define EVENT_QUEUE_SIZE (500) /**< size of the sink collecting events from the Message Handler FIFO */#define EVENT_PROCESSING_LIMIT (100) /**< batch processing control size (how many events are extracted from the queue at once) *//* MAC descriptors */#define STATIC_ENTRY (TRUE)#define DYNAMIC_ENTRY (FALSE)/* age reset on next maintenance - incrementing by 1 will reset to 0 */#define AGE_RESET (0xFFFFFFFF)/* dependency maps */#define EMPTY_DEPENDENCY_MAP (0)/* trees */#define RIGHT (1)#define LEFT (-1)/* macros */#define MIN(a, b) ((a) < (b) ? (a) : (b))#define IX_ETH_DB_CHECK_REC_TYPE(recType) \{ \ if ((recType) < IX_ETH_DB_WIFI_AP_TO_STA || (recType) > IX_ETH_DB_WIFI_TO_LOCAL) \ { \ ERROR_LOG("DB Return: Invalid record type\n"); \ return IX_ETH_DB_INVALID_ARG; \ } \}#define IX_ETH_DB_CHECK_PAD_LENGTH(padLen) \{ \ if ((padLen) > IX_ETH_DB_WIFI_MAX_PAD_SIZE) \ { \ ERROR_LOG("DB Return: Maximum size exceeded for pad length\n"); \ return IX_ETH_DB_INVALID_ARG; \ } \}#define IX_ETH_DB_CHECK_ODD_PAD(padLen) \{ \ if (((padLen) & 0x1) == 1) \ { \ ERROR_LOG("DB Return: Odd number for pad length is not allowed\n"); \ return IX_ETH_DB_INVALID_ARG; \ } \}#define IX_ETH_DB_CHECK_LOG_PORT(logPort) \{ \ if ((logPort) >= MAX_GW_SIZE && (logPort) != 0xFF) \ { \ ERROR_LOG("DB Return: Logical port ID is not in the allowable range\n"); \ return IX_ETH_DB_INVALID_ARG; \ } \}#define IX_ETH_DB_CHECK_WIFI_VLAN_TAG(vlanFlag) \{ \ if ((vlanFlag) > IX_ETH_DB_WIFI_VLAN_TAG || (vlanFlag) < IX_ETH_DB_WIFI_VLAN_NOTAG) \ { \ ERROR_LOG("DB Return: Vlan Tag is invalid\n"); \ return IX_ETH_DB_INVALID_ARG; \ } \}#define IX_ETH_DB_CHECK_PORT_EXISTS(portID) \{ \ if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \ { \ return IX_ETH_DB_INVALID_PORT; \ } \}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -