git: 10598997a2e3 - stable/15 - ena: Verify that an ENA ring is in netmap only in native mode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Apr 2026 22:20:30 UTC
The branch stable/15 has been updated by akiyano:
URL: https://cgit.FreeBSD.org/src/commit/?id=10598997a2e34cd7467418b8c83f5e41d5b424fe
commit 10598997a2e34cd7467418b8c83f5e41d5b424fe
Author: Arthur Kiyanovski <akiyano@amazon.com>
AuthorDate: 2026-02-14 01:13:00 +0000
Commit: Arthur Kiyanovski <akiyano@FreeBSD.org>
CommitDate: 2026-04-02 22:17:36 +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")
Reviewed by: cperciva
Differential Revision: https://reviews.freebsd.org/D55697
Sponsored by: Amazon, Inc.
(cherry picked from commit 97e84c587d6f86aa883720296449b380adcf6915)
---
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;
}