xref: /freebsd/share/man/man4/ena.4 (revision 13ec1e3155c7e9bf037b12af186351b7fa9b9450)
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
74When RSS is enabled, each Tx/Rx queue pair is bound to a corresponding
75CPU core and its NUMA domain. The order of those bindings is based on
76the RSS bucket mapping. For builds with RSS support disabled, the
77CPU and NUMA management is left to the kernel.
78.Pp
79The
80.Nm
81driver supports industry standard TCP/IP offload features such
82as checksum offload and TCP transmit segmentation offload (TSO).
83Receive-side scaling (RSS) is supported for multi-core scaling.
84.Pp
85The
86.Nm
87driver and its corresponding devices implement health
88monitoring mechanisms such as watchdog, enabling the device and driver
89to recover in a manner transparent to the application, as well as
90debug logs.
91.Pp
92Some of the ENA devices support a working mode called Low-latency
93Queue (LLQ), which saves several more microseconds.
94.Pp
95Support for the
96.Xr netmap 4
97framework is provided by the
98.Nm
99driver.
100Kernel must be built with the DEV_NETMAP option to be able to use this feature.
101.Sh HARDWARE
102Supported PCI vendor ID/device IDs:
103.Pp
104.Bl -bullet -compact
105.It
1061d0f:0ec2 - ENA PF
107.It
1081d0f:1ec2 - ENA PF with LLQ support
109.It
1101d0f:ec20 - ENA VF
111.It
1121d0f:ec21 - ENA VF with LLQ support
113.El
114.Sh LOADER TUNABLES
115The
116.Nm
117driver's behavior can be changed using run-time or boot-time sysctl
118arguments.
119The boot-time arguments can be set at the
120.Xr loader 8
121prompt before booting the kernel, or stored in the
122.Xr loader.conf 5 .
123The run-time arguments can be set using the
124.Xr sysctl 8
125command.
126.Pp
127Boot-time tunables:
128.Bl -tag -width indent
129.It Va hw.ena.enable_9k_mbufs
130Use 9k mbufs for the Rx descriptors.
131The default is 0.
132If the node value is set to 1, 9k mbufs will be used for the Rx buffers.
133If set to 0, page size mbufs will be used instead.
134.Pp
135Using 9k buffers for Rx can improve Rx throughput, but in low memory conditions
136it might increase allocation time, as the system has to look for 3 contiguous
137pages.
138This can further lead to OS instability, together with ENA driver reset and NVMe
139timeouts.
140If network performance is critical and memory capacity is sufficient, the 9k
141mbufs can be used.
142.It Va hw.ena.force_large_llq_headers
143Force the driver to use large LLQ headers (224 bytes).
144The default is 0.
145If the node value is set to 0, the regular size LLQ header will be used, which
146is 96B.
147In some cases, the packet header can be bigger than this (for example -
148IPv6 with multiple extensions).
149In such a situation, the large LLQ headers should be used by setting this node
150value to 1.
151This will take effect only if the device supports both LLQ and large LLQ
152headers.
153Otherwise, it will fallback to the no LLQ mode or regular header size.
154.Pp
155Increasing LLQ header size reduces the size of the Tx queue by half, so it may
156affect the number of dropped Tx packets.
157.El
158.Pp
159Run-time tunables:
160.Bl -tag -width indent
161.It Va hw.ena.log_level
162Controls extra logging verbosity of the driver.
163The default is 2.
164The higher the logging level, the more logs will be printed out. 0 means all
165extra logs are disabled and only error logs will be printed out.
166Default value (2) reports errors, warnings and is verbose about driver
167operation.
168.Pp
169The possible flags are:
170.Pp
171.Bl -bullet -compact
172.It
1730 - ENA_ERR  - Enable driver error messages and ena_com error logs.
174.It
1751 - ENA_WARN - Enable logs for non-critical errors.
176.It
1772 - ENA_INFO - Make the driver more verbose about its actions.
178.It
1793 - ENA_DBG  - Enable debug logs.
180.El
181.Pp
182NOTE: In order to enable logging on the Tx/Rx data path, driver must be compiled
183with ENA_LOG_IO_ENABLE compilation flag.
184.Pp
185Example:
186To enable logs for errors and warnings, the following command should be used:
187.Bd -literal -offset indent
188sysctl hw.ena.log_level=1
189.Ed
190.It Va dev.ena.X.io_queues_nb
191Number of the currently allocated and used IO queues.
192The default is max_num_io_queues.
193Controls the number of IO queue pairs (Tx/Rx). As this call has to reallocate
194the queues, it will reset the interface and restart all the queues - this means
195that everything, which was currently held in the queue, will be lost, leading to
196potential packet drops.
197.Pp
198This call can fail if the system isn't able to provide the driver with enough
199resources.
200In that situation, the driver will try to revert the previous number of the IO
201queues.
202If this also fails, the device reset will be triggered.
203.Pp
204Example:
205To use only 2 Tx and Rx queues for the device ena1, the following command should
206be used:
207.Bd -literal -offset indent
208sysctl dev.ena.1.io_queues_nb=2
209.Ed
210.It Va dev.ena.X.rx_queue_size
211Size of the Rx queue.
212The default is 1024.
213Controls the number of IO descriptors for each Rx queue.
214The user may want to increase the Rx queue size if they observe a high number of
215Rx drops in the driver's statistics.
216For performance reasons, the Rx queue size must be a power of 2.
217.Pp
218This call can fail if the system isn't able to provide the driver with enough
219resources.
220In that situation, the driver will try to revert to the previous number of the
221descriptors.
222If this also fails, the device reset will be triggered.
223.Pp
224Example:
225To increase Rx ring size to 8K descriptors for the device ena0, the following
226command should be used:
227.Bd -literal -offset indent
228sysctl dev.ena.0.rx_queue_size=8192
229.Ed
230.It Va dev.ena.X.buf_ring_size
231Size of the Tx buffer ring (drbr).
232The default is 4096.
233Input must be a power of 2.
234Controls the number of mbufs that can be held in the Tx buffer ring.
235The drbr is used as a multiple-producer, single-consumer lockless ring for
236buffering extra mbufs coming from the stack in case the Tx procedure is busy
237sending the packets, or the Tx ring is full.
238Increasing the size of the buffer ring may reduce the number of Tx packets being
239dropped in case of a big Tx burst, which cannot be handled by the IO queue
240immediately.
241Each Tx queue has its own drbr.
242.Pp
243It is recommended to keep the drbr with at least the default value, but in case
244the system lacks the resources, it can be reduced.
245This call can fail if the system is not able to provide the driver with enough
246resources.
247In that situation, the driver will try to revert to the previous number of the
248drbr and trigger the device reset.
249.Pp
250Example:
251To set drbr size for interface ena0 to 2048, the following command should
252be used:
253.Bd -literal -offset indent
254sysctl dev.ena.0.buf_ring_size=2048
255.Ed
256.It Va dev.ena.X.eni_metrics.sample_interval
257Interval in seconds for updating ENI metrics.
258The default is 0.
259Determines how often (if ever) the ENI metrics should be updated.
260The ENI metrics are being updated asynchronously in a timer service in order to
261avoid admin queue overload by sysctl node reading.
262The value in this node controls the interval between issuing admin commands to
263the device, which will update the ENI metrics values.
264.Pp
265If some application is periodically monitoring the eni_metrics, then the ENI
266metrics interval can be adjusted accordingly.
267Value 0 turns off the update completely.
268Value 1 is the minimum interval and is equal to 1 second.
269The maximum allowed update interval is 1 hour.
270.Pp
271Example:
272To update ENI metrics for the device ena1 every 10 seconds, the following
273command should be used:
274.Bd -literal -offset indent
275sysctl dev.ena.1.eni_metrics.sample_interval=10
276.Ed
277.It Va dev.ena.X.rss.indir_table_size
278RSS indirection table size.
279The default is 128.
280Returns the number of entries in the RSS indirection table.
281.Pp
282Example:
283To read the RSS indirection table size, the following command should be used:
284.Bd -literal -offset indent
285sysctl dev.ena.0.rss.indir_table_size
286.Ed
287.It Va dev.ena.X.rss.indir_table
288RSS indirection table mapping.
289The default is x:y key-pairs of indir_table_size length.
290Updates selected indices of the RSS indirection table.
291.Pp
292The entry string consists of one or more x:y keypairs, where x stands for
293the table index and y for its new value. Table indices that don't need to be
294updated can be omitted from the string and will retain their existing values.
295.Pp
296If an index is entered more than once, the last value is used.
297.Pp
298Example:
299To update two selected indices in the RSS indirection table, e.g. setting index
3000 to queue 5 and then index 5 to queue 0, the following command should be used:
301.Bd -literal -offset indent
302sysctl dev.ena.0.rss.indir_table="0:5 5:0"
303.Ed
304.It Va dev.ena.X.rss.key
305RSS hash key.
306The default is 40 bytes long randomly generated hash key.
307Controls the RSS Toeplitz hash algorithm key value.
308.Pp
309Only available when driver compiled without the kernel side RSS support.
310.Pp
311Example:
312To change the RSS hash key value to
313.Pp
3140x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
315.br
3160x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
317.br
3180xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
319.br
3200x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
321.br
3220x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
323.Pp
324the following command should be used:
325.Bd -literal -offset indent
326sysctl dev.ena.0.rss.key=6d5a56da255b0ec24167253d43a38fb0d0ca2bcbae7b30b477cb2da38030f20c6a42b73bbeac01fa
327.Ed
328.El
329.Sh DIAGNOSTICS
330.Ss Device initialization phase
331.Bl -diag
332.It ena%d: failed to init mmio read less
333.Pp
334Error occurred during initialization of the mmio register read request.
335.It ena%d: Can not reset device
336.Pp
337Device could not be reset.
338.br
339Device may not be responding or is already during reset.
340.It ena%d: device version is too low
341.Pp
342Version of the controller is too old and it is not supported by the driver.
343.It ena%d: Invalid dma width value %d
344.Pp
345The controller is unable to request dma transaction width.
346.br
347Device stopped responding or it demanded invalid value.
348.It ena%d: Can not initialize ena admin queue with device
349.Pp
350Initialization of the Admin Queue failed.
351.br
352Device may not be responding or there was a problem with initialization of
353the resources.
354.It ena%d: Cannot get attribute for ena device rc: %d
355.Pp
356Failed to get attributes of the device from the controller.
357.It ena%d: Cannot configure aenq groups rc: %d
358.Pp
359Errors occurred when trying to configure AENQ groups.
360.El
361.Ss Driver initialization/shutdown phase
362.Bl -diag
363.It ena%d: PCI resource allocation failed!
364.It ena%d: failed to pmap registers bar
365.It ena%d: can not allocate ifnet structure
366.It ena%d: Error with network interface setup
367.It ena%d: Failed to enable and set the admin interrupts
368.It ena%d: Error, MSI-X is already enabled
369.It ena%d: Failed to enable MSIX, vectors %d rc %d
370.It ena%d: Not enough number of MSI-X allocated: %d
371.It ena%d: Error with MSI-X enablement
372.It ena%d: could not allocate irq vector: %d
373.It ena%d: unable to allocate bus resource: registers!
374.It ena%d: unable to allocate bus resource: msix!
375.Pp
376Resource allocation failed when initializing the device.
377.br
378Driver will not be attached.
379.It ena%d: ENA device init failed (err: %d)
380.It ena%d: Cannot initialize device
381.Pp
382Device initialization failed.
383.br
384Driver will not be attached.
385.It ena%d: failed to register interrupt handler for irq %ju: %d
386.Pp
387Error occurred when trying to register Admin Queue interrupt handler.
388.It ena%d: Cannot setup mgmnt queue intr
389.Pp
390Error occurred during configuration of the Admin Queue interrupts.
391.It ena%d: Enable MSI-X failed
392.Pp
393Configuration of the MSI-X for Admin Queue failed.
394.br
395There could be lack of resources or interrupts could not have been configured.
396.br
397Driver will not be attached.
398.It ena%d: VLAN is in use, detach first
399.Pp
400VLANs are being used when trying to detach the driver.
401.br
402VLANs must be detached first and then detach routine have to be called again.
403.It ena%d: Unmapped RX DMA tag associations
404.It ena%d: Unmapped TX DMA tag associations
405.Pp
406Error occurred when trying to destroy RX/TX DMA tag.
407.It ena%d: Cannot init indirect table
408.It ena%d: Cannot fill indirect table
409.It ena%d: Cannot fill hash function
410.It ena%d: Cannot fill hash control
411.It ena%d: WARNING: RSS was not properly initialized, it will affect bandwidth
412.Pp
413Error occurred during initialization of one of RSS resources.
414.br
415The device will work with reduced performance because all RX packets will be
416passed to queue 0 and there will be no hash information.
417.It ena%d: LLQ is not supported. Fallback to host mode policy.
418.It ena%d: Failed to configure the device mode. Fallback to host mode policy.
419.It ena%d: unable to allocate LLQ bar resource. Fallback to host mode policy.
420.Pp
421Error occurred during Low-latency Queue mode setup.
422.br
423The device will work, but without the LLQ performance gain.
424.It ena%d: failed to enable write combining.
425.Pp
426Error occurred while setting the Write Combining mode, required for the LLQ.
427.It ena%d: failed to tear down irq: %d
428.It ena%d: dev has no parent while releasing res for irq: %d
429Release of the interrupts failed.
430.El
431.Ss Additional diagnostic
432.Bl -diag
433.It ena%d: Invalid MTU setting. new_mtu: %d max_mtu: %d min mtu: %d
434.Pp
435Requested MTU value is not supported and will not be set.
436.It ena%d: Failed to set MTU to %d
437.Pp
438This message appears when either MTU change feature is not supported, or device
439communication error has occurred.
440.It ena%d: Keep alive watchdog timeout.
441.Pp
442Device stopped responding and will be reset.
443.It ena%d: Found a Tx that wasn't completed on time, qid %d, index %d.
444.Pp
445Packet was pushed to the NIC but not sent within given time limit.
446.br
447It may be caused by hang of the IO queue.
448.It ena%d: The number of lost tx completion is above the threshold (%d > %d). Reset the device
449.Pp
450If too many Tx weren't completed on time the device is going to be reset.
451.br
452It may be caused by hanged queue or device.
453.It ena%d: Trigger reset is on
454.Pp
455Device will be reset.
456.br
457Reset is triggered either by watchdog or if too many TX packets were not
458completed on time.
459.It ena%d: device reset scheduled but trigger_reset is off
460.Pp
461Reset task has been triggered, but the driver did not request it.
462.br
463Device reset will not be performed.
464.It ena%d: Device reset failed
465.Pp
466Error occurred while trying to reset the device.
467.It ena%d: Cannot initialize device
468.It ena%d: Error, mac address are different
469.It ena%d: Error, device max mtu is smaller than ifp MTU
470.It ena%d: Validation of device parameters failed
471.It ena%d: Enable MSI-X failed
472.It ena%d: Failed to create I/O queues
473.It ena%d: Reset attempt failed. Can not reset the device
474.Pp
475Error occurred while trying to restore the device after reset.
476.It ena%d: Device reset completed successfully, Driver info: %s
477.Pp
478Device has been correctly restored after reset and is ready to use.
479.It ena%d: Allocation for Tx Queue %u failed
480.It ena%d: Allocation for Rx Queue %u failed
481.It ena%d: Unable to create Rx DMA map for buffer %d
482.It ena%d: Failed to create io TX queue #%d rc: %d
483.It ena%d: Failed to get TX queue handlers. TX queue num %d rc: %d
484.It ena%d: Failed to create io RX queue[%d] rc: %d
485.It ena%d: Failed to get RX queue handlers. RX queue num %d rc: %d
486.It ena%d: could not allocate irq vector: %d
487.It ena%d: failed to register interrupt handler for irq %ju: %d
488.Pp
489IO resources initialization failed.
490.br
491Interface will not be brought up.
492.It ena%d: LRO[%d] Initialization failed!
493.Pp
494Initialization of the LRO for the RX ring failed.
495.It ena%d: failed to alloc buffer for rx queue
496.It ena%d: failed to add buffer for rx queue %d
497.It ena%d: refilled rx qid %d with only %d mbufs (from %d)
498.Pp
499Allocation of resources used on RX path failed.
500.br
501If happened during initialization of the IO queue, the interface will not be
502brought up.
503.It ena%d: NULL mbuf in rx_info
504.Pp
505Error occurred while assembling mbuf from descriptors.
506.It ena%d: tx_info doesn't have valid mbuf
507.It ena%d: Invalid req_id: %hu
508.It ena%d: failed to prepare tx bufs
509.Pp
510Error occurred while preparing a packet for transmission.
511.It ena%d: ioctl promisc/allmulti
512.Pp
513IOCTL request for the device to work in promiscuous/allmulti mode.
514.br
515See
516.Xr ifconfig 8
517for more details.
518.El
519.Sh SUPPORT
520If an issue is identified with the released source code with a supported
521adapter, please email the specific information related to the issue to
522.Aq Mt mk@semihalf.com ,
523.Aq Mt dgr@semihalf.com
524and
525.Aq Mt mw@semihalf.com .
526.Sh SEE ALSO
527.Xr netmap 4 ,
528.Xr vlan 4 ,
529.Xr ifconfig 8
530.Sh HISTORY
531The
532.Nm
533driver first appeared in
534.Fx 11.1 .
535.Sh AUTHORS
536The
537.Nm
538driver was written by
539.An Semihalf .
540