PCI Link Speed와 이더넷 카드

1.
zeroserver를 공급할 때 OS 설치 및 튜닝을 의뢰받아 작업을 합니다. 서버를 공급할 때 서버에 설치한 부품이 공급한 제품과 견적이 같음을 보여주기 위하여 lspci결과값을 보내드립니다. 네트워크 카드가 중요하기 때문입니다. 또한 마더보드별로 지원하는 PCIe 슬롯의 사양과 숫자가 다릅니다. 이더넷 카드를 한장이 아니라 여러장을 설치하여야 할 경우 성능을 고려하지 않을 수 없습니다.

먼저 PCI와 PCIe의 차이를 살펴보았습니다 아래 그림으로 보면 직관적으로 이해할 수 있습니다.

lspci를 이용하여 어떤 환경인지 알아보죠. 제가 사용하는 데스크탑에서 실행한 결과입니다.

Intel PCIe 카드와 온보드 포트가 있습니다. 여기서 한걸음 더 나아가서 vv옵션을 주면 좀더 상세한 결과를 얻을 수 있습니다.

같은 결과이지만 다른 형식으로 볼 수 있습니다.pci rnwh

위에서 사용한 옵션에 대한 설명입니다.

-t Display output as a tree diagram.will have a physical x16 slot, but only use x8 lanes.
-v Display a verbose version of the output.
-vv Display a very verbose version of the output.
-vvv Display all available information in the output.

위 장치앞에 숫자가 있습니다. PCI Numbering이라고 하네요. 숫자의 의미는 이렇습니다.

PCI 버스(Bus):컴퓨터 내에서 PCI 장치들이 통신하는 경로입니다. 각 버스는 고유한 번호를 가지며, 여러 개의 장치가 연결될 수 있습니다.
PCI 장치 번호(Device):각 버스 내에서 장치들을 구분하는 번호입니다. 하나의 버스에는 여러 개의 장치가 연결될 수 있으며, 각 장치는 고유한 장치 번호를 갖습니다.
PCI 기능 번호(Function):일부 PCI 장치는 여러 개의 기능을 가지고 있을 수 있습니다. 이 경우 각 기능은 고유한 기능 번호로 식별됩니다.
PCI 장치 ID:PCI 장치 ID는 제조사 ID(Vendor ID)와 장치 ID(Device ID)를 조합하여 구성됩니다. 이를 통해 운영체제나 드라이버는 특정 장치를 정확하게 식별하고 해당 드라이버를 로드할 수 있습니다.

  • Bus Number: The Bus Number is used to identify the PCIe switch to which the endpoint is connected. It allows the CPU to route the communication to the correct switch.
  • Device Number: The Device Number is used to identify the specific endpoint within the PCIe switch. It allows the CPU to select the desired endpoint connected to a particular switch.
  • Function Number: The Function Number is used to identify a specific function or capability within the endpoint device. For devices that have multiple functions, such as multi-function network cards, this number allows the CPU to choose the desired function.

Intel Corporation Ethernet Controller 10-Gigabit X540-AT2와 관련한 숫자를 보면 아래와 같습니다.

-[0000:00]-+-00.0 Intel Corporation 2nd Generation Core Processor Family DRAM Controller
+-1c.0-[02]–+-00.0 Intel Corporation Ethernet Controller 10-Gigabit X540-AT2
| \-00.1 Intel Corporation Ethernet Controller 10-Gigabit X540-AT2

두가지 숫자가 나옵니다. 0000:00:1c.0과 이에 연결한 네트워크 카드 0000:02:00, 0.0000:02will have a physical x16 slot, but only use x8 lanes.:00.1입니다. 0000:00:1c.0이 무엇인지 확인해보면 PCI Express Root입니다. PCI Express Root Port를 줄여서 Root Port라고 불리웁니다.

smallake@elementaryOS:/media/smallake/Data/Warez$ lspci -s 00:1c.0
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)

컴퓨터에서 PCI 구조를 그림으로 표시하면 아래와 같습니다.

이중에서 Root Complex는 프로세서를 PCIe 서브시스템과 연결합니다. Root Complex에는 PCIe 디바이스를 연결할 수 있게 포트 (혹은 슬롯)가 있습니다. 루트 컴플렉스의 포트는 루트 포트 (Root Port)라고 부릅니다. 좀더 자세히 그림으로 표현하면 아래입니다.

제 컴퓨터 정보를 위 그림으로 이해하면 Root Complex는 아래와 같은 구성입니다.

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 82801 PCI Bridge (rev b5)
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b5)
00:1c.6 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 7 (rev b5)
00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 8 (rev b5)

이중에서

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)

이 Root Port역할인 듯 합니다.

좀더 자세한 설명은 An Introduction to PCI ExpressHow modern multi-processor multi-Root Complex system assigns PCI bus number을 참고하세요.

2.
이제 PCI와 관련한 자료를 찾아본 이유입니다. 앞서 이더넷카드와 관련한 정보를 lspci로 알아보았습니다. 이용자 권한으로 실행한 결과입니다.

관리자권한으로 실행하면 좀더 자세한 정보가 나옵니다.

두번째 결과중 Link와 관련한 항목이 있습니다.

LnkCap (Link Capability Register): Maximum link Speed와 Width 정보 및 전력관리 등
LnkSta (Link Status Register): 현재 Link Speed와 Width 정보 및 전력
LnkCtl (Link Control Register): Link 설정

데스크탑의 LnkCap과 LnkSta를 비교하면 동일합니다.

LnkCap: Port #1, Speed 5GT/s, Width x2
LnkSta: Speed 5GT/s (ok), Width x2 (ok)

만약 LnkSta Width가 LnkCap의 Width에 비해 낮을 때 downgraded라는 표시가 달립니다.

If LnkSta (Link Status) is less than LnkCap (Link Capability), it will display (downgraded) next to the Width. This means that the PCI card is capable of more than what the PCI slot can provide.

Width를 표시할 때 x(숫자)로 합니다. x2라고 하면 Lane을 둘 사용한다는 뜻입니다. 그러면 Lane이 무엇일까요? 아래 그림입니다.

PCIe 버전에 따른 레인(Lane)별 속도는 아래와 같습니다.

이제 숫자에 관심을 가져보죠. PCI Link Speed를 나타내는 숫자를 보면 ‘Speed 5GT/s’입니다. GT입니다. 흔히 네트워크 속도를 표시할 때 사용하는 Gigabit=Gb를 사용하는데 PCI Link Speed는 GT입니다. GT는 Gigatransfers Per Second입니다. GT숫자는 하나의 Lane 속도입니다. GT와 GB는 무슨 관계가 있을까요? Gbps와 GT/s는 모두 데이터 전송 속도를 나타내는 단위이지만, 의미하는 바가 다릅니다. GBps는 초당 기가바이트, 즉 데이터 전송 속도를 의미하며, GT/s는 초당 기가 전송 횟수를 의미합니다. 따라서 직접적인 변환할 수 없지만 추정을 합니다. Why does it say 8GB/s per lane in PCI Express 3.0?에 있는 설명입니다.

3.
이제 이더넷 카드의 성능을 PCIe의 관점으로 살펴보죠. 먼저 IPMI와 Bios 설정에서 소개하였던 Debugging PCIe Issues using lspci and setpci을 읽으면 좋을 듯 합니다.

PCIe를 중심으로 설명한 글은 Understanding PCIe Configuration for Maximum Performance입니다. 앞서 설명한 내용를 간명하게 정리하고 있습니다.

성능을 말할 때 Latency와 Throughput을 이야기합니다. PCIe는 Latency보다 Throughput과 관련이 있습니다.

PCIe is optimized for throughput not for latency.

Leave a Comment

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

이 사이트는 Akismet을 사용하여 스팸을 줄입니다. 댓글 데이터가 어떻게 처리되는지 알아보세요.