debian下使用dynamic printk分析usb網卡驅動 debian下配置dynamic printk以及從新編譯內核

在《debian下使用dynamic printk分析usb轉串口驅動執行流程》中使用了usb轉串口,當前例子使用usb網卡分析驅動(dm9601芯片)。html

仍然須要使能dynamic printk,能夠參考《debian下配置dynamic printk以及從新編譯內核》配置並從新編譯內核。node

此處使用的usb網卡是從京東購買的沐陽 Jp1081。函數

 

未插入usb網卡時,查看usb信息:post

$  lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 174f:114f Syntek 
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 003: ID 105b:e065  
Bus 003 Device 004: ID 0bda:0129 Realtek Semiconductor Corp. 

插入usb網卡,查看usb信息:ui

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 174f:114f Syntek 
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 003: ID 105b:e065  
Bus 003 Device 004: ID 0bda:0129 Realtek Semiconductor Corp. 
Bus 001 Device 074: ID 0fe6:9700 Kontron (Industrial Computer Source / ICS Advent) DM9601 Fast Ethernet Adapter

能夠看到多出一行輸出信息,其核心芯片是DM9601。url

 

 查看dm9601驅動信息:spa

$ sudo modinfo dm9601
[sudo] password for host: 
filename:       /lib/modules/3.2.57/kernel/drivers/net/usb/dm9601.ko
license:        GPL
description:    Davicom DM9601 USB 1.1 ethernet devices
author:         Peter Korsgaard <jacmet@sunsite.dk>
alias:          usb:v0A46p9000d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0FE6p9700d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0FE6p8101d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0A47p9601d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0A46p8515d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0A46p0268d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0A46p6688d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0A46p9601d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v07AAp9601d*dc*dsc*dp*ic*isc*ip*
depends:        usbnet,usbcore,mii
intree:         Y
vermagic:       3.2.57 SMP mod_unload modversions 

其中depends:一行後面的內容表示dm9601依賴於usbnet和usbcore和mii這三個驅動模塊,線程

能夠繼續用modinfo查看其餘模塊的依賴關係,還有usbcore依賴於usb-common模塊。debug

因此dm9601芯片依賴於dm960一、usbnet、mii、usbcore和usb-common這五個驅動程序。code

 

查看drivers/net/usbMakefile,能夠知道:

dm9601驅動由drivers/net/usb/dm9601.c生成的

usbnet驅動是由drivers/net/usb/usbnet.c生成的。

 

查看drivers/net/Makefile,能夠知道:

mii驅動是由drivers/net/mii.c生成的。

 

查看drivers/usb/Makefile,能夠知道:

usb-common驅動是由drivers/usb/usb-common.c生成的。

 

查看drivers/usb/core/Makefile,能夠知道:

usbcore是由由drivers/usb/core/下面的usb.c hub.c hcd.c urb.c message.c driver.c config.c file.c buffer.c sysfs.c endpoint.c devio.c

notify.c generic.c quirks.c devices.c hcd-pci.c inode.c這些文件生成的。

 

編譯一個配置腳原本配置dynamic printk,內容以下:

#!/bin/sh

DYNAMIC_CONTROL=/sys/kernel/debug/dynamic_debug/control

#usbcore
echo 'file drivers/usb/core/usb.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/hub.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/hcd.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/urb.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/message.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/driver.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/config.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/file.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/buffer.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/sysfs.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/endpoint.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/device.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/notify.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/generic.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/quirks.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/devices.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/hci-pci.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/usb/core/inode.c +flmpt' > $DYNAMIC_CONTROL

#drivers/base files
echo 'file drivers/base/core.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/sys.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/bus.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/dd.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/syscore.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/driver.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/class.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/platform.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/cpu.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/firmware.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/init.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/map.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/devres.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/attribute_container.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/transport_class.c +flmpt' > $DYNAMIC_CONTROL
echo 'file drivers/base/topology.c +flmpt' > $DYNAMIC_CONTROL

#usb-common
echo 'file drivers/usb/usb-common.c +flmpt' > $DYNAMIC_CONTROL

#mii
echo 'file drivers/net/mii.c +flmpt' > $DYNAMIC_CONTROL

#usbnet
echo 'file drivers/net/usbnet.c +flmpt' > $DYNAMIC_CONTROL

#dm9601
echo 'file drivers/net/dm9601.c +flmpt' > $DYNAMIC_CONTROL

切換到root帳戶:

su

下面命令都是使用root帳戶執行:

掛載debugfs:

mount -t debugfs none /sys/kernel/debug

 

拔掉usb網卡,刪除dm960一、usbnet和mii驅動(usbcore和usb_common沒法刪除,也應該刪除):

# modprobe -r dm9601 usbnet mii

而後執行上面配置dynamic printk的腳本。

 

而後插入usb網卡,獲得下面信息(使用dmesg):

[38737.680241] [11477] usbcore:usb_remote_wakeup:2737: usb usb1: usb wakeup-resume
[38737.680254] [11477] usbcore:hcd_bus_resume:2013: usb usb1: usb auto-resume
[38737.693461] [11477] usbcore:hub_resume:2810: hub 1-0:1.0: hub_resume
[38737.693488] [11477] usbcore:hub_activate:860: hub 1-0:1.0: port 2: status 0101 change 0001
[38737.693504] [11477] usbcore:hub_activate:860: hub 1-0:1.0: port 4: status 0507 change 0000
[38737.797310] [164] usbcore:hub_events:3592: hub 1-0:1.0: state 7 ports 4 chg 0004 evt 0000
[38737.797343] [164] usbcore:hub_port_connect_change:3330: hub 1-0:1.0: port 2, status 0101, change 0001, 12 Mb/s
[38737.925150] [164] usbcore:hub_port_debounce:2899: hub 1-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
[38738.036986] usb 1-2: new full-speed USB device number 78 using xhci_hcd
[38738.053846] [164] usbcore:usb_get_langid:791: usb 1-2: default language 0x0409
[38738.054100] [164] usbcore:usb_new_device:1973: usb 1-2: udev 78, busnum 1, minor = 77
[38738.054108] usb 1-2: New USB device found, idVendor=0fe6, idProduct=9700
[38738.054112] usb 1-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[38738.054116] usb 1-2: Product: USB 2.0 10/100M Ethernet Adaptor
[38738.054125] [164] core:device_add:973: device: '1-2': device_add
[38738.054287] [164] bus:bus_add_device:502: bus: 'usb': add device 1-2
[38738.054364] [164] dd:driver_probe_device:211: bus: 'usb': driver_probe_device: matched device 1-2 with driver usb
[38738.054375] [164] dd:really_probe:114: bus: 'usb': really_probe: probing driver usb with device 1-2
[38738.054395] [164] usbcore:usb_probe_device:228: usb 1-2: usb_probe_device
[38738.054407] [164] usbcore:usb_choose_configuration:146: usb 1-2: configuration #1 chosen from 1 choice
[38738.054669] [164] usbcore:usb_set_configuration:1863: usb 1-2: adding 1-2:1.0 (config #1, interface 0)
[38738.054684] [164] core:device_add:973: device: '1-2:1.0': device_add
[38738.054720] [164] bus:bus_add_device:502: bus: 'usb': add device 1-2:1.0
[38738.054802] [164] dd:driver_probe_device:211: bus: 'usb': driver_probe_device: matched device 1-2:1.0 with driver usbserial_generic
[38738.054814] [164] dd:really_probe:114: bus: 'usb': really_probe: probing driver usbserial_generic with device 1-2:1.0
[38738.054837] [164] usbcore:usb_probe_interface:279: usbserial_generic 1-2:1.0: usb_probe_interface
[38738.054851] [164] usbcore:usb_probe_interface:297: usbserial_generic 1-2:1.0: usb_probe_interface - got id
[38738.054877] [164] dd:really_probe:152: usbserial_generic: probe of 1-2:1.0 rejects match -19
[38738.054916] [164] core:device_add:973: device: 'ep_81': device_add
[38738.054975] [164] core:device_add:973: device: 'ep_02': device_add
[38738.055022] [164] core:device_add:973: device: 'ep_83': device_add
[38738.055079] [164] dd:driver_bound:41: driver: '1-2': driver_bound: bound to device 'usb'
[38738.055088] [164] dd:really_probe:137: bus: 'usb': really_probe: bound device 1-2 to driver usb
[38738.055101] [164] core:device_add:973: device: 'ep_00': device_add
[38738.079351] [11786] bus:bus_add_driver:702: bus: 'usb': add driver dm9601
[38738.079374] [11786] dd:driver_probe_device:211: bus: 'usb': driver_probe_device: matched device 1-2:1.0 with driver dm9601
[38738.079382] [11786] dd:really_probe:114: bus: 'usb': really_probe: probing driver dm9601 with device 1-2:1.0
[38738.079392] [11786] usbcore:usb_probe_interface:279: dm9601 1-2:1.0: usb_probe_interface
[38738.079399] [11786] usbcore:usb_probe_interface:297: dm9601 1-2:1.0: usb_probe_interface - got id
[38738.092443] [11786] core:device_add:973: device: 'eth0': device_add
[38738.093442] dm9601 1-2:1.0: eth0: register 'dm9601' at usb-0000:00:14.0-2, Davicom DM9601 USB Ethernet, 00:e0:4c:53:44:58
[38738.093482] [11786] dd:driver_bound:41: driver: '1-2:1.0': driver_bound: bound to device 'dm9601'
[38738.093497] [11786] dd:really_probe:137: bus: 'usb': really_probe: bound device 1-2:1.0 to driver dm9601
[38738.093586] usbcore: registered new interface driver dm9601
[38738.101169] [11663] core:device_rename:1651: device: 'eth0': device_rename: renaming to 'eth1'
[38738.137651] udevd[11663]: renamed network interface eth0 to eth1
[38738.188557] dm9601 1-2:1.0: eth1: link up, 100Mbps, full-duplex, lpa 0xFFFF
[38748.657111] eth1: no IPv6 routers present

前面大部分輸出信息跟使用usb轉串口相似,都是使用usbcore檢測設備信息以及設備驅動,最終檢測到dm9601驅動

 

 usb中有個remote wakeup功能,usb hcd(host controller driver)中默認remote wakeup功能就是調用hcd_resume_work實現,

該函數會調用usb_remote_wakeup,就產生了輸出信息:

[38737.680241] [11477] usbcore:usb_remote_wakeup:2737: usb usb1: usb wakeup-resume

 

在usb子系統初始化之時,執行usb_init函數,該函數調用了usb_register_device_driver(&usb_generic_driver, THIS_MODULE).

默認狀況下找到usb設備都是先調用usb_generic_driver的相關函數。此處執行resume功能就調用usb.generic_driver的resume功能,

即generic_resume函數。

在執行generic_resume時,調用了hcd_bus_resume函數,輸出了下面信息:

[38737.680254] [11477] usbcore:hcd_bus_resume:2013: usb usb1: usb auto-resume

 

接着調用hub的resume功能,即hub_resume函數,輸出下面信息:

[38737.693461] [11477] usbcore:hub_resume:2810: hub 1-0:1.0: hub_resume

hub_resume中還執行hub_activate(hub,HUB_RESUME),在hub_activate中檢查每個port是否狀態發生了改變,並輸出信息,

產生下面兩行輸出:

[38737.693488] [11477] usbcore:hub_activate:860: hub 1-0:1.0: port 2: status 0101 change 0001
[38737.693504] [11477] usbcore:hub_activate:860: hub 1-0:1.0: port 4: status 0507 change 0000

 

在usb hub初始化時,建立了一個內核線程(名爲khubd),線程執行函數是hub_thread.

在hub_thread函數中循環執行hub_events函數,hub_events中循環檢測是否port狀態發生了改變,並根據其改變狀態執行功能。

hub_events函數中若是hub_event_list不空,那麼就獲取從hub_event_list獲取對應的事件,根據該事件獲得hub,再根據hub獲得對應的hub_dev。

而後輸出事件信息:

 [38737.797310] [164] usbcore:hub_events:3592: hub 1-0:1.0: state 7 ports 4 chg 0004 evt 0000

 

hub_events中檢測到port鏈接狀態發生了改變,會調用hub_port_connect_change函數,該函數開頭輸出信息:

[38737.797343] [164] usbcore:hub_port_connect_change:3330: hub 1-0:1.0: port 2, status 0101, change 0001, 12 Mb/s

在hub_port_connect_change函數中執行hub_port_debounce函數,輸出下面信息:

[38737.925150] [164] usbcore:hub_port_debounce:2899: hub 1-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101

接着執行hub_port_init函數,在hub_port_init中輸出下面信息:

[38738.036986] usb 1-2: new full-speed USB device number 78 using xhci_hcd


接着執行usb_new_device函數,調用usb_enumerate_device函數,usb_enumerate_device調用usb_cache_string,

usb_cache_string調用usb_string,usb_string調用usb_get_langid,輸出下面信息:

[38738.053846] [164] usbcore:usb_get_langid:791: usb 1-2: default language 0x0409

以後usb_new_device輸出下面信息:

[38738.054100] [164] usbcore:usb_new_device:1973: usb 1-2: udev 78, busnum 1, minor = 77

在usb_new_device中調用announce_device函數,輸出下面信息:

[38738.054108] usb 1-2: New USB device found, idVendor=0fe6, idProduct=9700
[38738.054112] usb 1-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[38738.054116] usb 1-2: Product: USB 2.0 10/100M Ethernet Adaptor

 usb_new_device接着調用device_add。

在device_add中輸出信息:

[38738.054125] [164] core:device_add:973: device: '1-2': device_add

device_add中接着調用bus_add_device。

bus_add_device中輸出信息:

[38738.054287] [164] bus:bus_add_device:502: bus: 'usb': add device 1-2

device_add中接着調用bus_probe_device,bus_probe_device中執行device_attach.

在device_attach中對其bus上的每個驅動都調用__device_attach函數。

在__device_attach中對調用driver_match_device來對驅動和設備來進行匹配,若是匹配成功,則調用driver_probe_device,不然直接返回0.

此處將設備和驅動匹配成功,因此執行driver_probe_device函數。

在執行driver_probe_device時輸出下面信息:

[38738.054364] [164] dd:driver_probe_device:211: bus: 'usb': driver_probe_device: matched device 1-2 with driver usb

driver_probe_device繼續執行really_probe函數,輸出下面信息:

[38738.054375] [164] dd:really_probe:114: bus: 'usb': really_probe: probing driver usb with device 1-2

driver_probe_device會執行其驅動的probe函數。以前在對usb subsys初始化時調用了usb_init,usb_init調用了

usb_register_device_driver(&usb_generic_driver, THIS_MODULE),而後usb_register_device_driver中設置了驅動的probe函數是usb_probe_device.
因此這裏執行usb_probe_device函數,在此函數中輸出下面信息:

[38738.054395] [164] usbcore:usb_probe_device:228: usb 1-2: usb_probe_device

usb_probe_device還會執行usb_device_driver的probe函數,而usb_generic_driver定義時就將其probe設置成了generic_probe.

因此這裏會調用generic_probe函數。在generic_probe中會調用usb_choose_configuration,從而輸出下面信息:

[38738.054407] [164] usbcore:usb_choose_configuration:146: usb 1-2: configuration #1 chosen from 1 choice

generic_probe中接下來調用usb_set_configuration.

usb_set_configuration中對usb接口輸出下面信息:

[38738.054669] [164] usbcore:usb_set_configuration:1863: usb 1-2: adding 1-2:1.0 (config #1, interface 0)

在usb_set_configuration中調用device_add函數添加該usb接口設備。

device_add中輸出下面信息:

[38738.054684] [164] core:device_add:973: device: '1-2:1.0': device_add

device_add中調用bus_add_device,輸出下面信息:

[38738.054720] [164] bus:bus_add_device:502: bus: 'usb': add device 1-2:1.0

device_add接下來調用bus_probe_device,跟前面相似,仍然對總線上全部驅動和設備來進行匹配,若是匹配成功,

就執行這個驅動。此處匹配usbserial-generic驅動成功,執行driver_probe_device,輸出下面信息:

[38738.054802] [164] dd:driver_probe_device:211: bus: 'usb': driver_probe_device: matched device 1-2:1.0 with driver usbserial_generic

driver_probe_device中調用really_probe,在really_probe中輸出信息:

[38738.054814] [164] dd:really_probe:114: bus: 'usb': really_probe: probing driver usbserial_generic with device 1-2:1.0

跟前面相似,調用驅動的probe函數,即usb_probe_interface函數。

usb_probe_interface中輸出下面信息:

[38738.054837] [164] usbcore:usb_probe_interface:279: usbserial_generic 1-2:1.0: usb_probe_interface
[38738.054851] [164] usbcore:usb_probe_interface:297: usbserial_generic 1-2:1.0: usb_probe_interface - got id

該函數執行失敗,在回到really_probe函數後輸出下面信息:

[38738.054877] [164] dd:really_probe:152: usbserial_generic: probe of 1-2:1.0 rejects match -19

接下來三行輸出信息不知道是哪部分代碼產生的:

[38738.054916] [164] core:device_add:973: device: 'ep_81': device_add
[38738.054975] [164] core:device_add:973: device: 'ep_02': device_add
[38738.055022] [164] core:device_add:973: device: 'ep_83': device_add

此時返回到上一個執行的really_probe,執行driver_bound,輸出信息:

[38738.055079] [164] dd:driver_bound:41: driver: '1-2': driver_bound: bound to device 'usb'

而後在really_probe中輸出下面信息:

[38738.055079] [164] dd:driver_bound:41: driver: '1-2': driver_bound: bound to device 'usb'

下面一行輸出信息頁不知道是那部分代碼產生的(可能和當前代碼執行流程無關?):

[38738.055101] [164] core:device_add:973: device: 'ep_00': device_add

 

接下來加載dm9601驅動,調用dm9601_init,dm9601_init調用usb_register(&dm9601_driver).

usb_register中調用bus_add_driver。

在bus_add_driver中輸出下面信息:

[38738.079351] [11786] bus:bus_add_driver:702: bus: 'usb': add driver dm9601

bus_add_driver中調用driver_attach,driver_attach中對於總線上每一個設備執行__driver_attach.

__driver_attach中對設備和驅動進行匹配,若是匹配成功,則執行driver_probe_device.

此處匹配成功,執行driver_probe_device函數,輸出下面信息:

[38738.079374] [11786] dd:driver_probe_device:211: bus: 'usb': driver_probe_device: matched device 1-2:1.0 with driver dm9601

driver_probe_device中執行really_probe函數,而後調用驅動的probe函數,即usb_probe_interface函數,

usb_probe_interface中輸出下面信息:

[38738.079392] [11786] usbcore:usb_probe_interface:279: dm9601 1-2:1.0: usb_probe_interface
[38738.079399] [11786] usbcore:usb_probe_interface:297: dm9601 1-2:1.0: usb_probe_interface - got id

usb_probe_interface中調用driver->probe,dm9601_driver定義中其probe函數即usbnet_probe函數。

usbnet_probe函數中調用register_netdev,register_netdev調用register_netdevice,register_netdevice調用netdev_register_kobject,

netdev_register_kobject將設備名稱設置成eth0,而後調用device_add,在device_add中輸出下面信息:

[38738.092443] [11786] core:device_add:973: device: 'eth0': device_add

usbnet_probe繼續執行,輸出下面信息:

[38738.093442] dm9601 1-2:1.0: eth0: register 'dm9601' at usb-0000:00:14.0-2, Davicom DM9601 USB Ethernet, 00:e0:4c:53:44:58

 回到really_probe繼續執行,調用driver_bound,在driver_bound中輸出下面信息:

[38738.093482] [11786] dd:driver_bound:41: driver: '1-2:1.0': driver_bound: bound to device 'dm9601'

而後在really_probe中輸出下面信息:

[38738.093497] [11786] dd:really_probe:137: bus: 'usb': really_probe: bound device 1-2:1.0 to driver dm9601

回到前面的usb_register_driver,輸出下面信息:

[38738.093586] usbcore: registered new interface driver dm9601

個人系統中udev規則(/etc/udev/rules.d/70-persistent-net.rules)中有下面內容:

 # USB device 0x:0x (dm9601)
  SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:53:44:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL==    "eth*", NAME="eth1"

因此在添加usb網卡時會將eth0改爲eth1,產生下面輸出:

[38738.101169] [11663] core:device_rename:1651: device: 'eth0': device_rename: renaming to 'eth1'
[38738.137651] udevd[11663]: renamed network interface eth0 to eth1

dm9601驅動還會調用dm9601_link_reset,dm9601_link_reset調用mii_check_media,mii_check_media中產生下面輸出:

[38738.188557] dm9601 1-2:1.0: eth1: link up, 100Mbps, full-duplex, lpa 0xFFFF

最後一行信息是在addr_rs_timer函數中輸出的,該函數被配置成ipv6接口的定時器函數,過一段時間都會調用該函數。

 

到這裏整個usb網卡檢測過程就完成了,其餘的網卡相關函數還須要看看書後再來分析。

相關文章
相關標籤/搜索