From 45306e3bca5edfc219416b6cf3c7338e2480a2fc Mon Sep 17 00:00:00 2001 From: jfv Date: Wed, 30 Jun 2010 01:01:06 +0000 Subject: 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. --- sys/dev/ixgbe/ixgbe.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'sys/dev/ixgbe') 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 -- cgit v1.1