The branch main has been updated by kgalazka: URL: https://cgit.FreeBSD.org/src/commit/?id=dcb84ddcfe89d358a66cffb45196e6b45b45502c
commit dcb84ddcfe89d358a66cffb45196e6b45b45502c Author: Krzysztof Galazka <[email protected]> AuthorDate: 2026-09-28 11:47:43 +0000 Commit: Krzysztof Galazka <[email protected]> CommitDate: 2026-09-28 11:48:10 +0000 ice(4): Fix link bringup on driver load Patch adding Total Port Shutdown support incorrectly handled a case when this feature was not enabled in the NVM. When TPS bit is not set driver should apply link configuration according to user settings and update the status. Those steps were mistakenly omitted, while the state flag was still set to prevent link renegotation and status update on first attempt to bring interface up with ifconfig. Signed-off-by: Krzysztof Galazka <[email protected]> Reported by: kbowling Reviewed by: kbowling Fixes: 0011cd9f8863 ("ice(4): Support Total Port Shutdown on E830 devices") MFC after: 2 weeks Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D59578 --- sys/dev/ice/ice_lib.c | 26 ++++++++++++++++++++++---- sys/dev/ice/if_ice_iflib.c | 6 ++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/sys/dev/ice/ice_lib.c b/sys/dev/ice/ice_lib.c index 9c5732003494..f027e9092b97 100644 --- a/sys/dev/ice/ice_lib.c +++ b/sys/dev/ice/ice_lib.c @@ -9699,15 +9699,33 @@ retry: } return; } + ice_debug(hw, ICE_DBG_LINK, + "%s IFF_UP: %d, media: %d, TPS: %d, link_active_on_if_down: %d\n", + __func__, + (if_getflags(sc->ifp) & IFF_UP) != 0, + (pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE) != 0, + ice_test_state(&sc->state, ICE_STATE_TOTAL_PORT_SHUTDOWN), + ice_test_state(&sc->state, ICE_STATE_LINK_ACTIVE_ON_DOWN)); if (pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE) { ice_clear_state(&sc->state, ICE_STATE_NO_MEDIA); - /* Apply default link settings */ - if (!ice_test_state(&sc->state, ICE_STATE_LINK_ACTIVE_ON_DOWN)) { + if ((if_getflags(sc->ifp) & IFF_UP) != 0 || + ice_test_state(&sc->state, ICE_STATE_LINK_ACTIVE_ON_DOWN)) { + /* Apply default link settings if link was administratively + * brought up or link_active_on_if_down flag is enabled */ + ice_debug(hw, ICE_DBG_LINK, + "%s: applying saved phy cfg\n", + __func__); + ice_apply_saved_phy_cfg(sc, ICE_APPLY_LS_FEC_FC); + } else { + /* Either link_active_on_if_down is disabled or + * Total Port Shutdown is enabled in NVM */ + ice_debug(hw, ICE_DBG_LINK, + "%s: bringing link down\n", + __func__); ice_set_link(sc, false); ice_set_state(&sc->state, ICE_STATE_LINK_STATUS_REPORTED); - } else - ice_apply_saved_phy_cfg(sc, ICE_APPLY_LS_FEC_FC); + } } else { /* Set link down, and poll for media available in timer. This prevents the * driver from receiving spurious link-related events. diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c index d9143618a0ec..5576d7883a55 100644 --- a/sys/dev/ice/if_ice_iflib.c +++ b/sys/dev/ice/if_ice_iflib.c @@ -3583,10 +3583,8 @@ ice_init_link(struct ice_softc *sc) } else { ice_clear_state(&sc->state, ICE_STATE_PHY_FW_INIT_PENDING); - if (ice_is_e830(hw)) { - if (!(sc->ldo_tlv.options & ICE_LINK_OVERRIDE_PORT_DIS)) - return; - + if (ice_is_e830(hw) && + (sc->ldo_tlv.options & ICE_LINK_OVERRIDE_PORT_DIS) != 0) { ice_set_state(&sc->state, ICE_STATE_TOTAL_PORT_SHUTDOWN); ice_clear_state(&sc->state, ICE_STATE_LINK_ACTIVE_ON_DOWN); }
