Commit d9d85e9
issue: 4664603 fix rx ring fast-path pointer
The m_p_rx_ring pointer serves as a performance optimization for
single-ring sockets, avoiding map iteration overhead in the common
case. However, the logic to maintain this pointer was duplicated
across three locations with inconsistent behavior:
1. rx_add_ring_cb() - only set when map size == 1
2. rx_del_ring_cb() - conditionally nullified when removing
3. do_rings_migration_rx() - only set if previously NULL
This inconsistency caused a bug where m_p_rx_ring could point to a
stale ring after transitioning from single-ring to multi-ring
configurations, leading to incorrect CQ arming and packet loss in
multi-homed or bonded scenarios.
Introduce update_rx_ring_ptr() helper to centralize and standardize
the pointer maintenance logic:
- Sets m_p_rx_ring when exactly one ring exists (fast path)
- Nullifies m_p_rx_ring otherwise (forces map iteration)
Replace all three inconsistent code blocks with calls to this helper,
ensuring correct behavior during ring addition, removal, and migration.
Signed-off-by: Tomer Cabouly <[email protected]>1 parent b41b3f5 commit d9d85e9
2 files changed
+26
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1170 | 1170 | | |
1171 | 1171 | | |
1172 | 1172 | | |
1173 | | - | |
1174 | | - | |
1175 | | - | |
| 1173 | + | |
1176 | 1174 | | |
1177 | 1175 | | |
1178 | 1176 | | |
| |||
1530 | 1528 | | |
1531 | 1529 | | |
1532 | 1530 | | |
1533 | | - | |
1534 | | - | |
1535 | | - | |
| 1531 | + | |
1536 | 1532 | | |
1537 | 1533 | | |
1538 | 1534 | | |
| |||
1620 | 1616 | | |
1621 | 1617 | | |
1622 | 1618 | | |
1623 | | - | |
1624 | | - | |
1625 | | - | |
1626 | | - | |
1627 | | - | |
| 1619 | + | |
1628 | 1620 | | |
1629 | 1621 | | |
1630 | 1622 | | |
| |||
1828 | 1820 | | |
1829 | 1821 | | |
1830 | 1822 | | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
1831 | 1832 | | |
1832 | 1833 | | |
1833 | 1834 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
447 | 461 | | |
448 | 462 | | |
449 | 463 | | |
| |||
0 commit comments