亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产精品免费丝袜| 激情五月婷婷综合网| 欧美va亚洲va在线观看蝴蝶网| 99综合电影在线视频| 久久激五月天综合精品| 日韩精品成人一区二区在线| 一区二区三区在线高清| 亚洲美女屁股眼交| 亚洲精品免费在线播放| 亚洲精品视频在线看| 老司机精品视频一区二区三区| 91婷婷韩国欧美一区二区| 91在线porny国产在线看| 欧美mv和日韩mv的网站| 亚洲已满18点击进入久久| 亚洲综合男人的天堂| 国产91高潮流白浆在线麻豆| 国产999精品久久久久久| 欧美日韩精品一区二区天天拍小说 | 3751色影院一区二区三区| 7777精品伊人久久久大香线蕉完整版 | 亚瑟在线精品视频| 日韩成人一区二区三区在线观看| 天堂va蜜桃一区二区三区漫画版| 欧美日本精品一区二区三区| 日韩美女久久久| 亚洲综合激情小说| 国产69精品一区二区亚洲孕妇| 欧美电影免费观看高清完整版在线观看 | 精品制服美女丁香| 成人精品在线视频观看| 色视频欧美一区二区三区| 欧美在线免费播放| 91精品国产综合久久久蜜臀粉嫩 | 精品国产一区二区三区不卡| 国产日产精品一区| 亚洲丝袜美腿综合| 成人黄色av网站在线| 7777精品伊人久久久大香线蕉完整版 | 日韩美女一区二区三区四区| 三级久久三级久久| 3d成人动漫网站| 99riav久久精品riav| 色婷婷综合久久久久中文 | 国产酒店精品激情| 日本道在线观看一区二区| 欧美成人a在线| 激情图区综合网| 国产亚洲人成网站| 亚洲人成伊人成综合网小说| 99久久综合精品| 亚洲精品福利视频网站| 欧美午夜片在线看| 中文子幕无线码一区tr| 香蕉久久一区二区不卡无毒影院| 欧美日韩高清一区| 狠狠色丁香婷婷综合| 日本一区二区在线不卡| 成人免费的视频| 亚洲一区在线播放| 日韩精品一区二区三区swag| 国产成人免费在线观看不卡| 欧美一区二区成人6969| 中文字幕一区二区三区av| 国产一区二区精品在线观看| 4438x亚洲最大成人网| 狠狠色狠狠色综合系列| 久久激五月天综合精品| 国产午夜精品美女毛片视频| 一本久久a久久免费精品不卡| 亚洲 欧美综合在线网络| 国产女人水真多18毛片18精品视频| 91一区二区在线| 五月天一区二区| 欧美羞羞免费网站| 国产一区二区0| 亚洲一区二区三区四区在线免费观看| 日韩一区二区精品| 免费成人性网站| 日韩视频在线一区二区| 成人国产精品免费观看视频| 日韩综合小视频| 成人免费视频在线观看| 日韩欧美高清dvd碟片| 一本大道综合伊人精品热热| 美女视频免费一区| 精品国产一区久久| 91一区在线观看| 国产一区二区三区| 日韩高清不卡在线| 成人欧美一区二区三区| 久久先锋影音av| 国产成人免费xxxxxxxx| 日韩和的一区二区| 亚洲日本中文字幕区| 久久嫩草精品久久久久| 国产不卡视频在线观看| 青娱乐精品视频在线| 亚洲综合男人的天堂| 国产精品久久看| 一本色道久久综合亚洲aⅴ蜜桃| 国产乱码精品一区二区三区av | 成人一区二区三区中文字幕| 日本不卡视频一二三区| 亚洲午夜精品网| 日韩一区二区三区视频| 欧美三级日韩三级国产三级| 久久精品国产精品青草| 天涯成人国产亚洲精品一区av| 国产精品久久久久久久久免费桃花| 日韩欧美一二三| 日韩一区二区视频| 7777精品伊人久久久大香线蕉 | 伊人性伊人情综合网| 中文字幕在线观看不卡视频| 日本一区二区三区dvd视频在线 | 麻豆国产精品视频| 日韩精品一区第一页| 肉丝袜脚交视频一区二区| 日韩精品亚洲一区| 日本最新不卡在线| 美洲天堂一区二卡三卡四卡视频| 视频一区视频二区中文字幕| 日本亚洲最大的色成网站www| 亚洲成av人片| 日本 国产 欧美色综合| 麻豆成人91精品二区三区| 精品在线免费观看| 国产麻豆成人传媒免费观看| 国产成人av一区二区| 日韩一区二区三区在线观看| 制服丝袜av成人在线看| 日韩午夜激情av| 精品国产91亚洲一区二区三区婷婷| www激情久久| 国产精品理论片| 一区二区成人在线观看| 视频在线观看91| 国产一区高清在线| 91在线免费看| 欧美日韩精品免费| xfplay精品久久| 综合久久久久综合| 日韩精品一区第一页| 国产一区二区0| 色综合久久久久| 欧美一级免费大片| 欧美高清在线视频| 一区二区欧美视频| 久久成人精品无人区| 成人aaaa免费全部观看| 欧美男女性生活在线直播观看| 欧美成人午夜电影| 中文字幕色av一区二区三区| 偷窥少妇高潮呻吟av久久免费| 国产一区二区在线电影| 91视频观看视频| 日韩欧美精品在线| 亚洲视频1区2区| 卡一卡二国产精品| 91年精品国产| 精品国产91亚洲一区二区三区婷婷| 136国产福利精品导航| 蜜臀av性久久久久蜜臀aⅴ四虎| 成人aa视频在线观看| 欧美va在线播放| 亚洲一区电影777| 日韩三级精品电影久久久| 国产精品少妇自拍| 久久精品国产一区二区三| 色婷婷av久久久久久久| 精品国产乱码久久久久久老虎| 一卡二卡三卡日韩欧美| 国产高清久久久久| 日韩视频免费观看高清完整版 | 香蕉成人伊视频在线观看| 国产91精品免费| 日韩免费一区二区| 亚洲1区2区3区4区| 色婷婷亚洲一区二区三区| www国产成人免费观看视频 深夜成人网| 亚洲精品国久久99热| 成人午夜私人影院| 精品裸体舞一区二区三区| 午夜精品一区在线观看| 91丨九色丨国产丨porny| 国产日韩欧美激情| 精品一区二区三区在线观看国产| 欧美色倩网站大全免费| 亚洲免费在线播放| 波多野结衣中文字幕一区| 久久久精品蜜桃| 国产一区二区在线影院| 精品剧情v国产在线观看在线| 日韩电影一二三区| 在线不卡一区二区| 久久天堂av综合合色蜜桃网 | 亚洲日韩欧美一区二区在线| 粉嫩av亚洲一区二区图片| 久久久久久亚洲综合影院红桃|