armlinux 网卡驱动分析
DESCRIPTION
ARMLINUX 网卡驱动分析. hzlc 小组 : 章伟 , 陈浩强 , 刘鑫 , 海玉宝. 前人之述备矣。。。. 网络设备驱动结构. 网络协议接口层 网络设备接口层 设备驱动功能层 网络设备与媒介层. 网络协议接口层. 功能 : 给上层协议提供透明的数据包发送和接收接口 定义在 /include/linux/netdevice.h 中 函数原型 : int dev_queue_xmit(struct sk_buff *skb); intnetif_rx(struct sk_buff *skb); Sk_buff 含义为套接字缓冲区. - PowerPoint PPT PresentationTRANSCRIPT
-
ARMLINUXhzlc: , , ,
-
:/include/linux/netdevice.h:int dev_queue_xmit(struct sk_buff *skb);intnetif_rx(struct sk_buff *skb);Sk_buff
-
Sk_buff/linux/skbuff.h,Linux,,
-
Linux
-
net_devicenet_device
-
& Net_device
-
,,,,CirrusCS8900./drivers/net/cs89x0.c cs8900 datasheet:http://cst.mi.fu-berlin.de/proje ... eets/old/CS8900.pdf
-
/include/linux/netdevice.hAPI :Int register_netdev(struct net_device *dev)Void unregister_netdev(struct net_device *dev)net_device
-
net_deviceinit(),net_device.init()cs89x0_probe(): struct net_device * __init cs89x0_probe(int unit)
-
(2)for (port = netcard_portlist; *port; port++) { /*netcard_portlistunsigned intcs89x0.c,cs8900cs89x0_probe1*/ if (cs89x0_probe1(dev, *port, 0) == 0)/*, ,cs8900*/
-
(3) static int __init cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) net_device
-
/include/linux/netdevice.hvoid netif_start_queue(struct net_device *dev)I/ODMAvoid netif_stop_queue(struct net_device *dev)
-
TX_CMDTX_LENGPacketPagePP_BusST,8READY_FOR_TX_NOW ,.CAUTION!!spin_lock_irq(&lp->lock)
-
cs8900,,,,netif_rx().irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs * regs)
-
2 /**/ while ((status = readword(dev, ISQ_PORT))) { if (net_debug > 4)printk(%s: event=%04x\n, dev->name, status); handled = 1; switch(status & ISQ_EVENT_MASK) { case ISQ_RECEIVER_EVENT:/**/ net_rx(dev);/*, net_rx()*/ break;
-
3Void net_rx(struct net_device *dev) lp->stats.rx_packets++; lp->stats.rx_bytes += length;
-
,.net_device, .sk_buff,.
-
Function1:Queue a buffer for transmission to a network device. Function2:This function receives a packet from a device driver and queues it for the upper (protocol) levels to process.