From 4e92f4a13cf16ab488513a556fcc60b6f2c9db35 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 30 Apr 2015 14:17:26 +0000 Subject: [PATCH] Set the correct media type for 1000baseLX SFPs. Tested by/ok sthen@, ok mikeb@ --- sys/dev/pci/if_ix.c | 15 ++++++++++++--- sys/dev/pci/ixgbe_82599.c | 4 +++- sys/dev/pci/ixgbe_type.h | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index a05c836f9f4..bb90916e2fa 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -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; } /********************************************************************* diff --git a/sys/dev/pci/ixgbe_82599.c b/sys/dev/pci/ixgbe_82599.c index fd10af1844d..934af1f706b 100644 --- a/sys/dev/pci/ixgbe_82599.c +++ b/sys/dev/pci/ixgbe_82599.c @@ -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; diff --git a/sys/dev/pci/ixgbe_type.h b/sys/dev/pci/ixgbe_type.h index af09da2bd68..2c9d4937af9 100644 --- a/sys/dev/pci/ixgbe_type.h +++ b/sys/dev/pci/ixgbe_type.h @@ -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 -- 2.20.1