From: kevlo Date: Fri, 23 Feb 2024 01:06:18 +0000 (+0000) Subject: - Add support for reporting flow control status. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b4e446e2e1ebee1c46fdd4ad429f5cab390e1c46;p=openbsd - Add support for reporting flow control status. - Add missing igc_check_for_link() call; from Masanobu SAITOH via NetBSD. "Fine" deraadt@ ok jan@ --- diff --git a/sys/dev/pci/if_igc.c b/sys/dev/pci/if_igc.c index b7bc205b666..b88644ade21 100644 --- a/sys/dev/pci/if_igc.c +++ b/sys/dev/pci/if_igc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_igc.c,v 1.17 2024/02/14 22:41:48 bluhm Exp $ */ +/* $OpenBSD: if_igc.c,v 1.18 2024/02/23 01:06:18 kevlo Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause * @@ -1491,6 +1491,23 @@ igc_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) ifmr->ifm_active |= IFM_FDX; else ifmr->ifm_active |= IFM_HDX; + + switch (sc->hw.fc.current_mode) { + case igc_fc_tx_pause: + ifmr->ifm_active |= IFM_FLOW | IFM_ETH_TXPAUSE; + break; + case igc_fc_rx_pause: + ifmr->ifm_active |= IFM_FLOW | IFM_ETH_RXPAUSE; + break; + case igc_fc_full: + ifmr->ifm_active |= IFM_FLOW | IFM_ETH_RXPAUSE | + IFM_ETH_TXPAUSE; + break; + default: + ifmr->ifm_active &= ~(IFM_FLOW | IFM_ETH_RXPAUSE | + IFM_ETH_TXPAUSE); + break; + } } /********************************************************************* @@ -1591,6 +1608,9 @@ igc_update_link_status(struct igc_softc *sc) struct igc_hw *hw = &sc->hw; int link_state; + if (hw->mac.get_link_status == true) + igc_check_for_link(hw); + if (IGC_READ_REG(&sc->hw, IGC_STATUS) & IGC_STATUS_LU) { if (sc->link_active == 0) { igc_get_speed_and_duplex(hw, &sc->link_speed,