xref: /freebsd/share/man/man4/ena.4 (revision 33b8c039a960bcff3471baf5929558c4d1500727)
1.\" SPDX-License-Identifier: BSD-2-Clause
2.\"
3.\" Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\"
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in
15.\"    the documentation and/or other materials provided with the
16.\"    distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29.\"
30.\" $FreeBSD$
31.\"
32.Dd June 4, 2021
33.Dt ENA 4
34.Os
35.Sh NAME
36.Nm ena
37.Nd "FreeBSD kernel driver for Elastic Network Adapter (ENA) family"
38.Sh SYNOPSIS
39To compile this driver into the kernel,
40place the following line in the
41kernel configuration file:
42.Bd -ragged -offset indent
43.Cd "device ena"
44.Ed
45.Pp
46Alternatively, to load the driver as a
47module at boot time, place the following line in
48.Xr loader.conf 5 :
49.Bd -literal -offset indent
50if_ena_load="YES"
51.Ed
52.Sh DESCRIPTION
53The ENA is a networking interface designed to make good use of modern CPU
54features and system architectures.
55.Pp
56The ENA device exposes a lightweight management interface with a
57minimal set of memory mapped registers and extendable command set
58through an Admin Queue.
59.Pp
60The driver supports a range of ENA devices, is link-speed independent
61(i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has
62a negotiated and extendable feature set.
63.Pp
64Some ENA devices support SR-IOV.
65This driver is used for both the SR-IOV Physical Function (PF) and Virtual
66Function (VF) devices.
67.Pp
68The ENA devices enable high speed and low overhead network traffic
69processing by providing multiple Tx/Rx queue pairs (the maximum number
70is advertised by the device via the Admin Queue), a dedicated MSI-X
71interrupt vector per Tx/Rx queue pair, and CPU cacheline optimized
72data placement.
73.Pp
74The
75.Nm
76driver supports industry standard TCP/IP offload features such
77as checksum offload and TCP transmit segmentation offload (TSO).
78Receive-side scaling (RSS) is supported for multi-core scaling.
79.Pp
80The
81.Nm
82driver and its corresponding devices implement health
83monitoring mechanisms such as watchdog, enabling the device and driver
84to recover in a manner transparent to the application, as well as
85debug logs.
86.Pp
87Some of the ENA devices support a working mode called Low-latency
88Queue (LLQ), which saves several more microseconds.
89.Pp
90Support for the
91.Xr netmap 4
92framework is provided by the
93.Nm
94driver.
95Kernel must be built with the DEV_NETMAP option to be able to use this feature.
96.Sh HARDWARE
97Supported PCI vendor ID/device IDs:
98.Pp
99.Bl -bullet -compact
100.It
1011d0f:0ec2 - ENA PF
102.It
1031d0f:1ec2 - ENA PF with LLQ support
104.It
1051d0f:ec20 - ENA VF
106.It
1071d0f:ec21 - ENA VF with LLQ support
108.El
109.Sh LOADER TUNABLES
110The
111.Nm
112driver's behavior can be changed using run-time or boot-time sysctl
113arguments.
114The boot-time arguments can be set at the
115.Xr loader 8
116prompt before booting the kernel, or stored in the
117.Xr loader.conf 5 .
118The run-time arguments can be set using the
119.Xr sysctl 8
120command.
121.Pp
122Boot-time tunables:
123.Bl -tag -width indent
124.It Va hw.ena.enable_9k_mbufs
125Use 9k mbufs for the Rx descriptors.
126The default is 0.
127If the node value is set to 1, 9k mbufs will be used for the Rx buffers.
128If set to 0, page size mbufs will be used instead.
129.Pp
130Using 9k buffers for Rx can improve Rx throughput, but in low memory conditions
131it might increase allocation time, as the system has to look for 3 contiguous
132pages.
133This can further lead to OS instability, together with ENA driver reset and NVMe
134timeouts.
135If network performance is critical and memory capacity is sufficient, the 9k
136mbufs can be used.
137.It Va hw.ena.force_large_llq_headers
138Force the driver to use large LLQ headers (224 bytes).
139The default is 0.
140If the node value is set to 0, the regular size LLQ header will be used, which
141is 96B.
142In some cases, the packet header can be bigger than this (for example -
143IPv6 with multiple extensions).
144In such a situation, the large LLQ headers should be used by setting this node
145value to 1.
146This will take effect only if the device supports both LLQ and large LLQ
147headers.
148Otherwise, it will fallback to the no LLQ mode or regular header size.
149.Pp
150Increasing LLQ header size reduces the size of the Tx queue by half, so it may
151affect the number of dropped Tx packets.
152.El
153.Pp
154Run-time tunables:
155.Bl -tag -width indent
156.It Va hw.ena.log_level
157Controls extra logging verbosity of the driver.
158The default is 2.
159The higher the logging level, the more logs will be printed out. 0 means all
160extra logs are disabled and only error logs will be printed out.
161Default value (2) reports errors, warnings and is verbose about driver
162operation.
163.Pp
164The possible flags are:
165.Pp
166.Bl -bullet -compact
167.It
1680 - ENA_ERR  - Enable driver error messages and ena_com error logs.
169.It
1701 - ENA_WARN - Enable logs for non-critical errors.
171.It
1722 - ENA_INFO - Make the driver more verbose about its actions.
173.It
1743 - ENA_DBG  - Enable debug logs.
175.El
176.Pp
177NOTE: In order to enable logging on the Tx/Rx data path, driver must be compiled
178with ENA_LOG_IO_ENABLE compilation flag.
179.Pp
180Example:
181To enable logs for errors and warnings, the following command should be used:
182.Bd -literal -offset indent
183sysctl hw.ena.log_level=1
184.Ed
185.It Va dev.ena.X.io_queues_nb
186Number of the currently allocated and used IO queues.
187The default is max_num_io_queues.
188Controls the number of IO queue pairs (Tx/Rx). As this call has to reallocate
189the queues, it will reset the interface and restart all the queues - this means
190that everything, which was currently held in the queue, will be lost, leading to
191potential packet drops.
192.Pp
193This call can fail if the system isn't able to provide the driver with enough
194resources.
195In that situation, the driver will try to revert the previous number of the IO
196queues.
197If this also fails, the device reset will be triggered.
198.Pp
199Example:
200To use only 2 Tx and Rx queues for the device ena1, the following command should
201be used:
202.Bd -literal -offset indent
203sysctl dev.ena.1.io_queues_nb=2
204.Ed
205.It Va dev.ena.X.rx_queue_size
206Size of the Rx queue.
207The default is 1024.
208Controls the number of IO descriptors for each Rx queue.
209The user may want to increase the Rx queue size if they observe a high number of
210Rx drops in the driver's statistics.
211For performance reasons, the Rx queue size must be a power of 2.
212.Pp
213This call can fail if the system isn't able to provide the driver with enough
214resources.
215In that situation, the driver will try to revert to the previous number of the
216descriptors.
217If this also fails, the device reset will be triggered.
218.Pp
219Example:
220To increase Rx ring size to 8K descriptors for the device ena0, the following
221command should be used:
222.Bd -literal -offset indent
223sysctl dev.ena.0.rx_queue_size=8192
224.Ed
225.It Va dev.ena.X.buf_ring_size
226Size of the Tx buffer ring (drbr).
227The default is 4096.
228Input must be a power of 2.
229Controls the number of mbufs that can be held in the Tx buffer ring.
230The drbr is used as a multiple-producer, single-consumer lockless ring for
231buffering extra mbufs coming from the stack in case the Tx procedure is busy
232sending the packets, or the Tx ring is full.
233Increasing the size of the buffer ring may reduce the number of Tx packets being
234dropped in case of a big Tx burst, which cannot be handled by the IO queue
235immediately.
236Each Tx queue has its own drbr.
237.Pp
238It is recommended to keep the drbr with at least the default value, but in case
239the system lacks the resources, it can be reduced.
240This call can fail if the system is not able to provide the driver with enough
241resources.
242In that situation, the driver will try to revert to the previous number of the
243drbr and trigger the device reset.
244.Pp
245Example:
246To set drbr size for interface ena0 to 2048, the following command should
247be used:
248.Bd -literal -offset indent
249sysctl dev.ena.0.buf_ring_size=2048
250.Ed
251.It Va dev.ena.X.eni_metrics.sample_interval
252Interval in seconds for updating ENI metrics.
253The default is 0.
254Determines how often (if ever) the ENI metrics should be updated.
255The ENI metrics are being updated asynchronously in a timer service in order to
256avoid admin queue overload by sysctl node reading.
257The value in this node controls the interval between issuing admin commands to
258the device, which will update the ENI metrics values.
259.Pp
260If some application is periodically monitoring the eni_metrics, then the ENI
261metrics interval can be adjusted accordingly.
262Value 0 turns off the update completely.
263Value 1 is the minimum interval and is equal to 1 second.
264The maximum allowed update interval is 1 hour.
265.Pp
266Example:
267To update ENI metrics for the device ena1 every 10 seconds, the following
268command should be used:
269.Bd -literal -offset indent
270sysctl dev.ena.1.eni_metrics.sample_interval=10
271.Ed
272.El
273.Sh DIAGNOSTICS
274.Ss Device initialization phase
275.Bl -diag
276.It ena%d: failed to init mmio read less
277.Pp
278Error occurred during initialization of the mmio register read request.
279.It ena%d: Can not reset device
280.Pp
281Device could not be reset.
282.br
283Device may not be responding or is already during reset.
284.It ena%d: device version is too low
285.Pp
286Version of the controller is too old and it is not supported by the driver.
287.It ena%d: Invalid dma width value %d
288.Pp
289The controller is unable to request dma transaction width.
290.br
291Device stopped responding or it demanded invalid value.
292.It ena%d: Can not initialize ena admin queue with device
293.Pp
294Initialization of the Admin Queue failed.
295.br
296Device may not be responding or there was a problem with initialization of
297the resources.
298.It ena%d: Cannot get attribute for ena device rc: %d
299.Pp
300Failed to get attributes of the device from the controller.
301.It ena%d: Cannot configure aenq groups rc: %d
302.Pp
303Errors occurred when trying to configure AENQ groups.
304.El
305.Ss Driver initialization/shutdown phase
306.Bl -diag
307.It ena%d: PCI resource allocation failed!
308.It ena%d: failed to pmap registers bar
309.It ena%d: can not allocate ifnet structure
310.It ena%d: Error with network interface setup
311.It ena%d: Failed to enable and set the admin interrupts
312.It ena%d: Error, MSI-X is already enabled
313.It ena%d: Failed to enable MSIX, vectors %d rc %d
314.It ena%d: Not enough number of MSI-X allocated: %d
315.It ena%d: Error with MSI-X enablement
316.It ena%d: could not allocate irq vector: %d
317.It ena%d: unable to allocate bus resource: registers!
318.It ena%d: unable to allocate bus resource: msix!
319.Pp
320Resource allocation failed when initializing the device.
321.br
322Driver will not be attached.
323.It ena%d: ENA device init failed (err: %d)
324.It ena%d: Cannot initialize device
325.Pp
326Device initialization failed.
327.br
328Driver will not be attached.
329.It ena%d: failed to register interrupt handler for irq %ju: %d
330.Pp
331Error occurred when trying to register Admin Queue interrupt handler.
332.It ena%d: Cannot setup mgmnt queue intr
333.Pp
334Error occurred during configuration of the Admin Queue interrupts.
335.It ena%d: Enable MSI-X failed
336.Pp
337Configuration of the MSI-X for Admin Queue failed.
338.br
339There could be lack of resources or interrupts could not have been configured.
340.br
341Driver will not be attached.
342.It ena%d: VLAN is in use, detach first
343.Pp
344VLANs are being used when trying to detach the driver.
345.br
346VLANs must be detached first and then detach routine have to be called again.
347.It ena%d: Unmapped RX DMA tag associations
348.It ena%d: Unmapped TX DMA tag associations
349.Pp
350Error occurred when trying to destroy RX/TX DMA tag.
351.It ena%d: Cannot init indirect table
352.It ena%d: Cannot fill indirect table
353.It ena%d: Cannot fill hash function
354.It ena%d: Cannot fill hash control
355.It ena%d: WARNING: RSS was not properly initialized, it will affect bandwidth
356.Pp
357Error occurred during initialization of one of RSS resources.
358.br
359The device will work with reduced performance because all RX packets will be
360passed to queue 0 and there will be no hash information.
361.It ena%d: LLQ is not supported. Fallback to host mode policy.
362.It ena%d: Failed to configure the device mode. Fallback to host mode policy.
363.It ena%d: unable to allocate LLQ bar resource. Fallback to host mode policy.
364.Pp
365Error occured during Low-latency Queue mode setup.
366.br
367The device will work, but without the LLQ performance gain.
368.It ena%d: failed to enable write combining.
369.Pp
370Error occured while setting the Write Combining mode, required for the LLQ.
371.It ena%d: failed to tear down irq: %d
372.It ena%d: dev has no parent while releasing res for irq: %d
373Release of the interrupts failed.
374.El
375.Ss Additional diagnostic
376.Bl -diag
377.It ena%d: Invalid MTU setting. new_mtu: %d max_mtu: %d min mtu: %d
378.Pp
379Requested MTU value is not supported and will not be set.
380.It ena%d: Failed to set MTU to %d
381.Pp
382This message appears when either MTU change feature is not supported, or device
383communication error has occured.
384.It ena%d: Keep alive watchdog timeout.
385.Pp
386Device stopped responding and will be reset.
387.It ena%d: Found a Tx that wasn't completed on time, qid %d, index %d.
388.Pp
389Packet was pushed to the NIC but not sent within given time limit.
390.br
391It may be caused by hang of the IO queue.
392.It ena%d: The number of lost tx completion is aboce the threshold (%d > %d). Reset the device
393.Pp
394If too many Tx weren't completed on time the device is going to be reset.
395.br
396It may be caused by hanged queue or device.
397.It ena%d: Trigger reset is on
398.Pp
399Device will be reset.
400.br
401Reset is triggered either by watchdog or if too many TX packets were not
402completed on time.
403.It ena%d: device reset scheduled but trigger_reset is off
404.Pp
405Reset task has been triggered, but the driver did not request it.
406.br
407Device reset will not be performed.
408.It ena%d: Device reset failed
409.Pp
410Error occured while trying to reset the device.
411.It ena%d: Cannot initialize device
412.It ena%d: Error, mac address are different
413.It ena%d: Error, device max mtu is smaller than ifp MTU
414.It ena%d: Validation of device parameters failed
415.It ena%d: Enable MSI-X failed
416.It ena%d: Failed to create I/O queues
417.It ena%d: Reset attempt failed. Can not reset the device
418.Pp
419Error occured while trying to restore the device after reset.
420.It ena%d: Device reset completed successfully, Driver info: %s
421.Pp
422Device has been correctly restored after reset and is ready to use.
423.It ena%d: Allocation for Tx Queue %u failed
424.It ena%d: Allocation for Rx Queue %u failed
425.It ena%d: Unable to create Rx DMA map for buffer %d
426.It ena%d: Failed to create io TX queue #%d rc: %d
427.It ena%d: Failed to get TX queue handlers. TX queue num %d rc: %d
428.It ena%d: Failed to create io RX queue[%d] rc: %d
429.It ena%d: Failed to get RX queue handlers. RX queue num %d rc: %d
430.It ena%d: could not allocate irq vector: %d
431.It ena%d: failed to register interrupt handler for irq %ju: %d
432.Pp
433IO resources initialization failed.
434.br
435Interface will not be brought up.
436.It ena%d: LRO[%d] Initialization failed!
437.Pp
438Initialization of the LRO for the RX ring failed.
439.It ena%d: failed to alloc buffer for rx queue
440.It ena%d: failed to add buffer for rx queue %d
441.It ena%d: refilled rx qid %d with only %d mbufs (from %d)
442.Pp
443Allocation of resources used on RX path failed.
444.br
445If happened during initialization of the IO queue, the interface will not be
446brought up.
447.It ena%d: NULL mbuf in rx_info
448.Pp
449Error occured while assembling mbuf from descriptors.
450.It ena%d: tx_info doesn't have valid mbuf
451.It ena%d: Invalid req_id: %hu
452.It ena%d: failed to prepare tx bufs
453.Pp
454Error occured while preparing a packet for transmission.
455.It ena%d: ioctl promisc/allmulti
456.Pp
457IOCTL request for the device to work in promiscuous/allmulti mode.
458.br
459See
460.Xr ifconfig 8
461for more details.
462.El
463.Sh SUPPORT
464If an issue is identified with the released source code with a supported
465adapter, please email the specific information related to the issue to
466.Aq Mt mk@semihalf.com ,
467.Aq Mt ar@semihalf.com
468and
469.Aq Mt mw@semihalf.com .
470.Sh SEE ALSO
471.Xr netmap 4 ,
472.Xr vlan 4 ,
473.Xr ifconfig 8
474.Sh HISTORY
475The
476.Nm
477driver first appeared in
478.Fx 11.1 .
479.Sh AUTHORS
480The
481.Nm
482driver was written by
483.An Semihalf .
484