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

📄 skdrv2nd.h

📁 这是Marvell Technology Group Ltd. 4355 (rev 12)网卡在linux下的驱动程序源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/****************************************************************************** * * Name:        skdrv2nd.h * Project:     GEnesis, PCI Gigabit Ethernet Adapter * Version:     $Revision: 1.34.4.29 $ * Date:        $Date: 2008/04/09 12:16:01 $ * Purpose:     Second header file for driver and all other modules * ******************************************************************************//****************************************************************************** * *      LICENSE: *      (C)Copyright Marvell. *       *      This program is free software; you can redistribute it and/or modify *      it under the terms of the GNU General Public License as published by *      the Free Software Foundation; either version 2 of the License, or *      (at your option) any later version. *       *      The information in this file is provided "AS IS" without warranty. *      /LICENSE * ******************************************************************************//****************************************************************************** * * Description: * * This is the second include file of the driver, which includes all other * neccessary files and defines all structures and constants used by the * driver and the common modules. * * Include File Hierarchy: * *	see skge.c * ******************************************************************************/#ifndef __INC_SKDRV2ND_H#define __INC_SKDRV2ND_H#include "h/skqueue.h"#include "h/skgehwt.h"#include "h/sktimer.h"#include "h/sktwsi.h"#include "h/skgepnmi.h"#include "h/skvpd.h"#include "h/skgehw.h"#include "h/sky2le.h"#include "h/skgeinit.h"#include "h/skaddr.h"#include "h/skgesirq.h"#include "h/skcsum.h"#include "h/skrlmt.h"#include "h/skgedrv.h"#include "h/mvyexhw.h"#ifdef SK_ASF#include "h/skgeasf.h"#include "h/skgeasfconv.h"#endif/* Required for 64 bit division */#include "asm/div64.h"/* Defines for the poll cotroller */#if !defined(SK_NETDUMP_POLL)#define SK_NETDUMP_POLL#endif#if defined(SK_NETDUMP_POLL)#if defined(HAVE_POLL_CONTROLLER)#define SK_POLL_CONTROLLER#define CONFIG_SK98LIN_NAPI#elif defined(CONFIG_NET_POLL_CONTROLLER)#define SK_POLL_CONTROLLER#if !defined(CONFIG_SK98LIN_NAPI)#define CONFIG_SK98LIN_NAPI#endif#endif#endif/****************************************************************************** * * Generic driver defines * ******************************************************************************/#define USE_TIST_FOR_RESET	/* Use timestamp for reset */#define Y2_RECOVERY		/* use specific recovery yukon2 functions */#define Y2_LE_CHECK		/* activate check for LE order */#define Y2_SYNC_CHECK		/* activate check for receiver in sync */#define SK_YUKON2		/* Enable Yukon2 dual net support */#define USE_SK_TX_CHECKSUM	/* use the tx hw checksum driver functionality */#define USE_SK_RX_CHECKSUM	/* use the rx hw checksum driver functionality */#define USE_SK_TSO_FEATURE	/* use TCP segmentation offload if possible */#define SK_COPY_THRESHOLD 50	/* threshold for copying small RX frames; 				 * 0 avoids copying, 9001 copies all */#define SK_MAX_CARD_PARAM 16	/* number of adapters that can be configured via 				 * command line params *///#define USE_TX_COMPLETE	/* use of a transmit complete interrupt */#define Y2_RX_CHECK		/* RX Check timestamp */#define SK_REL_SPIN_LOCK(IoC)#define SK_ACQ_SPIN_LOCK(IoC)/* * use those defines for a compile-in version of the driver instead * of command line parameters */// #define LINK_SPEED_A	{"Auto",}// #define LINK_SPEED_B	{"Auto",}// #define AUTO_NEG_A	{"Sense",}// #define AUTO_NEG_B	{"Sense"}// #define DUP_CAP_A	{"Both",}// #define DUP_CAP_B	{"Both",}// #define FLOW_CTRL_A	{"SymOrRem",}// #define FLOW_CTRL_B	{"SymOrRem",}// #define ROLE_A	{"Auto",}// #define ROLE_B	{"Auto",}// #define PREF_PORT	{"A",}// #define CON_TYPE 	{"Auto",}// #define RLMT_MODE	{"CheckLinkState",}#ifdef Y2_RECOVERY#define CHECK_TRANSMIT_TIMEOUT#define Y2_RESYNC_WATERMARK     1000000L#endif/****************************************************************************** * * Generic ISR defines * ******************************************************************************/#define SkIsrRetVar     void#define SkIsrRetNone    NULL#define SkIsrRetHandled NULL#define DEV_KFREE_SKB(skb) dev_kfree_skb(skb)#define DEV_KFREE_SKB_IRQ(skb) dev_kfree_skb_irq(skb)#define DEV_KFREE_SKB_ANY(skb) dev_kfree_skb_any(skb)/****************************************************************************** * * Global function prototypes * ******************************************************************************/extern SK_MBUF *SkDrvAllocRlmtMbuf(SK_AC*, SK_IOC, unsigned);extern void SkDrvFreeRlmtMbuf(SK_AC*, SK_IOC, SK_MBUF*);extern SK_U64 SkOsGetTime(SK_AC*);extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*);extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*);extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*);extern int SkPciWriteCfgDWord(SK_AC*, int, SK_U32);extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16);extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8);extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA);extern int SkDrvEnterDiagMode(SK_AC *pAc);extern int SkDrvLeaveDiagMode(SK_AC *pAc);#ifdef USE_ASF_DASH_FWextern void	SetRamAddr(SK_AC *, int, int, int);extern SK_U8 AccessRamBuf(SK_AC *, int, SK_BOOL);#endif/****************************************************************************** * * Linux specific RLMT buffer structure (SK_MBUF typedef in skdrv1st)! * ******************************************************************************/struct s_DrvRlmtMbuf {	SK_MBUF         *pNext;    /* Pointer to next RLMT Mbuf.       */	SK_U8           *pData;    /* Data buffer (virtually contig.). */	unsigned         Size;     /* Data buffer size.                */	unsigned         Length;   /* Length of packet (<= Size).      */	SK_U32           PortIdx;  /* Receiving/transmitting port.     */#ifdef SK_RLMT_MBUF_PRIVATE	SK_RLMT_MBUF     Rlmt;     /* Private part for RLMT.           */#endif	struct sk_buff  *pOs;      /* Pointer to message block         */};/****************************************************************************** * * Linux specific TIME defines * ******************************************************************************/#if SK_TICKS_PER_SEC == 100#define SK_PNMI_HUNDREDS_SEC(t)	(t)#else#define SK_PNMI_HUNDREDS_SEC(t) ((((unsigned long)t)*100)/(SK_TICKS_PER_SEC))#endif#ifdef USE_ALT_TIMING#define __RDTSCLL(val) __asm__ __volatile__("rdtsc": "=A" (val))#define SkOsGetTimeCurrent(pAC, pUsec) { \	SK_U64 currentTime; \	__RDTSCLL(currentTime); \	do_div(currentTime, cpu_khz); \	do_div(currentTime,(SK_U64)((SK_U32)1000 / SK_TICKS_PER_SEC)); \	*pUsec = currentTime; \}#endif#ifndef USE_ALT_TIMING#define SkOsGetTimeCurrent(pAC, pUsec) {\	static struct timeval prev_t; \	struct timeval t;\	do_gettimeofday(&t);\	if (prev_t.tv_sec == t.tv_sec) { \		if (prev_t.tv_usec > t.tv_usec) { \			t.tv_usec = prev_t.tv_usec; \		} else { \			prev_t.tv_usec = t.tv_usec; \		} \	} else { \		prev_t = t; \	} \	*pUsec = ((t.tv_sec*100L)+(t.tv_usec/10000));\}#endif/****************************************************************************** * * Linux specific IOCTL defines and typedefs * ******************************************************************************/#define	SK_IOCTL_BASE        (SIOCDEVPRIVATE)#define	SK_IOCTL_GETMIB      (SK_IOCTL_BASE + 0)#define	SK_IOCTL_SETMIB      (SK_IOCTL_BASE + 1)#define	SK_IOCTL_PRESETMIB   (SK_IOCTL_BASE + 2)#define	SK_IOCTL_GEN         (SK_IOCTL_BASE + 3)#define	SK_IOCTL_DIAG        (SK_IOCTL_BASE + 4)#ifdef USE_ASF_DASH_FW#define	SK_IOCTL_IPTOFW      (SK_IOCTL_BASE + 10)#define SK_IOCTL_PATTERNTOFW (SK_IOCTL_BASE + 11)#define SK_IOCTL_READASFFIFO (SK_IOCTL_BASE + 12)#define SK_IOCTL_LINKTOFW    (SK_IOCTL_BASE + 13)#define SK_IOCTL_GETLINKCAP  (SK_IOCTL_BASE + 14)#define SK_AUTONEG_SUCCESS 0#define SK_AUTONEG_FAIL    1#define SK_AUTONEG_OFF     2#define SK_AUTONEG_NOLINK  3#define SK_ST_FIFOTYPE		3#define SK_ST_BUFADDR_LOW	0xc5#define SK_ST_BUFADDR_HIGH	0x0#define SK_ST_BUFSIZE		191#endiftypedef struct s_IOCTL SK_GE_IOCTL;struct s_IOCTL {	char*		pData;	unsigned int	Len;};/****************************************************************************** * * Generic sizes and length definitions * ******************************************************************************/#define TX_RING_SIZE  (24*1024)			/* GEnesis/Yukon */#define RX_RING_SIZE  (24*1024)			/* GEnesis/Yukon */#define RX_MAX_NBR_BUFFERS   128		/* Yukon-EC/-II */#define TX_MAX_NBR_BUFFERS   128		/* Yukon-EC/-II */#define MAXIMUM_LOW_ADDRESS 0xFFFFFFFF		/* Max. low address */#define	ETH_BUF_SIZE        1560		/* multiples of 8 bytes */#define	ETH_MAX_MTU         1500#define	ETH_MAX_LEN         1518#define ETH_MIN_MTU         60#define ETH_MULTICAST_BIT   0x01#define SK_JUMBO_MTU        9000#define TX_PRIO_LOW    0 /* asynchronous queue */#define TX_PRIO_HIGH   1 /* synchronous queue */#define DESCR_ALIGN   64 /* alignment of Rx/Tx descriptors *//****************************************************************************** * * PNMI related definitions * ******************************************************************************/#define SK_DRIVER_RESET(pAC, IoC)	0#define SK_DRIVER_SENDEVENT(pAC, IoC)	0#define SK_DRIVER_SELFTEST(pAC, IoC)	0/* For get mtu you must add an own function */#define SK_DRIVER_GET_MTU(pAc,IoC,i)	0#define SK_DRIVER_SET_MTU(pAc,IoC,i,v)	0#define SK_DRIVER_PRESET_MTU(pAc,IoC,i,v)	0/****************************************************************************** * * Various offsets and sizes * ******************************************************************************/#define	SK_DRV_MODERATION_TIMER         1   /* id */#define SK_DRV_MODERATION_TIMER_LENGTH  1   /* 1 second */#define C_LEN_ETHERMAC_HEADER_DEST_ADDR 6#define C_LEN_ETHERMAC_HEADER_SRC_ADDR  6#define C_LEN_ETHERMAC_HEADER_LENTYPE   2#define C_LEN_ETHERMAC_HEADER           ( (C_LEN_ETHERMAC_HEADER_DEST_ADDR) + \                                          (C_LEN_ETHERMAC_HEADER_SRC_ADDR)  + \                                          (C_LEN_ETHERMAC_HEADER_LENTYPE) )#define C_LEN_ETHERMTU_MINSIZE          46#define C_LEN_ETHERMTU_MAXSIZE_STD      1500#define C_LEN_ETHERMTU_MAXSIZE_JUMBO    9000#define C_LEN_ETHERNET_MINSIZE          ( (C_LEN_ETHERMAC_HEADER) + \                                          (C_LEN_ETHERMTU_MINSIZE) )#define C_OFFSET_IPHEADER               C_LEN_ETHERMAC_HEADER#define C_OFFSET_IPHEADER_IPPROTO       9

⌨️ 快捷键说明

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