📄 swpmactb.h
字号:
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This software is copyrighted by and is the sole property of
* VIA Networking Technologies, Inc. This software may only be used
* in accordance with the corresponding license agreement. Any unauthorized
* use, duplication, transmission, distribution, or disclosure of this
* software is expressly forbidden.
*
* This software is provided by VIA Networking Technologies, Inc. "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 VIA Networking Technologies, Inc.
* be liable for any direct, indirect, incidental, special, exemplary, or
* consequential damages.
*
*
* File: swpmactb.h
*
* Purpose: Mac table operation functions
*
* Author: Tevin Chen
* Henry Lin
*
* Date: Jan 08, 2002
* Apr 22, 2005
*
*/
#ifndef __SWPMACTB_H__
#define __SWPMACTB_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
/*--------------------- Export Definitions ------------------------*/
//
// Bit position for static MAC unicast table fields
//
#define MAC_BIT_FID_S 0
#define MAC_BIT_FID_E 12
// for static
#define MAC_BIT_DMAC_REDIR_S 13
#define MAC_BIT_DMAC_REDIR_E 13
#define MAC_BIT_DMAC_PRI_S 14
#define MAC_BIT_DMAC_PRI_E 14
#define MAC_BIT_SEC_DRP_EXCP_S 15
#define MAC_BIT_SEC_DRP_EXCP_E 15
// for dynamic
#define MAC_BIT_AGE_COUNT_S 13
#define MAC_BIT_AGE_COUNT_E 15
// for unicast
#define MAC_BIT_SRC_ID_S 16
#define MAC_BIT_SRC_ID_E 20
#define MAC_BIT_TRK_TYPE_S 21
#define MAC_BIT_TRK_TYPE_E 21
#define MAC_BIT_CPU_INV_S 22
#define MAC_BIT_CPU_INV_E 22
#define MAC_BIT_SMAC_PRI_S 23
#define MAC_BIT_SMAC_PRI_E 23
#define MAC_BIT_SMAC_REDIR_S 24
#define MAC_BIT_SMAC_REDIR_E 24
#define MAC_BIT_FLT_SMAC_S 25
#define MAC_BIT_FLT_SMAC_E 25
// for multicast
#define MAC_BIT_MCST_IDX_S 16
#define MAC_BIT_MCST_IDX_E 25
//
#define MAC_BIT_CAST_TYPE_S 26
#define MAC_BIT_CAST_TYPE_E 26
#define MAC_BIT_STATIC_S 27
#define MAC_BIT_STATIC_E 27
#define MAC_BIT_TAG_S 28
#define MAC_BIT_TAG_E 63
// Bit position mapping from MAC to TAG
#define MAC_MAP_MACADDR_TO_TAG_S 12
#define MAC_MAP_MACADDR_TO_TAG_E 47
#define MAC_ADDR_SIZE 6 // 6 bytes
/*--------------------- Export Types ------------------------------*/
// MAC table entry structure
struct tagSMacEntry {
UINT8 abyMacAddr[MAC_ADDR_SIZE]; // Mac address of the entry
BOOL bStatic; // Is entry static or dynamic?
BOOL bTypeMcst; // Is unicast or multicast ?
// for unicast
BOOL bFltrSmac; // Filter packet when it's SMAC
BOOL bNotRedirSmac; // Is entry not enforce L2+ redirect action when it's SMAC?
BOOL bPriSmac; // Use SMAC priority when it's SMAC
BOOL bCpuInv; // CPU intervention if SMAC ?
BOOL bTrkGrp; // Is src port single port/trunk grp?
UINT8 u8SrcId; // Src port/Trunk grp ID
// for multicast
UINT16 u16McstIdx; // multicast mask
// for static
BOOL bSecDropExcp; // Enable Security Drop Exception
BOOL bPriDmac; // Use DMAC priority when it's DMAC
BOOL bNotRedirDmac; // Do not enforce L2+ redirect action when it's DMAC?
// for dynamic
UINT8 u8AgeCnt; // age count
UINT16 u16Fid; // FID of the entry
//Field used by SMAC table
BOOL bIpMcst;
UINT8 byBindId;
};
typedef struct tagSMacEntry SMacEntry;
/*--------------------- Export Macros -----------------------------*/
#define GET_PMAC_SLOTID(x) ((x & 0x00000008) ? 1 : 0) //x is pmac entry slot address,ex: x=0xA0008, means pmac entry is in slot1
#define GET_PMAC_MEMENTRY_ADDR(x) (x & ~(0x00000008)) //x is pmac entry slot address,ex: x=0xA0008, means pmac memory entry address is 0xA0000
#define PMAC_INDEX_TO_SA(indx) (SRAM_PMAC_TBL_BASE_ADDR + (indx<<SHIFT_NUM_SIZE_8Byte))
#define PMAC_MEM_INDEX_TO_SA(indx) (SRAM_PMAC_TBL_BASE_ADDR + (indx<<SHIFT_NUM_SIZE_16Byte))
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
BOOL SWMACTB_bIsEntryStatic(UINT16 u16Indx);
BOOL SWMACTB_bIsEntryEmpty(UINT16 u16Indx);
BOOL SWMACTB_bIsEntryUcst(UINT16 u16Indx);
UINT16 SWMACTB_wSearchEntry(PUINT8 abyMacAddr, UINT16 u16Fid);
BOOL SWMACTB_bGetEntry(UINT16 u16Indx, SMacEntry* pSEntry);
BOOL SWMACTB_bInsEntry(SMacEntry* pSEntry, BOOL bIsOverWrite);
BOOL SWMACTB_bDelEntry(PUINT8 abyMacAddr, UINT16 u16Fid);
void SWMACTB_vDelEntryByIndx(UINT16 u16Indx);
UINT16 SWMACTB_wHash(PUINT8 abyMacAddr, UINT16 u16Fid);
void SWMACTB_vInvHash(UINT16 u16Index, UINT16 u16Fid, PUINT8 abyTag, PUINT8 abyMacAddr);
BOOL SWMACTB_bClearTblNonStaticEntry(void);
#endif // __SWPMACTB_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -