cxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.

The hardware is unavailable when the device is suspended or in the
middle of a reset.

MFC after:	1 week
Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2022-02-11 15:37:17 -08:00
parent dba02df30d
commit 39a36707bd

View File

@ -3165,7 +3165,7 @@ cxgbe_media_change(struct ifnet *ifp)
if (IFM_OPTIONS(ifm->ifm_media) & IFM_ETH_TXPAUSE)
lc->requested_fc |= PAUSE_TX;
}
if (pi->up_vis > 0) {
if (pi->up_vis > 0 && !hw_off_limits(sc)) {
fixup_link_config(pi);
rc = apply_link_config(pi);
}
@ -3333,7 +3333,7 @@ cxgbe_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
return;
PORT_LOCK(pi);
if (pi->up_vis == 0) {
if (pi->up_vis == 0 && !hw_off_limits(sc)) {
/*
* If all the interfaces are administratively down the firmware
* does not report transceiver changes. Refresh port info here