Author: jfv
Date: Wed Jun 30 01:01:06 2010
New Revision: 209602
URL: http://svn.freebsd.org/changeset/base/209602

Log:
  Add a new sysctl option, this will allow one to
  limit the advertised speed of an SFP+ to 1G, effectively
  "forcing" link at that lower speed. It is off by default
  and is enabled by sysctl dev.ix.0.force_gig=1, 0 will
  set it back to the norm.

Modified:
  head/sys/dev/ixgbe/ixgbe.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.c  Tue Jun 29 23:08:33 2010        (r209601)
+++ head/sys/dev/ixgbe/ixgbe.c  Wed Jun 30 01:01:06 2010        (r209602)
@@ -239,6 +239,15 @@ static int ixgbe_flow_control = ixgbe_fc
 TUNABLE_INT("hw.ixgbe.flow_control", &ixgbe_flow_control);
 
 /*
+** These adapters do not really autoneg, but slower
+** speed can be set by forcing the advertised value
+** to only 1G. Default to 0, set it to 1 to
+** force 1G link.
+*/
+static int ixgbe_force_speed = 0;
+TUNABLE_INT("hw.ixgbe.force_speed", &ixgbe_force_speed);
+
+/*
 ** Smart speed setting, default to on
 ** this only works as a compile option
 ** right now as its during attach, set
@@ -464,6 +473,11 @@ ixgbe_attach(device_t dev)
                        OID_AUTO, "flow_control", CTLTYPE_INT | CTLFLAG_RW,
                        adapter, 0, ixgbe_set_flowcntl, "I", "Flow Control");
 
+       SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+                       SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+                       OID_AUTO, "force_gig", CTLTYPE_INT | CTLFLAG_RW,
+                       adapter, 0, ixgbe_set_gigspeed, "I", "Force 1G Speed");
+
         SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
                        SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
                        OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW,
@@ -4942,6 +4956,34 @@ ixgbe_sysctl_debug(SYSCTL_HANDLER_ARGS)
 }
 
 /*
+** Set link advertisement to 1G:
+**     0 - off
+**     1 - off
+*/
+static int
+ixgbe_set_gigspeed(SYSCTL_HANDLER_ARGS)
+{
+       struct adapter *adapter;
+       struct ixgbe_hw *hw;
+       int error;
+
+       error = sysctl_handle_int(oidp, &ixgbe_force_speed, 0, req);
+
+       if (error)
+               return (error);
+
+       adapter = (struct adapter *) arg1;
+       hw = &adapter->hw;
+       if (ixgbe_force_speed)
+                hw->phy.autoneg_advertised = IXGBE_LINK_SPEED_1GB_FULL;
+       else
+                hw->phy.autoneg_advertised = IXGBE_LINK_SPEED_10GB_FULL;
+       
+       return error;
+}
+
+
+/*
 ** Set flow control using sysctl:
 ** Flow control values:
 **     0 - off
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to