diff options
| author | Gilad Ben Yakov <giladben@amazon.com> | 2026-05-05 10:02:13 +0000 |
|---|---|---|
| committer | Arthur Kiyanovski <akiyano@FreeBSD.org> | 2026-10-29 03:25:50 +0000 |
| commit | 2d4d2ed3fef6acda9269f545f6703d6f32f2f0b7 (patch) | |
| tree | 1722c9e97c58730d220273e42d2b30b5ce39e083 /sys/dev/ena/ena.c | |
| parent | 3d1e732a43eda16f20dea3fe2671ce6fca8a03a6 (diff) | |
ena: Reinit RSS table on device restore when queue count shrinks
When ena_restore_device() is called after a reset, pci_alloc_msix()
may return fewer MSI-X vectors than requested, causing num_io_queues
to shrink. When this happens, the RSS indirection table retains
entries referencing queues that no longer exist, routing packets to
non-existent queues and causing connectivity loss.
Extract ena_set_io_queue_count() to pair the queue count update with
ena_com_rss_destroy(), ensuring the RSS table is always invalidated
when the queue count changes. Use it from both ena_update_io_rings()
and ena_restore_device().
Reviewed by: cperciva
Fixes: e2735b095b7e ("Fix assumptions about number of IO queues in the ENA")
MFC after: 3 days
Sponsored by: Amazon, Inc.
Diffstat (limited to 'sys/dev/ena/ena.c')
| -rw-r--r-- | sys/dev/ena/ena.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index 211e33b8a4ce..b16e8ff324be 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -1299,13 +1299,18 @@ ena_update_queue_size(struct ena_adapter *adapter, uint32_t new_tx_size, } static void -ena_update_io_rings(struct ena_adapter *adapter, uint32_t num) +ena_set_io_queue_count(struct ena_adapter *adapter, uint32_t num) { - ena_free_all_io_rings_resources(adapter); + adapter->num_io_queues = num; /* Force indirection table to be reinitialized */ ena_com_rss_destroy(adapter->ena_dev); +} - adapter->num_io_queues = num; +static void +ena_update_io_rings(struct ena_adapter *adapter, uint32_t num) +{ + ena_free_all_io_rings_resources(adapter); + ena_set_io_queue_count(adapter, num); ena_init_io_rings(adapter); } @@ -3680,7 +3685,8 @@ ena_restore_device(struct ena_adapter *adapter) * are available. */ if ((adapter->msix_vecs - ENA_ADMIN_MSIX_VEC) < adapter->num_io_queues) - adapter->num_io_queues = adapter->msix_vecs - ENA_ADMIN_MSIX_VEC; + ena_set_io_queue_count(adapter, + adapter->msix_vecs - ENA_ADMIN_MSIX_VEC); /* Re-initialize rings basic information */ ena_init_io_rings(adapter); |
