Set the correct media type for 1000baseLX SFPs.
authorjsg <jsg@openbsd.org>
Thu, 30 Apr 2015 14:17:26 +0000 (14:17 +0000)
committerjsg <jsg@openbsd.org>
Thu, 30 Apr 2015 14:17:26 +0000 (14:17 +0000)
Tested by/ok sthen@, ok mikeb@

sys/dev/pci/if_ix.c
sys/dev/pci/ixgbe_82599.c
sys/dev/pci/ixgbe_type.h

index a05c836..bb90916 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_ix.c,v 1.118 2015/03/20 10:41:15 mikeb Exp $       */
+/*     $OpenBSD: if_ix.c,v 1.119 2015/04/30 14:17:26 jsg Exp $ */
 
 /******************************************************************************
 
@@ -953,8 +953,15 @@ ixgbe_media_status(struct ifnet * ifp, struct ifmediareq * ifmr)
                        ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
                        break;
                case IXGBE_LINK_SPEED_1GB_FULL:
-                       ifmr->ifm_active |= ((sc->optics == IFM_1000_SX) ?
-                           IFM_1000_SX : IFM_1000_T) | IFM_FDX;
+                       switch (sc->optics) {
+                       case IFM_1000_SX:
+                       case IFM_1000_LX:
+                               ifmr->ifm_active |= sc->optics | IFM_FDX;
+                               break;
+                       default:
+                               ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
+                               break;
+                       }
                        break;
                case IXGBE_LINK_SPEED_10GB_FULL:
                        ifmr->ifm_active |= sc->optics | IFM_FDX;
@@ -1407,6 +1414,8 @@ ixgbe_setup_optics(struct ix_softc *sc)
                sc->optics = IFM_10G_CX4;
        else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX)
                sc->optics = IFM_1000_SX;
+       else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_LX)
+               sc->optics = IFM_1000_LX;
 }
 
 /*********************************************************************
index fd10af1..934af1f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ixgbe_82599.c,v 1.11 2015/04/30 13:24:36 sthen Exp $  */
+/*     $OpenBSD: ixgbe_82599.c,v 1.12 2015/04/30 14:17:26 jsg Exp $    */
 
 /******************************************************************************
 
@@ -1582,6 +1582,8 @@ sfp_check:
                        physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_T;
                else if (comp_codes_1g & IXGBE_SFF_1GBASESX_CAPABLE)
                        physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_SX;
+               else if (comp_codes_1g & IXGBE_SFF_1GBASELX_CAPABLE)
+                       physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_LX;
                break;
        default:
                break;
index af09da2..2c9d493 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ixgbe_type.h,v 1.21 2015/04/30 13:24:36 sthen Exp $   */
+/*     $OpenBSD: ixgbe_type.h,v 1.22 2015/04/30 14:17:26 jsg Exp $     */
 
 /******************************************************************************
 
@@ -2591,6 +2591,7 @@ typedef uint32_t ixgbe_physical_layer;
 #define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI      0x1000
 #define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA     0x2000
 #define IXGBE_PHYSICAL_LAYER_1000BASE_SX       0x4000
+#define IXGBE_PHYSICAL_LAYER_1000BASE_LX       0x8000
 
 /* Flow Control Data Sheet defined values
  * Calculation and defines taken from 802.1bb Annex O