summaryrefslogtreecommitdiffstats
path: root/sys/dev/e1000/if_igb.c
diff options
context:
space:
mode:
authorjfv <jfv@FreeBSD.org>2012-07-07 20:21:05 +0000
committerjfv <jfv@FreeBSD.org>2012-07-07 20:21:05 +0000
commitb5336ab352c11dcd18cdec71746a53518ab2f96f (patch)
treea0414c7f619b99f2d7a199b8821a649f34cfda58 /sys/dev/e1000/if_igb.c
parentf2e3e9e07318ddf592e5f29fb5edce4ea8b697c8 (diff)
downloadFreeBSD-src-b5336ab352c11dcd18cdec71746a53518ab2f96f.zip
FreeBSD-src-b5336ab352c11dcd18cdec71746a53518ab2f96f.tar.gz
Change the interface to the Energy Efficient Ethernet (EEE)
setting in the igb and em driver. This was necessitated by a shared code change that I was given late in the game, a data type changed from bool to int, in the last update I dealt with it by a cast, but it was pointed out (thanks jhb) that there was a potential problem with this. John suggested this safer approach, and it is fine with me... MFC after:2 days (to catch the 9.1 update)
Diffstat (limited to 'sys/dev/e1000/if_igb.c')
-rw-r--r--sys/dev/e1000/if_igb.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c
index 204a62c..26d0903 100644
--- a/sys/dev/e1000/if_igb.c
+++ b/sys/dev/e1000/if_igb.c
@@ -277,6 +277,7 @@ static void igb_set_sysctl_value(struct adapter *, const char *,
const char *, int *, int);
static int igb_set_flowcntl(SYSCTL_HANDLER_ARGS);
static int igb_sysctl_dmac(SYSCTL_HANDLER_ARGS);
+static int igb_sysctl_eee(SYSCTL_HANDLER_ARGS);
#ifdef DEVICE_POLLING
static poll_handler_t igb_poll;
@@ -586,10 +587,11 @@ igb_attach(device_t dev)
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "dmac", CTLTYPE_INT|CTLFLAG_RW,
adapter, 0, igb_sysctl_dmac, "I", "DMA Coalesce");
- igb_set_sysctl_value(adapter, "eee_disabled",
- "enable Energy Efficient Ethernet",
- (int *)&adapter->hw.dev_spec._82575.eee_disable,
- TRUE);
+ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+ OID_AUTO, "eee_disabled", CTLTYPE_INT|CTLFLAG_RW,
+ adapter, 0, igb_sysctl_eee, "I",
+ "Disable Energy Efficient Ethernet");
if (adapter->hw.phy.media_type == e1000_media_type_copper)
e1000_set_eee_i350(&adapter->hw);
}
@@ -5988,3 +5990,25 @@ igb_sysctl_dmac(SYSCTL_HANDLER_ARGS)
igb_init(adapter);
return (error);
}
+
+/*
+** Manage Energy Efficient Ethernet:
+** Control values:
+** 0/1 - enabled/disabled
+*/
+static int
+igb_sysctl_eee(SYSCTL_HANDLER_ARGS)
+{
+ struct adapter *adapter = (struct adapter *) arg1;
+ int error, value;
+
+ value = adapter->hw.dev_spec._82575.eee_disable;
+ error = sysctl_handle_int(oidp, &value, 0, req);
+ if (error || req->newptr == NULL)
+ return (error);
+ IGB_CORE_LOCK(adapter);
+ adapter->hw.dev_spec._82575.eee_disable = (value != 0);
+ igb_init_locked(adapter);
+ IGB_CORE_UNLOCK(adapter);
+ return (0);
+}
OpenPOWER on IntegriCloud