- Add support for reporting flow control status.
authorkevlo <kevlo@openbsd.org>
Fri, 23 Feb 2024 01:06:18 +0000 (01:06 +0000)
committerkevlo <kevlo@openbsd.org>
Fri, 23 Feb 2024 01:06:18 +0000 (01:06 +0000)
- Add missing igc_check_for_link() call; from Masanobu SAITOH via NetBSD.

"Fine" deraadt@

ok jan@

sys/dev/pci/if_igc.c

index b7bc205..b88644a 100644 (file)
@@ -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,