git: 97e84c587d6f - main - ena: Verify that an ENA ring is in netmap only in native mode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Mar 2026 19:50:49 UTC
The branch main has been updated by akiyano:
URL: https://cgit.FreeBSD.org/src/commit/?id=97e84c587d6f86aa883720296449b380adcf6915
commit 97e84c587d6f86aa883720296449b380adcf6915
Author: David Arinzon <darinzon@amazon.com>
AuthorDate: 2026-02-05 14:21:13 +0000
Commit: Arthur Kiyanovski <akiyano@FreeBSD.org>
CommitDate: 2026-03-10 19:48:39 +0000
ena: Verify that an ENA ring is in netmap only in native mode
netmap operates in two modes:
1) Emulated - netmap handling is done by the network stack, the
NIC driver operates transparently to netmap.
2) Native - netmap management is done by the NIC driver.
When checking whether a specific ENA ring is running in netmap
mode, only the following checks were done:
1. IFCAP_NETMAP - Check whether netmap capability is enabled on
the device.
2. NKR_NETMAP_ON - Check whether netmap is actively using this
ring.
The above checks implied that the netmap mode is native and the
ENA driver needs to handle the netmap logic.
The code was missing an explicit check on whether native mode
is actually on (NAF_NATIVE).
This led to a case where though emulated mode was used and
a netmap application was turned on, the ENA driver still managed
netmap logic partially and caused missing buffers and lack of
refill as part of the datapath.
Note: Enabling netmap emulated mode is insufficient and there's
a need to load a netmap program in order to trigger this use-case.
Add an explicit check of whether NAF_NATIVE mode is set.
The issue was reported in [1].
[1]: https://github.com/amzn/amzn-drivers/issues/361
Fixes: 358bcc4c6cde ("Add support for ENA NETMAP partial initialization")
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D55697
---
sys/dev/ena/ena_netmap.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sys/dev/ena/ena_netmap.c b/sys/dev/ena/ena_netmap.c
index 8a220373ec3f..0e8c95fb289a 100644
--- a/sys/dev/ena/ena_netmap.c
+++ b/sys/dev/ena/ena_netmap.c
@@ -223,9 +223,11 @@ ena_ring_in_netmap(struct ena_adapter *adapter, int qid, enum txrx x)
if (if_getcapenable(adapter->ifp) & IFCAP_NETMAP) {
na = NA(adapter->ifp);
- kring = (x == NR_RX) ? na->rx_rings[qid] : na->tx_rings[qid];
- if (kring->nr_mode == NKR_NETMAP_ON)
- return true;
+ if (na->na_flags & NAF_NATIVE) {
+ kring = (x == NR_RX) ? na->rx_rings[qid] : na->tx_rings[qid];
+ if (kring->nr_mode == NKR_NETMAP_ON)
+ return true;
+ }
}
return false;
}