怎么写linux网卡驱动程序

怎么写linux网卡驱动程序,第1张

1

方法一:

1:ethtool -i ethx

如:

linux:/mnt # ethtool -i eth1

driver: e1000e

version: 1.0.2-k2

firmware-version: 1.9-0

bus-info: 0000:0b:00.0

linux:/mnt # ethtool -i eth16

driver: igb

version: 2.1.0-k2

firmware-version: 1.4-1

bus-info: 0000:0a:00.0

linux:/mnt #

2:使用 modinfo igb 查看驱动信息

linux:~ # modinfo igb

filename: /lib/modules/2.6.32.12-0.7-default/kernel/drivers/net/igb/igb.ko

version:5.2.5

license:GPL

description:Intel(R) Gigabit Ethernet Network Driver

author: Intel Corporation, <e1000-devel@lists.sourceforge.net>

srcversion: 0E80ABCD0117D822FE8B271

alias: pci:v00008086d000010D6sv*sd*bc*sc*i*

alias: pci:v00008086d000010A9sv*sd*bc*sc*i*

alias: pci:v00008086d000010A7sv*sd*bc*sc*i*

alias: pci:v00008086d000010E8sv*sd*bc*sc*i*

alias: pci:v00008086d00001526sv*sd*bc*sc*i*

alias: pci:v00008086d0000150Dsv*sd*bc*sc*i*

alias: pci:v00008086d000010E7sv*sd*bc*sc*i*

alias: pci:v00008086d000010E6sv*sd*bc*sc*i*

alias: pci:v00008086d00001518sv*sd*bc*sc*i*

alias: pci:v00008086d0000150Asv*sd*bc*sc*i*

alias: pci:v00008086d000010C9sv*sd*bc*sc*i*

alias: pci:v00008086d00000440sv*sd*bc*sc*i*

alias: pci:v00008086d0000043Csv*sd*bc*sc*i*

alias: pci:v00008086d0000043Asv*sd*bc*sc*i*

alias: pci:v00008086d00000438sv*sd*bc*sc*i*

alias: pci:v00008086d00001516sv*sd*bc*sc*i*

alias: pci:v00008086d00001511sv*sd*bc*sc*i*

alias: pci:v00008086d00001510sv*sd*bc*sc*i*

alias: pci:v00008086d00001527sv*sd*bc*sc*i*

alias: pci:v00008086d0000150Fsv*sd*bc*sc*i*

alias: pci:v00008086d0000150Esv*sd*bc*sc*i*

alias: pci:v00008086d00001524sv*sd*bc*sc*i*

alias: pci:v00008086d00001523sv*sd*bc*sc*i*

alias: pci:v00008086d00001522sv*sd*bc*sc*i*

alias: pci:v00008086d00001521sv*sd*bc*sc*i*

alias: pci:v00008086d00001539sv*sd*bc*sc*i*

alias: pci:v00008086d0000157Csv*sd*bc*sc*i*

alias: pci:v00008086d0000157Bsv*sd*bc*sc*i*

alias: pci:v00008086d00001538sv*sd*bc*sc*i*

alias: pci:v00008086d00001537sv*sd*bc*sc*i*

alias: pci:v00008086d00001536sv*sd*bc*sc*i*

alias: pci:v00008086d00001533sv*sd*bc*sc*i*

alias: pci:v00008086d00001F45sv*sd*bc*sc*i*

alias: pci:v00008086d00001F41sv*sd*bc*sc*i*

alias: pci:v00008086d00001F40sv*sd*bc*sc*i*

depends:hwmon,dca

supported: external

vermagic: 2.6.32.12-0.7-default SMP mod_unload modversions

parm: InterruptThrottleRate:Maximum interrupts per second, per vector, (max 100000), default 3=adaptive (array of int)

parm: IntMode:Change Interrupt Mode (0=Legacy, 1=MSI, 2=MSI-X), default 2 (array of int)

parm: Node:set the starting node to allocate memory on, default -1 (array of int)

parm: LLIPort:Low Latency Interrupt TCP Port (0-65535), default 0=off (array of int)

parm: LLIPush:Low Latency Interrupt on TCP Push flag (0,1), default 0=off (array of int)

parm: LLISize:Low Latency Interrupt on Packet Size (0-1500), default 0=off (array of int)

parm: RSS:Number of Receive-Side Scaling Descriptor Queues (0-8), default 1, 0=number of cpus (array of int)

parm: VMDQ:Number of Virtual Machine Device Queues: 0-1 = disable, 2-8 enable, default 0 (array of int)

parm: max_vfs:Number of Virtual Functions: 0 = disable, 1-7 enable, default 0 (array of int)

parm: MDD:Malicious Driver Detection (0/1), default 1 = enabled. Only available when max_vfs is greater than 0 (array of int)

parm: QueuePairs:Enable Tx/Rx queue pairs for interrupt handling (0,1), default 1=on (array of int)

parm: EEE:Enable/disable on parts that support the feature (array of int)

parm: DMAC:Disable or set latency for DMA Coalescing ((0=off, 1000-10000(msec), 250, 500 (usec)) (array of int)

parm: LRO:Large Receive Offload (0,1), default 0=off (array of int)

parm: enable_debug:Set to 1 to enable debug tracing into the syslog (uint)

parm: debug:Debug level (0=none, ..., 16=all) (int)

linux:~ #

2

方法二:

1:dmesg | grep ethx

如:

linux:~ # dmesg | grep eth17

[ 30.351872] igb 0000:0a:00.1: eth17: (PCIe:2.5Gb/s:Width x4) 00:0b:ab:52:fb:b3

[ 30.351952] igb 0000:0a:00.1: eth17: PBA No: ffffff-0ff

[429171.548763] device eth17 entered promiscuous mode

[429173.116530] igb: eth17 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX

[429173.118867] ADDRCONF(NETDEV_UP): eth17: link is not ready

[429173.121176] ADDRCONF(NETDEV_CHANGE): eth17: link becomes ready

[429183.236266] eth17: no IPv6 routers present

[1641503.272376] igb 0000:0a:00.1: eth17: (PCIe:2.5Gb/s:Width x4) 00:0b:ab:52:fb:b3

[1641503.272460] igb 0000:0a:00.1: eth17: PBA No: ffffff-0ff

[1641598.356110] device eth17 entered promiscuous mode

[1641598.369229] igb: eth17 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX

[1641598.372636] ADDRCONF(NETDEV_UP): eth17: link is not ready

[1641598.374978] ADDRCONF(NETDEV_CHANGE): eth17: link becomes ready

[1641608.564181] eth17: no IPv6 routers present

[1701779.787471] igb 0000:0a:00.1: eth17: (PCIe:2.5GT/s:Width x4)

[1701779.787473] igb 0000:0a:00.1: eth17: MAC: 00:0b:ab:52:fb:b3

[1701779.787555] igb 0000:0a:00.1: eth17: PBA No: FFFFFF-0FF

[1702124.805650] device eth17 entered promiscuous mode

[1702141.839131] ADDRCONF(NETDEV_UP): eth17: link is not ready

[1702144.057474] igb: eth17 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None

[1702144.059425] ADDRCONF(NETDEV_CHANGE): eth17: link becomes ready

[1702154.705520] eth17: no IPv6 routers present

[1712008.630151] igb 0000:0a:00.1: eth17: (PCIe:2.5GT/s:Width x4)

[1712008.630153] igb 0000:0a:00.1: eth17: MAC: 00:0b:ab:52:fb:b3

[1712008.630235] igb 0000:0a:00.1: eth17: PBA No: FFFFFF-0FF

[1712100.136186] device eth17 entered promiscuous mode

[1712101.873823] ADDRCONF(NETDEV_UP): eth17: link is not ready

[1712104.159209] igb: eth17 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None

[1712104.161548] ADDRCONF(NETDEV_CHANGE): eth17: link becomes ready

[1712114.854722] eth17: no IPv6 routers present

linux:~ #

2:使用 modinfo igb 查看驱动信息

(结果同方法一中的)

vmware虚拟机安装网卡驱动的具体步骤如下:

需要准备的材料分别是:电脑、vmware。

1、在开始菜单,双击打开VMware软件。

2、在VMware主界面的菜单栏中,单击编辑选项卡。

3、在d出下拉菜单中,选择虚拟网络编辑器。

4、在“虚拟网络编辑器”界面上,点击“添加网络”按钮。

5、单击提示中的确定选项。

6、此时就能看到虚拟网络编辑器中多了一个虚拟网卡,至此,安装过程完成。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/9010754.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-23
下一篇 2023-04-23

发表评论

登录后才能评论

评论列表(0条)

保存