summaryrefslogtreecommitdiffstats
path: root/sys/dev/ixgbe
diff options
context:
space:
mode:
authorjfv <jfv@FreeBSD.org>2010-06-30 01:01:06 +0000
committerjfv <jfv@FreeBSD.org>2010-06-30 01:01:06 +0000
commit45306e3bca5edfc219416b6cf3c7338e2480a2fc (patch)
tree9d6a930408bdd9cbd43991c95ec2c3e4711da37b /sys/dev/ixgbe
parent8fcbe1caf89944ec27f00e1265b29374fd3e05de (diff)
downloadFreeBSD-src-45306e3bca5edfc219416b6cf3c7338e2480a2fc.zip
FreeBSD-src-45306e3bca5edfc219416b6cf3c7338e2480a2fc.tar.gz
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.
Diffstat (limited to 'sys/dev/ixgbe')
-rw-r--r--sys/dev/ixgbe/ixgbe.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c
index 174c08d..fe33329 100644
--- a/sys/dev/ixgbe/ixgbe.c
+++ b/sys/dev/ixgbe/ixgbe.c
@@ -239,6 +239,15 @@ static int ixgbe_flow_control = ixgbe_fc_full;
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
OpenPOWER on IntegriCloud