aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Arinzon <darinzon@amazon.com>2026-02-05 14:21:13 +0000
committerArthur Kiyanovski <akiyano@FreeBSD.org>2026-03-10 19:48:39 +0000
commit97e84c587d6f86aa883720296449b380adcf6915 (patch)
treef62fd37fae9702b59ed32ba38633efd592cca7f9
parent2667a8454cff5896c7b467c78cd4ace5ad40f5eb (diff)
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
-rw-r--r--sys/dev/ena/ena_netmap.c8
1 files 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;
}