← Documents Documentation/networking/device_drivers/ethernet/freescale/dpaa.rst GitHub 원문 ↗

Linux 6.18.37 · Networking

The QorIQ DPAA Ethernet Driver

QorIQ DPAA의 FMan·QMan·BMan 구조, 프레임 버퍼 수명, mqprio 트래픽 클래스, QMan portal IRQ 친화도와 128개 FQ 기반 RSS를 설명합니다.

Source pathDocumentation/networking/device_drivers/ethernet/freescale/dpaa.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

dpaa.rst:1-269

DPAA Ethernet은 일반 NIC 드라이버보다 하드웨어 큐와 버퍼 관리자가 전면에 드러나는 구조입니다. FMan이 MAC과 프레임 입출력을 담당하고, QMan이 프레임 큐를, BMan이 버퍼 풀을 관리합니다. RSS는 흐름 해시를 128개 전용 FQ와 CPU portal에 연결해 순서를 유지하면서 병렬성을 확보합니다.

DPAA 하드웨어 계층
`eth0` ... `ethN``dpaa_eth`FMan Tx·Rx PortFMan MAC`dtsec`·`tgec`·`memac`MURAM·SP·Port HW

원문의 첫 번째 ASCII 구조도를 역할 중심으로 다시 구성했습니다.

QMan·BMan 데이터 경로
Rx Default·Error FQQManFMan QMI`dpaa_eth`
Tx FQFMan QMITx Confirmation FQ`dpaa_eth`
버퍼 풀BManFMan BMIRx·Tx 버퍼

원문의 두 번째 ASCII 구조도를 큐와 버퍼 흐름으로 다시 구성했습니다.

핵심 블록
블록역할
FManMAC, Port, 프레임 입출력
QManFrame Queue 관리
BMan버퍼 풀 관리
QMIFMan의 QMan 인터페이스
BMIFMan의 BMan 인터페이스
PAMUPPC 메모리 접근 지원

각 하드웨어 관리자와 인터페이스의 책임입니다.

MAC 종류
MAC지원 속도
dtsec10/100/1000Mbps
tgec10Gbps
memac10/100/1000/10000Mbps

SoC 세대와 링크 속도에 따라 사용되는 FMan MAC입니다.

플랫폼 구성
범위옵션
ARM64·PowerPC 공통FSL_DPAA·FMAN·DPAA_ETH·XGMAC_MDIO
PowerPC 전용FSL_PAMU
RDB PHYVITESSE·REALTEK·AQUANTIA PHY

공통 Kconfig와 아키텍처별 차이입니다.

수신 버퍼 수명
드라이버 초기화1페이지 버퍼전용 BMan 풀수신 프레임네트워크 스택

인터페이스 전용 풀을 페이지 단위로 채우고 수신 프레임에 사용합니다.

송신 버퍼 수명
`skb`버퍼에 backpointerTx FQ하드웨어 송신Tx Confirmation FQ`skb` 소비

backpointer가 confirmation FQ에서 원래 skb를 찾아 해제하게 합니다.

송신 트래픽 클래스
skb 우선순위클래스수준
0~3TC0낮음
4~7TC1중간-낮음
8~11TC2중간-높음
12~15TC3높음

skb 우선순위 네 개씩을 한 하드웨어 트래픽 클래스에 매핑합니다.

RSS 비활성 경로
인터페이스 수신기본 Rx FQpool channel`HOLDACTIVE`동일 CPU낮은 재정렬·제한된 병렬성

기본 FQ와 HOLDACTIVE는 순서를 지키지만 한 인터페이스를 CPU 하나만 처리합니다.

RSS 활성 경로
IPv4/6·L4 4-tupleFMan Parser·Keygen128개 Rx FQ전용 channel고정 portal·CPU흐름 순서 보존

Parser·Keygen 해시가 흐름을 128개 전용 FQ와 고정 CPU에 분산합니다.

RSS 제어 특성
항목동작
끄기`rx-flow-hash tcp4 ""`
켜기`rx-flow-hash udp4 sfdn`
프로토콜별 독립 제어없음
FQ→CPU indirection table없음, 하드코딩
대상 프로토콜tcp·udp·ah·esp·sctp, IPv4/6

ethtool 명령의 실제 제어 범위와 제약입니다.

두 해시 기능의 의존성
기능역할제어
rx-flow-hashing트래픽을 128개 FQ로 분산`ethtool -N`
rx-hashingskb hash 기록`ethtool -K`
의존성flow hashing을 끄면 skb hashing도 중단표시와 실제 상태 차이 가능

`rx-hashing`은 `rx-flow-hashing`이 켜져 있어야 의미가 있습니다.

진단 표면
인터페이스정보
ethtoolCPU별 IRQ·Rx·Tx·확인·오류·혼잡 통계
sysfs fqids유형별 Frame Queue ID
sysfs bpids사용 중인 Buffer Pool ID

ethtool과 sysfs가 서로 다른 수준의 정보를 제공합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ==============================
4 The QorIQ DPAA Ethernet Driver
5 ==============================
6
7 Authors:
8 - Madalin Bucur <madalin.bucur@nxp.com>
9 - Camelia Groza <camelia.groza@nxp.com>
10
11 .. Contents
12
13 - DPAA Ethernet Overview
14 - DPAA Ethernet Supported SoCs
15 - Configuring DPAA Ethernet in your kernel
16 - DPAA Ethernet Frame Processing
17 - DPAA Ethernet Features
18 - DPAA IRQ Affinity and Receive Side Scaling
19 - Debugging
20
21 DPAA Ethernet Overview
22 ======================
23
24 DPAA stands for Data Path Acceleration Architecture and it is a
25 set of networking acceleration IPs that are available on several
26 generations of SoCs, both on PowerPC and ARM64.
27
28 The Freescale DPAA architecture consists of a series of hardware blocks
29 that support Ethernet connectivity. The Ethernet driver depends upon the
30 following drivers in the Linux kernel:
31
32 - Peripheral Access Memory Unit (PAMU) (* needed only for PPC platforms)
33 drivers/iommu/fsl_*
34 - Frame Manager (FMan)
35 drivers/net/ethernet/freescale/fman
36 - Queue Manager (QMan), Buffer Manager (BMan)
37 drivers/soc/fsl/qbman
38
39 A simplified view of the dpaa_eth interfaces mapped to FMan MACs::
40
41 dpaa_eth /eth0\ ... /ethN\
42 driver | | | |
43 ------------- ---- ----------- ---- -------------
44 -Ports / Tx Rx \ ... / Tx Rx \
45 FMan | | | |
46 -MACs | MAC0 | | MACN |
47 / dtsec0 \ ... / dtsecN \ (or tgec)
48 / \ / \(or memac)
49 --------- -------------- --- -------------- ---------
50 FMan, FMan Port, FMan SP, FMan MURAM drivers
51 ---------------------------------------------------------
52 FMan HW blocks: MURAM, MACs, Ports, SP
53 ---------------------------------------------------------
54
55 The dpaa_eth relation to the QMan, BMan and FMan::
56
57 ________________________________
58 dpaa_eth / eth0 \
59 driver / \
60 --------- -^- -^- -^- --- ---------
61 QMan driver / \ / \ / \ \ / | BMan |
62 |Rx | |Rx | |Tx | |Tx | | driver |
63 --------- |Dfl| |Err| |Cnf| |FQs| | |
64 QMan HW |FQ | |FQ | |FQs| | | | |
65 / \ / \ / \ \ / | |
66 --------- --- --- --- -v- ---------
67 | FMan QMI | |
68 | FMan HW FMan BMI | BMan HW |
69 ----------------------- --------
70
71 where the acronyms used above (and in the code) are:
72
73 =============== ===========================================================
74 DPAA Data Path Acceleration Architecture
75 FMan DPAA Frame Manager
76 QMan DPAA Queue Manager
77 BMan DPAA Buffers Manager
78 QMI QMan interface in FMan
79 BMI BMan interface in FMan
80 FMan SP FMan Storage Profiles
81 MURAM Multi-user RAM in FMan
82 FQ QMan Frame Queue
83 Rx Dfl FQ default reception FQ
84 Rx Err FQ Rx error frames FQ
85 Tx Cnf FQ Tx confirmation FQs
86 Tx FQs transmission frame queues
87 dtsec datapath three speed Ethernet controller (10/100/1000 Mbps)
88 tgec ten gigabit Ethernet controller (10 Gbps)
89 memac multirate Ethernet MAC (10/100/1000/10000)
90 =============== ===========================================================
91
92 DPAA Ethernet Supported SoCs
93 ============================
94
95 The DPAA drivers enable the Ethernet controllers present on the following SoCs:
96
97 PPC
98 - P1023
99 - P2041
100 - P3041
101 - P4080
102 - P5020
103 - P5040
104 - T1023
105 - T1024
106 - T1040
107 - T1042
108 - T2080
109 - T4240
110 - B4860
111
112 ARM
113 - LS1043A
114 - LS1046A
115
116 Configuring DPAA Ethernet in your kernel
117 ========================================
118
119 To enable the DPAA Ethernet driver, the following Kconfig options are required::
120
121 # common for arch/arm64 and arch/powerpc platforms
122 CONFIG_FSL_DPAA=y
123 CONFIG_FSL_FMAN=y
124 CONFIG_FSL_DPAA_ETH=y
125 CONFIG_FSL_XGMAC_MDIO=y
126
127 # for arch/powerpc only
128 CONFIG_FSL_PAMU=y
129
130 # common options needed for the PHYs used on the RDBs
131 CONFIG_VITESSE_PHY=y
132 CONFIG_REALTEK_PHY=y
133 CONFIG_AQUANTIA_PHY=y
134
135 DPAA Ethernet Frame Processing
136 ==============================
137
138 On Rx, buffers for the incoming frames are retrieved from the buffers found
139 in the dedicated interface buffer pool. The driver initializes and seeds these
140 with one page buffers.
141
142 On Tx, all transmitted frames are returned to the driver through Tx
143 confirmation frame queues. The driver is then responsible for freeing the
144 buffers. In order to do this properly, a backpointer is added to the buffer
145 before transmission that points to the skb. When the buffer returns to the
146 driver on a confirmation FQ, the skb can be correctly consumed.
147
148 DPAA Ethernet Features
149 ======================
150
151 Currently the DPAA Ethernet driver enables the basic features required for
152 a Linux Ethernet driver. The support for advanced features will be added
153 gradually.
154
155 The driver has Rx and Tx checksum offloading for UDP and TCP. Currently the Rx
156 checksum offload feature is enabled by default and cannot be controlled through
157 ethtool. Also, rx-flow-hash and rx-hashing was added. The addition of RSS
158 provides a big performance boost for the forwarding scenarios, allowing
159 different traffic flows received by one interface to be processed by different
160 CPUs in parallel.
161
162 The driver has support for multiple prioritized Tx traffic classes. Priorities
163 range from 0 (lowest) to 3 (highest). These are mapped to HW workqueues with
164 strict priority levels. Each traffic class contains NR_CPU TX queues. By
165 default, only one traffic class is enabled and the lowest priority Tx queues
166 are used. Higher priority traffic classes can be enabled with the mqprio
167 qdisc. For example, all four traffic classes are enabled on an interface with
168 the following command. Furthermore, skb priority levels are mapped to traffic
169 classes as follows:
170
171 * priorities 0 to 3 - traffic class 0 (low priority)
172 * priorities 4 to 7 - traffic class 1 (medium-low priority)
173 * priorities 8 to 11 - traffic class 2 (medium-high priority)
174 * priorities 12 to 15 - traffic class 3 (high priority)
175
176 ::
177
178 tc qdisc add dev <int> root handle 1: \
179 mqprio num_tc 4 map 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 hw 1
180
181 DPAA IRQ Affinity and Receive Side Scaling
182 ==========================================
183
184 Traffic coming on the DPAA Rx queues or on the DPAA Tx confirmation
185 queues is seen by the CPU as ingress traffic on a certain portal.
186 The DPAA QMan portal interrupts are affined each to a certain CPU.
187 The same portal interrupt services all the QMan portal consumers.
188
189 By default the DPAA Ethernet driver enables RSS, making use of the
190 DPAA FMan Parser and Keygen blocks to distribute traffic on 128
191 hardware frame queues using a hash on IP v4/v6 source and destination
192 and L4 source and destination ports, in present in the received frame.
193 When RSS is disabled, all traffic received by a certain interface is
194 received on the default Rx frame queue. The default DPAA Rx frame
195 queues are configured to put the received traffic into a pool channel
196 that allows any available CPU portal to dequeue the ingress traffic.
197 The default frame queues have the HOLDACTIVE option set, ensuring that
198 traffic bursts from a certain queue are serviced by the same CPU.
199 This ensures a very low rate of frame reordering. A drawback of this
200 is that only one CPU at a time can service the traffic received by a
201 certain interface when RSS is not enabled.
202
203 To implement RSS, the DPAA Ethernet driver allocates an extra set of
204 128 Rx frame queues that are configured to dedicated channels, in a
205 round-robin manner. The mapping of the frame queues to CPUs is now
206 hardcoded, there is no indirection table to move traffic for a certain
207 FQ (hash result) to another CPU. The ingress traffic arriving on one
208 of these frame queues will arrive at the same portal and will always
209 be processed by the same CPU. This ensures intra-flow order preservation
210 and workload distribution for multiple traffic flows.
211
212 RSS can be turned off for a certain interface using ethtool, i.e.::
213
214 # ethtool -N fm1-mac9 rx-flow-hash tcp4 ""
215
216 To turn it back on, one needs to set rx-flow-hash for tcp4/6 or udp4/6::
217
218 # ethtool -N fm1-mac9 rx-flow-hash udp4 sfdn
219
220 There is no independent control for individual protocols, any command
221 run for one of tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 is
222 going to control the rx-flow-hashing for all protocols on that interface.
223
224 Besides using the FMan Keygen computed hash for spreading traffic on the
225 128 Rx FQs, the DPAA Ethernet driver also sets the skb hash value when
226 the NETIF_F_RXHASH feature is on (active by default). This can be turned
227 on or off through ethtool, i.e.::
228
229 # ethtool -K fm1-mac9 rx-hashing off
230 # ethtool -k fm1-mac9 | grep hash
231 receive-hashing: off
232 # ethtool -K fm1-mac9 rx-hashing on
233 Actual changes:
234 receive-hashing: on
235 # ethtool -k fm1-mac9 | grep hash
236 receive-hashing: on
237
238 Please note that Rx hashing depends upon the rx-flow-hashing being on
239 for that interface - turning off rx-flow-hashing will also disable the
240 rx-hashing (without ethtool reporting it as off as that depends on the
241 NETIF_F_RXHASH feature flag).
242
243 Debugging
244 =========
245
246 The following statistics are exported for each interface through ethtool:
247
248 - interrupt count per CPU
249 - Rx packets count per CPU
250 - Tx packets count per CPU
251 - Tx confirmed packets count per CPU
252 - Tx S/G frames count per CPU
253 - Tx error count per CPU
254 - Rx error count per CPU
255 - Rx error count per type
256 - congestion related statistics:
257
258 - congestion status
259 - time spent in congestion
260 - number of time the device entered congestion
261 - dropped packets count per cause
262
263 The driver also exports the following information in sysfs:
264
265 - the FQ IDs for each FQ type
266 /sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/fqids
267
268 - the ID of the buffer pool in use
269 /sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/bpids
270

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

DPAA 개요, 하드웨어 블록과 용어

1-91

QorIQ 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의 단순화된 연결

dpaa_eth와 FMan MAC
`eth0` ... `ethN``dpaa_eth` 드라이버FMan Tx·Rx 포트`MAC0` ... `MACN``dtsec`·`tgec`·`memac`FMan MURAM·Port·SP

각 Linux 인터페이스가 FMan 포트와 MAC을 거쳐 하드웨어 블록에 연결됩니다.

`dpaa_eth`와 QMan, BMan, FMan의 관계

프레임 큐와 버퍼 관리자
`dpaa_eth eth0`Rx Default·Rx Error FQQMan portalFMan QMIFMan 하드웨어
`dpaa_eth eth0`Tx·Tx Confirmation FQQManFMan QMI
버퍼BMan driverBMan HWFMan BMI

수신·송신 큐는 QMan이 관리하고 버퍼는 BMan과 FMan BMI를 통해 연결됩니다.

앞의 도식과 코드에서 사용하는 약어

약어
DPAAData Path Acceleration Architecture
FManDPAA Frame Manager
QManDPAA Queue Manager
BManDPAA Buffer Manager
QMIFMan의 QMan 인터페이스
BMIFMan의 BMan 인터페이스
FMan SPFMan Storage Profile
MURAMFMan의 Multi-user RAM
FQQMan Frame Queue
Rx Dfl FQ기본 수신 FQ
Rx Err FQ수신 오류 프레임 FQ
Tx Cnf FQ송신 확인 FQ
Tx FQs송신 프레임 큐
dtsec10/100/1000Mbps datapath three-speed 이더넷 컨트롤러
tgec10Gbps ten-gigabit 이더넷 컨트롤러
memac10/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-134

DPAA 이더넷 지원 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-180

DPAA 이더넷 프레임 처리

수신할 때 들어오는 프레임의 버퍼는 해당 인터페이스 전용 버퍼 풀에서 가져옵니다. 드라이버는 이 풀을 페이지 하나 크기의 버퍼로 초기화하고 채웁니다.

송신한 모든 프레임은 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-242

DPAA 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