How to see which NIC is installed in which PCI slot by script ?

Sergei_Shablovsky

Member

Reaction score: 10
Messages: 89

Hi, FreeBSD guru!

Is it possible at all to see which NIC is installed in which PCI slot by script ?

As I know this may be something near the dmidecode and pciconf commands.
But interesting to determine which exactly motherboard PCI slot are used for which NIC.

I know that different motherboard manufacturer using different way to numbering PCI slots in BIOS, ordinary SOHO motherboards may have no any painted marks on a PCB, but anyway, let's say the printed marks on a PCB near each PCI slot exist and we able to determine that 'VX900 PCI Express Root Port 3' mean "PCI slot 3"....

And another small sub-question, how to see UUID or S/N or installed PCI NIC card?

Your help appreciated!
 

gpw928

Aspiring Daemon

Reaction score: 270
Messages: 596

I'm certainly no expert, but had a quick look at the options.

For example, my ZFS server has 6 Ethernet ports:
  1. one (Realtek) is on-board (PCI 3);
  2. one is a single port Intel PCI bus card (PCI 7); and
  3. one is a quad port Intel PCI bus card (PCI 11 and 12).
I got the mappings to the NIC names from dmesg, generally the contents of /var/run/dmesg.boot:
Code:
[sherman.178] $ dmesg | egrep "Intel.*Network|Gigabit Ethernet"
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0xc000-0xc0ff mem 0xd0004000-0xd0004fff,0xd0000000-0xd0003fff irq 44 at device 0.0 on pci3
em0: <Intel(R) PRO/1000 Network Connection> port 0xa000-0xa01f mem 0xfe5c0000-0xfe5dffff,0xfe500000-0xfe57ffff,0xfe5e0000-0xfe5e3fff irq 48 at device 0.0 on pci7
em1: <Intel(R) PRO/1000 Network Connection> port 0x9020-0x903f mem 0xfe4a0000-0xfe4bffff,0xfe480000-0xfe49ffff irq 21 at device 0.0 on pci11
em2: <Intel(R) PRO/1000 Network Connection> port 0x9000-0x901f mem 0xfe440000-0xfe45ffff,0xfe420000-0xfe43ffff irq 20 at device 0.1 on pci11
em3: <Intel(R) PRO/1000 Network Connection> port 0x8020-0x803f mem 0xfe3a0000-0xfe3bffff,0xfe380000-0xfe39ffff irq 22 at device 0.0 on pci12
em4: <Intel(R) PRO/1000 Network Connection> port 0x8000-0x801f mem 0xfe340000-0xfe35ffff,0xfe320000-0xfe33ffff irq 21 at device 0.1 on pci12
There's more information available from lspci (note PCI numbers change to hex):
Code:
[sherman.166] $ 
sudo lspci
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD9x0/RX980 Host Bridge (rev 02)
00:02.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GFX port 0)
00:03.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0 PCI to PCI bridge (PCI Express GFX port 1)
00:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 0)
00:05.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 1)
00:06.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 2)
00:07.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 3)
00:09.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 4)
00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] (rev 40)
00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller (rev 42)
00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC host controller (rev 40)
00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge (rev 40)
00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
00:15.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB700/SB800/SB900 PCI to PCI bridge (PCIE port 0)
00:16.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:16.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] R480 [Radeon X850 XT]
01:00.1 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] R480 [Radeon X850 XT] (Secondary)
02:00.0 Serial Attached SCSI controller: Broadcom / LSI SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 09)
04:00.0 USB controller: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller
05:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 01)
06:00.0 USB controller: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller
07:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
09:00.0 PCI bridge: Microsemi / PMC / IDT PES12N3A 12-lane 3-Port PCI Express Switch (rev 04)
0a:00.0 PCI bridge: Microsemi / PMC / IDT PES12N3A 12-lane 3-Port PCI Express Switch (rev 04)
0a:01.0 PCI bridge: Microsemi / PMC / IDT PES12N3A 12-lane 3-Port PCI Express Switch (rev 04)
0b:00.0 Ethernet controller: Intel Corporation 82571EB/82571GB Gigabit Ethernet Controller (Copper) (rev 06)
0b:00.1 Ethernet controller: Intel Corporation 82571EB/82571GB Gigabit Ethernet Controller (Copper) (rev 06)
0c:00.0 Ethernet controller: Intel Corporation 82571EB/82571GB Gigabit Ethernet Controller (Copper) (rev 06)
0c:00.1 Ethernet controller: Intel Corporation 82571EB/82571GB Gigabit Ethernet Controller (Copper) (rev 06)
All the buses, bridges, devices and connections between them are shown here:
Code:
[sherman.129] $ sudo lspci -mm -t
-[0000:00]-+-00.0
           +-02.0-[01]--+-00.0
           |            \-00.1
           +-03.0-[02]----00.0
           +-04.0-[03]----00.0
           +-05.0-[04]----00.0
           +-06.0-[05]----00.0
           +-07.0-[06]----00.0
           +-09.0-[07]----00.0
           +-11.0
           +-12.0
           +-12.2
           +-13.0
           +-13.2
           +-14.0
           +-14.2
           +-14.3
           +-14.4-[08]--
           +-14.5
           +-15.0-[09-0c]----00.0-[0a-0c]--+-00.0-[0b]--+-00.0
           |                               |            \-00.1
           |                               \-01.0-[0c]--+-00.0
           |                                            \-00.1
           +-16.0
           +-16.2
           +-18.0
           +-18.1
           +-18.2
           +-18.3
           +-18.4
           \-18.5
I have not found a unique way to identify the individual NICs.
 
Top