← Documents Documentation/networking/device_drivers/ethernet/netronome/nfp.rst GitHub 원문 ↗

Linux 6.18.37 · Networking

Network Flow Processor Kernel Drivers

NFP/Agilio SmartNIC의 펌웨어 검색 우선순위, devlink 정보, 링크·MTU·FEC 구성과 장치 통계를 설명합니다.

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

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

1. 요약·해설

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

요약·해설

nfp.rst:1-374

NFP는 firmware가 application을 결정하는 programmable SmartNIC입니다. 운영의 핵심은 serial/PCI/card-type 파일의 검색 우선순위, initramfs 갱신, flash와 disk의 로드 정책을 분리해 이해하는 것입니다.

NFP firmware 선택 순서
`serial-*.nffw``pci-*.nffw``nic_AMDA*.nffw`flash firmware관리 firmware policy

장치별 파일이 일반 card image보다 우선합니다.

구성 시 주의점
항목조건적용
2x25G→10Gport 0을 port 1보다 먼저두 interface down 후 ethtool
MTUtunnel header와 fallback PF 경로 고려지속 설정은 OS 관리 도구
강제 FECauto-negotiation offport별 ethtool
firmware 교체정확한 card/media image필요 시 initramfs 재생성

link, MTU와 FEC 변경의 선행 조건입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 .. include:: <isonum.txt>
3
4 ===========================================
5 Network Flow Processor (NFP) Kernel Drivers
6 ===========================================
7
8 :Copyright: |copy| 2019, Netronome Systems, Inc.
9 :Copyright: |copy| 2022, Corigine, Inc.
10
11 Contents
12 ========
13
14 - `Overview`_
15 - `Acquiring Firmware`_
16 - `Devlink Info`_
17 - `Configure Device`_
18 - `Statistics`_
19
20 Overview
21 ========
22
23 This driver supports Netronome and Corigine's line of Network Flow Processor
24 devices, including the NFP3800, NFP4000, NFP5000, and NFP6000 models, which
25 are also incorporated in the companies' family of Agilio SmartNICs. The SR-IOV
26 physical and virtual functions for these devices are supported by the driver.
27
28 Acquiring Firmware
29 ==================
30
31 The NFP3800, NFP4000 and NFP6000 devices require application specific firmware
32 to function. Application firmware can be located either on the host file system
33 or in the device flash (if supported by management firmware).
34
35 Firmware files on the host filesystem contain card type (`AMDA-*` string), media
36 config etc. They should be placed in `/lib/firmware/netronome` directory to
37 load firmware from the host file system.
38
39 Firmware for basic NIC operation is available in the upstream
40 `linux-firmware.git` repository.
41
42 A more comprehensive list of firmware can be downloaded from the
43 `Corigine Support site <https://www.corigine.com/DPUDownload.html>`_.
44
45 Firmware in NVRAM
46 -----------------
47
48 Recent versions of management firmware supports loading application
49 firmware from flash when the host driver gets probed. The firmware loading
50 policy configuration may be used to configure this feature appropriately.
51
52 Devlink or ethtool can be used to update the application firmware on the device
53 flash by providing the appropriate `nic_AMDA*.nffw` file to the respective
54 command. Users need to take care to write the correct firmware image for the
55 card and media configuration to flash.
56
57 Available storage space in flash depends on the card being used.
58
59 Dealing with multiple projects
60 ------------------------------
61
62 NFP hardware is fully programmable therefore there can be different
63 firmware images targeting different applications.
64
65 When using application firmware from host, we recommend placing
66 actual firmware files in application-named subdirectories in
67 `/lib/firmware/netronome` and linking the desired files, e.g.::
68
69 $ tree /lib/firmware/netronome/
70 /lib/firmware/netronome/
71 ├── bpf
72 │   ├── nic_AMDA0081-0001_1x40.nffw
73 │   └── nic_AMDA0081-0001_4x10.nffw
74 ├── flower
75 │   ├── nic_AMDA0081-0001_1x40.nffw
76 │   └── nic_AMDA0081-0001_4x10.nffw
77 ├── nic
78 │   ├── nic_AMDA0081-0001_1x40.nffw
79 │   └── nic_AMDA0081-0001_4x10.nffw
80 ├── nic_AMDA0081-0001_1x40.nffw -> bpf/nic_AMDA0081-0001_1x40.nffw
81 └── nic_AMDA0081-0001_4x10.nffw -> bpf/nic_AMDA0081-0001_4x10.nffw
82
83 3 directories, 8 files
84
85 You may need to use hard instead of symbolic links on distributions
86 which use old `mkinitrd` command instead of `dracut` (e.g. Ubuntu).
87
88 After changing firmware files you may need to regenerate the initramfs
89 image. Initramfs contains drivers and firmware files your system may
90 need to boot. Refer to the documentation of your distribution to find
91 out how to update initramfs. Good indication of stale initramfs
92 is system loading wrong driver or firmware on boot, but when driver is
93 later reloaded manually everything works correctly.
94
95 Selecting firmware per device
96 -----------------------------
97
98 Most commonly all cards on the system use the same type of firmware.
99 If you want to load a specific firmware image for a specific card, you
100 can use either the PCI bus address or serial number. The driver will
101 print which files it's looking for when it recognizes a NFP device::
102
103 nfp: Looking for firmware file in order of priority:
104 nfp: netronome/serial-00-12-34-aa-bb-cc-10-ff.nffw: not found
105 nfp: netronome/pci-0000:02:00.0.nffw: not found
106 nfp: netronome/nic_AMDA0081-0001_1x40.nffw: found, loading...
107
108 In this case if file (or link) called *serial-00-12-34-aa-bb-5d-10-ff.nffw*
109 or *pci-0000:02:00.0.nffw* is present in `/lib/firmware/netronome` this
110 firmware file will take precedence over `nic_AMDA*` files.
111
112 Note that `serial-*` and `pci-*` files are **not** automatically included
113 in initramfs, you will have to refer to documentation of appropriate tools
114 to find out how to include them.
115
116 Running firmware version
117 ------------------------
118
119 The version of the loaded firmware for a particular <netdev> interface,
120 (e.g. enp4s0), or an interface's port <netdev port> (e.g. enp4s0np0) can
121 be displayed with the ethtool command::
122
123 $ ethtool -i <netdev>
124
125 Firmware loading policy
126 -----------------------
127
128 Firmware loading policy is controlled via three HWinfo parameters
129 stored as key value pairs in the device flash:
130
131 app_fw_from_flash
132 Defines which firmware should take precedence, 'Disk' (0), 'Flash' (1) or
133 the 'Preferred' (2) firmware. When 'Preferred' is selected, the management
134 firmware makes the decision over which firmware will be loaded by comparing
135 versions of the flash firmware and the host supplied firmware.
136 This variable is configurable using the 'fw_load_policy'
137 devlink parameter.
138
139 abi_drv_reset
140 Defines if the driver should reset the firmware when
141 the driver is probed, either 'Disk' (0) if firmware was found on disk,
142 'Always' (1) reset or 'Never' (2) reset. Note that the device is always
143 reset on driver unload if firmware was loaded when the driver was probed.
144 This variable is configurable using the 'reset_dev_on_drv_probe'
145 devlink parameter.
146
147 abi_drv_load_ifc
148 Defines a list of PF devices allowed to load FW on the device.
149 This variable is not currently user configurable.
150
151 Devlink Info
152 ============
153
154 The devlink info command displays the running and stored firmware versions
155 on the device, serial number and board information.
156
157 Devlink info command example (replace PCI address)::
158
159 $ devlink dev info pci/0000:03:00.0
160 pci/0000:03:00.0:
161 driver nfp
162 serial_number CSAAMDA2001-1003000111
163 versions:
164 fixed:
165 board.id AMDA2001-1003
166 board.rev 01
167 board.manufacture CSA
168 board.model mozart
169 running:
170 fw.mgmt 22.10.0-rc3
171 fw.cpld 0x1000003
172 fw.app nic-22.09.0
173 chip.init AMDA-2001-1003 1003000111
174 stored:
175 fw.bundle_id bspbundle_1003000111
176 fw.mgmt 22.10.0-rc3
177 fw.cpld 0x0
178 chip.init AMDA-2001-1003 1003000111
179
180 Configure Device
181 ================
182
183 This section explains how to use Agilio SmartNICs running basic NIC firmware.
184
185 Configure interface link-speed
186 ------------------------------
187 The following steps explains how to change between 10G mode and 25G mode on
188 Agilio CX 2x25GbE cards. The changing of port speed must be done in order,
189 port 0 (p0) must be set to 10G before port 1 (p1) may be set to 10G.
190
191 Down the respective interface(s)::
192
193 $ ip link set dev <netdev port 0> down
194 $ ip link set dev <netdev port 1> down
195
196 Set interface link-speed to 10G::
197
198 $ ethtool -s <netdev port 0> speed 10000
199 $ ethtool -s <netdev port 1> speed 10000
200
201 Set interface link-speed to 25G::
202
203 $ ethtool -s <netdev port 0> speed 25000
204 $ ethtool -s <netdev port 1> speed 25000
205
206 Reload driver for changes to take effect::
207
208 $ rmmod nfp; modprobe nfp
209
210 Configure interface Maximum Transmission Unit (MTU)
211 ---------------------------------------------------
212
213 The MTU of interfaces can temporarily be set using the iproute2, ip link or
214 ifconfig tools. Note that this change will not persist. Setting this via
215 Network Manager, or another appropriate OS configuration tool, is
216 recommended as changes to the MTU using Network Manager can be made to
217 persist.
218
219 Set interface MTU to 9000 bytes::
220
221 $ ip link set dev <netdev port> mtu 9000
222
223 It is the responsibility of the user or the orchestration layer to set
224 appropriate MTU values when handling jumbo frames or utilizing tunnels. For
225 example, if packets sent from a VM are to be encapsulated on the card and
226 egress a physical port, then the MTU of the VF should be set to lower than
227 that of the physical port to account for the extra bytes added by the
228 additional header. If a setup is expected to see fallback traffic between
229 the SmartNIC and the kernel then the user should also ensure that the PF MTU
230 is appropriately set to avoid unexpected drops on this path.
231
232 Configure Forward Error Correction (FEC) modes
233 ----------------------------------------------
234
235 Agilio SmartNICs support FEC mode configuration, e.g. Auto, Firecode Base-R,
236 ReedSolomon and Off modes. Each physical port's FEC mode can be set
237 independently using ethtool. The supported FEC modes for an interface can
238 be viewed using::
239
240 $ ethtool <netdev>
241
242 The currently configured FEC mode can be viewed using::
243
244 $ ethtool --show-fec <netdev>
245
246 To force the FEC mode for a particular port, auto-negotiation must be disabled
247 (see the `Auto-negotiation`_ section). An example of how to set the FEC mode
248 to Reed-Solomon is::
249
250 $ ethtool --set-fec <netdev> encoding rs
251
252 Auto-negotiation
253 ----------------
254
255 To change auto-negotiation settings, the link must first be put down. After the
256 link is down, auto-negotiation can be enabled or disabled using::
257
258 ethtool -s <netdev> autoneg <on|off>
259
260 Statistics
261 ==========
262
263 Following device statistics are available through the ``ethtool -S`` interface:
264
265 .. flat-table:: NFP device statistics
266 :header-rows: 1
267 :widths: 3 1 11
268
269 * - Name
270 - ID
271 - Meaning
272
273 * - dev_rx_discards
274 - 1
275 - Packet can be discarded on the RX path for one of the following reasons:
276
277 * The NIC is not in promisc mode, and the destination MAC address
278 doesn't match the interfaces' MAC address.
279 * The received packet is larger than the max buffer size on the host.
280 I.e. it exceeds the Layer 3 MRU.
281 * There is no freelist descriptor available on the host for the packet.
282 It is likely that the NIC couldn't cache one in time.
283 * A BPF program discarded the packet.
284 * The datapath drop action was executed.
285 * The MAC discarded the packet due to lack of ingress buffer space
286 on the NIC.
287
288 * - dev_rx_errors
289 - 2
290 - A packet can be counted (and dropped) as RX error for the following
291 reasons:
292
293 * A problem with the VEB lookup (only when SR-IOV is used).
294 * A physical layer problem that causes Ethernet errors, like FCS or
295 alignment errors. The cause is usually faulty cables or SFPs.
296
297 * - dev_rx_bytes
298 - 3
299 - Total number of bytes received.
300
301 * - dev_rx_uc_bytes
302 - 4
303 - Unicast bytes received.
304
305 * - dev_rx_mc_bytes
306 - 5
307 - Multicast bytes received.
308
309 * - dev_rx_bc_bytes
310 - 6
311 - Broadcast bytes received.
312
313 * - dev_rx_pkts
314 - 7
315 - Total number of packets received.
316
317 * - dev_rx_mc_pkts
318 - 8
319 - Multicast packets received.
320
321 * - dev_rx_bc_pkts
322 - 9
323 - Broadcast packets received.
324
325 * - dev_tx_discards
326 - 10
327 - A packet can be discarded in the TX direction if the MAC is
328 being flow controlled and the NIC runs out of TX queue space.
329
330 * - dev_tx_errors
331 - 11
332 - A packet can be counted as TX error (and dropped) for one for the
333 following reasons:
334
335 * The packet is an LSO segment, but the Layer 3 or Layer 4 offset
336 could not be determined. Therefore LSO could not continue.
337 * An invalid packet descriptor was received over PCIe.
338 * The packet Layer 3 length exceeds the device MTU.
339 * An error on the MAC/physical layer. Usually due to faulty cables or
340 SFPs.
341 * A CTM buffer could not be allocated.
342 * The packet offset was incorrect and could not be fixed by the NIC.
343
344 * - dev_tx_bytes
345 - 12
346 - Total number of bytes transmitted.
347
348 * - dev_tx_uc_bytes
349 - 13
350 - Unicast bytes transmitted.
351
352 * - dev_tx_mc_bytes
353 - 14
354 - Multicast bytes transmitted.
355
356 * - dev_tx_bc_bytes
357 - 15
358 - Broadcast bytes transmitted.
359
360 * - dev_tx_pkts
361 - 16
362 - Total number of packets transmitted.
363
364 * - dev_tx_mc_pkts
365 - 17
366 - Multicast packets transmitted.
367
368 * - dev_tx_bc_pkts
369 - 18
370 - Broadcast packets transmitted.
371
372 Note that statistics unknown to the driver will be displayed as
373 ``dev_unknown_stat$ID``, where ``$ID`` refers to the second column
374 above.
375

3. 한국어 전문 번역

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

NFP 드라이버 개요

1-28

이 문서는 `GPL-2.0-only OR BSD-2-Clause` 이중 라이선스를 따릅니다.

Network Flow Processor(NFP) 커널 드라이버

Copyright (c) 2019, Netronome Systems, Inc.

Copyright (c) 2022, Corigine, Inc.

목차

  • 개요
  • 펌웨어 구하기
  • Devlink 정보
  • 장치 구성
  • 통계

이 드라이버는 Netronome과 Corigine의 NFP3800, NFP4000, NFP5000, NFP6000과 이를 탑재한 Agilio SmartNIC 제품군을 지원합니다. 각 장치의 SR-IOV physical function과 virtual function도 지원합니다.

.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
.. include:: <isonum.txt>

===========================================
Network Flow Processor (NFP) Kernel Drivers
===========================================

:Copyright: |copy| 2019, Netronome Systems, Inc.
:Copyright: |copy| 2022, Corigine, Inc.

Contents
========

- `Overview`_
- `Acquiring Firmware`_
- `Devlink Info`_
- `Configure Device`_
- `Statistics`_

Overview
========

This driver supports Netronome and Corigine's line of Network Flow Processor
devices, including the NFP3800, NFP4000, NFP5000, and NFP6000 models, which
are also incorporated in the companies' family of Agilio SmartNICs. The SR-IOV
physical and virtual functions for these devices are supported by the driver.

Acquiring Firmware

애플리케이션 펌웨어 선택과 로드 정책

29-151

펌웨어 구하기

NFP3800, NFP4000과 NFP6000은 동작하려면 애플리케이션별 펌웨어가 필요합니다. 관리 펌웨어가 지원하면 host filesystem 또는 장치 flash에서 읽을 수 있습니다.

host의 펌웨어 파일에는 card type(`AMDA-*` 문자열), media configuration 등이 들어 있습니다. `/lib/firmware/netronome`에 배치하십시오. 기본 NIC 펌웨어는 upstream `linux-firmware.git`에 있고 더 폭넓은 목록은 원문의 Corigine Support 사이트에서 받을 수 있습니다.

NVRAM의 펌웨어

최근 관리 펌웨어는 host driver probe 때 flash의 application firmware를 로드할 수 있습니다. firmware loading policy로 이 동작을 조정합니다.

devlink 또는 ethtool에 알맞은 `nic_AMDA*.nffw` 파일을 제공하면 장치 flash의 application firmware를 갱신할 수 있습니다. card와 media configuration에 맞는 이미지를 기록하는 책임은 사용자에게 있습니다. 사용 가능한 flash 공간은 card마다 다릅니다.

여러 프로젝트 다루기

NFP는 완전 프로그래밍 가능하므로 서로 다른 application을 위한 firmware image가 존재할 수 있습니다. host에서 로드할 때는 `/lib/firmware/netronome` 아래에 application 이름의 하위 디렉터리를 만들고 원하는 파일로 링크하는 방식을 권장합니다.

When using application firmware from host, we recommend placing
actual firmware files in application-named subdirectories in
`/lib/firmware/netronome` and linking the desired files, e.g.::

$ tree /lib/firmware/netronome/
/lib/firmware/netronome/
├── bpf
│   ├── nic_AMDA0081-0001_1x40.nffw
│   └── nic_AMDA0081-0001_4x10.nffw
├── flower
│   ├── nic_AMDA0081-0001_1x40.nffw
│   └── nic_AMDA0081-0001_4x10.nffw
├── nic
│   ├── nic_AMDA0081-0001_1x40.nffw
│   └── nic_AMDA0081-0001_4x10.nffw
├── nic_AMDA0081-0001_1x40.nffw -> bpf/nic_AMDA0081-0001_1x40.nffw
└── nic_AMDA0081-0001_4x10.nffw -> bpf/nic_AMDA0081-0001_4x10.nffw

3 directories, 8 files

구형 `mkinitrd`를 쓰는 배포판에서는 symbolic link 대신 hard link가 필요할 수 있습니다. 펌웨어 파일을 바꾼 뒤에는 배포판 문서에 따라 initramfs를 다시 생성해야 할 수 있습니다. 부팅 때만 잘못된 driver/firmware를 읽고 이후 수동 reload에서는 정상이라면 오래된 initramfs가 강한 징후입니다.

장치별 펌웨어 선택

대부분 시스템의 모든 card는 같은 firmware type을 씁니다. 특정 card에 별도 image를 로드하려면 PCI bus address 또는 serial number를 파일 이름에 사용합니다. NFP 장치를 인식하면 드라이버가 다음 우선순위를 로그에 출력합니다.

nfp: Looking for firmware file in order of priority:
nfp:  netronome/serial-00-12-34-aa-bb-cc-10-ff.nffw: not found
nfp:  netronome/pci-0000:02:00.0.nffw: not found

`/lib/firmware/netronome`에 `serial-*.nffw` 또는 `pci-*.nffw` 파일이나 링크가 있으면 `nic_AMDA*`보다 우선합니다. `serial-*`와 `pci-*` 파일은 initramfs에 자동 포함되지 않으므로 사용하는 도구의 문서에 따라 직접 포함해야 합니다.

실행 중인 펌웨어 버전

특정 netdev(예: `enp4s0`) 또는 포트 netdev(예: `enp4s0np0`)가 로드한 펌웨어 버전은 다음 명령으로 확인합니다.

$ ethtool -i <netdev>

펌웨어 로드 정책

로드 정책은 장치 flash에 key-value로 저장한 세 HWinfo parameter로 제어합니다.

NFP firmware loading policy
HWinfo값과 동작devlink parameter
`app_fw_from_flash``Disk`(0), `Flash`(1), `Preferred`(2). Preferred에서는 관리 펌웨어가 flash와 host 버전을 비교해 선택`fw_load_policy`
`abi_drv_reset`probe 때 `Disk`(0), `Always`(1), `Never`(2) 중 reset 정책. probe 때 firmware를 로드했다면 unload 시에는 항상 reset`reset_dev_on_drv_probe`
`abi_drv_load_ifc`장치에 firmware를 로드할 수 있는 PF 목록현재 사용자 설정 불가

flash의 HWinfo 변수와 대응하는 devlink parameter를 정리했습니다.

==================

The NFP3800, NFP4000 and NFP6000 devices require application specific firmware
to function. Application firmware can be located either on the host file system
or in the device flash (if supported by management firmware).

Firmware files on the host filesystem contain card type (`AMDA-*` string), media
config etc. They should be placed in `/lib/firmware/netronome` directory to
load firmware from the host file system.

Firmware for basic NIC operation is available in the upstream
`linux-firmware.git` repository.

A more comprehensive list of firmware can be downloaded from the
`Corigine Support site <https://www.corigine.com/DPUDownload.html>`_.

Firmware in NVRAM
-----------------

Recent versions of management firmware supports loading application
firmware from flash when the host driver gets probed. The firmware loading
policy configuration may be used to configure this feature appropriately.

Devlink or ethtool can be used to update the application firmware on the device
flash by providing the appropriate `nic_AMDA*.nffw` file to the respective
command. Users need to take care to write the correct firmware image for the
card and media configuration to flash.

Available storage space in flash depends on the card being used.

Dealing with multiple projects
------------------------------

NFP hardware is fully programmable therefore there can be different
firmware images targeting different applications.

When using application firmware from host, we recommend placing
actual firmware files in application-named subdirectories in
`/lib/firmware/netronome` and linking the desired files, e.g.::

    $ tree /lib/firmware/netronome/
    /lib/firmware/netronome/
    ├── bpf
    │   ├── nic_AMDA0081-0001_1x40.nffw
    │   └── nic_AMDA0081-0001_4x10.nffw
    ├── flower
    │   ├── nic_AMDA0081-0001_1x40.nffw
    │   └── nic_AMDA0081-0001_4x10.nffw
    ├── nic
    │   ├── nic_AMDA0081-0001_1x40.nffw
    │   └── nic_AMDA0081-0001_4x10.nffw
    ├── nic_AMDA0081-0001_1x40.nffw -> bpf/nic_AMDA0081-0001_1x40.nffw
    └── nic_AMDA0081-0001_4x10.nffw -> bpf/nic_AMDA0081-0001_4x10.nffw

    3 directories, 8 files

You may need to use hard instead of symbolic links on distributions
which use old `mkinitrd` command instead of `dracut` (e.g. Ubuntu).

After changing firmware files you may need to regenerate the initramfs
image. Initramfs contains drivers and firmware files your system may
need to boot. Refer to the documentation of your distribution to find
out how to update initramfs. Good indication of stale initramfs
is system loading wrong driver or firmware on boot, but when driver is
later reloaded manually everything works correctly.

Selecting firmware per device
-----------------------------

Most commonly all cards on the system use the same type of firmware.
If you want to load a specific firmware image for a specific card, you
can use either the PCI bus address or serial number. The driver will
print which files it's looking for when it recognizes a NFP device::

    nfp: Looking for firmware file in order of priority:
    nfp:  netronome/serial-00-12-34-aa-bb-cc-10-ff.nffw: not found
    nfp:  netronome/pci-0000:02:00.0.nffw: not found
    nfp:  netronome/nic_AMDA0081-0001_1x40.nffw: found, loading...

In this case if file (or link) called *serial-00-12-34-aa-bb-5d-10-ff.nffw*
or *pci-0000:02:00.0.nffw* is present in `/lib/firmware/netronome` this
firmware file will take precedence over `nic_AMDA*` files.

Note that `serial-*` and `pci-*` files are **not** automatically included
in initramfs, you will have to refer to documentation of appropriate tools
to find out how to include them.

Running firmware version
------------------------

The version of the loaded firmware for a particular <netdev> interface,
(e.g. enp4s0), or an interface's port <netdev port> (e.g. enp4s0np0) can
be displayed with the ethtool command::

  $ ethtool -i <netdev>

Firmware loading policy
-----------------------

Firmware loading policy is controlled via three HWinfo parameters
stored as key value pairs in the device flash:

app_fw_from_flash
    Defines which firmware should take precedence, 'Disk' (0), 'Flash' (1) or
    the 'Preferred' (2) firmware. When 'Preferred' is selected, the management
    firmware makes the decision over which firmware will be loaded by comparing
    versions of the flash firmware and the host supplied firmware.
    This variable is configurable using the 'fw_load_policy'
    devlink parameter.

abi_drv_reset
    Defines if the driver should reset the firmware when
    the driver is probed, either 'Disk' (0) if firmware was found on disk,
    'Always' (1) reset or 'Never' (2) reset. Note that the device is always
    reset on driver unload if firmware was loaded when the driver was probed.
    This variable is configurable using the 'reset_dev_on_drv_probe'
    devlink parameter.

abi_drv_load_ifc
    Defines a list of PF devices allowed to load FW on the device.
    This variable is not currently user configurable.

Devlink Info

링크 속도, MTU, FEC와 auto-negotiation

181-260

장치 구성

이 절은 기본 NIC firmware를 실행하는 Agilio SmartNIC 구성 방법을 설명합니다.

인터페이스 link speed

Agilio CX 2x25GbE card에서 10G와 25G 모드를 바꾸는 순서입니다. 10G로 내릴 때는 반드시 port 0(p0)을 먼저 설정한 다음 port 1(p1)을 설정해야 합니다.

$ ip link set dev <netdev port 0> down
$ ip link set dev <netdev port 1> down
$ ethtool -s <netdev port 0> speed 10000
$ ethtool -s <netdev port 1> speed 10000
$ ethtool -s <netdev port 0> speed 25000
$ ethtool -s <netdev port 1> speed 25000
$ rmmod nfp; modprobe nfp

MTU

iproute2의 `ip link` 또는 ifconfig로 임시 MTU를 설정할 수 있지만 재부팅 뒤에는 유지되지 않습니다. 지속 설정은 NetworkManager나 운영체제의 적절한 구성 도구를 사용하십시오.

$ ip link set dev <netdev port> mtu 9000

jumbo frame이나 tunnel을 사용할 때 알맞은 MTU를 정하는 책임은 사용자 또는 orchestration layer에 있습니다. VM 패킷을 card에서 encapsulation해 physical port로 내보내면 추가 header 공간만큼 VF MTU를 physical port보다 작게 잡아야 합니다. SmartNIC과 kernel 사이 fallback traffic도 예상한다면 PF MTU를 맞춰 이 경로의 예상 밖 drop을 막으십시오.

FEC mode

Agilio SmartNIC은 Auto, Firecode Base-R, Reed-Solomon, Off FEC를 지원합니다. physical port마다 ethtool로 독립 설정할 수 있습니다.

$ ethtool <netdev>
$ ethtool --show-fec <netdev>
$ ethtool --set-fec <netdev> encoding rs

특정 FEC를 강제하려면 먼저 auto-negotiation을 꺼야 합니다. auto-negotiation을 바꿀 때도 link를 먼저 내린 뒤 다음 명령을 사용합니다.

ethtool -s <netdev> autoneg <on|off>
================

This section explains how to use Agilio SmartNICs running basic NIC firmware.

Configure interface link-speed
------------------------------
The following steps explains how to change between 10G mode and 25G mode on
Agilio CX 2x25GbE cards. The changing of port speed must be done in order,
port 0 (p0) must be set to 10G before port 1 (p1) may be set to 10G.

Down the respective interface(s)::

  $ ip link set dev <netdev port 0> down
  $ ip link set dev <netdev port 1> down

Set interface link-speed to 10G::

  $ ethtool -s <netdev port 0> speed 10000
  $ ethtool -s <netdev port 1> speed 10000

Set interface link-speed to 25G::

  $ ethtool -s <netdev port 0> speed 25000
  $ ethtool -s <netdev port 1> speed 25000

Reload driver for changes to take effect::

  $ rmmod nfp; modprobe nfp

Configure interface Maximum Transmission Unit (MTU)
---------------------------------------------------

The MTU of interfaces can temporarily be set using the iproute2, ip link or
ifconfig tools. Note that this change will not persist. Setting this via
Network Manager, or another appropriate OS configuration tool, is
recommended as changes to the MTU using Network Manager can be made to
persist.

Set interface MTU to 9000 bytes::

  $ ip link set dev <netdev port> mtu 9000

It is the responsibility of the user or the orchestration layer to set
appropriate MTU values when handling jumbo frames or utilizing tunnels. For
example, if packets sent from a VM are to be encapsulated on the card and
egress a physical port, then the MTU of the VF should be set to lower than
that of the physical port to account for the extra bytes added by the
additional header. If a setup is expected to see fallback traffic between
the SmartNIC and the kernel then the user should also ensure that the PF MTU
is appropriately set to avoid unexpected drops on this path.

Configure Forward Error Correction (FEC) modes
----------------------------------------------

Agilio SmartNICs support FEC mode configuration, e.g. Auto, Firecode Base-R,
ReedSolomon and Off modes. Each physical port's FEC mode can be set
independently using ethtool. The supported FEC modes for an interface can
be viewed using::

  $ ethtool <netdev>

The currently configured FEC mode can be viewed using::

  $ ethtool --show-fec <netdev>

To force the FEC mode for a particular port, auto-negotiation must be disabled
(see the `Auto-negotiation`_ section). An example of how to set the FEC mode
to Reed-Solomon is::

  $ ethtool --set-fec <netdev> encoding rs

Auto-negotiation
----------------

To change auto-negotiation settings, the link must first be put down. After the
link is down, auto-negotiation can be enabled or disabled using::

  ethtool -s <netdev> autoneg <on|off>

Statistics

ethtool 장치 통계

261-374

통계

다음 장치 통계는 `ethtool -S` 인터페이스로 제공합니다.

NFP device statistics
이름ID의미
`dev_rx_discards`1promiscuous mode가 아니면서 destination MAC 불일치, host max buffer/L3 MRU 초과, host freelist descriptor 부족, BPF drop, datapath drop action 또는 NIC ingress buffer 부족 때문에 RX에서 버린 packet
`dev_rx_errors`2SR-IOV VEB lookup 문제 또는 faulty cable/SFP로 인한 FCS·alignment 같은 physical Ethernet 오류 때문에 RX error로 세고 버린 packet
`dev_rx_bytes`3전체 수신 byte
`dev_rx_uc_bytes`4수신 unicast byte
`dev_rx_mc_bytes`5수신 multicast byte
`dev_rx_bc_bytes`6수신 broadcast byte
`dev_rx_pkts`7전체 수신 packet
`dev_rx_mc_pkts`8수신 multicast packet
`dev_rx_bc_pkts`9수신 broadcast packet
`dev_tx_discards`10MAC이 flow control 상태이고 NIC TX queue 공간이 고갈되어 TX에서 버린 packet
`dev_tx_errors`11LSO의 L3/L4 offset 판별 실패, invalid PCIe descriptor, L3 length의 device MTU 초과, cable/SFP에 따른 MAC/physical 오류, CTM buffer 할당 실패 또는 NIC가 고치지 못한 잘못된 packet offset 때문에 TX error로 세고 버린 packet
`dev_tx_bytes`12전체 송신 byte
`dev_tx_uc_bytes`13송신 unicast byte
`dev_tx_mc_bytes`14송신 multicast byte
`dev_tx_bc_bytes`15송신 broadcast byte
`dev_tx_pkts`16전체 송신 packet
`dev_tx_mc_pkts`17송신 multicast packet
`dev_tx_bc_pkts`18송신 broadcast packet

카운터 ID, 트래픽 범위와 drop/error 조건을 원문 순서대로 번역했습니다.

드라이버가 알지 못하는 통계는 두 번째 열의 ID를 사용해 `dev_unknown_stat$ID` 형식으로 표시됩니다.

==========

Following device statistics are available through the ``ethtool -S`` interface:

.. flat-table:: NFP device statistics
   :header-rows: 1
   :widths: 3 1 11

   * - Name
     - ID
     - Meaning

   * - dev_rx_discards
     - 1
     - Packet can be discarded on the RX path for one of the following reasons:

        * The NIC is not in promisc mode, and the destination MAC address
          doesn't match the interfaces' MAC address.
        * The received packet is larger than the max buffer size on the host.
          I.e. it exceeds the Layer 3 MRU.
        * There is no freelist descriptor available on the host for the packet.
          It is likely that the NIC couldn't cache one in time.
        * A BPF program discarded the packet.
        * The datapath drop action was executed.
        * The MAC discarded the packet due to lack of ingress buffer space
          on the NIC.

   * - dev_rx_errors
     - 2
     - A packet can be counted (and dropped) as RX error for the following
       reasons:

       * A problem with the VEB lookup (only when SR-IOV is used).
       * A physical layer problem that causes Ethernet errors, like FCS or
         alignment errors. The cause is usually faulty cables or SFPs.

   * - dev_rx_bytes
     - 3
     - Total number of bytes received.

   * - dev_rx_uc_bytes
     - 4
     - Unicast bytes received.

   * - dev_rx_mc_bytes
     - 5
     - Multicast bytes received.

   * - dev_rx_bc_bytes
     - 6
     - Broadcast bytes received.

   * - dev_rx_pkts
     - 7
     - Total number of packets received.

   * - dev_rx_mc_pkts
     - 8
     - Multicast packets received.

   * - dev_rx_bc_pkts
     - 9
     - Broadcast packets received.

   * - dev_tx_discards
     - 10
     - A packet can be discarded in the TX direction if the MAC is
       being flow controlled and the NIC runs out of TX queue space.

   * - dev_tx_errors
     - 11
     - A packet can be counted as TX error (and dropped) for one for the
       following reasons:

       * The packet is an LSO segment, but the Layer 3 or Layer 4 offset
         could not be determined. Therefore LSO could not continue.
       * An invalid packet descriptor was received over PCIe.
       * The packet Layer 3 length exceeds the device MTU.
       * An error on the MAC/physical layer. Usually due to faulty cables or
         SFPs.
       * A CTM buffer could not be allocated.
       * The packet offset was incorrect and could not be fixed by the NIC.

   * - dev_tx_bytes
     - 12
     - Total number of bytes transmitted.

   * - dev_tx_uc_bytes
     - 13
     - Unicast bytes transmitted.

   * - dev_tx_mc_bytes
     - 14
     - Multicast bytes transmitted.

   * - dev_tx_bc_bytes
     - 15
     - Broadcast bytes transmitted.

   * - dev_tx_pkts
     - 16
     - Total number of packets transmitted.

   * - dev_tx_mc_pkts
     - 17
     - Multicast packets transmitted.

   * - dev_tx_bc_pkts
     - 18
     - Broadcast packets transmitted.

Note that statistics unknown to the driver will be displayed as
``dev_unknown_stat$ID``, where ``$ID`` refers to the second column
above.