detecting nic and ports on systems loaded with linux - linux

Is there a simple way to detect nic and associated ports on systems loaded with linux.
From my study on this, i found lshw -C network would help me to some extent, by giving details on ports and interfaces.
But i didn't get clear differentiation done with nic and associated ports.
Say if i have 2 nic cards with one 4 ports and other nic with 2 ports, how to i detect this information using lshw or any way!!.
lshw -C network ( only portion of the information pasted here)
Using lshw -C network, we can use the serial number for example:
*-network:0
description: Ethernet interface
product: 82575EB Gigabit Network Connection
vendor: Intel Corporation
physical id: 0
bus info: pci#0000:01:00.0
logical name: eth0
version: 02
serial: 00:14:4f:e7:40:e0
*-network:1
description: Ethernet interface
product: 82575EB Gigabit Network Connection
vendor: Intel Corporation
physical id: 0.1
bus info: pci#0000:01:00.1
logical name: eth1
version: 02
serial: 00:14:4f:e7:40:e1
*-network:0 DISABLED
description: Ethernet interface
product: 82571EB Gigabit Ethernet Controller (Copper)
vendor: Intel Corporation
physical id: 0
bus info: pci#0000:2b:00.0
logical name: eth6
version: 06
serial: 00:15:17:be:e6:75
*-network:1 DISABLED
description: Ethernet interface
product: 82571EB Gigabit Ethernet Controller (Copper)
vendor: Intel Corporation
physical id: 0.1
bus info: pci#0000:2b:00.1
logical name: eth4
version: 06
serial: 00:15:17:be:e6:74
serial number kind of helps, the first five tuples help me to distinguish the nics and the last tuple in the serial number seems to be in sequence when in comes to different ports on given nic.
-Thanks
Harish

I'm not entirely sure what information you want to know. I'm guessing you want to know which ethernet interfaces are on the same board. One quick way to detect is via the sysfs directory which contains information about devices and drivers. This information can also be correlated to lspci.
Example:
find /sys/devices/ -type d | grep eth
Which outputs data on my system in the format of:
/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0
Where pci0000:00 is the bus, and the last number is the card (0000:02:00.0).
Then if I run lspci I can look up the card identifier to get more information
lspci | grep 02:00
Nets me:
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02)
On your system, you should have multiple eth* mapped to each card. This should tell you the mapping of which eth to which card and more information about each specific card.

Related

is lspci command return memory mapped io locations of registers from /sys/bus/pci/device/***

I have intel system. running linux. On my system when I run sudo lspci -v command it gives me something like this for wireless network card
In the image it says for wireless network card something like this Memory at c0700000 (64-bit, non-prefetchable) [size=8K]
I want to know is this the memory location for Memory-Mapped-IO for pci wireless network card?
and the lines afterwards says something like Capabilities: [c8] Power Management version 3
and Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit. Can any one please tell is c8 and d0 respectively are the offset address values from base value of c0700000 (from above) for setting these capabilities to wireless network card. I have pci based wireless in my laptop.

Connect two extra monitors to laptop

I have following models of graphics card in my DELL Inspiron 5520 15R:
lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series] (rev ff)
Laptop has one HDMI port and one VGA port. When I try to connect two external monitors on each of these ports, I can only use one at a time.
Is there anyway to use two external screens at the same time given the configurations I mentioned above?
There is a limitation with laptops that by default you can only use one extra display at a time, reason being the graphic adapter. So to run more than 2 displays you will need a little extra hardware. You can have a look at this youtube video.

Understanding segment group, bus, device and function numbers from SMBIOS

Objective
I'm trying to programmatically find out on which physical slot a particular PCIe device is connected. The premise is that I have the PCI-ID of a card that is surely occupying a slot, and the solution would be finding out which one.
Note that I'm only interested in working on the PCI Express bus, although the device identification/enumeration process I think is the same as the old PCI.
Attempt
The SMBIOS contains information about the motherboard slots available. It is possible to examine this information from the linux command line:
$ sudo dmidecode -t slot
# dmidecode 2.11
SMBIOS 2.7 present.
Handle 0x003A, DMI type 9, 17 bytes
System Slot Information
Designation: PCIEX16_1
Type: x16 PCI Express x16
Current Usage: In Use
Length: Short
ID: 1
Characteristics:
3.3 V is provided
Opening is shared
PME signal is supported
Bus Address: 0000:03:02.0
Handle 0x003B, DMI type 9, 17 bytes
System Slot Information
Designation: PCIEX16_2
Type: x8 PCI Express x8
Current Usage: In Use
Length: Short
ID: 2
Characteristics:
3.3 V is provided
Opening is shared
PME signal is supported
Bus Address: 0000:04:02.2
Handle 0x003C, DMI type 9, 17 bytes
System Slot Information
Designation: PCIEX16_3
Type: x16 PCI Express x16
Current Usage: In Use
Length: Short
ID: 3
Characteristics:
3.3 V is provided
Opening is shared
PME signal is supported
Bus Address: 0000:05:03.0
However, I can't find any device in the PCI bus (lspci) that has a PCI ID of 0000:03:02.0, 0000:04:02.2 or 0000:05:03.0. What I know by manual inspection is the following:
Card 0000:03:00.0 is in the first slot. The PCI bridge appears to be 0000:00:02.0
Card 0000:04:00.0 is in the second slot. The PCI bridge appears to be 0000:00:02.2
Card 0000:05:00.0 is in the third slot. The PCI bridge appears to be 0000:00:03.0
So a pattern emerges here. From the SMBIOS structure, the bus number is the one given to the card that is plugged in but the device/function numbers are the same as the corresponding PCI bridge.
Is this pattern just a coincidence in my motherboard or there is a rationale behind? It is an Asus motherboard, with an AMI BIOS. I've read that some BIOSes do not provide accurate information about their slots so I would like to know how much generality I can achieve.
Any hint or pointer to reference documentation is also greatly appreciated.
You may find the lspci command helpful. Here's a sample output:
# lspci -v -t
-[0000:00]-+-00.0 Intel Corporation 5500 I/O Hub to ESI Port
+-01.0-[01]--+-00.0 Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
| \-00.1 Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
+-03.0-[02]--+-00.0 Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
| \-00.1 Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
+-07.0-[04]----00.0 LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator]
+-09.0-[05]----00.0 LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator]
+-14.0 Intel Corporation 7500/5520/5500/X58 I/O Hub System Management Registers
+-14.1 Intel Corporation 7500/5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers
+-14.2 Intel Corporation 7500/5520/5500/X58 I/O Hub Control Status and RAS Registers
+-1a.0 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4
+-1a.1 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5
+-1a.7 Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2
+-1c.0-[03]----00.0 LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator]
+-1d.0 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1
+-1d.1 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2
+-1d.7 Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1
+-1e.0-[06]----03.0 Matrox Electronics Systems Ltd. MGA G200eW WPCM450
+-1f.0 Intel Corporation 82801IB (ICH9) LPC Interface Controller
\-1f.2 Intel Corporation 82801IB (ICH9) 2 port SATA Controller [IDE mode]

Finding Memory Address of a Parallel Port on Linux

I'm trying to find the base (memory) address of a parallel port I have connected to my laptop via a PCI express card. Running lspci -v shows that my computer recognizes the parallel port and gives the I/O ports (1000 and 1008) but not the memory address (other entries have both ports and memory locations…this card is the only entry without a memory address). Also, when I look in /proc/ioports I get the same ports given in lspci. However, when I try to use either of those addresses in the program I'm running (EMC2 to control stepper motors), it does not find a parallel port at that address.
What would be really great is if there were an analogue to the Windows Device Manager -> Ports -> Resources. Is there any way to do this in Ubuntu? Is there a standard memory location for PCIe devices?
Edit:
The output from lspci -v
04:00.0 Parallel controller: Oxford Semiconductor Ltd Device c110 (prog-if 02)
Subsystem: Oxford Semiconductor Ltd Device c110
Flags: bus master, fast devsel, latency 0, IRQ 18
I/O ports at 1000 [size=8]
I/O ports at 1008 [size=4]
Capabilities: [40] Power Management version 3
Capabilities: [50] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-
Capabilities: [70] Express Legacy Endpoint, MSI 00
Capabilities: [100] Device Serial Number 10-01-00-11-11-e0-30-00
Capabilities: [110] Power Budgeting <?>
Kernel driver in use: parport_pc
Kernel modules: parport_pc
And for reference, another entry that shows the memory location:
0c:03.0 FireWire (IEEE 1394): Agere Systems FW322/323 (rev 61) (prog-if 10)
Subsystem: Agere Systems FW322/323
Flags: bus master, fast Back2Back, medium devsel, latency 248, IRQ 19
Memory at 8c000000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [44] Power Management version 2
Kernel driver in use: ohci1394
Kernel modules: firewire-ohci, ohci1394
Try cat /proc/ioports | grep parport to filter the output of ioports.
Quick answer: there is no memory location for the parallel port. Parallel ports only ever have IO ports allocated to them. This is the way parallel port interfaces have worked for decades, and nobody has felt the need to make an incompatible memory mapped interface that would need special drivers.
Now I must ask, why are you intent on finding the port's memory location? What do you want to do with it?

Whats the command to find Nic cards serial numbers in linux?

Whats the command to find Nic cards serial numbers in linux ? I tried dmidecode options and lshow
may be I missed some thing
I'm not sure about serial numbers, but lspci gives me the following information about my ethernet card:
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
If you haven't mucked with your MAC address since bootup, it will be globally unique. See http://www.coffer.com/mac_info/locate-unix.html
NICs aren't required to have any other serial number than that, and if they do it might not be electronically readable.
Use "ifconfig" to get each ports globally unique MAC Addresses
ifconfig -a
For all adapters

Resources