From: Pravin Pathak <[email protected]>

This series introduces the Software Load Balancer (SLB) Eventdev PMD
(`event_slb`) supporting parallel, atomic and ordered queues. It is 
a distributed software scheduler that scales well.

Motivation
----------
Existing software eventdev PMDs face trade-offs between centralized
bottlenecks and feature coverage:
- `event_sw` relies on a dedicated centralized scheduler consuming
  an extra CPU core. The single scheduling core also limits maximum
  throughput and it does not scale.
- `event_dsw` distributes scheduling across worker cores without a
  central scheduler core, but does not support ordered queues and 
  incurs per-port control ring messaging overhead during atomic flow
  migrations. It also does not support service priority.

Design Overview
---------------
`event_slb` is a distributed (`RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED`),
maintenance-free (`RTE_EVENT_DEV_CAP_MAINTENANCE_FREE`) software eventdev
PMD that supports Atomic, Ordered, Parallel, and Single-Link queues:

1. Queue-Centric Ring Architecture:
   - Parallel and Single-Link queues map directly to `rte_event_ring`
     instances (MP/MC for parallel, MP/SC for single-link), allowing
     zero-copy burst enqueue and dequeue without history tracking.
   - Ordered queues use the ring slot index at dequeue time as an implicit
     sequence number into a per-queue reorder buffer, draining contiguous
     completed events in order without global sequence counters. This 
         makes ordered queue implementaion highly efficient performing close
         to parallel queues.
   - Atomic queues use a main MP/SC queue ring alongside per-port SP/SC
     rings and a 2048-entry flow-to-port affinity table. All cores
         served by the atomic queue are used for scheduling.

2. Lock-Free / Zero-Pause Atomic Flow Migration:
   - When an atomic queue refills per-port rings and detects persistent
     congestion on a destination port, SLB selects the lightest flow on
     that port (outside the migration cooldown window) and waits for
         queues in-flight events to drain naturally before switching the 
         flow's port affinity and schedule hold-buffer entries.
   - Hold buffer is used for buffering events towards migrating ports
     while allowing serving other ports.
   - Implementaion avoids cross-port pause/unpause control rings while
     preserving strict per-flow ordering.

3. Credit-Based Backpressure & Priority Scheduling:
   - A global atomic credit pool with per-port local credit caches bounds
     total in-flight events (`nb_events_limit`) and enforces
         `new_event_threshold` with minimal atomic contention.
   - Ports support two strict service priority levels with
     round-robin scheduling within each priority level.

4. Observability & Testing:
   - Device and per-port/per-queue extended statistics (`xstats`),
     detailed `rte_event_dev_dump()` diagnostics, and a unit self-test
     suite (`eventdev_selftest_slb`) covering parallel, atomic, ordered,
     single-link, priority, backpressure, stop-flush, and multi-core
     atomic migration scenarios.

5. Future Plan:
   - Supporting Event priority
   - Optimizing atomic flow migration

Pravin Pathak (8):
  event/slb: introduce software load balancer PMD
  event/slb: add support for ordered queues
  event/slb: add support for atomic queues
  event/slb: add dynamic flow migration for atomic queues
  event/slb: add extended statistics and diagnostics
  event/slb: add self-test and documentation
  event/slb: update resets and credit defaults
  event/slb: improve port linking, config checks and atomic refill

 MAINTAINERS                           |    6 +
 app/test/test_eventdev.c              |    7 +
 doc/guides/eventdevs/features/slb.ini |   25 +
 doc/guides/eventdevs/index.rst        |    1 +
 doc/guides/eventdevs/slb.rst          |   61 ++
 drivers/event/meson.build             |    1 +
 drivers/event/slb/meson.build         |   21 +
 drivers/event/slb/slb_evdev.c         |  904 ++++++++++++++++++
 drivers/event/slb/slb_evdev.h         |  263 ++++++
 drivers/event/slb/slb_event.c         | 1219 +++++++++++++++++++++++++
 drivers/event/slb/slb_selftest.c      |  522 +++++++++++
 drivers/event/slb/slb_xstats.c        |  347 +++++++
 12 files changed, 3377 insertions(+)
 create mode 100644 doc/guides/eventdevs/features/slb.ini
 create mode 100644 doc/guides/eventdevs/slb.rst
 create mode 100644 drivers/event/slb/meson.build
 create mode 100644 drivers/event/slb/slb_evdev.c
 create mode 100644 drivers/event/slb/slb_evdev.h
 create mode 100644 drivers/event/slb/slb_event.c
 create mode 100644 drivers/event/slb/slb_selftest.c
 create mode 100644 drivers/event/slb/slb_xstats.c

-- 
2.53.0

Reply via email to