亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? myson803.c

?? myson803源代碼 myson803.c: A Linux device driver for the Myson mtd803 Ethernet chip.
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* myson803.c: A Linux device driver for the Myson mtd803 Ethernet chip. *//*	Written 1998-2003 by Donald Becker.	This software may be used and distributed according to the terms of	the GNU General Public License (GPL), incorporated herein by reference.	Drivers based on or derived from this code fall under the GPL and must	retain the authorship, copyright and license notice.  This file is not	a complete program and may only be used when the entire operating	system is licensed under the GPL.	The author may be reached as becker@scyld.com, or C/O	Scyld Computing Corporation	410 Severn Ave., Suite 210	Annapolis MD 21403	Support information and updates available at	http://www.scyld.com/network/myson803.html*//* These identify the driver base version and may not be removed. */static const char version1[] ="myson803.c:v1.05 3/10/2003 Written by Donald Becker <becker@scyld.com>\n";static const char version2[] ="  http://www.scyld.com/network/drivers.html\n";/* Automatically extracted configuration info:probe-func: myson803_probeconfig-in: tristate 'Myson MTD803 series Ethernet support' CONFIG_MYSON_ETHERc-help-name: Myson MTD803 PCI Ethernet supportc-help-symbol: CONFIG_MYSON_ETHERc-help: This driver is for the Myson MTD803 Ethernet adapter series.c-help: More specific information and updates are available from c-help: http://www.scyld.com/network/drivers.html*//* The user-configurable values.   These may be modified when a driver module is loaded.*//* Message enable level: 0..31 = no..all messages.  See NETIF_MSG docs. */static int debug = 2;/* Maximum events (Rx packets, etc.) to handle at each interrupt. */static int max_interrupt_work = 40;/* Maximum number of multicast addresses to filter (vs. rx-all-multicast).   This chip uses a 64 element hash table based on the Ethernet CRC.  */static int multicast_filter_limit = 32;/* Set the copy breakpoint for the copy-only-tiny-frames scheme.   Setting to > 1518 effectively disables this feature. */static int rx_copybreak = 0;/* Used to pass the media type, etc.   Both 'options[]' and 'full_duplex[]' should exist for driver   interoperability.   The media type is usually passed in 'options[]'.    The default is autonegotation for speed and duplex.	This should rarely be overridden.    Use option values 0x10/0x20 for 10Mbps, 0x100,0x200 for 100Mbps.    Use option values 0x10 and 0x100 for forcing half duplex fixed speed.    Use option values 0x20 and 0x200 for forcing full duplex operation.*/#define MAX_UNITS 8		/* More are supported, limit only on options */static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};/* Operational parameters that are set at compile time. *//* Keep the ring sizes a power of two for compile efficiency.   The compiler will convert <unsigned>'%'<2^N> into a bit mask.   Making the Tx ring too large decreases the effectiveness of channel   bonding and packet priority.   There are no ill effects from too-large receive rings. */#define TX_RING_SIZE	16#define TX_QUEUE_LEN	10		/* Limit Tx ring entries actually used.  */#define RX_RING_SIZE	32/* Operational parameters that usually are not changed. *//* Time in jiffies before concluding the transmitter is hung. */#define TX_TIMEOUT  (6*HZ)/* Allocation size of Rx buffers with normal sized Ethernet frames.   Do not change this value without good reason.  This is not a limit,   but a way to keep a consistent allocation size among drivers. */#define PKT_BUF_SZ		1536#ifndef __KERNEL__#define __KERNEL__#endif#if !defined(__OPTIMIZE__)#warning  You must compile this file with the correct options!#warning  See the last lines of the source file.#error You must compile this driver with "-O".#endif/* Include files, designed to support most kernel versions 2.0.0 and later. */#include <linux/config.h>#if defined(CONFIG_SMP) && ! defined(__SMP__)#define __SMP__#endif#if defined(MODULE) && defined(CONFIG_MODVERSIONS) && ! defined(MODVERSIONS)#define MODVERSIONS#endif#include <linux/version.h>#if defined(MODVERSIONS)#include <linux/modversions.h>#endif#include <linux/module.h>#include <linux/kernel.h>#include <linux/string.h>#include <linux/timer.h>#include <linux/errno.h>#include <linux/ioport.h>#if LINUX_VERSION_CODE >= 0x20400#include <linux/slab.h>#else#include <linux/malloc.h>#endif#include <linux/interrupt.h>#include <linux/pci.h>#include <linux/netdevice.h>#include <linux/etherdevice.h>#include <linux/skbuff.h>#include <linux/delay.h>#include <asm/processor.h>		/* Processor type for cache alignment. */#include <asm/bitops.h>#include <asm/io.h>#include <asm/unaligned.h>#ifdef INLINE_PCISCAN#include "k_compat.h"#else#include "pci-scan.h"#include "kern_compat.h"#endif/* Condensed operations for readability. */#define virt_to_le32desc(addr)  cpu_to_le32(virt_to_bus(addr))#define le32desc_to_virt(addr)  bus_to_virt(le32_to_cpu(addr))#if (LINUX_VERSION_CODE >= 0x20100)  &&  defined(MODULE)char kernel_version[] = UTS_RELEASE;#endif/* Kernels before 2.1.0 cannot map the high addrs assigned by some BIOSes. */#if (LINUX_VERSION_CODE < 0x20100)  ||  ! defined(MODULE)#define USE_IO_OPS#endifMODULE_AUTHOR("Donald Becker <becker@scyld.com>");MODULE_DESCRIPTION("Myson mtd803 Ethernet driver");MODULE_LICENSE("GPL");/* List in order of common use. */MODULE_PARM(debug, "i");MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");MODULE_PARM(max_interrupt_work, "i");MODULE_PARM(rx_copybreak, "i");MODULE_PARM(multicast_filter_limit, "i");MODULE_PARM_DESC(debug, "Driver message level (0-31)");MODULE_PARM_DESC(options, "Force transceiver type or fixed speed+duplex");MODULE_PARM_DESC(full_duplex, "Non-zero to force full duplex, "				 "non-negotiated link (deprecated).");MODULE_PARM_DESC(max_interrupt_work,				 "Maximum events handled per interrupt");MODULE_PARM_DESC(rx_copybreak,				 "Breakpoint in bytes for copy-only-tiny-frames");MODULE_PARM_DESC(multicast_filter_limit,				 "Multicast addresses before switching to Rx-all-multicast");/*				Theory of OperationI. Board CompatibilityThis driver is for the Myson mtd803 chip.It should work with other Myson 800 series chips.II. Board-specific settingsNone.III. Driver operationIIIa. Ring buffersThis driver uses two statically allocated fixed-size descriptor listsformed into rings by a branch from the final descriptor to the beginning ofthe list.  The ring sizes are set at compile time by RX/TX_RING_SIZE.Some chips explicitly use only 2^N sized rings, while others use a'next descriptor' pointer that the driver forms into rings.IIIb/c. Transmit/Receive StructureThis driver uses a zero-copy receive and transmit scheme.The driver allocates full frame size skbuffs for the Rx ring buffers atopen() time and passes the skb->data field to the chip as receive databuffers.  When an incoming frame is less than RX_COPYBREAK bytes long,a fresh skbuff is allocated and the frame is copied to the new skbuff.When the incoming frame is larger, the skbuff is passed directly up theprotocol stack.  Buffers consumed this way are replaced by newly allocatedskbuffs in a later phase of receives.The RX_COPYBREAK value is chosen to trade-off the memory wasted byusing a full-sized skbuff for small frames vs. the copying costs of largerframes.  New boards are typically used in generously configured machinesand the underfilled buffers have negligible impact compared to the benefit ofa single allocation size, so the default value of zero results in nevercopying packets.  When copying is done, the cost is usually mitigated by usinga combined copy/checksum routine.  Copying also preloads the cache, which ismost useful with small frames.A subtle aspect of the operation is that the IP header at offset 14 in anethernet frame isn't longword aligned for further processing.When unaligned buffers are permitted by the hardware (and always on copies)frames are put into the skbuff at an offset of "+2", 16-byte aligningthe IP header.IIId. SynchronizationThe driver runs as two independent, single-threaded flows of control.  Oneis the send-packet routine, which enforces single-threaded use by thedev->tbusy flag.  The other thread is the interrupt handler, which is singlethreaded by the hardware and interrupt handling software.The send packet thread has partial control over the Tx ring and 'dev->tbusy'flag.  It sets the tbusy flag whenever it's queuing a Tx packet. If the nextqueue slot is empty, it clears the tbusy flag when finished otherwise it setsthe 'lp->tx_full' flag.The interrupt handler has exclusive control over the Rx ring and records statsfrom the Tx ring.  After reaping the stats, it marks the Tx queue entry asempty by incrementing the dirty_tx mark. Iff the 'lp->tx_full' flag is set, itclears both the tx_full and tbusy flags.IIId. SMP semanticsThe following are serialized with respect to each other via the "xmit_lock".  dev->hard_start_xmit()	Transmit a packet  dev->tx_timeout()			Transmit watchdog for stuck Tx  dev->set_multicast_list()	Set the recieve filter.Note: The Tx timeout watchdog code is implemented by the timer routine inkernels up to 2.2.*.  In 2.4.* and later the timeout code is part of thedriver interface.The following fall under the global kernel lock.  The module will not beunloaded during the call, unless a call with a potential reschedule e.g.kmalloc() is called.  No other synchronization assertion is made.  dev->open()  dev->do_ioctl()  dev->get_stats()Caution: The lock for dev->open() is commonly broken with request_irq() orkmalloc().  It is best to avoid any lock-breaking call in do_ioctl() andget_stats(), or additional module locking code must be implemented.The following is self-serialized (no simultaneous entry)  An handler registered with request_irq().IV. NotesIVb. Referenceshttp://www.scyld.com/expert/100mbps.htmlhttp://scyld.com/expert/NWay.htmlhttp://www.myson.com.hk/mtd/datasheet/mtd803.pdf   Myson does not require a NDA to read the datasheet.IVc. ErrataNo undocumented errata.*//* PCI probe routines. */static void *myson_probe1(struct pci_dev *pdev, void *init_dev,						   long ioaddr, int irq, int chip_idx, int find_cnt);static int netdev_pwr_event(void *dev_instance, int event);/* Chips prior to the 803 have an external MII transceiver. */enum chip_capability_flags { HasMIIXcvr=1, HasChipXcvr=2 };#ifdef USE_IO_OPS#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO  | PCI_ADDR0)#define PCI_IOSIZE	256#else#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1)#define PCI_IOSIZE	1024#endifstatic struct pci_id_info pci_id_tbl[] = {	{"Myson mtd803 Fast Ethernet", {0x08031516, 0xffffffff, },	 PCI_IOTYPE, PCI_IOSIZE, HasChipXcvr},	{"Myson mtd891 Gigabit Ethernet", {0x08911516, 0xffffffff, },	 PCI_IOTYPE, PCI_IOSIZE, HasChipXcvr},	{0,},						/* 0 terminated list. */};struct drv_id_info myson803_drv_id = {	"myson803", 0, PCI_CLASS_NETWORK_ETHERNET<<8, pci_id_tbl, myson_probe1,	netdev_pwr_event };/* This driver was written to use PCI memory space, however x86-oriented   hardware sometimes works only with I/O space accesses. */#ifdef USE_IO_OPS#undef readb#undef readw#undef readl#undef writeb#undef writew#undef writel#define readb inb#define readw inw#define readl inl#define writeb outb#define writew outw#define writel outl#endif/* Offsets to the various registers.   Most accesses must be longword aligned. */enum register_offsets {	StationAddr=0x00, MulticastFilter0=0x08, MulticastFilter1=0x0C,	FlowCtrlAddr=0x10, RxConfig=0x18, TxConfig=0x1a, PCIBusCfg=0x1c,	TxStartDemand=0x20, RxStartDemand=0x24,	RxCurrentPtr=0x28, TxRingPtr=0x2c, RxRingPtr=0x30,	IntrStatus=0x34, IntrEnable=0x38,	FlowCtrlThreshold=0x3c,	MIICtrl=0x40, EECtrl=0x40, RxErrCnts=0x44, TxErrCnts=0x48,	PHYMgmt=0x4c,};/* Bits in the interrupt status/mask registers. */enum intr_status_bits {	IntrRxErr=0x0002, IntrRxDone=0x0004, IntrTxDone=0x0008,	IntrTxEmpty=0x0010, IntrRxEmpty=0x0020, StatsMax=0x0040, RxEarly=0x0080,	TxEarly=0x0100, RxOverflow=0x0200, TxUnderrun=0x0400,	IntrPCIErr=0x2000, NWayDone=0x4000, LinkChange=0x8000,};/* Bits in the RxMode (np->txrx_config) register. */enum rx_mode_bits {	RxEnable=0x01, RxFilter=0xfe,	AcceptErr=0x02, AcceptRunt=0x08, AcceptBroadcast=0x40,	AcceptMulticast=0x20, AcceptAllPhys=0x80, AcceptMyPhys=0x00,	RxFlowCtrl=0x2000,	TxEnable=0x40000, TxModeFDX=0x00100000, TxThreshold=0x00e00000,};/* Misc. bits. */enum misc_bits {	BCR_Reset=1,				/* PCIBusCfg */	TxThresholdInc=0x200000,};/* The Rx and Tx buffer descriptors. *//* Note that using only 32 bit fields simplifies conversion to big-endian   architectures. */struct netdev_desc {	u32 status;	u32 ctrl_length;	u32 buf_addr;	u32 next_desc;};/* Bits in network_desc.status */enum desc_status_bits {	DescOwn=0x80000000,	RxDescStartPacket=0x0800, RxDescEndPacket=0x0400, RxDescWholePkt=0x0c00,	RxDescErrSum=0x80, RxErrRunt=0x40, RxErrLong=0x20, RxErrFrame=0x10,	RxErrCRC=0x08, RxErrCode=0x04,	TxErrAbort=0x2000, TxErrCarrier=0x1000, TxErrLate=0x0800,	TxErr16Colls=0x0400, TxErrDefer=0x0200, TxErrHeartbeat=0x0100,	TxColls=0x00ff,};/* Bits in network_desc.ctrl_length */enum ctrl_length_bits {	TxIntrOnDone=0x80000000, TxIntrOnFIFO=0x40000000,	TxDescEndPacket=0x20000000, TxDescStartPacket=0x10000000,	TxAppendCRC=0x08000000, TxPadTo64=0x04000000, TxNormalPkt=0x3C000000,};#define PRIV_ALIGN	15 	/* Required alignment mask *//* Use  __attribute__((aligned (L1_CACHE_BYTES)))  to maintain alignment   within the structure. */struct netdev_private {	/* Descriptor rings first for alignment. */	struct netdev_desc rx_ring[RX_RING_SIZE];	struct netdev_desc tx_ring[TX_RING_SIZE];	struct net_device *next_module;		/* Link for devices of this type. */	void *priv_addr;					/* Unaligned address for kfree */	/* The addresses of receive-in-place skbuffs. */	struct sk_buff* rx_skbuff[RX_RING_SIZE];	/* The saved address of a sent-in-place packet/buffer, for later free(). */	struct sk_buff* tx_skbuff[TX_RING_SIZE];	struct net_device_stats stats;	struct timer_list timer;	/* Media monitoring timer. */	/* Frequently used values: keep some adjacent for cache effect. */	int msg_level;	int max_interrupt_work;	int intr_enable;	int chip_id, drv_flags;	struct pci_dev *pci_dev;	struct netdev_desc *rx_head_desc;	unsigned int cur_rx, dirty_rx;		/* Producer/consumer ring indices */	unsigned int rx_buf_sz;				/* Based on MTU+slack. */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
2020国产成人综合网| 92国产精品观看| 午夜精品久久久| 亚洲成a人片综合在线| 亚洲一二三四久久| 亚洲一区二区三区四区在线| 亚洲成a人v欧美综合天堂下载| 午夜视频在线观看一区二区三区| 首页国产欧美日韩丝袜| 欧美大片一区二区三区| 国产一区二区91| 中文字幕av一区 二区| 国产精品欧美一级免费| 亚洲丝袜另类动漫二区| 亚洲午夜在线观看视频在线| 丝袜美腿成人在线| 激情久久五月天| 99精品1区2区| 91精品国产麻豆| 久久众筹精品私拍模特| 精品久久久久久久久久久久包黑料| 精品国产免费视频| 一区二区三区在线免费观看| 日韩在线一二三区| 国产福利一区在线观看| 色天使色偷偷av一区二区| 欧美一区二区美女| 国产精品久久久久永久免费观看 | 一本到三区不卡视频| 亚洲综合一区在线| 卡一卡二国产精品 | 日韩制服丝袜先锋影音| 国产一区二区精品久久| 日本道免费精品一区二区三区| 欧美一区日韩一区| 国产精品美女www爽爽爽| 午夜伦欧美伦电影理论片| 成人小视频在线观看| 51午夜精品国产| 亚洲视频在线观看一区| 久久99久久99| 欧美老女人在线| 综合中文字幕亚洲| 国产成人精品一区二区三区四区| 欧美网站大全在线观看| 国产精品丝袜久久久久久app| 日本v片在线高清不卡在线观看| av一区二区久久| 精品入口麻豆88视频| 婷婷丁香久久五月婷婷| 91女人视频在线观看| 国产免费成人在线视频| 免费成人结看片| 欧美日韩一区二区三区高清| 亚洲素人一区二区| 国产白丝精品91爽爽久久| 日韩午夜电影av| 亚洲成人av在线电影| 国产成人av电影在线| 欧美高清视频不卡网| 国产日韩欧美电影| 国产自产2019最新不卡| 欧美一级久久久久久久大片| 亚洲视频在线观看一区| 国产综合久久久久久鬼色| 91精品国产色综合久久不卡电影| 亚洲综合在线五月| 欧美三级日韩三级国产三级| 亚洲国产精品v| 日韩vs国产vs欧美| 欧美一区二区三区四区久久| 日韩影院免费视频| 4438x成人网最大色成网站| 日本不卡一二三区黄网| 这里只有精品电影| 美国十次了思思久久精品导航| 欧美美女直播网站| 美国毛片一区二区三区| 日韩精品一区二区三区中文精品| 国精产品一区一区三区mba桃花| 这里只有精品视频在线观看| 麻豆国产欧美日韩综合精品二区| 日韩精品一区二区三区在线观看 | 欧美三级中文字幕在线观看| 一区二区三区中文字幕在线观看| 欧美色综合影院| 久久精品国产网站| 国产精品三级久久久久三级| jlzzjlzz国产精品久久| 亚洲一区二区在线免费观看视频| 欧美日本一区二区| 狠狠色丁香婷婷综合久久片| 国产精品美女久久久久久久久 | 中文字幕永久在线不卡| 色综合久久久网| 久久国产夜色精品鲁鲁99| 精品国产一区二区三区久久久蜜月| 国产精品一二二区| 日韩美女久久久| 日韩欧美在线网站| 成人午夜在线免费| 午夜视频在线观看一区| 精品美女在线观看| 色婷婷综合久色| 国产麻豆午夜三级精品| 亚洲毛片av在线| 久久一区二区三区四区| 在线一区二区三区| 国产一区亚洲一区| 午夜免费欧美电影| 国产精品久久久久久久蜜臀| 欧美一级二级在线观看| av不卡免费在线观看| 麻豆久久久久久久| 亚洲自拍欧美精品| 中文字幕第一页久久| 91精品在线麻豆| 欧美怡红院视频| 91影院在线观看| 国产在线乱码一区二区三区| 亚洲国产精品一区二区www在线| 久久久久久久性| 欧美一级理论性理论a| 色素色在线综合| va亚洲va日韩不卡在线观看| 韩国v欧美v亚洲v日本v| 日韩经典中文字幕一区| 亚洲精品国产一区二区精华液 | 久久久久久日产精品| 欧美日韩性生活| 91久久免费观看| av高清不卡在线| 成人在线视频一区二区| 韩国理伦片一区二区三区在线播放 | 91福利视频在线| 蜜桃久久av一区| 91精品一区二区三区在线观看| 成人免费视频一区二区| 日韩av中文在线观看| 亚洲国产毛片aaaaa无费看| 亚洲丝袜美腿综合| 国产精品福利影院| 亚洲欧洲av另类| 综合av第一页| 亚洲欧美一区二区视频| 日韩伦理av电影| 亚洲图片激情小说| 一区在线观看免费| 自拍视频在线观看一区二区| 国产精品国产a级| 亚洲精品国久久99热| 亚洲精品国产a久久久久久| 亚洲免费观看在线视频| 亚洲与欧洲av电影| 日韩av高清在线观看| 免费成人在线网站| 国产精品一区二区久激情瑜伽 | 国产精品成人一区二区艾草| 久久久久久黄色| 国产欧美精品在线观看| 国产精品久久久久久久第一福利| 国产精品国模大尺度视频| 亚洲精品视频在线观看免费 | 国产精品一区二区三区99| 天堂va蜜桃一区二区三区| 精品国产免费视频| 日韩欧美在线观看一区二区三区| 欧美电影一区二区| 欧美一区二区三区四区五区 | 成人综合婷婷国产精品久久蜜臀| 国产+成+人+亚洲欧洲自线| 99国产精品久久| 欧美喷水一区二区| 久久综合精品国产一区二区三区| 国产精品美女久久久久aⅴ| 亚洲综合区在线| 蜜臀av一级做a爰片久久| 国产成人免费xxxxxxxx| 欧洲生活片亚洲生活在线观看| 欧美精品少妇一区二区三区 | 亚洲欧美一区二区在线观看| 五月婷婷激情综合网| 美国十次综合导航| 久久久美女艺术照精彩视频福利播放| 久久99国产精品久久| 夜色激情一区二区| 久久se精品一区二区| 成人精品视频网站| 欧美挠脚心视频网站| 国产精品欧美一级免费| 午夜精品一区在线观看| 粗大黑人巨茎大战欧美成人| 欧美狂野另类xxxxoooo| 亚洲国产岛国毛片在线| 青青草国产精品97视觉盛宴| 99久久婷婷国产综合精品电影| 日韩欧美第一区| 亚洲第一在线综合网站| 成人激情小说网站| 精品盗摄一区二区三区|