?? skrlmt.h
字號:
SK_BOOL IsBc /* Flag: packet is broadcast */unsigned *pOffset /* offs. of bytes to present to SK_RLMT_LOOKAHEAD */unsigned *pNumBytes /* #Bytes to present to SK_RLMT_LOOKAHEAD */#endif /* 0 */#define SK_RLMT_PRE_LOOKAHEAD(pAC,PortNum,PktLen,IsBc,pOffset,pNumBytes) { \ SK_AC *_pAC; \ SK_U32 _PortNum; \ _pAC = (pAC); \ _PortNum = (SK_U32)(PortNum); \ /* _pAC->Rlmt.Port[_PortNum].PacketsRx++; */ \ _pAC->Rlmt.Port[_PortNum].PacketsPerTimeSlot++; \ if (_pAC->Rlmt.RlmtOff) { \ *(pNumBytes) = 0; \ } \ else {\ if ((_pAC->Rlmt.Port[_PortNum].Net->RlmtMode & SK_RLMT_TRANSPARENT) != 0) { \ *(pNumBytes) = 0; \ } \ else if (IsBc) { \ if (_pAC->Rlmt.Port[_PortNum].Net->RlmtMode != SK_RLMT_MODE_CLS) { \ *(pNumBytes) = 6; \ *(pOffset) = 6; \ } \ else { \ *(pNumBytes) = 0; \ } \ } \ else { \ if ((PktLen) > SK_RLMT_MAX_TX_BUF_SIZE) { \ /* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \ *(pNumBytes) = 0; \ } \ else { \ *(pNumBytes) = 6; \ *(pOffset) = 0; \ } \ } \ } \}#if 0SK_AC *pAC /* adapter context */SK_U32 PortNum /* receiving port */SK_U8 *pLaPacket, /* received packet's data (points to pOffset) */SK_BOOL IsBc /* Flag: packet is broadcast */SK_BOOL IsMc /* Flag: packet is multicast */unsigned *pForRlmt /* Result: bits SK_RLMT_RX_RLMT, SK_RLMT_RX_PROTOCOL */SK_RLMT_LOOKAHEAD() expects *pNumBytes frompacket offset *pOffset (s.a.) at *pLaPacket.If you use SK_RLMT_LOOKAHEAD in a path where you already know if the packet isBC, MC, or UC, you should use constants for IsBc and IsMc, so that your compilercan trash unneeded parts of the if construction.#endif /* 0 */#define SK_RLMT_LOOKAHEAD(pAC,PortNum,pLaPacket,IsBc,IsMc,pForRlmt) { \ SK_AC *_pAC; \ SK_U32 _PortNum; \ SK_U8 *_pLaPacket; \ _pAC = (pAC); \ _PortNum = (SK_U32)(PortNum); \ _pLaPacket = (SK_U8 *)(pLaPacket); \ if (IsBc) {\ if (!SK_ADDR_EQUAL(_pLaPacket, _pAC->Addr.Net[_pAC->Rlmt.Port[ \ _PortNum].Net->NetNumber].CurrentMacAddress.a)) { \ _pAC->Rlmt.Port[_PortNum].BcTimeStamp = SkOsGetTime(_pAC); \ _pAC->Rlmt.CheckSwitch = SK_TRUE; \ } \ /* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \ *(pForRlmt) = SK_RLMT_RX_PROTOCOL; \ } \ else if (IsMc) { \ if (SK_ADDR_EQUAL(_pLaPacket, BridgeMcAddr.a)) { \ _pAC->Rlmt.Port[_PortNum].BpduPacketsPerTimeSlot++; \ if (_pAC->Rlmt.Port[_PortNum].Net->RlmtMode & SK_RLMT_CHECK_SEG) { \ *(pForRlmt) = SK_RLMT_RX_RLMT | SK_RLMT_RX_PROTOCOL; \ } \ else { \ *(pForRlmt) = SK_RLMT_RX_PROTOCOL; \ } \ } \ else if (SK_ADDR_EQUAL(_pLaPacket, SkRlmtMcAddr.a)) { \ *(pForRlmt) = SK_RLMT_RX_RLMT; \ } \ else { \ /* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \ *(pForRlmt) = SK_RLMT_RX_PROTOCOL; \ } \ } \ else { \ if (SK_ADDR_EQUAL( \ _pLaPacket, \ _pAC->Addr.Port[_PortNum].CurrentMacAddress.a)) { \ *(pForRlmt) = SK_RLMT_RX_RLMT; \ } \ else { \ /* _pAC->Rlmt.Port[_PortNum].DataPacketsPerTimeSlot++; */ \ *(pForRlmt) = SK_RLMT_RX_PROTOCOL; \ } \ } \}#ifdef SK_RLMT_FAST_LOOKAHEADError: SK_RLMT_FAST_LOOKAHEAD no longer used. Use new macros for lookahead.#endif /* SK_RLMT_FAST_LOOKAHEAD */#ifdef SK_RLMT_SLOW_LOOKAHEADError: SK_RLMT_SLOW_LOOKAHEAD no longer used. Use new macros for lookahead.#endif /* SK_RLMT_SLOW_LOOKAHEAD *//* typedefs *******************************************************************/#ifdef SK_RLMT_MBUF_PRIVATEtypedef struct s_RlmtMbuf { some content} SK_RLMT_MBUF;#endif /* SK_RLMT_MBUF_PRIVATE */#ifdef SK_LA_INFOtypedef struct s_Rlmt_PacketInfo { unsigned PacketLength; /* Length of packet. */ unsigned PacketType; /* Directed/Multicast/Broadcast. */} SK_RLMT_PINFO;#endif /* SK_LA_INFO */typedef struct s_RootId { SK_U8 Id[8]; /* Root Bridge Id. */} SK_RLMT_ROOT_ID;typedef struct s_port { SK_MAC_ADDR CheckAddr; SK_BOOL SuspectTx;} SK_PORT_CHECK;typedef struct s_RlmtNet SK_RLMT_NET;typedef struct s_RlmtPort {/* ----- Public part (read-only) ----- */ SK_U8 PortState; /* Current state of this port. */ /* For PNMI */ SK_BOOL LinkDown; SK_BOOL PortDown; SK_U8 Align01; SK_U32 PortNumber; /* Number of port on adapter. */ SK_RLMT_NET * Net; /* Net port belongs to. */ SK_U64 TxHelloCts; SK_U64 RxHelloCts; SK_U64 TxSpHelloReqCts; SK_U64 RxSpHelloCts;/* ----- Private part ----- *//* SK_U64 PacketsRx; */ /* Total packets received. */ SK_U32 PacketsPerTimeSlot; /* Packets rxed between TOs. *//* SK_U32 DataPacketsPerTimeSlot; */ /* Data packets ... */ SK_U32 BpduPacketsPerTimeSlot; /* BPDU packets rxed in TS. */ SK_U64 BcTimeStamp; /* Time of last BC receive. */ SK_U64 GuTimeStamp; /* Time of entering GOING_UP. */ SK_TIMER UpTimer; /* Timer struct Link/Port up. */ SK_TIMER DownRxTimer; /* Timer struct down rx. */ SK_TIMER DownTxTimer; /* Timer struct down tx. */ SK_U32 CheckingState; /* Checking State. */ SK_ADDR_PORT * AddrPort; SK_U8 Random[4]; /* Random value. */ unsigned PortsChecked; /* #ports checked. */ unsigned PortsSuspect; /* #ports checked that are s. */ SK_PORT_CHECK PortCheck[1];/* SK_PORT_CHECK PortCheck[SK_MAX_MACS - 1]; */ SK_BOOL PortStarted; /* Port is started. */ SK_BOOL PortNoRx; /* NoRx for >= 1 time slot. */ SK_BOOL RootIdSet; SK_RLMT_ROOT_ID Root; /* Root Bridge Id. */} SK_RLMT_PORT;struct s_RlmtNet {/* ----- Public part (read-only) ----- */ SK_U32 NetNumber; /* Number of net. */ SK_RLMT_PORT * Port[SK_MAX_MACS]; /* Ports that belong to this net. */ SK_U32 NumPorts; /* Number of ports. */ SK_U32 PrefPort; /* Preferred port. */ /* For PNMI */ SK_U32 ChgBcPrio; /* Change Priority of last broadcast received */ SK_U32 RlmtMode; /* Check ... */ SK_U32 ActivePort; /* Active port. */ SK_U32 Preference; /* 0xFFFFFFFF: Automatic. */ SK_U8 RlmtState; /* Current RLMT state. *//* ----- Private part ----- */ SK_BOOL RootIdSet; SK_U16 Align01; int LinksUp; /* #Links up. */ int PortsUp; /* #Ports up. */ SK_U32 TimeoutValue; /* RLMT timeout value. */ SK_U32 CheckingState; /* Checking State. */ SK_RLMT_ROOT_ID Root; /* Root Bridge Id. */ SK_TIMER LocTimer; /* Timer struct. */ SK_TIMER SegTimer; /* Timer struct. */};typedef struct s_Rlmt {/* ----- Public part (read-only) ----- */ SK_U32 NumNets; /* Number of nets. */ SK_U32 NetsStarted; /* Number of nets started. */ SK_RLMT_NET Net[SK_MAX_NETS]; /* Array of available nets. */ SK_RLMT_PORT Port[SK_MAX_MACS]; /* Array of available ports. *//* ----- Private part ----- */ SK_BOOL CheckSwitch; SK_BOOL RlmtOff; /* set to zero if the Mac addresses are equal or the second one is zero */ SK_U16 Align01;} SK_RLMT;extern SK_MAC_ADDR BridgeMcAddr;extern SK_MAC_ADDR SkRlmtMcAddr;/* function prototypes ********************************************************/#ifndef SK_KR_PROTO/* Functions provided by SkRlmt *//* ANSI/C++ compliant function prototypes */extern void SkRlmtInit( SK_AC *pAC, SK_IOC IoC, int Level);extern int SkRlmtEvent( SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para);#else /* defined(SK_KR_PROTO) *//* Non-ANSI/C++ compliant function prototypes */#error KR-style function prototypes are not yet provided.#endif /* defined(SK_KR_PROTO)) */#ifdef __cplusplus}#endif /* __cplusplus */#endif /* __INC_SKRLMT_H */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -