驱动层日志添加了下文件目录,函数,代码行的打印(这里要小心,驱动目录源代码打印日志里边添进程号可能有问题,因为在驱动初始化的时候,内核还没有创建进程,不过猜测可以先不打印进程相关信息,在操作系统完成启动后再打印可能没有问题,不过在前面测试的时候,在驱动目录代码里边添加sched.h会报错,因为这个头文件对其他头文件的依赖本来就非常复杂):
添加日志文件目录,函数,代码行的打印前是这样的,比如想看某处打印详细代码位置,是很难的:
添加打印信息后是这样的,这样要找源代码目录比较容易,比较容易找到代码执行流程:
这里实际上是很多模块在初始化,calling后边的函数是可以直接在代码里边搜索的,一般都是一个模块的初始化入口:
这里可以看到总线上在不断添加计算机硬件的驱动:
这里好像是在添加osi的:
这里要注意,是在初始化网卡,e1000目录里有网卡初始化代码:
如果是看下边这个图,比较明显可以看出来IP层、UDP层、以太层源代码目录,很方便:
TCP打印日志的代码还比较少:
这样可以跟网络协议层对应上:
网卡驱动(e1000)到77XX行才装,这块没想明白,从下边这个日志也可以看出来不同驱动安装的先后顺序和大概时间
行 261: [ 1.060526] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'gpio': add driver gpio_stub_drv
行 267: [ 1.060647] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver reg-dummy
行 339: [ 1.077919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver sram
行 343: [ 1.077919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver syscon
行 349: [ 1.077919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver dummy
行 398: [ 1.079105] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'serial-base': add driver ctrl
行 400: [ 1.079121] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'serial-base': add driver port
行 498: [ 1.086687] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver sx150x-pinctrl
行 502: [ 1.086725] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver byt_gpio
行 506: [ 1.086755] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver cherryview-pinctrl
行 511: [ 1.086800] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver palmas-gpio
行 515: [ 1.086831] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver rc5t583-gpio
行 519: [ 1.086862] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver tps6586x-gpio
行 523: [ 1.086893] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver tps65910-gpio
行 585: [ 1.194919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver clk-lpss-atom
行 1096: [ 1.710919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'acpi': add driver ec
行 1116: [ 1.712042] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver 88PM860x
行 1119: [ 1.712072] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver WM8400
行 1122: [ 1.712098] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver wm831x
行 1125: [ 1.712128] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'spi': add driver wm831x
行 1128: [ 1.712152] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver wm8350
行 1131: [ 1.712176] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver tps65910
行 1134: [ 1.712202] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'spi': add driver ezx-pcap
行 1137: [ 1.712227] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver da903x
行 1140: [ 1.712252] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'spi': add driver da9052
行 1143: [ 1.712278] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver da9052
行 1146: [ 1.712303] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver lp8788
行 1149: [ 1.712329] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver da9055-pmic
行 1152: [ 1.712360] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver max77843
行 1155: [ 1.712385] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver max8925
行 1158: [ 1.712411] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver max8997
行 1161: [ 1.712435] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver max8998
行 1164: [ 1.712460] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver tps6586x
行 1167: [ 1.712486] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver tps65090
行 1170: [ 1.712510] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver aat2870
行 1173: [ 1.712535] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver palmas
行 1176: [ 1.712567] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver rc5t583
行 1179: [ 1.712593] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver as3711
行 1183: [ 1.712653] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'nd': add driver nd_bus
行 1185: [ 1.712669] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'nd': add driver nvdimm
行 1187: [ 1.712685] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'nd': add driver nd_region
行 1201: [ 1.712919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'mdio_bus': add driver Generic Clause 45 PHY
行 1203: [ 1.712919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'mdio_bus': add driver Generic PHY
行 1209: [ 1.712919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'usb': add driver usbfs
行 1212: [ 1.712919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'usb': add driver hub
行 1215: [ 1.712919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'usb': add driver usb
行 1226: [ 1.712919] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver i2c_designware
行 1370: [ 1.742313] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pnp': add driver system
行 1762: [ 1.899565] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver iosf_mbi_pci
行 1782: [ 1.900008] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver alarmtimer
行 1890: [ 1.942817] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver amd_gpio
行 1894: [ 1.942856] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver basic-mmio-gpio
行 1898: [ 1.942890] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver crystal_cove_gpio
行 1902: [ 1.943305] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver crystal_cove_pwm
行 1905: [ 1.943336] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver pwm-lpss
行 1909: [ 1.943397] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver pwm-lpss
行 1912: [ 1.943431] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci_express': add driver aer
行 1914: [ 1.943448] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci_express': add driver pcie_pme
行 1916: [ 1.943464] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci_express': add driver dpc
行 1918: [ 1.943481] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci_express': add driver pciehp
行 1920: [ 1.943503] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver pcieport
行 2010: [ 2.006564] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver shpchp
行 2022: [ 2.007190] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver dw-pcie
行 2026: [ 2.007221] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver imsttfb
行 2030: [ 2.007260] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver asiliantfb
行 2035: [ 2.007309] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver acpi-ged
行 2041: [ 2.007601] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver ac
行 2045: [ 2.008076] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'acpi': add driver button
行 2063: [ 2.009068] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver acpi-fan
行 2067: [ 2.009099] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'cpu': add driver processor
行 2072: [ 2.011421] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'acpi': add driver thermal
行 2077: [ 2.011635] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'acpi': add driver hardware_error_device
行 2085: [ 2.011816] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver byt_crystal_cove_pmic
行 2089: [ 2.011850] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver cht_crystal_cove_pmic
行 2093: [ 2.011881] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver axp288_pmic_acpi
行 2097: [ 2.011913] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver bxt_whiskey_cove_pmic
行 2101: [ 2.011956] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver cht_whiskey_cove_pmic
行 2105: [ 2.011995] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver cht_dollar_cove_ti_pmic
行 2109: [ 2.012027] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver tps68470_pmic_opregion
行 2112: [ 2.012053] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'acpi': add driver battery
行 2115: [ 2.012063] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver gpio-clk
行 2119: [ 2.012095] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver clk-fch
行 2123: [ 2.012124] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver clk-pmc-atom
行 2127: [ 2.012156] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver lgm-dma
行 2132: [ 2.012190] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver virtio-mmio
行 2135: [ 2.012220] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver virtio-pci
行 2138: [ 2.012260] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'virtio': add driver virtio_balloon
行 2146: [ 2.012343] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver xen-platform-pci
行 2152: [ 2.012404] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver simple-reset
行 2163: [ 2.013752] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pnp': add driver serial
行 2171: [ 2.028581] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver serial8250
行 2174: [ 2.028865] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver 8250_mid
行 2177: [ 2.028918] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver serial
行 2182: [ 2.029175] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'spi': add driver max310x
行 2184: [ 2.029195] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver max310x
行 2188: [ 2.029226] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver uart-sccnxp
行 2193: [ 2.029260] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver kgdboc
行 2199: [ 2.030463] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'virtio': add driver virtio_console
行 2201: [ 2.030481] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'virtio': add driver virtio_rproc_serial
行 2204: [ 2.031056] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'acpi': add driver hpet
行 2210: [ 2.031434] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver agpgart-amd64
行 2214: [ 2.031486] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver agpgart-intel
行 2221: [ 2.034341] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver agpgart-via
行 2226: [ 2.034397] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver tpm_tis
行 2228: [ 2.034418] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pnp': add driver tpm_tis
行 2231: [ 2.034450] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'acpi': add driver tpm_crb
行 2234: [ 2.034480] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'virtio': add driver virtio_iommu
行 2242: [ 2.040748] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver simple-framebuffer
行 2277: [ 2.110999] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'virtio': add driver virtio_blk
行 2282: [ 2.111050] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver tps65912
行 2285: [ 2.111079] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'spi': add driver tps65912
行 2288: [ 2.111105] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver twl
行 2292: [ 2.111138] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver twl4030-audio
行 2295: [ 2.111169] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver twl6040
行 2298: [ 2.111197] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver da9063
行 2302: [ 2.111226] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver max14577
行 2305: [ 2.111259] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver max77693
行 2308: [ 2.111285] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver adp5520
行 2311: [ 2.111311] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver crystal_cove_i2c
行 2314: [ 2.111339] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver CHT Whiskey Cove PMIC
行 2318: [ 2.111370] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver e820_pmem
行 2326: [ 2.111758] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'virtio': add driver virtio_scsi
行 2330: [ 2.111809] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'scsi': add driver sd
行 2334: [ 2.111845] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'scsi': add driver sr
行 2339: [ 2.111908] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver ata_piix
行 2349: [ 2.114703] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver pata_sis
行 2352: [ 2.114756] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver ata_generic
行 2358: [ 2.114853] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'mdio_bus': add driver Broadcom BCM84881
行 2366: [ 2.115247] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'virtio': add driver virtio_net
行 2377: [ 2.115465] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver dwc2
行 2384: [ 2.115526] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver ehci-pci
行 2388: [ 2.115600] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver ehci-platform
行 2394: [ 2.115652] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver ohci-pci
行 2398: [ 2.115691] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver ohci-platform
行 2402: [ 2.115765] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver uhci_hcd
行 2440: [ 2.132881] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pnp': add driver i8042 kbd
行 2442: [ 2.132925] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pnp': add driver i8042 aux
行 2446: [ 2.132982] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver i8042
行 2458: [ 2.135415] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'serio': add driver atkbd
行 2461: [ 2.135451] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'i2c': add driver elants_i2c
行 2466: [ 2.136518] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pnp': add driver rtc_cmos
行 2509: [ 2.139688] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver mt6323-pwrc
行 2513: [ 2.139722] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver poweroff-restart
行 2517: [ 2.139754] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver tps65086-restart
行 2554: [ 2.144580] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver intel_scu
行 2560: [ 2.144651] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver rproc-virtio
行 4164: [ 3.899638] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver charger-manager
行 4172: [ 3.899706] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver acpi-cpufreq
行 4179: [ 3.899765] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver pcc-cpufreq
行 5506: [ 4.999918] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver floppy
行 7250: [ 5.254145] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver pata_acpi
行 7760: [ 5.279796] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver e1000
行 8335: [ 5.305475] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver ahci
行 9562: [ 5.374956] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver mptspi
行 11238: [ 5.425274] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'serio': add driver psmouse
行 11247: [ 5.427417] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'usb': add driver usbhid
行 11468: [ 5.462425] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'hid': add driver hid-generic
行 14968: [ 8.408096] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'parport': add driver lp
行 15338: [ 8.427068] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'parport': add driver ppdev
行 15879: [ 8.449648] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver parport_pc
行 15882: [ 8.449764] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pnp': add driver parport_pc
行 15885: [ 8.451462] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver parport_pc
行 17133: [ 9.712975] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'serio': add driver serio_raw
行 19747: [10.025896] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver vmw_vmci
行 19752: [10.031504] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver piix4_smbus
行 24366: [10.418290] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver vmwgfx
行 32450: [12.286369] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'snd_seq': add driver snd_seq_midi
行 37707: [12.661877] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'pci': add driver snd_ens1371
行 39934: [12.826173] kernel: [drivers/base/bus.c bus_add_driver 648] bus: 'platform': add driver intel_rapl_msr
root@a:/home/a/linux-6.9.0# lspci,lspci这个命令可以查看PCI总线上挂了哪些设备(其中在02:01.0上挂的网卡 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01))
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:10.0 SCSI storage controller: Broadcom / LSI 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
02:00.0 USB controller: VMware USB1.1 UHCI Controller
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:02.0 Multimedia audio controller: Ensoniq ES1371/ES1373 / Creative Labs CT2518 (rev 02)
02:03.0 USB controller: VMware USB2 EHCI Controller
02:04.0 SATA controller: VMware SATA AHCI controller
从内核打印日志中可以找到总线挂载的位置,然后找到安装的驱动:
实际在收发以太层数据包也是可以看到的:
完整日志:
登录 - Gitee.comhttps://gitee.com/r77683962/linux-6.9.0-testlog/commit/4298a01610b18175feac1993fc7bd71a4173245a登录 - Gitee.comhttps://gitee.com/r77683962/linux-6.9.0-testlog/commit/e0c4f6d11e823f60327923eef86c9e9c8419b665
驱动层很多源代码采用如下宏打印日志,添加了打印文件,行,函数,不知道能不能把进程id也添加上:
有些驱动目录的源代码不是使用的这个打印宏,修改后的代码
(参考来源:include/linux/printk.h):
修改的源代码,这里碰到一个问题,这个问题改和测试花了一两天(主要是修改dev_printk.h或printk.h这类头文件修改,基本上要全量编译,涉及需要在头文件的函数中添加打印日志的一定要小心,现在一般看到头文件,手都不怎么敢碰键盘,不小心修改了文件,很耗时间,doge),现在能运行的内核是需要编译两次(也可能理解的不对),第一次编译会报链接错误,再编译一次就好了,而且这样编译的内核还可以启动,这。。。。:
include/linux/dev_printk.h · r77683962/linux-6.9.0 - Gitee.comhttps://gitee.com/r77683962/linux-6.9.0/blob/master/include/linux/dev_printk.h
感谢。
参考资料:
[转]pci设备学习笔记_pci init-CSDN博客
补充:
netdev_start_xmit到e1000_xmit_frame,应该是下边代码,不过从udp_send_skb到ip_send_skb再到netdev_start_xmit还没找到代码能衔接上,还在继续找。
【linux】内核源码TCP->IP->L2层函数调用继续摸索中-CSDN博客