On Thu, Apr 30, 2015 at 01:13:36PM +0100, Stuart Henderson wrote:
> Diff below allows ix(4) to support 1Gb LX SFP in its SFP+ port. It is
> https://github.com/torvalds/linux/commit/345be204dcbb2cc7580a63bc377a185125a6f822.patch
> ported to our driver. Small changes to the 3rd hunk of the ixgbe_phy.c
> patch as we don't have the "enforce_sfp" flag that Linux has.
> 
> Goes from this:
> 
> ix1 at pci1 dev 0 function 1 "Intel 82599" rev 0x01: Unsupported SFP+ Module
> 
> to a working interface, albeit with wrong media flag in ifconfig:
> 
> # ifconfig ix1
> ix1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         lladdr 00:1b:21:c0:25:bd
>         priority: 0
>         groups: egress
>         media: Ethernet autoselect (1000baseT full-duplex,rxpause,txpause)
>         status: active
>         inet 192.168.42.216 netmask 0xffffff00 broadcast 192.168.42.255
> 
> OK?

Do you get the correct media type with the following diff?

Index: ixgbe_82599.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ixgbe_82599.c,v
retrieving revision 1.10
diff -u -p -r1.10 ixgbe_82599.c
--- ixgbe_82599.c       5 Aug 2013 19:58:06 -0000       1.10
+++ ixgbe_82599.c       30 Apr 2015 12:42:56 -0000
@@ -1580,6 +1580,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: ixgbe_type.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/ixgbe_type.h,v
retrieving revision 1.20
diff -u -p -r1.20 ixgbe_type.h
--- ixgbe_type.h        25 Aug 2014 14:26:25 -0000      1.20
+++ ixgbe_type.h        30 Apr 2015 12:41:44 -0000
@@ -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
Index: if_ix.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_ix.c,v
retrieving revision 1.118
diff -u -p -r1.118 if_ix.c
--- if_ix.c     20 Mar 2015 10:41:15 -0000      1.118
+++ if_ix.c     30 Apr 2015 12:41:37 -0000
@@ -953,8 +953,15 @@ ixgbe_media_status(struct ifnet * ifp, s
                        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;
 }
 
 /*********************************************************************

Reply via email to