PCIe with lspci

本文详细介绍了如何使用lspci工具查看PCIe设备的配置信息,包括宽度、速度、最大读取请求等参数,并提供了计算PCIe最大带宽的方法及示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PCIe with lspci

PCIe Width

# lspci -s 81:00.0 -vvv | grep Width
                LnkCap: Port #0, Speed 8GT/s, Width x16, ASPM not supported, Exit Latency L0s unlimited, L1 unlimited
                LnkSta: Speed 8GT/s, Width x16, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-

PCIe Speed

# lspci -s 81:00.0 -vvv | grep Speed
                LnkCap: Port #0, Speed 8GT/s, Width x16, ASPM not supported, Exit Latency L0s unlimited, L1 unlimited
                LnkSta: Speed 8GT/s, Width x16, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-

# lspci -s 81:00.0 -vvv | grep PCIeGen
                        [V0] Vendor specific: PCIeGen3 x16

PCIe Max Payload Size

# lspci -s 81:00.0 -vvv | grep DevCtl: -C 2
                DevCap: MaxPayload 512 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset+ SlotPowerLimit 0.000W
                DevCtl: Report errors: Correctable- Non-Fatal+ Fatal+ Unsupported-
                        RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop- FLReset-
                        MaxPayload 256 bytes, MaxReadReq 4096 bytes

PCIe Max Read Request

# lspci -s 81:00.0 -vvv | grep MaxReadReq
                        MaxPayload 256 bytes, MaxReadReq 1024 bytes

修改PCIe Max Read Request

lspci -s <NIC PCI address> -vvv | grep MaxReadReq
setpci -s <NIC PCI address> 68.w
setpci -s <NIC PCI address> 68.w=3XXX

0 - 128B, 1 - 256B, 2 - 512B, 3 - 1024B, 4 - 2048B and 5 - 4096B.

Maximum PCIe Bandwidth

PCIe 最大带宽计算公式:

Maximum PCIe Bandwidth = SPEED * WIDTH * (1 - ENCODING) - 1Gb/s.

PCIe-Gen3 x8 带宽

Maximum PCIe Bandwidth = 8G * 8 * (1 - 2/130) - 1G = 64G * 0.985 - 1G = ~62Gb/s.

PCIe-Gen2 x16 带宽

Maximum PCIe Bandwidth = 5G * 16 * (1 - 1/5) - 1G = 80G * 0.8 - 1G = ~63Gb/s.
### Linux PCIe Configuration and Troubleshooting #### Understanding PCIe Interface Configuration in Linux In Linux systems, configuring the Peripheral Component Interconnect Express (PCIe) interface involves several key aspects including device enumeration, parameter specification, and driver interaction. For NVIDIA ConnectX-5 and newer devices, when enabling the PCIe switch functionality, specific parameters like `Depth`, `pcie_index`, and `node` must be set to identify which PCIe port should gather requested data such as performance counters or signal quality metrics[^1]. #### Configuring PCIe Switch Parameters To configure these settings within a Linux environment: ```bash echo "depth=2 pcie_index=3 node=4" | sudo tee /sys/class/infiniband/mlx5_0/device/config ``` The above command sets up the necessary parameters for accessing detailed hardware statistics through the specified PCIe path. #### Handling Device Drivers and BIOS Settings Certain motherboard configurations may require adjustments at the Basic Input Output System (BIOS) level before proper operation of network interfaces under Linux. Enabling options related to onboard peripherals might reactivate components disabled during operating system shutdown processes. This has been observed particularly with certain models from manufacturers like GIGABYTE using older firmware versions[^2]. However, this behavior varies between different motherboards and their respective BIOS implementations. #### Addressing Unsupported Hardware Issues Some peripheral types remain unsupported directly by mainstream kernels due to lack of official drivers or community support. Devices falling into this category often include specialized USB controllers among others mentioned briefly without elaboration here[^3]. Users encountering issues with unlisted equipment will need alternative solutions ranging from custom-built modules to third-party software packages depending upon availability. #### Common Diagnostic Commands When facing potential problems associated with PCI express slots or connected gadgets, executing diagnostic commands provides valuable insights towards resolution strategies: ```bash lspci -vnn dmesg | grep pci journalctl -k | grep -i error ``` These utilities help pinpoint misconfigurations or conflicts affecting overall stability while offering clues about underlying causes requiring attention.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值