ipg.h

来自「linux 内核源代码」· C头文件 代码 · 共 837 行 · 第 1/2 页

H
837
字号
#define IPG_WE_MAGIC_PKT_ENABLE         0x02#define IPG_WE_LINK_EVT_ENABLE          0x04#define IPG_WE_WAKE_POLARITY            0x08#define IPG_WE_WAKE_PKT_EVT             0x10#define IPG_WE_MAGIC_PKT_EVT            0x20#define IPG_WE_LINK_EVT                 0x40#define IPG_WE_WOL_ENABLE               0x80/* IntEnable */#define IPG_IE_RSVD_MASK                0x1FFE#define IPG_IE_HOST_ERROR               0x0002#define IPG_IE_TX_COMPLETE              0x0004#define IPG_IE_MAC_CTRL_FRAME           0x0008#define IPG_IE_RX_COMPLETE              0x0010#define IPG_IE_RX_EARLY                 0x0020#define IPG_IE_INT_REQUESTED            0x0040#define IPG_IE_UPDATE_STATS             0x0080#define IPG_IE_LINK_EVENT               0x0100#define IPG_IE_TX_DMA_COMPLETE          0x0200#define IPG_IE_RX_DMA_COMPLETE          0x0400#define IPG_IE_RFD_LIST_END             0x0800#define IPG_IE_RX_DMA_PRIORITY          0x1000/* IntStatus */#define IPG_IS_RSVD_MASK                0x1FFF#define IPG_IS_INTERRUPT_STATUS         0x0001#define IPG_IS_HOST_ERROR               0x0002#define IPG_IS_TX_COMPLETE              0x0004#define IPG_IS_MAC_CTRL_FRAME           0x0008#define IPG_IS_RX_COMPLETE              0x0010#define IPG_IS_RX_EARLY                 0x0020#define IPG_IS_INT_REQUESTED            0x0040#define IPG_IS_UPDATE_STATS             0x0080#define IPG_IS_LINK_EVENT               0x0100#define IPG_IS_TX_DMA_COMPLETE          0x0200#define IPG_IS_RX_DMA_COMPLETE          0x0400#define IPG_IS_RFD_LIST_END             0x0800#define IPG_IS_RX_DMA_PRIORITY          0x1000/* MACCtrl */#define IPG_MC_RSVD_MASK                0x7FE33FA3#define IPG_MC_IFS_SELECT               0x00000003#define IPG_MC_IFS_4352BIT              0x00000003#define IPG_MC_IFS_1792BIT              0x00000002#define IPG_MC_IFS_1024BIT              0x00000001#define IPG_MC_IFS_96BIT                0x00000000#define IPG_MC_DUPLEX_SELECT            0x00000020#define IPG_MC_DUPLEX_SELECT_FD         0x00000020#define IPG_MC_DUPLEX_SELECT_HD         0x00000000#define IPG_MC_TX_FLOW_CONTROL_ENABLE   0x00000080#define IPG_MC_RX_FLOW_CONTROL_ENABLE   0x00000100#define IPG_MC_RCV_FCS                  0x00000200#define IPG_MC_FIFO_LOOPBACK            0x00000400#define IPG_MC_MAC_LOOPBACK             0x00000800#define IPG_MC_AUTO_VLAN_TAGGING        0x00001000#define IPG_MC_AUTO_VLAN_UNTAGGING      0x00002000#define IPG_MC_COLLISION_DETECT         0x00010000#define IPG_MC_CARRIER_SENSE            0x00020000#define IPG_MC_STATISTICS_ENABLE        0x00200000#define IPG_MC_STATISTICS_DISABLE       0x00400000#define IPG_MC_STATISTICS_ENABLED       0x00800000#define IPG_MC_TX_ENABLE                0x01000000#define IPG_MC_TX_DISABLE               0x02000000#define IPG_MC_TX_ENABLED               0x04000000#define IPG_MC_RX_ENABLE                0x08000000#define IPG_MC_RX_DISABLE               0x10000000#define IPG_MC_RX_ENABLED               0x20000000#define IPG_MC_PAUSED                   0x40000000/* *	Tune *//* Miscellaneous Constants. */#define   TRUE  1#define   FALSE 0/* Assign IPG_APPEND_FCS_ON_TX > 0 for auto FCS append on TX. */#define         IPG_APPEND_FCS_ON_TX         TRUE/* Assign IPG_APPEND_FCS_ON_TX > 0 for auto FCS strip on RX. */#define         IPG_STRIP_FCS_ON_RX          TRUE/* Assign IPG_DROP_ON_RX_ETH_ERRORS > 0 to drop RX frames with * Ethernet errors. */#define         IPG_DROP_ON_RX_ETH_ERRORS    TRUE/* Assign IPG_INSERT_MANUAL_VLAN_TAG > 0 to insert VLAN tags manually * (via TFC). */#define		IPG_INSERT_MANUAL_VLAN_TAG   FALSE/* Assign IPG_ADD_IPCHECKSUM_ON_TX > 0 for auto IP checksum on TX. */#define         IPG_ADD_IPCHECKSUM_ON_TX     FALSE/* Assign IPG_ADD_TCPCHECKSUM_ON_TX > 0 for auto TCP checksum on TX. * DO NOT USE FOR SILICON REVISIONS B3 AND EARLIER. */#define         IPG_ADD_TCPCHECKSUM_ON_TX    FALSE/* Assign IPG_ADD_UDPCHECKSUM_ON_TX > 0 for auto UDP checksum on TX. * DO NOT USE FOR SILICON REVISIONS B3 AND EARLIER. */#define         IPG_ADD_UDPCHECKSUM_ON_TX    FALSE/* If inserting VLAN tags manually, assign the IPG_MANUAL_VLAN_xx * constants as desired. */#define		IPG_MANUAL_VLAN_VID		0xABC#define		IPG_MANUAL_VLAN_CFI		0x1#define		IPG_MANUAL_VLAN_USERPRIORITY 0x5#define         IPG_IO_REG_RANGE		0xFF#define         IPG_MEM_REG_RANGE		0x154#define         IPG_DRIVER_NAME		"Sundance Technology IPG Triple-Speed Ethernet"#define         IPG_NIC_PHY_ADDRESS          0x01#define		IPG_DMALIST_ALIGN_PAD	0x07#define		IPG_MULTICAST_HASHTABLE_SIZE	0x40/* Number of miliseconds to wait after issuing a software reset. * 0x05 <= IPG_AC_RESETWAIT to account for proper 10Mbps operation. */#define         IPG_AC_RESETWAIT             0x05/* Number of IPG_AC_RESETWAIT timeperiods before declaring timeout. */#define         IPG_AC_RESET_TIMEOUT         0x0A/* Minimum number of nanoseconds used to toggle MDC clock during * MII/GMII register access. */#define		IPG_PC_PHYCTRLWAIT_NS		200#define		IPG_TFDLIST_LENGTH		0x100/* Number of frames between TxDMAComplete interrupt. * 0 < IPG_FRAMESBETWEENTXDMACOMPLETES <= IPG_TFDLIST_LENGTH */#define		IPG_FRAMESBETWEENTXDMACOMPLETES 0x1#ifdef JUMBO_FRAME# ifdef JUMBO_FRAME_SIZE_2K# define JUMBO_FRAME_SIZE 2048# define __IPG_RXFRAG_SIZE 2048# else#  ifdef JUMBO_FRAME_SIZE_3K#  define JUMBO_FRAME_SIZE 3072#  define __IPG_RXFRAG_SIZE 3072#  else#   ifdef JUMBO_FRAME_SIZE_4K#   define JUMBO_FRAME_SIZE 4096#   define __IPG_RXFRAG_SIZE 4088#   else#    ifdef JUMBO_FRAME_SIZE_5K#    define JUMBO_FRAME_SIZE 5120#    define __IPG_RXFRAG_SIZE 4088#    else#     ifdef JUMBO_FRAME_SIZE_6K#     define JUMBO_FRAME_SIZE 6144#     define __IPG_RXFRAG_SIZE 4088#     else#      ifdef JUMBO_FRAME_SIZE_7K#      define JUMBO_FRAME_SIZE 7168#      define __IPG_RXFRAG_SIZE 4088#      else#       ifdef JUMBO_FRAME_SIZE_8K#       define JUMBO_FRAME_SIZE 8192#       define __IPG_RXFRAG_SIZE 4088#       else#        ifdef JUMBO_FRAME_SIZE_9K#        define JUMBO_FRAME_SIZE 9216#        define __IPG_RXFRAG_SIZE 4088#        else#         ifdef JUMBO_FRAME_SIZE_10K#         define JUMBO_FRAME_SIZE 10240#         define __IPG_RXFRAG_SIZE 4088#         else#         define JUMBO_FRAME_SIZE 4096#         endif#        endif#       endif#      endif#     endif#    endif#   endif#  endif# endif#endif/* Size of allocated received buffers. Nominally 0x0600. * Define larger if expecting jumbo frames. */#ifdef JUMBO_FRAME//IPG_TXFRAG_SIZE must <= 0x2b00, or TX will crash#define		IPG_TXFRAG_SIZE		JUMBO_FRAME_SIZE#endif/* Size of allocated received buffers. Nominally 0x0600. * Define larger if expecting jumbo frames. */#ifdef JUMBO_FRAME//4088=4096-8#define		IPG_RXFRAG_SIZE		__IPG_RXFRAG_SIZE#define     IPG_RXSUPPORT_SIZE   IPG_MAX_RXFRAME_SIZE#else#define		IPG_RXFRAG_SIZE		0x0600#define     IPG_RXSUPPORT_SIZE   IPG_RXFRAG_SIZE#endif/* IPG_MAX_RXFRAME_SIZE <= IPG_RXFRAG_SIZE */#ifdef JUMBO_FRAME#define		IPG_MAX_RXFRAME_SIZE		JUMBO_FRAME_SIZE#else#define		IPG_MAX_RXFRAME_SIZE		0x0600#endif#define		IPG_RFDLIST_LENGTH		0x100/* Maximum number of RFDs to process per interrupt. * 1 < IPG_MAXRFDPROCESS_COUNT < IPG_RFDLIST_LENGTH */#define		IPG_MAXRFDPROCESS_COUNT	0x80/* Minimum margin between last freed RFD, and current RFD. * 1 < IPG_MINUSEDRFDSTOFREE < IPG_RFDLIST_LENGTH */#define		IPG_MINUSEDRFDSTOFREE	0x80/* specify the jumbo frame maximum size * per unit is 0x600 (the RxBuffer size that one RFD can carry) */#define     MAX_JUMBOSIZE	        0x8	// max is 12K/* Key register values loaded at driver start up. *//* TXDMAPollPeriod is specified in 320ns increments. * * Value	Time * --------------------- * 0x00-0x01	320ns * 0x03		~1us * 0x1F		~10us * 0xFF		~82us */#define		IPG_TXDMAPOLLPERIOD_VALUE	0x26/* TxDMAUrgentThresh specifies the minimum amount of * data in the transmit FIFO before asserting an * urgent transmit DMA request. * * Value	Min TxFIFO occupied space before urgent TX request * --------------------------------------------------------------- * 0x00-0x04	128 bytes (1024 bits) * 0x27		1248 bytes (~10000 bits) * 0x30		1536 bytes (12288 bits) * 0xFF		8192 bytes (65535 bits) */#define		IPG_TXDMAURGENTTHRESH_VALUE	0x04/* TxDMABurstThresh specifies the minimum amount of * free space in the transmit FIFO before asserting an * transmit DMA request. * * Value	Min TxFIFO free space before TX request * ---------------------------------------------------- * 0x00-0x08	256 bytes * 0x30		1536 bytes * 0xFF		8192 bytes */#define		IPG_TXDMABURSTTHRESH_VALUE	0x30/* RXDMAPollPeriod is specified in 320ns increments. * * Value	Time * --------------------- * 0x00-0x01	320ns * 0x03		~1us * 0x1F		~10us * 0xFF		~82us */#define		IPG_RXDMAPOLLPERIOD_VALUE	0x01/* RxDMAUrgentThresh specifies the minimum amount of * free space within the receive FIFO before asserting * a urgent receive DMA request. * * Value	Min RxFIFO free space before urgent RX request * --------------------------------------------------------------- * 0x00-0x04	128 bytes (1024 bits) * 0x27		1248 bytes (~10000 bits) * 0x30		1536 bytes (12288 bits) * 0xFF		8192 bytes (65535 bits) */#define		IPG_RXDMAURGENTTHRESH_VALUE	0x30/* RxDMABurstThresh specifies the minimum amount of * occupied space within the receive FIFO before asserting * a receive DMA request. * * Value	Min TxFIFO free space before TX request * ---------------------------------------------------- * 0x00-0x08	256 bytes * 0x30		1536 bytes * 0xFF		8192 bytes */#define		IPG_RXDMABURSTTHRESH_VALUE	0x30/* FlowOnThresh specifies the maximum amount of occupied * space in the receive FIFO before a PAUSE frame with * maximum pause time transmitted. * * Value	Max RxFIFO occupied space before PAUSE * --------------------------------------------------- * 0x0000	0 bytes * 0x0740	29,696 bytes * 0x07FF	32,752 bytes */#define		IPG_FLOWONTHRESH_VALUE	0x0740/* FlowOffThresh specifies the minimum amount of occupied * space in the receive FIFO before a PAUSE frame with * zero pause time is transmitted. * * Value	Max RxFIFO occupied space before PAUSE * --------------------------------------------------- * 0x0000	0 bytes * 0x00BF	3056 bytes * 0x07FF	32,752 bytes */#define		IPG_FLOWOFFTHRESH_VALUE	0x00BF/* * Miscellaneous macros. *//* Marco for printing debug statements.#  define IPG_DDEBUG_MSG(args...) printk(KERN_DEBUG "IPG: " ## args) */#ifdef IPG_DEBUG#  define IPG_DEBUG_MSG(args...)#  define IPG_DDEBUG_MSG(args...) printk(KERN_DEBUG "IPG: " args)#  define IPG_DUMPRFDLIST(args) ipg_dump_rfdlist(args)#  define IPG_DUMPTFDLIST(args) ipg_dump_tfdlist(args)#else#  define IPG_DEBUG_MSG(args...)#  define IPG_DDEBUG_MSG(args...)#  define IPG_DUMPRFDLIST(args)#  define IPG_DUMPTFDLIST(args)#endif/* * End miscellaneous macros. *//* Transmit Frame Descriptor. The IPG supports 15 fragments, * however Linux requires only a single fragment. Note, each * TFD field is 64 bits wide. */struct ipg_tx {	__le64 next_desc;	__le64 tfc;	__le64 frag_info;};/* Receive Frame Descriptor. Note, each RFD field is 64 bits wide. */struct ipg_rx {	__le64 next_desc;	__le64 rfs;	__le64 frag_info;};struct SJumbo {	int FoundStart;	int CurrentSize;	struct sk_buff *skb;};/* Structure of IPG NIC specific data. */struct ipg_nic_private {	void __iomem *ioaddr;	struct ipg_tx *txd;	struct ipg_rx *rxd;	dma_addr_t txd_map;	dma_addr_t rxd_map;	struct sk_buff *TxBuff[IPG_TFDLIST_LENGTH];	struct sk_buff *RxBuff[IPG_RFDLIST_LENGTH];	unsigned int tx_current;	unsigned int tx_dirty;	unsigned int rx_current;	unsigned int rx_dirty;// Add by Grace 2005/05/19#ifdef JUMBO_FRAME	struct SJumbo Jumbo;#endif	unsigned int rx_buf_sz;	struct pci_dev *pdev;	struct net_device *dev;	struct net_device_stats stats;	spinlock_t lock;	int tenmbpsmode;	/*Jesse20040128EEPROM_VALUE */	u16 LED_Mode;	u16 station_addr[3];	/* Station Address in EEPROM Reg 0x10..0x12 */	struct mutex		mii_mutex;	struct mii_if_info	mii_if;	int ResetCurrentTFD;#ifdef IPG_DEBUG	int RFDlistendCount;	int RFDListCheckedCount;	int EmptyRFDListCount;#endif	struct delayed_work task;};#endif				/* __LINUX_IPG_H */

⌨️ 快捷键说明

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