Skip to contentSkip to conversation

net/axgbe: AN state machine and PHY mode change run in EAL interrupt thread

DPDK/ethdev Bug 2149 [email protected] 1 participant 1 message Nov 19

lore
Share & tools
lore
#0 lore raw

https://bugs.dpdk.org/show_bug.cgi?id=2149

Bug ID: 2149
Summary: net/axgbe: AN state machine and PHY mode change run in
EAL interrupt thread
Product: DPDK
Version: 26.11
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: ethdev
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---

Found while reviewing latest axgbe changes. The problem with busy waiting in interrupt thread is that it will then block all other interrupts from occurring from other devices.

The axgbe interrupt callback runs the full autonegotiation state machine, including PHY mode changes, directly on the EAL interrupt thread. That path busy-waits on firmware and hardware for hundreds of milliseconds, and up to several seconds on timeout.

Call path:

axgbe_dev_interrupt_handler() axgbe_ethdev.c:316

    pdata->phy_if.an_isr()
      axgbe_an73_isr()                       axgbe_mdio.c:660
        pthread_mutex_lock(&pdata->an_mutex)
        axgbe_an73_state_machine()
          axgbe_an73_incompat_link()
            axgbe_switch_mode() -> phy_impl.set_mode()
              axgbe_phy_perform_ratechange()  axgbe_phy_impl.c:1561
                mailbox poll: rte_delay_us(1500) x 500 (750 ms max)
                axgbe_rx_adaptation(): rte_delay_ms(200)

PHY access from this context also goes through axgbe_phy_get_comm_ownership(), which polls the hardware I2C/MDIO mutex with rte_delay_us(100) for up to 5 seconds while holding phy_mutex.

Impact:

- The EAL interrupt thread is shared across all devices. While axgbe is busy-waiting, LSC/RMV/mailbox interrupts for every other port and PMD in the process are stalled.
- EAL alarm callbacks are dispatched from the same thread and are delayed the same way.
- Application threads calling link_update/dev_start block on an_mutex for the same duration.

The Linux amd-xgbe driver, which this PMD is derived from, does not do this work in the ISR. It defers it with queue_work(pdata->an_workqueue, &pdata->an_irq_work). The DPDK port collapsed that into the interrupt callback.

Suggested fix:

The interrupt callback should only read and clear the AN interrupt status into pdata->an_int and wake a per-port control thread (rte_thread_create_internal_control) that runs the state machine and mode change. That matches the Linux design and keeps the existing mutexes meaningful (AN worker vs application control path).

Deferring with rte_eal_alarm_set() is not sufficient, since alarms run on the same EAL interrupt thread.

Other PMDs whose interrupt callbacks reach rte_delay_* in PHY or firmware code probably have the same problem and should be audited.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.