HomeFreeBSD

e6000sw: fix bus ordering; don't panic if miibus devices are destroyed

Description

e6000sw: fix bus ordering; don't panic if miibus devices are destroyed

Unloading the e6000sw driver with a "fixed" ixgbe (which is doing
MDIO transfers faster than 8ms per) has exposed another fun race
condition - the MII busses were being torn down before the etherswitch
device.

  • Modify e6000sw_miiforphy() to return NULL if the mii bus device isn't setup, which stops the panic
  • Change the module order so the e6000sw module is detached first, before the miibus entries and attached PHYs are destroyed. This ensures that the miibus entries aren't destroyed outside of the driver lock, and e6000sw_tick() doesn't try dereferencing dead miibus device_t's.

Differential Revision: https://reviews.freebsd.org/D50294
Reviewed by: jhb

Details

Provenance
adrianAuthored on May 11 2025, 2:31 AM
Reviewer
jhb
Differential Revision
D50294: e6000sw: fix bus ordering; don't panic if miibus devices are destroyed
Parents
rGaa266fad5829: net80211: refactor sequence number assignment code
Branches
Unknown
Tags
Unknown