The tap PMD registers each queue file descriptor for Rx interrupts but the
feature is not usable through the generic API. This series fixes a crash
reachable without any of the interrupt work, then two distinct issues
against the original Rx interrupt support, plus a small type cleanup.

Patch 1 fixes a NULL dereference: tap_tx_queue_release() reads
dev->data->rx_queues to decide whether the queue fd is still shared, but
ethdev releases the Rx queues first and frees that array. It is reached
from the reset_queues path of rte_eth_dev_configure() and from
rte_eth_dev_internal_reset(), so removing a tap port from a bonding device
crashes on current main. This is independent of the rest of the series.

Patch 2 adds the missing rx_queue_intr_enable/disable ops. Without them
rte_eth_dev_rx_intr_enable() returns -ENOTSUP, so applications that arm
queues before sleeping (l3fwd-power and similar) treat tap as having no
interrupt support and fall back to polling.

Patch 3 fixes a traffic stall specific to interrupt mode: the Rx burst
skips reading the queue fd until the SIGIO trigger advances, but the
trigger is process wide while the epoll wakeup targets the lcore waiting
on that queue, so the burst can run before the trigger has advanced and
return 0. The registration is edge triggered, so no further wakeup comes
for data that is already queued. The fd is now drained unconditionally in
interrupt mode and the SIGIO trigger is not armed on the data queue fds.

Patch 4 converts the driver's int-as-boolean fields to bool.

Patches 1 to 3 are candidates for stable.

v3:
 - new patch 1 fixing the tap_tx_queue_release() NULL dereference
   (Stephen), with its own Fixes: and Cc: stable
 - patch 3: commit message now explains why the trigger can lag behind the
   epoll wakeup, and that the registration is edge triggered, which is what
   makes the stall permanent (Stephen); no code change
 - patch 4: convert the remaining int-as-boolean local and parameters, and
   use !pmd->flow_init instead of comparing to 0 (Stephen)
 - rte_eth_tap.h includes <stdbool.h> directly (Stephen)

v2:
 - use bool for the new interrupt-mode fields instead of int (Stephen);
   both fit existing padding, so neither struct grows
 - add a patch converting the existing int booleans to bool

The coding_style.rst note that discouraged bool in structures no longer
matches DPDK practice; it is dropped by a separate patch.

Maxime Leroy (4):
  net/tap: fix crash on Tx queue release after reconfigure
  net/tap: support Rx queue interrupt enable/disable
  net/tap: drain queue FD in Rx interrupt mode
  net/tap: use bool for boolean flags

 drivers/net/tap/rte_eth_tap.c | 43 ++++++++++++++++++++++++++--------
 drivers/net/tap/rte_eth_tap.h | 12 +++++++---
 drivers/net/tap/tap_flow.c    |  6 ++---
 drivers/net/tap/tap_intr.c    | 44 +++++++++++++++++++++++++++++++++++
 4 files changed, 89 insertions(+), 16 deletions(-)

-- 
2.43.0

Reply via email to