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