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

📄 sw.h

📁 网络驱动开发
💻 H
📖 第 1 页 / 共 3 页
字号:
// This structure is Rx report queue entry
//
typedef struct _RX_REPORT_QUEUE_ENTRY
{
   union
   {
	    struct
	    {
		    ULONG	Own:1;                  // the least significant bit
		    ULONG	Raw:1;
           ULONG   Index:12;               // Range from 0 to 4095
           ULONG   rqSlotType:2;
           ULONG   reserved2:16;
	    }
           RxReportQDWord0;

   	ULONG	RxReportQueueDword0;
   };

   union	
   {
	    struct                              // Rx AAL5 Report Queue Entry
	    {
		    ULONG	VC:12;
		    ULONG	Size:12;
		    ULONG	Efci:1;
		    ULONG	Clp:1;
		    ULONG	Status:3;
		    ULONG	Bad:1;
		    ULONG	Sop:1;
		    ULONG	Eop:1;
	    }
           RxReportQDWord1;

	    struct                              // Rx Raw Cell Report Queue Entry
	    {
		    ULONG	reserved:32;
	    };

   	ULONG	RxReportQueueDword1;
   };

}
   RX_REPORT_QUEUE_ENTRY,
   *PRX_REPORT_QUEUE_ENTRY;

//
// Definitions of bad status of receive report queue.
//
typedef enum _TBATM155_RX_REPORTQ_BAD_STATUS
{
       Crc32ErrDiscard = 0,
       LengthErrDiscard,
       AbortedPktDiscard,
       SlotCongDiscard,
       OtherCellErrDiscard,
       ReassemblyTimeout,
       PktTooLongErr,
       Reserved,
       TbAtm155TxReportQBadStatus
}
   TBATM155_TX_REPORTQ_BAD_STATUS;


typedef	struct	_RX_REPORT_QUEUE
{
   PRX_REPORT_QUEUE_ENTRY  RxReportQptrVa;
   NDIS_PHYSICAL_ADDRESS   RxReportQptrPa;     // point to starting of Rx report queue.

   ALLOCATION_INFO;
}
   RX_REPORT_QUEUE,
   *PRX_REPORT_QUEUE;


typedef struct _ADAPTER_BLOCK
{
#if DBG
   //
   //	Structure that contains debug log information.
   //
   struct _TBATM155_LOG_INFO   *DebugInfo;

   //
   //	contains packet size to detect if packet is not 48 byte boundary.
   //
   ULONG       CurrPacketSize;
   ULONG       PrevPacketSize;

#endif

   //
   //	Handle for use in calls into NDIS.
   //
   NDIS_HANDLE             MiniportAdapterHandle;

   ULONG                   References;
   NDIS_SPIN_LOCK          lock;

   //
   //	Flags describing the adapter state.
   //
   ULONG                   Flags;

   //
   //	Current hardware status.
   //
   NDIS_HARDWARE_STATUS        HardwareStatus;

   //
   //	Current link status.
   //
   NDIS_MEDIA_STATE            MediaConnectStatus;

   ///
   //	Contains hardware information.
   ///
   PHARDWARE_INFO              HardwareInfo;

   //
   //	Registry information.
   //
   PTBATM155_REGISTRY_PARAMETER    RegistryParameters;

   ///
   //	Adapter statistics.
   ///
   TBATM155_STATISTICS_INFO        StatInfo;

   //
   //	Interrupt Tx fatal error count.
   //
   ULONG                   TxFatalError;

   //
   //	PCI error interrupt.
   //
   ULONG                   PciErrorCount;

   //
   //	Tx Free Slot Underflow interrupt.
   //
   ULONG                   TxFreeSlotUnflCount;

   //
   //	Rx Free Slot Overflow interrupt.
   //
   ULONG                   RxFreeSlotOvflCount;

   ///
   //	List of the Vc's
   //
   //	We maintain 2 lists of VCs. Those that have been activated
   //	and thoes that are not.
   ///
   LIST_ENTRY              InactiveVcList;
   LIST_ENTRY              ActiveVcList;

   //
   //	The following are in cells/sec.
   //	
   ULONG                   MaximumBandwidth;
   ULONG                   MinimumCbrBandwidth;
   ULONG                   MinimumAbrBandwidth;
   ULONG                   RemainingTransmitBandwidth;

#if    AW_QOS

   //
   //	The Number of available CBR VCs
   //  9/17/97
   //      Should never limit the CBR Vc connection (theoretically).
   //      In order to pass NDIS tester with limited equipments,
   //      we use "patch" way to make it pass the tester.
   //      Later on, need to come back to find out the cause(s) of
   //      the failure "NDIS_STATUS_INCOMPATABLE QOS" when we get an
   //      ATM analyzer.
   //	
   USHORT                  NumOfAvailableCbrVc;
#endif // end of AW_QOS

   USHORT                  NumOfAvailVc_B;
   USHORT                  NumOfAvailVc_S;

   //
   //	The Number of entries are used in CBR schedule table
   //	
   ULONG                   TotalEntriesUsedonCBRs;

   //
   //	Transmit report queue information
   //
   TX_REPORT_QUEUE         TxReportQueue;    

   //
   //	Receive report queue information
   //
   RX_REPORT_QUEUE         RxReportQueue;    

   //
   //	Pointer to Map Register buffer
   //
   PMAP_REGISTER           pMapRegisters;

   //
   //   Spinlock for VcHashList below.
   //
   NDIS_SPIN_LOCK          VcHashLock;

   //
   //	The following cannot be moved!!!!
   //	This is the hash list of a given VCI to it's PVC_BLOCK
   //
   PVC_BLOCK               VcHashList[1];
};

//
//	Macros for adapter flag manipulation
//
#define ADAPTER_SET_FLAG(_adapter, _f)     (_adapter)->Flags |= (_f)
#define ADAPTER_CLEAR_FLAG(_adapter, _f)   (_adapter)->Flags &= ~(_f)
#define ADAPTER_TEST_FLAG(_adapter, _f)    (((_adapter)->Flags & (_f)) == (_f))

//
//	Flags for describing the Adapter state.
//
#define fADAPTER_INITIALIZING              0x00000001
#define fADAPTER_HARDWARE_FAILURE          0x00000002
#define fADAPTER_RESET_REQUESTED           0x00000004
#define fADAPTER_RESET_IN_PROGRESS         0x00000008
#define fADAPTER_PROCESSING_INTERRUPTS     0x00000010
#if TB_CHK4HANG
 #define fADAPTER_EXPECT_TXIOC             0x00000020
#endif // end of TB_CHK4HANG
#define fADAPTER_PROCESSING_SENDPACKETS    0x00000040
#define fADAPTER_SHUTTING_DOWN             0x80000000

typedef struct _VC_BLOCK
{
#if DBG
	//
	//	Structure that contains debug log information.
	//
	struct _TBATM155_LOG_INFO   *DebugInfo;
#endif

   LIST_ENTRY              Link;
		
   PVC_BLOCK               NextVcHash;     //  Pointer to the next VC in
                                           //  the hash list.
	
   PADAPTER_BLOCK          Adapter;
   PHARDWARE_INFO          HwInfo;
   NDIS_HANDLE             NdisVcHandle;
   PSAR_INFO               Sar;
   PXMIT_DMA_QUEUE         XmitDmaQ;
   PRECV_DMA_QUEUE         RecvDmaQ;

   ULONG                   References;     //  Number of outstanding references
                                           //  on this VC.

   ULONG                   PktsHoldsByNdis; //  The number of packets needed to be 
                                            //  returned from Ndis.

#if DBG
   ULONG                   SegWaitRef;
   ULONG                   SegCompRef;
   ULONG                   DmaWaitRef;
   ULONG                   DmaCompRef;

   ULONG                   RecvDmaCompRef;
#endif
	
   NDIS_SPIN_LOCK          lock;           //  Protection for this structure.
	
   ULONG                   Flags;          //  Flags describing vc state.

   //
   //	VC specific statistics.
   //
   TBATM155_STATISTICS_INFO    StatInfo;

   //
   //	ATM media parameters for this VC.
   //
   ULONG                   MediaFlags;

   ATM_VPIVCI              VpiVci;		//	VCI assigned to the VC.
   ATM_AAL_TYPE            AALType;	//	AAL type supported by this VC.

   //
   //	Rate information.
   //
   ATM_FLOW_PARAMETERS     Transmit;
   ATM_FLOW_PARAMETERS     Receive;

   //
   //	The following is the transmit buffer descriptor that is
   //	pre-built on VCI activation.
   //
   PXMIT_SEG_INFO          XmitSegInfo;
   PRECV_SEG_INFO          RecvSegInfo;

   //
   //  Based on the MaxSduSize, it will be set to either
   //  RECV_BIG_BUFFER or RECV_SMALL_BUFFER which indicate the type
   //  of slot being posted, "BIG" or "SMALL".
   //
   UCHAR                   RecvBufType;

   //
   //	CBR schedule table setup pre VC with CBR flow control.
   //
   ULONG                   CbrNumOfEntris;
   UCHAR                   CbrPreScaleVal;

   //
   //	Pointer to the call parameters.
   //	This is used for async completion of the VC activation.
   //
   PCO_CALL_PARAMETERS     CoCallParameters;
};

//
//	Macros for VC flag manipulation
//
#define VC_SET_FLAG(_vc, _f)       (_vc)->Flags |= (_f)
#define VC_CLEAR_FLAG(_vc, _f)     (_vc)->Flags &= ~(_f)
#define VC_TEST_FLAG(_vc, _f)      (((_vc)->Flags & (_f)) == (_f))

//
//	Flags describing VC state.
//
#define fVC_ACTIVE                 0x00000001
#define fVC_DEACTIVATING           0x00000002
#define fVC_TRANSMIT               0x00000004
#define fVC_RECEIVE                0x00000008
#define fVC_SET_CLP                0x00000010
#define fVC_RESET_IN_PROGRESS      0x00000020
#define fVC_INDICATE_END_OF_TX     0x00000040
#define fVC_ALLOCATING_TXBUF       0x00000100
#define fVC_ALLOCATING_RXBUF       0x00000200
#define fVC_MEM_OUT_OF_RESOURCES   0x00000400

#if DBG
 #define fVC_DBG_RXVC              0x02000000
 #define fVC_DBG_TXVC              0x04000000
#endif    // end of DBG

#define fVC_ERROR                  0x80000000


//
//
//
#define tbAtm155ReferenceAdapter(_adapter)     (_adapter)->References++
#define tbAtm155DereferenceAdapter(_adapter)   (_adapter)->References--

#if DBG

#define tbAtm155ReferenceVc(_vc)                                           \
{                                                                          \
   (_vc)->References++;                                                    \
   if ((_vc)->References > 150)                                            \
   {                                                                       \
       DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO,                             \
        ("Reference %u Vc 0x%x\n", (_vc)->References, (_vc)->VpiVci.Vci)); \
   }                                                                       \
}

#define tbAtm155DereferenceVc(_vc)                                         \
{                                                                          \
   (_vc)->References--;                                                    \
   if ((_vc)->References > 150)                                            \
   {                                                                       \
       DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO,                             \
        ("Deeference %u Vc 0x%x\n", (_vc)->References, (_vc)->VpiVci.Vci)); \
   }                                                                       \
}

#else      // else of DBG

#define tbAtm155ReferenceVc(_vc)           (_vc)->References++
#define tbAtm155DereferenceVc(_vc)         (_vc)->References--

#endif


#endif // __SW_H
					


⌨️ 快捷键说明

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