From b4e446e2e1ebee1c46fdd4ad429f5cab390e1c46 Mon Sep 17 00:00:00 2001 From: kevlo Date: Fri, 23 Feb 2024 01:06:18 +0000 Subject: [PATCH] - Add support for reporting flow control status. - Add missing igc_check_for_link() call; from Masanobu SAITOH via NetBSD. "Fine" deraadt@ ok jan@ --- sys/dev/pci/if_igc.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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, -- 2.20.1