e1000e网卡驱动分析—网卡驱动的体系结构

本文介绍了e1000e网卡驱动的工作原理,从PCI设备的初始化开始,讲解了配置空间的映射、驱动加载过程以及关键数据结构pci_dev、net_device和e1000_adapter的角色。驱动通过pci_register_driver()与设备进行匹配,调用probe方法完成驱动的加载,其中adapter结构体是硬件与软件接口的关键,管理硬件特性并实现收发数据包的缓冲区管理。
摘要由CSDN通过智能技术生成

在硬件上电初始化时,BIOS统一检查所有的PCI设备,并为每个设备分配一个物理地址,该地址通过BIOS获得并写到设备的配置空间内,CPU不能直接访问,驱动程序可以将这部分配置空间通过ioremap映射到普通内存供CPU访问。

当操作系统初始化时,其为每个PCI设备分配了一个pci_dev结构,并将前面分配的物理地址写到pci_dev的resource字段中。在驱动程序中,可以通过读取这个字段得到设备的配置空间地址,由函数pci_resource_start()以及pci_resource_len()获得配置空间的起始地址和大小,再通过ioremap映射到内存中,供CPU访问,来控制该设备。

e1000e网卡驱动加载时,显而易见的是调用module_init(e1000_init_module)宏,然后调用e1000_init_module()函数,该函数又会进一步的调用pci_register_driver()函数。

pci_register_driver()函数以一个pci_driver的结构作为入参,该结构定义了PCI设备相关的操作函数,如probe、shutdown、remove等,最主要的是定义了id_table。我们知道,网卡设备也是一个PCI设备,而系统所有PCI设备的id_table在系统启动阶段就已经分配,这里的主要目的是用pci_driver结构的id_table和所有PCI设备的id_table比较,找到匹配项,然后取出该PCI设备的pci_dev结构,最后调用probe方

在线封装和离线封装驱动 Name net-e1000e (obsolete!) Description Driver for Intel GigaBit NICs (incl. I217/I218/82579LM/82574L and others) Please note that this driver is obsolete, because with ESXi 5.5 Update 3 VMware introduced a newer version of e1000e which supports the same set of devices plus Intel i219 adapters (PCI IDs 8086:156f, 8086:1570, 8086:15b7, 8086:15b8)! Please use this instead. For details read this blog post. Author George L. Roman, VMware forums user GLRoman Vendor (Vendor Code) GLRoman (GLR) Current Version 3.1.0.2-glr2 Supported Devices / PCI IDs 8086:1049, 8086:104a, 8086:104b, 8086:104c, 8086:104d, 8086:105e, 8086:105f, 8086:1060, 8086:107d, 8086:107e, 8086:107f, 8086:108b, 8086:108c, 8086:1096, 8086:1098, 8086:109a, 8086:10a4, 8086:10a5, 8086:10b9, 8086:10ba, 8086:10bb, 8086:10bc, 8086:10bd, 8086:10bf, 8086:10c0, 8086:10c2, 8086:10c3, 8086:10c4, 8086:10c5, 8086:10cb, 8086:10cc, 8086:10cd, 8086:10ce, 8086:10d3, 8086:10d5, 8086:10d9, 8086:10da, 8086:10de, 8086:10df, 8086:10e5, 8086:10ea, 8086:10eb, 8086:10ef, 8086:10f0, 8086:10f5, 8086:10f6, 8086:1501, 8086:1502, 8086:1503, 8086:150c, 8086:1525, 8086:153a, 8086:153b, 8086:1559, 8086:155a, 8086:15a0, 8086:15a1, 8086:15a2, 8086:15a3, 8086:294c Acceptance Level CommunitySupported Dependencies and Restrictions Replaces/Updates: VMware built-in net-e1000e driver Depends On: vmkapi_2_0_0_0, com.vmware.driverAPI-9.2.0.0 Package Properties Requires MaintMode Live Install Allowed Live Remove Allowed Stateless Ready Overlay Yes No No Yes No Additional links Related VMware Forum's post Package updated to include missing device IDs 1502 and 1503 following this hint from VMware forums user cmcallen
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值