我有一张 Intel 82599ES 双 10Gbit 卡,与带有内核 5.11.0-34-generic 的 Linux Mint 20.2 一起使用。我正在尝试使用“setpci”命令将 MaxReadRequest 的值从 512 字节设置为最大 2048 字节。这是 lspci 输出:
04:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
Subsystem: Intel Corporation Ethernet Server Adapter X520-2
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin B routed to IRQ 34
Region 0: Memory at e0300000 (64-bit, prefetchable) [size=512K]
Region 2: I/O ports at d000 [disabled] [size=32]
Region 4: Memory at e0400000 (64-bit, prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME-
Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
Address: 0000000000000000 Data: 0000
Masking: 00000000 Pending: 00000000
Capabilities: [70] MSI-X: Enable+ Count=64 Masked-
Vector table: BAR=4 offset=00000000
PBA: BAR=4 offset=00002000
Capabilities: [a0] Express (v2) Endpoint, MSI 00
DevCap: MaxPayload 512 bytes, PhantFunc 0, Latency L0s <512ns, L1 <64us
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset+ SlotPowerLimit 0.000W
DevCtl: CorrErr+ NonFatalErr+ FatalErr+ UnsupReq+
RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ FLReset-
MaxPayload 256 bytes, **MaxReadReq 512 bytes**
DevSta: CorrErr+ NonFatalErr- FatalErr- UnsupReq+ AuxPwr- TransPend-
LnkCap: Port #0, Speed 5GT/s, Width x8, ASPM L0s, Exit Latency L0s <1us
ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 5GT/s (ok), Width x8 (ok)
TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, NROPrPrP-, LTR-
10BitTagComp-, 10BitTagReq-, OBFF Not Supported, ExtFmt-, EETLPPrefix-
EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
FRS-, TPHComp-, ExtTPHComp-
AtomicOpsCap: 32bit- 64bit- 128bitCAS-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
AtomicOpsCtl: ReqEn-
LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
使用英特尔数据表 82599,它说设备控制寄存器控制MaxReadReq 位于字节偏移 0xA8, 具体来说:
这是 82599ES 的十六进制空间:
sudo lspci -xxx -s 04:00.1
04:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
00: 86 80 fb 10 06 04 10 00 01 00 00 02 10 00 80 00
10: 0c 00 30 e0 00 00 00 00 01 d0 00 00 00 00 00 00
20: 0c 00 40 e0 00 00 00 00 00 00 00 00 86 80 03 00
30: 00 00 00 00 40 00 00 00 00 00 00 00 ff 02 00 00
40: 01 50 23 48 00 20 00 2b 00 00 00 00 00 00 00 00
50: 05 70 80 01 00 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
70: 11 a0 3f 80 04 00 00 00 04 20 00 00 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 10 00 02 00 c2 8c 00 10 3f 28 09 00 82 c4 01 00
b0: 40 00 82 10 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 1f 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
我从 Mellanox 找到了一个例子了解 PCIe 配置以获得最佳性能但使用他们正在使用的 setpci 命令似乎没有做任何事情......可能是因为我更改了错误的寄存器位置。我仍在努力了解如何理解位 14:12 处的“字节偏移 0xA8”并将其转录为 setpci 可以理解的内容......
问题: 使用“setpci”命令,如何找出 0xA8 位 14:12 是什么,并将其值更改为“100b”以将 MaxReadReq 从 512 字节更改为 2048 字节?非常感谢任何帮助!
答案1
setpci -s 04:00.1 a8.w
将输出设备控制寄存器的值。
-s 04:00.1
是设备规格,如问题所示。a8
是设备控制寄存器的地址,如问题所示。.w
指定您正在访问一个两字节(w序)注册。
请参阅设置pci(8)手册页以获取更多信息。
如您所知,位 12-14 将表示对数映射中的最大读取请求大小。如 82599 的英特尔数据表(问题中引用)所示,
- 0xxx → 128
- 1xxx → 256
- 2xxx → 512
- 3xxx → 1024
- 4xxx → 2048
无论适配器为最后 3 位返回什么值,更改第一位数字并使用语法设置新值。例如,如果适配器返回name=value
283f,并且您想将其设置为2048字节,那么您将值更改为483f。
setpci -s 04:00.1 a8.w=483f
通过在没有值的情况下重新发出来再次尝试读取来检查它是否获取了您的值:
setpci -s 04:00.1 a8.w
它应该返回您输入的值。
关闭电源并重新启动以激活。