Merge 6.4-rc5 into usb-next
[platform/kernel/linux-starfive.git] / Documentation / networking / device_drivers / ethernet / mellanox / mlx5 / devlink.rst
1 .. SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
2 .. include:: <isonum.txt>
3
4 =======
5 Devlink
6 =======
7
8 :Copyright: |copy| 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
9
10 Contents
11 ========
12
13 - `Info`_
14 - `Parameters`_
15 - `Health reporters`_
16
17 Info
18 ====
19
20 The devlink info reports the running and stored firmware versions on device.
21 It also prints the device PSID which represents the HCA board type ID.
22
23 User command example::
24
25    $ devlink dev info pci/0000:00:06.0
26       pci/0000:00:06.0:
27       driver mlx5_core
28       versions:
29          fixed:
30             fw.psid MT_0000000009
31          running:
32             fw.version 16.26.0100
33          stored:
34             fw.version 16.26.0100
35
36 Parameters
37 ==========
38
39 flow_steering_mode: Device flow steering mode
40 ---------------------------------------------
41 The flow steering mode parameter controls the flow steering mode of the driver.
42 Two modes are supported:
43
44 1. 'dmfs' - Device managed flow steering.
45 2. 'smfs' - Software/Driver managed flow steering.
46
47 In DMFS mode, the HW steering entities are created and managed through the
48 Firmware.
49 In SMFS mode, the HW steering entities are created and managed though by
50 the driver directly into hardware without firmware intervention.
51
52 SMFS mode is faster and provides better rule insertion rate compared to default DMFS mode.
53
54 User command examples:
55
56 - Set SMFS flow steering mode::
57
58     $ devlink dev param set pci/0000:06:00.0 name flow_steering_mode value "smfs" cmode runtime
59
60 - Read device flow steering mode::
61
62     $ devlink dev param show pci/0000:06:00.0 name flow_steering_mode
63       pci/0000:06:00.0:
64       name flow_steering_mode type driver-specific
65       values:
66          cmode runtime value smfs
67
68 enable_roce: RoCE enablement state
69 ----------------------------------
70 If the device supports RoCE disablement, RoCE enablement state controls device
71 support for RoCE capability. Otherwise, the control occurs in the driver stack.
72 When RoCE is disabled at the driver level, only raw ethernet QPs are supported.
73
74 To change RoCE enablement state, a user must change the driverinit cmode value
75 and run devlink reload.
76
77 User command examples:
78
79 - Disable RoCE::
80
81     $ devlink dev param set pci/0000:06:00.0 name enable_roce value false cmode driverinit
82     $ devlink dev reload pci/0000:06:00.0
83
84 - Read RoCE enablement state::
85
86     $ devlink dev param show pci/0000:06:00.0 name enable_roce
87       pci/0000:06:00.0:
88       name enable_roce type generic
89       values:
90          cmode driverinit value true
91
92 esw_port_metadata: Eswitch port metadata state
93 ----------------------------------------------
94 When applicable, disabling eswitch metadata can increase packet rate
95 up to 20% depending on the use case and packet sizes.
96
97 Eswitch port metadata state controls whether to internally tag packets with
98 metadata. Metadata tagging must be enabled for multi-port RoCE, failover
99 between representors and stacked devices.
100 By default metadata is enabled on the supported devices in E-switch.
101 Metadata is applicable only for E-switch in switchdev mode and
102 users may disable it when NONE of the below use cases will be in use:
103
104 1. HCA is in Dual/multi-port RoCE mode.
105 2. VF/SF representor bonding (Usually used for Live migration)
106 3. Stacked devices
107
108 When metadata is disabled, the above use cases will fail to initialize if
109 users try to enable them.
110
111 - Show eswitch port metadata::
112
113     $ devlink dev param show pci/0000:06:00.0 name esw_port_metadata
114       pci/0000:06:00.0:
115         name esw_port_metadata type driver-specific
116           values:
117             cmode runtime value true
118
119 - Disable eswitch port metadata::
120
121     $ devlink dev param set pci/0000:06:00.0 name esw_port_metadata value false cmode runtime
122
123 - Change eswitch mode to switchdev mode where after choosing the metadata value::
124
125     $ devlink dev eswitch set pci/0000:06:00.0 mode switchdev
126
127 hairpin_num_queues: Number of hairpin queues
128 --------------------------------------------
129 We refer to a TC NIC rule that involves forwarding as "hairpin".
130
131 Hairpin queues are mlx5 hardware specific implementation for hardware
132 forwarding of such packets.
133
134 - Show the number of hairpin queues::
135
136     $ devlink dev param show pci/0000:06:00.0 name hairpin_num_queues
137       pci/0000:06:00.0:
138         name hairpin_num_queues type driver-specific
139           values:
140             cmode driverinit value 2
141
142 - Change the number of hairpin queues::
143
144     $ devlink dev param set pci/0000:06:00.0 name hairpin_num_queues value 4 cmode driverinit
145
146 hairpin_queue_size: Size of the hairpin queues
147 ----------------------------------------------
148 Control the size of the hairpin queues.
149
150 - Show the size of the hairpin queues::
151
152     $ devlink dev param show pci/0000:06:00.0 name hairpin_queue_size
153       pci/0000:06:00.0:
154         name hairpin_queue_size type driver-specific
155           values:
156             cmode driverinit value 1024
157
158 - Change the size (in packets) of the hairpin queues::
159
160     $ devlink dev param set pci/0000:06:00.0 name hairpin_queue_size value 512 cmode driverinit
161
162 Health reporters
163 ================
164
165 tx reporter
166 -----------
167 The tx reporter is responsible for reporting and recovering of the following two error scenarios:
168
169 - tx timeout
170     Report on kernel tx timeout detection.
171     Recover by searching lost interrupts.
172 - tx error completion
173     Report on error tx completion.
174     Recover by flushing the tx queue and reset it.
175
176 tx reporter also support on demand diagnose callback, on which it provides
177 real time information of its send queues status.
178
179 User commands examples:
180
181 - Diagnose send queues status::
182
183     $ devlink health diagnose pci/0000:82:00.0 reporter tx
184
185 .. note::
186    This command has valid output only when interface is up, otherwise the command has empty output.
187
188 - Show number of tx errors indicated, number of recover flows ended successfully,
189   is autorecover enabled and graceful period from last recover::
190
191     $ devlink health show pci/0000:82:00.0 reporter tx
192
193 rx reporter
194 -----------
195 The rx reporter is responsible for reporting and recovering of the following two error scenarios:
196
197 - rx queues' initialization (population) timeout
198     Population of rx queues' descriptors on ring initialization is done
199     in napi context via triggering an irq. In case of a failure to get
200     the minimum amount of descriptors, a timeout would occur, and
201     descriptors could be recovered by polling the EQ (Event Queue).
202 - rx completions with errors (reported by HW on interrupt context)
203     Report on rx completion error.
204     Recover (if needed) by flushing the related queue and reset it.
205
206 rx reporter also supports on demand diagnose callback, on which it
207 provides real time information of its receive queues' status.
208
209 - Diagnose rx queues' status and corresponding completion queue::
210
211     $ devlink health diagnose pci/0000:82:00.0 reporter rx
212
213 NOTE: This command has valid output only when interface is up. Otherwise, the command has empty output.
214
215 - Show number of rx errors indicated, number of recover flows ended successfully,
216   is autorecover enabled, and graceful period from last recover::
217
218     $ devlink health show pci/0000:82:00.0 reporter rx
219
220 fw reporter
221 -----------
222 The fw reporter implements `diagnose` and `dump` callbacks.
223 It follows symptoms of fw error such as fw syndrome by triggering
224 fw core dump and storing it into the dump buffer.
225 The fw reporter diagnose command can be triggered any time by the user to check
226 current fw status.
227
228 User commands examples:
229
230 - Check fw heath status::
231
232     $ devlink health diagnose pci/0000:82:00.0 reporter fw
233
234 - Read FW core dump if already stored or trigger new one::
235
236     $ devlink health dump show pci/0000:82:00.0 reporter fw
237
238 .. note::
239    This command can run only on the PF which has fw tracer ownership,
240    running it on other PF or any VF will return "Operation not permitted".
241
242 fw fatal reporter
243 -----------------
244 The fw fatal reporter implements `dump` and `recover` callbacks.
245 It follows fatal errors indications by CR-space dump and recover flow.
246 The CR-space dump uses vsc interface which is valid even if the FW command
247 interface is not functional, which is the case in most FW fatal errors.
248 The recover function runs recover flow which reloads the driver and triggers fw
249 reset if needed.
250 On firmware error, the health buffer is dumped into the dmesg. The log
251 level is derived from the error's severity (given in health buffer).
252
253 User commands examples:
254
255 - Run fw recover flow manually::
256
257     $ devlink health recover pci/0000:82:00.0 reporter fw_fatal
258
259 - Read FW CR-space dump if already stored or trigger new one::
260
261     $ devlink health dump show pci/0000:82:00.1 reporter fw_fatal
262
263 .. note::
264    This command can run only on PF.
265
266 vnic reporter
267 -------------
268 The vnic reporter implements only the `diagnose` callback.
269 It is responsible for querying the vnic diagnostic counters from fw and displaying
270 them in realtime.
271
272 Description of the vnic counters:
273
274 - total_q_under_processor_handle
275         number of queues in an error state due to
276         an async error or errored command.
277 - send_queue_priority_update_flow
278         number of QP/SQ priority/SL update events.
279 - cq_overrun
280         number of times CQ entered an error state due to an overflow.
281 - async_eq_overrun
282         number of times an EQ mapped to async events was overrun.
283         comp_eq_overrun number of times an EQ mapped to completion events was
284         overrun.
285 - quota_exceeded_command
286         number of commands issued and failed due to quota exceeded.
287 - invalid_command
288         number of commands issued and failed dues to any reason other than quota
289         exceeded.
290 - nic_receive_steering_discard
291         number of packets that completed RX flow
292         steering but were discarded due to a mismatch in flow table.
293
294 User commands examples:
295
296 - Diagnose PF/VF vnic counters::
297
298         $ devlink health diagnose pci/0000:82:00.1 reporter vnic
299
300 - Diagnose representor vnic counters (performed by supplying devlink port of the
301   representor, which can be obtained via devlink port command)::
302
303         $ devlink health diagnose pci/0000:82:00.1/65537 reporter vnic
304
305 .. note::
306    This command can run over all interfaces such as PF/VF and representor ports.