요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
==============================
The QorIQ DPAA Ethernet Driver
==============================
Authors:
- Madalin Bucur <madalin.bucur@nxp.com>
- Camelia Groza <camelia.groza@nxp.com>
.. Contents
- DPAA Ethernet Overview
- DPAA Ethernet Supported SoCs
- Configuring DPAA Ethernet in your kernel
- DPAA Ethernet Frame Processing
- DPAA Ethernet Features
- DPAA IRQ Affinity and Receive Side Scaling
- Debugging
DPAA Ethernet Overview
======================
DPAA stands for Data Path Acceleration Architecture and it is a
set of networking acceleration IPs that are available on several
generations of SoCs, both on PowerPC and ARM64.
The Freescale DPAA architecture consists of a series of hardware blocks
that support Ethernet connectivity. The Ethernet driver depends upon the
following drivers in the Linux kernel:
- Peripheral Access Memory Unit (PAMU) (* needed only for PPC platforms)
drivers/iommu/fsl_*
- Frame Manager (FMan)
drivers/net/ethernet/freescale/fman
- Queue Manager (QMan), Buffer Manager (BMan)
drivers/soc/fsl/qbman
A simplified view of the dpaa_eth interfaces mapped to FMan MACs::
dpaa_eth /eth0\ ... /ethN\
driver | | | |
------------- ---- ----------- ---- -------------
-Ports / Tx Rx \ ... / Tx Rx \
FMan | | | |
-MACs | MAC0 | | MACN |
/ dtsec0 \ ... / dtsecN \ (or tgec)
/ \ / \(or memac)
--------- -------------- --- -------------- ---------
FMan, FMan Port, FMan SP, FMan MURAM drivers
---------------------------------------------------------
FMan HW blocks: MURAM, MACs, Ports, SP
---------------------------------------------------------
The dpaa_eth relation to the QMan, BMan and FMan::
________________________________
dpaa_eth / eth0 \
driver / \
--------- -^- -^- -^- --- ---------
QMan driver / \ / \ / \ \ / | BMan |
|Rx | |Rx | |Tx | |Tx | | driver |
--------- |Dfl| |Err| |Cnf| |FQs| | |
QMan HW |FQ | |FQ | |FQs| | | | |
/ \ / \ / \ \ / | |
--------- --- --- --- -v- ---------
| FMan QMI | |
| FMan HW FMan BMI | BMan HW |
----------------------- --------
where the acronyms used above (and in the code) are:
=============== ===========================================================
DPAA Data Path Acceleration Architecture
FMan DPAA Frame Manager
QMan DPAA Queue Manager
BMan DPAA Buffers Manager
QMI QMan interface in FMan
BMI BMan interface in FMan
FMan SP FMan Storage Profiles
MURAM Multi-user RAM in FMan
FQ QMan Frame Queue
Rx Dfl FQ default reception FQ
Rx Err FQ Rx error frames FQ
Tx Cnf FQ Tx confirmation FQs
Tx FQs transmission frame queues
dtsec datapath three speed Ethernet controller (10/100/1000 Mbps)
tgec ten gigabit Ethernet controller (10 Gbps)
memac multirate Ethernet MAC (10/100/1000/10000)
=============== ===========================================================
DPAA Ethernet Supported SoCs
============================
The DPAA drivers enable the Ethernet controllers present on the following SoCs:
PPC
- P1023
- P2041
- P3041
- P4080
- P5020
- P5040
- T1023
- T1024
- T1040
- T1042
- T2080
- T4240
- B4860
ARM
- LS1043A
- LS1046A
Configuring DPAA Ethernet in your kernel
========================================
To enable the DPAA Ethernet driver, the following Kconfig options are required::
# common for arch/arm64 and arch/powerpc platforms
CONFIG_FSL_DPAA=y
CONFIG_FSL_FMAN=y
CONFIG_FSL_DPAA_ETH=y
CONFIG_FSL_XGMAC_MDIO=y
# for arch/powerpc only
CONFIG_FSL_PAMU=y
# common options needed for the PHYs used on the RDBs
CONFIG_VITESSE_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_AQUANTIA_PHY=y
DPAA Ethernet Frame Processing
==============================
On Rx, buffers for the incoming frames are retrieved from the buffers found
in the dedicated interface buffer pool. The driver initializes and seeds these
with one page buffers.
On Tx, all transmitted frames are returned to the driver through Tx
confirmation frame queues. The driver is then responsible for freeing the
buffers. In order to do this properly, a backpointer is added to the buffer
before transmission that points to the skb. When the buffer returns to the
driver on a confirmation FQ, the skb can be correctly consumed.
DPAA Ethernet Features
======================
Currently the DPAA Ethernet driver enables the basic features required for
a Linux Ethernet driver. The support for advanced features will be added
gradually.
The driver has Rx and Tx checksum offloading for UDP and TCP. Currently the Rx
checksum offload feature is enabled by default and cannot be controlled through
ethtool. Also, rx-flow-hash and rx-hashing was added. The addition of RSS
provides a big performance boost for the forwarding scenarios, allowing
different traffic flows received by one interface to be processed by different
CPUs in parallel.
The driver has support for multiple prioritized Tx traffic classes. Priorities
range from 0 (lowest) to 3 (highest). These are mapped to HW workqueues with
strict priority levels. Each traffic class contains NR_CPU TX queues. By
default, only one traffic class is enabled and the lowest priority Tx queues
are used. Higher priority traffic classes can be enabled with the mqprio
qdisc. For example, all four traffic classes are enabled on an interface with
the following command. Furthermore, skb priority levels are mapped to traffic
classes as follows:
* priorities 0 to 3 - traffic class 0 (low priority)
* priorities 4 to 7 - traffic class 1 (medium-low priority)
* priorities 8 to 11 - traffic class 2 (medium-high priority)
* priorities 12 to 15 - traffic class 3 (high priority)
::
tc qdisc add dev <int> root handle 1: \
mqprio num_tc 4 map 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 hw 1
DPAA IRQ Affinity and Receive Side Scaling
==========================================
Traffic coming on the DPAA Rx queues or on the DPAA Tx confirmation
queues is seen by the CPU as ingress traffic on a certain portal.
The DPAA QMan portal interrupts are affined each to a certain CPU.
The same portal interrupt services all the QMan portal consumers.
By default the DPAA Ethernet driver enables RSS, making use of the
DPAA FMan Parser and Keygen blocks to distribute traffic on 128
hardware frame queues using a hash on IP v4/v6 source and destination
and L4 source and destination ports, in present in the received frame.
When RSS is disabled, all traffic received by a certain interface is
received on the default Rx frame queue. The default DPAA Rx frame
queues are configured to put the received traffic into a pool channel
that allows any available CPU portal to dequeue the ingress traffic.
The default frame queues have the HOLDACTIVE option set, ensuring that
traffic bursts from a certain queue are serviced by the same CPU.
This ensures a very low rate of frame reordering. A drawback of this
is that only one CPU at a time can service the traffic received by a
certain interface when RSS is not enabled.
To implement RSS, the DPAA Ethernet driver allocates an extra set of
128 Rx frame queues that are configured to dedicated channels, in a
round-robin manner. The mapping of the frame queues to CPUs is now
hardcoded, there is no indirection table to move traffic for a certain
FQ (hash result) to another CPU. The ingress traffic arriving on one
of these frame queues will arrive at the same portal and will always
be processed by the same CPU. This ensures intra-flow order preservation
and workload distribution for multiple traffic flows.
RSS can be turned off for a certain interface using ethtool, i.e.::
# ethtool -N fm1-mac9 rx-flow-hash tcp4 ""
To turn it back on, one needs to set rx-flow-hash for tcp4/6 or udp4/6::
# ethtool -N fm1-mac9 rx-flow-hash udp4 sfdn
There is no independent control for individual protocols, any command
run for one of tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 is
going to control the rx-flow-hashing for all protocols on that interface.
Besides using the FMan Keygen computed hash for spreading traffic on the
128 Rx FQs, the DPAA Ethernet driver also sets the skb hash value when
the NETIF_F_RXHASH feature is on (active by default). This can be turned
on or off through ethtool, i.e.::
# ethtool -K fm1-mac9 rx-hashing off
# ethtool -k fm1-mac9 | grep hash
receive-hashing: off
# ethtool -K fm1-mac9 rx-hashing on
Actual changes:
receive-hashing: on
# ethtool -k fm1-mac9 | grep hash
receive-hashing: on
Please note that Rx hashing depends upon the rx-flow-hashing being on
for that interface - turning off rx-flow-hashing will also disable the
rx-hashing (without ethtool reporting it as off as that depends on the
NETIF_F_RXHASH feature flag).
Debugging
=========
The following statistics are exported for each interface through ethtool:
- interrupt count per CPU
- Rx packets count per CPU
- Tx packets count per CPU
- Tx confirmed packets count per CPU
- Tx S/G frames count per CPU
- Tx error count per CPU
- Rx error count per CPU
- Rx error count per type
- congestion related statistics:
- congestion status
- time spent in congestion
- number of time the device entered congestion
- dropped packets count per cause
The driver also exports the following information in sysfs:
- the FQ IDs for each FQ type
/sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/fqids
- the ID of the buffer pool in use
/sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/bpids
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
DPAA 개요, 하드웨어 블록과 용어
1-91QorIQ DPAA 이더넷 드라이버
저자
- Madalin Bucur <madalin.bucur@nxp.com>
- Camelia Groza <camelia.groza@nxp.com>
목차
- DPAA 이더넷 개요
- DPAA 이더넷 지원 SoC
- 커널에서 DPAA 이더넷 구성
- DPAA 이더넷 프레임 처리
- DPAA 이더넷 기능
- DPAA IRQ 친화도와 Receive Side Scaling
- 디버깅
DPAA 이더넷 개요
DPAA는 Data Path Acceleration Architecture의 약자입니다. PowerPC와 ARM64의 여러 세대 SoC에서 제공되는 네트워킹 가속 IP 집합입니다.
Freescale DPAA 아키텍처는 이더넷 연결을 지원하는 여러 하드웨어 블록으로 구성됩니다. 이더넷 드라이버는 Linux 커널의 다음 드라이버에 의존합니다.
- Peripheral Access Memory Unit(`PAMU`), PPC 플랫폼에서만 필요: `drivers/iommu/fsl_*`
- Frame Manager(`FMan`): `drivers/net/ethernet/freescale/fman`
- Queue Manager(`QMan`)와 Buffer Manager(`BMan`): `drivers/soc/fsl/qbman`
`dpaa_eth` 인터페이스와 FMan MAC의 단순화된 연결
각 Linux 인터페이스가 FMan 포트와 MAC을 거쳐 하드웨어 블록에 연결됩니다.
`dpaa_eth`와 QMan, BMan, FMan의 관계
수신·송신 큐는 QMan이 관리하고 버퍼는 BMan과 FMan BMI를 통해 연결됩니다.
앞의 도식과 코드에서 사용하는 약어
| 약어 | 뜻 |
|---|---|
| DPAA | Data Path Acceleration Architecture |
| FMan | DPAA Frame Manager |
| QMan | DPAA Queue Manager |
| BMan | DPAA Buffer Manager |
| QMI | FMan의 QMan 인터페이스 |
| BMI | FMan의 BMan 인터페이스 |
| FMan SP | FMan Storage Profile |
| MURAM | FMan의 Multi-user RAM |
| FQ | QMan Frame Queue |
| Rx Dfl FQ | 기본 수신 FQ |
| Rx Err FQ | 수신 오류 프레임 FQ |
| Tx Cnf FQ | 송신 확인 FQ |
| Tx FQs | 송신 프레임 큐 |
| dtsec | 10/100/1000Mbps datapath three-speed 이더넷 컨트롤러 |
| tgec | 10Gbps ten-gigabit 이더넷 컨트롤러 |
| memac | 10/100/1000/10000 multirate 이더넷 MAC |
.. SPDX-License-Identifier: GPL-2.0
==============================
The QorIQ DPAA Ethernet Driver
==============================
Authors:
- Madalin Bucur <madalin.bucur@nxp.com>
- Camelia Groza <camelia.groza@nxp.com>
.. Contents
- DPAA Ethernet Overview
- DPAA Ethernet Supported SoCs
- Configuring DPAA Ethernet in your kernel
- DPAA Ethernet Frame Processing
- DPAA Ethernet Features
- DPAA IRQ Affinity and Receive Side Scaling
- Debugging
DPAA Ethernet Overview
======================
DPAA stands for Data Path Acceleration Architecture and it is a
set of networking acceleration IPs that are available on several
generations of SoCs, both on PowerPC and ARM64.
The Freescale DPAA architecture consists of a series of hardware blocks
that support Ethernet connectivity. The Ethernet driver depends upon the
following drivers in the Linux kernel:
- Peripheral Access Memory Unit (PAMU) (* needed only for PPC platforms)
drivers/iommu/fsl_*
- Frame Manager (FMan)
drivers/net/ethernet/freescale/fman
- Queue Manager (QMan), Buffer Manager (BMan)
drivers/soc/fsl/qbman
A simplified view of the dpaa_eth interfaces mapped to FMan MACs::
dpaa_eth /eth0\ ... /ethN\
driver | | | |
------------- ---- ----------- ---- -------------
-Ports / Tx Rx \ ... / Tx Rx \
FMan | | | |
-MACs | MAC0 | | MACN |
/ dtsec0 \ ... / dtsecN \ (or tgec)
/ \ / \(or memac)
--------- -------------- --- -------------- ---------
FMan, FMan Port, FMan SP, FMan MURAM drivers
---------------------------------------------------------
FMan HW blocks: MURAM, MACs, Ports, SP
---------------------------------------------------------
The dpaa_eth relation to the QMan, BMan and FMan::
________________________________
dpaa_eth / eth0 \
driver / \
--------- -^- -^- -^- --- ---------
QMan driver / \ / \ / \ \ / | BMan |
|Rx | |Rx | |Tx | |Tx | | driver |
--------- |Dfl| |Err| |Cnf| |FQs| | |
QMan HW |FQ | |FQ | |FQs| | | | |
/ \ / \ / \ \ / | |
--------- --- --- --- -v- ---------
| FMan QMI | |
| FMan HW FMan BMI | BMan HW |
----------------------- --------
where the acronyms used above (and in the code) are:
=============== ===========================================================
DPAA Data Path Acceleration Architecture
FMan DPAA Frame Manager
QMan DPAA Queue Manager
BMan DPAA Buffers Manager
QMI QMan interface in FMan
BMI BMan interface in FMan
FMan SP FMan Storage Profiles
MURAM Multi-user RAM in FMan
FQ QMan Frame Queue
Rx Dfl FQ default reception FQ
Rx Err FQ Rx error frames FQ
Tx Cnf FQ Tx confirmation FQs
Tx FQs transmission frame queues
dtsec datapath three speed Ethernet controller (10/100/1000 Mbps)
tgec ten gigabit Ethernet controller (10 Gbps)
memac multirate Ethernet MAC (10/100/1000/10000)
=============== ===========================================================
지원 SoC와 Kconfig
92-134DPAA 이더넷 지원 SoC
DPAA 드라이버는 다음 SoC의 이더넷 컨트롤러를 활성화합니다.
PPC
- P1023
- P2041
- P3041
- P4080
- P5020
- P5040
- T1023
- T1024
- T1040
- T1042
- T2080
- T4240
- B4860
ARM
- LS1043A
- LS1046A
커널에서 DPAA 이더넷 구성
DPAA 이더넷 드라이버를 활성화하려면 다음 Kconfig 옵션이 필요합니다.
# arch/arm64와 arch/powerpc 공통
CONFIG_FSL_DPAA=y
CONFIG_FSL_FMAN=y
CONFIG_FSL_DPAA_ETH=y
CONFIG_FSL_XGMAC_MDIO=y
# arch/powerpc 전용
CONFIG_FSL_PAMU=y
# RDB에서 사용하는 PHY의 공통 옵션
CONFIG_VITESSE_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_AQUANTIA_PHY=y
DPAA Ethernet Supported SoCs
============================
The DPAA drivers enable the Ethernet controllers present on the following SoCs:
PPC
- P1023
- P2041
- P3041
- P4080
- P5020
- P5040
- T1023
- T1024
- T1040
- T1042
- T2080
- T4240
- B4860
ARM
- LS1043A
- LS1046A
Configuring DPAA Ethernet in your kernel
========================================
To enable the DPAA Ethernet driver, the following Kconfig options are required::
# common for arch/arm64 and arch/powerpc platforms
CONFIG_FSL_DPAA=y
CONFIG_FSL_FMAN=y
CONFIG_FSL_DPAA_ETH=y
CONFIG_FSL_XGMAC_MDIO=y
# for arch/powerpc only
CONFIG_FSL_PAMU=y
# common options needed for the PHYs used on the RDBs
CONFIG_VITESSE_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_AQUANTIA_PHY=y
프레임 처리, 오프로딩과 송신 트래픽 클래스
135-180DPAA 이더넷 프레임 처리
수신할 때 들어오는 프레임의 버퍼는 해당 인터페이스 전용 버퍼 풀에서 가져옵니다. 드라이버는 이 풀을 페이지 하나 크기의 버퍼로 초기화하고 채웁니다.
송신한 모든 프레임은 Tx confirmation frame queue를 통해 드라이버로 돌아옵니다. 드라이버는 그 뒤 버퍼를 해제해야 합니다. 이를 올바르게 처리하기 위해 송신 전에 버퍼에 `skb`를 가리키는 backpointer를 넣습니다. 확인 FQ를 통해 버퍼가 드라이버로 돌아오면 해당 `skb`를 올바르게 소비할 수 있습니다.
DPAA 이더넷 기능
현재 DPAA 이더넷 드라이버는 Linux 이더넷 드라이버에 필요한 기본 기능을 활성화합니다. 고급 기능 지원은 점진적으로 추가됩니다.
드라이버는 UDP와 TCP의 수신·송신 체크섬 오프로딩을 지원합니다. 수신 체크섬 오프로딩은 기본으로 활성화되어 있으며 ethtool로 제어할 수 없습니다. `rx-flow-hash`와 `rx-hashing`도 추가되었습니다. RSS는 한 인터페이스가 받은 서로 다른 트래픽 흐름을 여러 CPU가 병렬 처리하게 하므로 포워딩 시나리오의 성능을 크게 높입니다.
드라이버는 우선순위가 있는 여러 송신 트래픽 클래스를 지원합니다. 우선순위 범위는 0이 가장 낮고 3이 가장 높으며 엄격한 우선순위 수준을 가진 하드웨어 workqueue에 매핑됩니다. 각 트래픽 클래스에는 `NR_CPU`개의 TX 큐가 있습니다.
기본적으로 트래픽 클래스 하나만 활성화되며 가장 낮은 우선순위의 Tx 큐를 사용합니다. `mqprio` qdisc로 더 높은 우선순위의 트래픽 클래스를 활성화할 수 있습니다. 네 클래스를 모두 활성화할 때 skb 우선순위는 다음처럼 매핑됩니다.
- 우선순위 0~3: 트래픽 클래스 0, 낮은 우선순위
- 우선순위 4~7: 트래픽 클래스 1, 중간-낮은 우선순위
- 우선순위 8~11: 트래픽 클래스 2, 중간-높은 우선순위
- 우선순위 12~15: 트래픽 클래스 3, 높은 우선순위
tc qdisc add dev <int> root handle 1: \
mqprio num_tc 4 map 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 hw 1
DPAA Ethernet Frame Processing
==============================
On Rx, buffers for the incoming frames are retrieved from the buffers found
in the dedicated interface buffer pool. The driver initializes and seeds these
with one page buffers.
On Tx, all transmitted frames are returned to the driver through Tx
confirmation frame queues. The driver is then responsible for freeing the
buffers. In order to do this properly, a backpointer is added to the buffer
before transmission that points to the skb. When the buffer returns to the
driver on a confirmation FQ, the skb can be correctly consumed.
DPAA Ethernet Features
======================
Currently the DPAA Ethernet driver enables the basic features required for
a Linux Ethernet driver. The support for advanced features will be added
gradually.
The driver has Rx and Tx checksum offloading for UDP and TCP. Currently the Rx
checksum offload feature is enabled by default and cannot be controlled through
ethtool. Also, rx-flow-hash and rx-hashing was added. The addition of RSS
provides a big performance boost for the forwarding scenarios, allowing
different traffic flows received by one interface to be processed by different
CPUs in parallel.
The driver has support for multiple prioritized Tx traffic classes. Priorities
range from 0 (lowest) to 3 (highest). These are mapped to HW workqueues with
strict priority levels. Each traffic class contains NR_CPU TX queues. By
default, only one traffic class is enabled and the lowest priority Tx queues
are used. Higher priority traffic classes can be enabled with the mqprio
qdisc. For example, all four traffic classes are enabled on an interface with
the following command. Furthermore, skb priority levels are mapped to traffic
classes as follows:
* priorities 0 to 3 - traffic class 0 (low priority)
* priorities 4 to 7 - traffic class 1 (medium-low priority)
* priorities 8 to 11 - traffic class 2 (medium-high priority)
* priorities 12 to 15 - traffic class 3 (high priority)
::
tc qdisc add dev <int> root handle 1: \
mqprio num_tc 4 map 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 hw 1
IRQ 친화도, RSS와 수신 해시
181-242DPAA IRQ 친화도와 Receive Side Scaling
DPAA Rx 큐 또는 Tx confirmation 큐로 들어오는 트래픽은 CPU에서 특정 portal의 ingress 트래픽으로 보입니다. 각 DPAA QMan portal 인터럽트에는 특정 CPU 친화도가 설정됩니다. 같은 portal 인터럽트가 해당 QMan portal의 모든 소비자를 처리합니다.
DPAA 이더넷 드라이버는 기본적으로 RSS를 활성화합니다. DPAA FMan Parser와 Keygen 블록이 수신 프레임에 존재하는 IPv4/IPv6 출발지·목적지 주소와 L4 출발지·목적지 포트를 해시해 트래픽을 128개 하드웨어 프레임 큐에 분산합니다.
RSS를 끄면 특정 인터페이스가 받는 모든 트래픽이 기본 Rx frame queue로 들어갑니다. 기본 DPAA Rx frame queue는 사용 가능한 어느 CPU portal이든 ingress 트래픽을 dequeue할 수 있는 pool channel에 트래픽을 넣도록 구성됩니다.
기본 frame queue에는 `HOLDACTIVE` 옵션이 설정되어 특정 큐의 트래픽 버스트를 같은 CPU가 처리합니다. 프레임 재정렬 비율을 매우 낮게 유지하지만 RSS가 없으면 한 시점에 CPU 하나만 특정 인터페이스의 수신 트래픽을 처리할 수 있다는 단점이 있습니다.
RSS를 구현하기 위해 드라이버는 128개의 추가 Rx frame queue를 할당하고 round-robin 방식으로 전용 채널에 연결합니다. frame queue와 CPU의 매핑은 현재 하드코딩되어 있으며 특정 FQ, 즉 해시 결과의 트래픽을 다른 CPU로 옮길 indirection table이 없습니다.
이 프레임 큐로 들어오는 ingress 트래픽은 같은 portal에 도착해 항상 같은 CPU가 처리합니다. 따라서 흐름 내부 순서를 보존하면서 여러 트래픽 흐름의 작업을 분산합니다.
특정 인터페이스의 RSS를 ethtool로 끄는 예
ethtool -N fm1-mac9 rx-flow-hash tcp4 ""
다시 켜려면 `tcp4/6` 또는 `udp4/6`의 `rx-flow-hash`를 설정합니다.
ethtool -N fm1-mac9 rx-flow-hash udp4 sfdn
프로토콜별 독립 제어는 없습니다. `tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6` 중 하나에 명령을 실행하면 해당 인터페이스의 모든 프로토콜에 대한 `rx-flow-hashing`을 제어합니다.
드라이버는 FMan Keygen 해시로 트래픽을 128개 Rx FQ에 분산하는 것 외에도 `NETIF_F_RXHASH` 기능이 켜져 있으면 `skb` 해시 값을 설정합니다. 이 기능은 기본으로 활성화되며 ethtool로 켜고 끌 수 있습니다.
ethtool -K fm1-mac9 rx-hashing off
ethtool -k fm1-mac9 | grep hash
receive-hashing: off
ethtool -K fm1-mac9 rx-hashing on
Actual changes:
receive-hashing: on
ethtool -k fm1-mac9 | grep hash
receive-hashing: on
수신 해시는 해당 인터페이스의 `rx-flow-hashing`이 켜져 있어야 작동합니다. `rx-flow-hashing`을 끄면 `rx-hashing`도 비활성화됩니다. 다만 ethtool의 표시는 `NETIF_F_RXHASH` 기능 플래그에 의존하므로 off로 보고되지 않을 수 있습니다.
DPAA IRQ Affinity and Receive Side Scaling
==========================================
Traffic coming on the DPAA Rx queues or on the DPAA Tx confirmation
queues is seen by the CPU as ingress traffic on a certain portal.
The DPAA QMan portal interrupts are affined each to a certain CPU.
The same portal interrupt services all the QMan portal consumers.
By default the DPAA Ethernet driver enables RSS, making use of the
DPAA FMan Parser and Keygen blocks to distribute traffic on 128
hardware frame queues using a hash on IP v4/v6 source and destination
and L4 source and destination ports, in present in the received frame.
When RSS is disabled, all traffic received by a certain interface is
received on the default Rx frame queue. The default DPAA Rx frame
queues are configured to put the received traffic into a pool channel
that allows any available CPU portal to dequeue the ingress traffic.
The default frame queues have the HOLDACTIVE option set, ensuring that
traffic bursts from a certain queue are serviced by the same CPU.
This ensures a very low rate of frame reordering. A drawback of this
is that only one CPU at a time can service the traffic received by a
certain interface when RSS is not enabled.
To implement RSS, the DPAA Ethernet driver allocates an extra set of
128 Rx frame queues that are configured to dedicated channels, in a
round-robin manner. The mapping of the frame queues to CPUs is now
hardcoded, there is no indirection table to move traffic for a certain
FQ (hash result) to another CPU. The ingress traffic arriving on one
of these frame queues will arrive at the same portal and will always
be processed by the same CPU. This ensures intra-flow order preservation
and workload distribution for multiple traffic flows.
RSS can be turned off for a certain interface using ethtool, i.e.::
# ethtool -N fm1-mac9 rx-flow-hash tcp4 ""
To turn it back on, one needs to set rx-flow-hash for tcp4/6 or udp4/6::
# ethtool -N fm1-mac9 rx-flow-hash udp4 sfdn
There is no independent control for individual protocols, any command
run for one of tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 is
going to control the rx-flow-hashing for all protocols on that interface.
Besides using the FMan Keygen computed hash for spreading traffic on the
128 Rx FQs, the DPAA Ethernet driver also sets the skb hash value when
the NETIF_F_RXHASH feature is on (active by default). This can be turned
on or off through ethtool, i.e.::
# ethtool -K fm1-mac9 rx-hashing off
# ethtool -k fm1-mac9 | grep hash
receive-hashing: off
# ethtool -K fm1-mac9 rx-hashing on
Actual changes:
receive-hashing: on
# ethtool -k fm1-mac9 | grep hash
receive-hashing: on
Please note that Rx hashing depends upon the rx-flow-hashing being on
for that interface - turning off rx-flow-hashing will also disable the
rx-hashing (without ethtool reporting it as off as that depends on the
NETIF_F_RXHASH feature flag).
ethtool 통계와 sysfs 진단
243-269디버깅
각 인터페이스에서 ethtool로 다음 통계를 내보냅니다.
- CPU별 인터럽트 수
- CPU별 수신 패킷 수
- CPU별 송신 패킷 수
- CPU별 송신 확인 패킷 수
- CPU별 송신 S/G 프레임 수
- CPU별 송신 오류 수
- CPU별 수신 오류 수
- 유형별 수신 오류 수
- 혼잡 상태
- 혼잡 상태로 보낸 시간
- 장치가 혼잡 상태에 들어간 횟수
- 원인별 폐기 패킷 수
드라이버는 sysfs에도 다음 정보를 내보냅니다.
각 FQ 유형의 FQ ID
/sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/fqids
사용 중인 버퍼 풀 ID
/sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/bpids
Debugging
=========
The following statistics are exported for each interface through ethtool:
- interrupt count per CPU
- Rx packets count per CPU
- Tx packets count per CPU
- Tx confirmed packets count per CPU
- Tx S/G frames count per CPU
- Tx error count per CPU
- Rx error count per CPU
- Rx error count per type
- congestion related statistics:
- congestion status
- time spent in congestion
- number of time the device entered congestion
- dropped packets count per cause
The driver also exports the following information in sysfs:
- the FQ IDs for each FQ type
/sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/fqids
- the ID of the buffer pool in use
/sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/bpids
요약·해설
dpaa.rst:1-269DPAA Ethernet은 일반 NIC 드라이버보다 하드웨어 큐와 버퍼 관리자가 전면에 드러나는 구조입니다. FMan이 MAC과 프레임 입출력을 담당하고, QMan이 프레임 큐를, BMan이 버퍼 풀을 관리합니다. RSS는 흐름 해시를 128개 전용 FQ와 CPU portal에 연결해 순서를 유지하면서 병렬성을 확보합니다.
원문의 첫 번째 ASCII 구조도를 역할 중심으로 다시 구성했습니다.
원문의 두 번째 ASCII 구조도를 큐와 버퍼 흐름으로 다시 구성했습니다.
각 하드웨어 관리자와 인터페이스의 책임입니다.
SoC 세대와 링크 속도에 따라 사용되는 FMan MAC입니다.
공통 Kconfig와 아키텍처별 차이입니다.
인터페이스 전용 풀을 페이지 단위로 채우고 수신 프레임에 사용합니다.
backpointer가 confirmation FQ에서 원래 skb를 찾아 해제하게 합니다.
skb 우선순위 네 개씩을 한 하드웨어 트래픽 클래스에 매핑합니다.
기본 FQ와 HOLDACTIVE는 순서를 지키지만 한 인터페이스를 CPU 하나만 처리합니다.
Parser·Keygen 해시가 흐름을 128개 전용 FQ와 고정 CPU에 분산합니다.
ethtool 명령의 실제 제어 범위와 제약입니다.
`rx-hashing`은 `rx-flow-hashing`이 켜져 있어야 의미가 있습니다.
ethtool과 sysfs가 서로 다른 수준의 정보를 제공합니다.