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

📄 s2io.h

📁 linux 内核源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* FIFO mappings for all possible number of fifos configured */static int fifo_map[][MAX_TX_FIFOS] = {	{0, 0, 0, 0, 0, 0, 0, 0},	{0, 0, 0, 0, 1, 1, 1, 1},	{0, 0, 0, 1, 1, 1, 2, 2},	{0, 0, 1, 1, 2, 2, 3, 3},	{0, 0, 1, 1, 2, 2, 3, 4},	{0, 0, 1, 1, 2, 3, 4, 5},	{0, 0, 1, 2, 3, 4, 5, 6},	{0, 1, 2, 3, 4, 5, 6, 7},};/* Maintains Per FIFO related information. */struct tx_fifo_config {#define	MAX_AVAILABLE_TXDS	8192	u32 fifo_len;		/* specifies len of FIFO upto 8192, ie no of TxDLs *//* Priority definition */#define TX_FIFO_PRI_0               0	/*Highest */#define TX_FIFO_PRI_1               1#define TX_FIFO_PRI_2               2#define TX_FIFO_PRI_3               3#define TX_FIFO_PRI_4               4#define TX_FIFO_PRI_5               5#define TX_FIFO_PRI_6               6#define TX_FIFO_PRI_7               7	/*lowest */	u8 fifo_priority;	/* specifies pointer level for FIFO */	/* user should not set twos fifos with same pri */	u8 f_no_snoop;#define NO_SNOOP_TXD                0x01#define NO_SNOOP_TXD_BUFFER          0x02};/* Maintains per Ring related information */struct rx_ring_config {	u32 num_rxd;		/*No of RxDs per Rx Ring */#define RX_RING_PRI_0               0	/* highest */#define RX_RING_PRI_1               1#define RX_RING_PRI_2               2#define RX_RING_PRI_3               3#define RX_RING_PRI_4               4#define RX_RING_PRI_5               5#define RX_RING_PRI_6               6#define RX_RING_PRI_7               7	/* lowest */	u8 ring_priority;	/*Specifies service priority of ring */	/* OSM should not set any two rings with same priority */	u8 ring_org;		/*Organization of ring */#define RING_ORG_BUFF1		0x01#define RX_RING_ORG_BUFF3	0x03#define RX_RING_ORG_BUFF5	0x05	u8 f_no_snoop;#define NO_SNOOP_RXD                0x01#define NO_SNOOP_RXD_BUFFER         0x02};/* This structure provides contains values of the tunable parameters * of the H/W */struct config_param {/* Tx Side */	u32 tx_fifo_num;	/*Number of Tx FIFOs */	u8 fifo_mapping[MAX_TX_FIFOS];	struct tx_fifo_config tx_cfg[MAX_TX_FIFOS];	/*Per-Tx FIFO config */	u32 max_txds;		/*Max no. of Tx buffer descriptor per TxDL */	u64 tx_intr_type;#define INTA	0#define MSI_X	2	u8 intr_type;	u8 napi;	/* Specifies if Tx Intr is UTILZ or PER_LIST type. *//* Rx Side */	u32 rx_ring_num;	/*Number of receive rings */#define MAX_RX_BLOCKS_PER_RING  150	struct rx_ring_config rx_cfg[MAX_RX_RINGS];	/*Per-Rx Ring config */#define HEADER_ETHERNET_II_802_3_SIZE 14#define HEADER_802_2_SIZE              3#define HEADER_SNAP_SIZE               5#define HEADER_VLAN_SIZE               4#define MIN_MTU                       46#define MAX_PYLD                    1500#define MAX_MTU                     (MAX_PYLD+18)#define MAX_MTU_VLAN                (MAX_PYLD+22)#define MAX_PYLD_JUMBO              9600#define MAX_MTU_JUMBO               (MAX_PYLD_JUMBO+18)#define MAX_MTU_JUMBO_VLAN          (MAX_PYLD_JUMBO+22)	u16 bus_speed;};/* Structure representing MAC Addrs */struct mac_addr {	u8 mac_addr[ETH_ALEN];};/* Structure that represent every FIFO element in the BAR1 * Address location. */struct TxFIFO_element {	u64 TxDL_Pointer;	u64 List_Control;#define TX_FIFO_LAST_TXD_NUM( val)     vBIT(val,0,8)#define TX_FIFO_FIRST_LIST             s2BIT(14)#define TX_FIFO_LAST_LIST              s2BIT(15)#define TX_FIFO_FIRSTNLAST_LIST        vBIT(3,14,2)#define TX_FIFO_SPECIAL_FUNC           s2BIT(23)#define TX_FIFO_DS_NO_SNOOP            s2BIT(31)#define TX_FIFO_BUFF_NO_SNOOP          s2BIT(30)};/* Tx descriptor structure */struct TxD {	u64 Control_1;/* bit mask */#define TXD_LIST_OWN_XENA       s2BIT(7)#define TXD_T_CODE              (s2BIT(12)|s2BIT(13)|s2BIT(14)|s2BIT(15))#define TXD_T_CODE_OK(val)      (|(val & TXD_T_CODE))#define GET_TXD_T_CODE(val)     ((val & TXD_T_CODE)<<12)#define TXD_GATHER_CODE         (s2BIT(22) | s2BIT(23))#define TXD_GATHER_CODE_FIRST   s2BIT(22)#define TXD_GATHER_CODE_LAST    s2BIT(23)#define TXD_TCP_LSO_EN          s2BIT(30)#define TXD_UDP_COF_EN          s2BIT(31)#define TXD_UFO_EN		s2BIT(31) | s2BIT(30)#define TXD_TCP_LSO_MSS(val)    vBIT(val,34,14)#define TXD_UFO_MSS(val)	vBIT(val,34,14)#define TXD_BUFFER0_SIZE(val)   vBIT(val,48,16)	u64 Control_2;#define TXD_TX_CKO_CONTROL      (s2BIT(5)|s2BIT(6)|s2BIT(7))#define TXD_TX_CKO_IPV4_EN      s2BIT(5)#define TXD_TX_CKO_TCP_EN       s2BIT(6)#define TXD_TX_CKO_UDP_EN       s2BIT(7)#define TXD_VLAN_ENABLE         s2BIT(15)#define TXD_VLAN_TAG(val)       vBIT(val,16,16)#define TXD_INT_NUMBER(val)     vBIT(val,34,6)#define TXD_INT_TYPE_PER_LIST   s2BIT(47)#define TXD_INT_TYPE_UTILZ      s2BIT(46)#define TXD_SET_MARKER         vBIT(0x6,0,4)	u64 Buffer_Pointer;	u64 Host_Control;	/* reserved for host */};/* Structure to hold the phy and virt addr of every TxDL. */struct list_info_hold {	dma_addr_t list_phy_addr;	void *list_virt_addr;};/* Rx descriptor structure for 1 buffer mode */struct RxD_t {	u64 Host_Control;	/* reserved for host */	u64 Control_1;#define RXD_OWN_XENA            s2BIT(7)#define RXD_T_CODE              (s2BIT(12)|s2BIT(13)|s2BIT(14)|s2BIT(15))#define RXD_FRAME_PROTO         vBIT(0xFFFF,24,8)#define RXD_FRAME_PROTO_IPV4    s2BIT(27)#define RXD_FRAME_PROTO_IPV6    s2BIT(28)#define RXD_FRAME_IP_FRAG	s2BIT(29)#define RXD_FRAME_PROTO_TCP     s2BIT(30)#define RXD_FRAME_PROTO_UDP     s2BIT(31)#define TCP_OR_UDP_FRAME        (RXD_FRAME_PROTO_TCP | RXD_FRAME_PROTO_UDP)#define RXD_GET_L3_CKSUM(val)   ((u16)(val>> 16) & 0xFFFF)#define RXD_GET_L4_CKSUM(val)   ((u16)(val) & 0xFFFF)	u64 Control_2;#define	THE_RXD_MARK		0x3#define	SET_RXD_MARKER		vBIT(THE_RXD_MARK, 0, 2)#define	GET_RXD_MARKER(ctrl)	((ctrl & SET_RXD_MARKER) >> 62)#define MASK_VLAN_TAG           vBIT(0xFFFF,48,16)#define SET_VLAN_TAG(val)       vBIT(val,48,16)#define SET_NUM_TAG(val)       vBIT(val,16,32)};/* Rx descriptor structure for 1 buffer mode */struct RxD1 {	struct RxD_t h;#define MASK_BUFFER0_SIZE_1       vBIT(0x3FFF,2,14)#define SET_BUFFER0_SIZE_1(val)   vBIT(val,2,14)#define RXD_GET_BUFFER0_SIZE_1(_Control_2) \	(u16)((_Control_2 & MASK_BUFFER0_SIZE_1) >> 48)	u64 Buffer0_ptr;};/* Rx descriptor structure for 3 or 2 buffer mode */struct RxD3 {	struct RxD_t h;#define MASK_BUFFER0_SIZE_3       vBIT(0xFF,2,14)#define MASK_BUFFER1_SIZE_3       vBIT(0xFFFF,16,16)#define MASK_BUFFER2_SIZE_3       vBIT(0xFFFF,32,16)#define SET_BUFFER0_SIZE_3(val)   vBIT(val,8,8)#define SET_BUFFER1_SIZE_3(val)   vBIT(val,16,16)#define SET_BUFFER2_SIZE_3(val)   vBIT(val,32,16)#define RXD_GET_BUFFER0_SIZE_3(Control_2) \	(u8)((Control_2 & MASK_BUFFER0_SIZE_3) >> 48)#define RXD_GET_BUFFER1_SIZE_3(Control_2) \	(u16)((Control_2 & MASK_BUFFER1_SIZE_3) >> 32)#define RXD_GET_BUFFER2_SIZE_3(Control_2) \	(u16)((Control_2 & MASK_BUFFER2_SIZE_3) >> 16)#define BUF0_LEN	40#define BUF1_LEN	1	u64 Buffer0_ptr;	u64 Buffer1_ptr;	u64 Buffer2_ptr;};/* Structure that represents the Rx descriptor block which contains * 128 Rx descriptors. */struct RxD_block {#define MAX_RXDS_PER_BLOCK_1            127	struct RxD1 rxd[MAX_RXDS_PER_BLOCK_1];	u64 reserved_0;#define END_OF_BLOCK    0xFEFFFFFFFFFFFFFFULL	u64 reserved_1;		/* 0xFEFFFFFFFFFFFFFF to mark last				 * Rxd in this blk */	u64 reserved_2_pNext_RxD_block;	/* Logical ptr to next */	u64 pNext_RxD_Blk_physical;	/* Buff0_ptr.In a 32 bit arch					 * the upper 32 bits should					 * be 0 */};#define SIZE_OF_BLOCK	4096#define RXD_MODE_1	0 /* One Buffer mode */#define RXD_MODE_3B	1 /* Two Buffer mode *//* Structure to hold virtual addresses of Buf0 and Buf1 in * 2buf mode. */struct buffAdd {	void *ba_0_org;	void *ba_1_org;	void *ba_0;	void *ba_1;};/* Structure which stores all the MAC control parameters *//* This structure stores the offset of the RxD in the ring * from which the Rx Interrupt processor can start picking * up the RxDs for processing. */struct rx_curr_get_info {	u32 block_index;	u32 offset;	u32 ring_len;};struct rx_curr_put_info {	u32 block_index;	u32 offset;	u32 ring_len;};/* This structure stores the offset of the TxDl in the FIFO * from which the Tx Interrupt processor can start picking * up the TxDLs for send complete interrupt processing. */struct tx_curr_get_info {	u32 offset;	u32 fifo_len;};struct tx_curr_put_info {	u32 offset;	u32 fifo_len;};struct rxd_info {	void *virt_addr;	dma_addr_t dma_addr;};/* Structure that holds the Phy and virt addresses of the Blocks */struct rx_block_info {	void *block_virt_addr;	dma_addr_t block_dma_addr;	struct rxd_info *rxds;};/* Ring specific structure */struct ring_info {	/* The ring number */	int ring_no;	/*	 *  Place holders for the virtual and physical addresses of	 *  all the Rx Blocks	 */	struct rx_block_info rx_blocks[MAX_RX_BLOCKS_PER_RING];	int block_count;	int pkt_cnt;	/*	 * Put pointer info which indictes which RxD has to be replenished	 * with a new buffer.	 */	struct rx_curr_put_info rx_curr_put_info;	/*	 * Get pointer info which indictes which is the last RxD that was	 * processed by the driver.	 */	struct rx_curr_get_info rx_curr_get_info;	/* Index to the absolute position of the put pointer of Rx ring */	int put_pos;	/* Buffer Address store. */	struct buffAdd **ba;	struct s2io_nic *nic;};/* Fifo specific structure */struct fifo_info {	/* FIFO number */	int fifo_no;	/* Maximum TxDs per TxDL */	int max_txds;	/* Place holder of all the TX List's Phy and Virt addresses. */	struct list_info_hold *list_info;	/*	 * Current offset within the tx FIFO where driver would write	 * new Tx frame	 */	struct tx_curr_put_info tx_curr_put_info;	/*	 * Current offset within tx FIFO from where the driver would start freeing	 * the buffers	 */	struct tx_curr_get_info tx_curr_get_info;	struct s2io_nic *nic;};/* Information related to the Tx and Rx FIFOs and Rings of Xena * is maintained in this structure. */struct mac_info {/* tx side stuff */	/* logical pointer of start of each Tx FIFO */	struct TxFIFO_element __iomem *tx_FIFO_start[MAX_TX_FIFOS];	/* Fifo specific structure */	struct fifo_info fifos[MAX_TX_FIFOS];

⌨️ 快捷键说明

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