summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintel-ethernet <eric_mann@mail.intel.com>2013-06-12 19:08:12 -0700
committerintel-ethernet <eric_mann@mail.intel.com>2013-06-12 19:08:12 -0700
commit608a1d32ba40b302820f12a881861c6ef54a3631 (patch)
treea9186f7713d8d54a20fee760949e53b5e8704219
parent6856610e4d687402c8864af5994938268846186e (diff)
downloadOpen-AVB-608a1d32ba40b302820f12a881861c6ef54a3631.tar.gz
Update igb_avb driver to track latest supported igb_stable on sourceforge (4.2.16).
+ Startup script to illustrate how to steer OS traffic to non-AVB queues + added pci.updates and igb_avb.7 manpage
-rwxr-xr-xkmod/igb/igb_avb.7253
-rw-r--r--kmod/igb/igb_hwmon.c241
-rw-r--r--kmod/igb/igb_sysfs.c1058
-rw-r--r--kmod/igb/pci.updates19
-rw-r--r--kmod/igb/startup.sh15
5 files changed, 528 insertions, 1058 deletions
diff --git a/kmod/igb/igb_avb.7 b/kmod/igb/igb_avb.7
new file mode 100755
index 00000000..ed8dba10
--- /dev/null
+++ b/kmod/igb/igb_avb.7
@@ -0,0 +1,253 @@
+.\" LICENSE
+.\"
+.\" This software program is released under the terms of a license agreement between you ('Licensee') and Intel. Do not use or load this software or any associated materials (collectively, the 'Software') until you have carefully read the full terms and conditions of the LICENSE located in this software package. By loading or using the Software, you agree to the terms of this Agreement. If you do not agree with the terms of this Agreement, do not install or use the Software.
+.\"
+.\" * Other names and brands may be claimed as the property of others.
+.\"
+.TH igb 1 "January 5, 2012"
+
+.SH NAME
+igb \-This file describes the Linux* Base Driver for the Gigabit Family of Adapters.
+.SH SYNOPSIS
+.PD 0.4v
+modprobe igb [<option>=<VAL1>,<VAL2>,...]
+.PD 1v
+.SH DESCRIPTION
+This driver is intended for \fB2.4.x\fR and \fB2.6.x\fR kernels. This driver includes support for Intel(R) Itanium(R)2-based systems.
+.LP
+This driver is only supported as a loadable module at this time. Intel is not supplying patches against the kernel source toallow for static linking of the driver. For questions related to hardware requirements, refer to the documentation supplied with your Intel adapter. All hardware requirements listed apply to use with Linux.
+.SH OPTIONS
+The following optional parameters are used by entering them on the command line with the modprobe command.
+For example:
+.IP
+modprobe igb InterruptThrottleRate=16000,16000
+.IP
+.B InterruptThrottleRate
+.IP
+.B Valid Range:
+0,1,3,100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
+.IP
+.B Default Value:
+3
+This represents the maximum number of interrupts per second the controller generates. InterruptThrottleRate is another setting used in interrupt moderation. Dynamic mode uses a heuristic algorithm to adjust InterruptThrottleRate based on the current traffic load.
+.IP
+The default setting is configured to optimize interrupts for bulk
+throughput while keeping CPU utilization low. However this setting may
+result in slower overall transfer speeds if network traffic consists
+mostly of small packets. If this is the case, change this value to 0.
+.IP
+Un-supported Adapters: InterruptThrottleRate is NOT supported by 82542, 82543 or 82544-based adapters.
+.IP
+.B NOTE:
+InterruptThrottleRate takes precedence over the TxAbsIntDelay and RxAbsIntDelay parameters. Inother words, minimizing the receive and/or transmit absolute delays does not force the controller to generate more interrupts than what the Interrupt Throttle Rate allows.
+.IP
+See the section "InterruptThrottleRate" in README.
+.IP
+.B LLIPort
+.IP
+.B Valid Range:
+0-65535 (0=off)
+.IP
+.B Default Value:
+0
+.IP
+LLI is configured with the LLIPort command-line parameter, which specifies which TCP port should generate Low Latency Interrupts.
+.IP
+For example, using LLIPort=80 would cause the board to generate an immediate interrupt upon receipt of any packet sent to TCPport 80 on the local machine.
+.IP
+.B LLIPush
+.IP
+.B Valid Range:
+0-1 (0=off)
+.IP
+.B Default Value:
+0
+.IP
+Can be set to be enabled or disabled (default). It is most effective in an environment with many small transactions.
+.IP
+NOTE: Enabling LLIPush may allow a denial of service attack.
+.IP
+.B LLISize
+.IP
+.B Valid Range:
+0-1500 (0=off)
+.IP
+.B Default Value:
+0
+.IP
+Causes an immediate interrupt if the board receives a packet smaller than the specified size.
+.IP
+.B IntMode
+.IP
+.B Valid Range:
+0-2 (0 = Legacy Int, 1 = MSI and 2 = MSI-X)
+.IP
+.B Default Value:
+2
+.IP
+IntMode controls allow load time control over the type of interrupt
+registered for by the driver. MSI-X is required for multiple queue
+support, and some kernels and combinations of kernel .config options will
+force a lower level of interrupt support. 'cat /proc/interrupts' will show
+different values for each type of interrupt.
+.IP
+.B RSS
+.IP
+.B Valid Range:
+0-8
+.IP
+.B Default Value:
+1
+.IP
+0 - Assign up to whichever is less, number of CPUS or number of queues
+X - Assign X queues where X is less than or equal to maximum number of queues.
+ The driver allows maximum supported queue value. For example, I350-based
+ adapters allow RSS=8 (where 8-queues is the maximum allowable queues).
+.IP
+Note: for 82575-based adapters the maximum number of queues is 4; for
+82576-based and newer adapters it is 8; for I210-based adapters it is 4 queues;
+and for I211-based adapters it is 2 queues.
+.IP
+This parameter is also affected by the VMDq parameter in that it will limit the
+queues more.
+.IP
+VMDQ
+.IP
+Model 0 1 2 3+
+82575 4 4 3 1
+82576 8 2 2 2
+82580 8 1 1 1
+.IP
+.B VMDQ
+.IP
+.B Valid Range:
+0 - 4 on 82575-based adapters; and 0 - 8 for 82576 and
+82580-based adapters.
+.IP
+.B Default Value:
+0
+.IP
+Supports enabling VMDq pools as this is needed to support SR-IOV.
+.IP
+0 = disabled
+1 = sets the netdev as pool 0
+2+ = add additional queues but they currently are not used.
+.IP
+This parameter is forced to 1 or more if the max_vfs module parameter is used.
+In addition the number of queues available for RSS is limited if this is set to 1 or greater.
+.IP
+.B max_vfs
+.IP
+.B Valid Range:
+0-7
+.IP
+.B Default Value:
+0
+.IP
+If the value is greater than 0 it will also force the VMDq parameter to be 1 or
+more.
+.IP
+This parameter adds support for SR-IOV. It causes the driver to spawn up to
+max_vfs worth of virtual function.
+.IP
+.B QueuePairs
+.IP
+.B Valid Range:
+0-1
+.IP
+.B Default Value:
+1 (TX and RX will be paired onto one interrupt vector)
+.IP
+If set to 0, when MSI-X is enabled, the TX and RX will attempt to occupy
+separate vectors.
+.IP
+This option can be overridden to 1 if there are not sufficient interrupts
+available. This can occur if any combination of RSS, VMDQ, and max_vfs
+results in more than 4 queues being used.
+.IP
+.B Node
+.IP
+.B Valid Range:
+0-n
+.IP
+.B Default Value:
+-1 (off)
+.IP
+0 - n: where n is the number of the NUMA node that should be used to allocate memory for this adapter port.
+.IP
+-1: uses the driver default of allocating memory on whichever processor is running modprobe.
+.IP
+The Node parameter will allow you to pick which NUMA node you want to have
+the adapter allocate memory from. All driver structures, in-memory queues, and receive buffers will be allocated on the node specified. This parameter is onlyuseful when interrupt affinity is specified, otherwise some portion of the time the interrupt could run on a different core than the memory is allocated on, causing slower memory access and impacting throughput, CPU, or both.
+.IP
+.B EEE
+.IP
+.B Valid Range:
+0-1
+.IP
+.B Default Value:
+1 (enabled)
+.IP
+A link between two EEE-compliant devices will result in periodic bursts of
+data followed by periods where the link is in an idle state. This Low
+Power Idle (LPI) state is supported in both 1Gbps and 100Mbps link speeds.
+.IP
+NOTE: EEE support requires autonegotiation.
+.IP
+.B DMAC
+.IP
+.B Valid Range:
+0, 250, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000.
+.IP
+.B Default Value:
+0 (disabled)
+.IP
+Enables or disables DMA Coalescing feature. Values are in usec’s and increase the internal DMA Coalescing feature’s internal timer. DMA (Direct Memory Access) allows the network device to move packet data directly to the system's memory,
+ reducing CPU utilitzation. However, the frequency and random intervals at
+ which packets arrive do not allow the system to enter a lower power state.
+ DMA Coalescing allows the adapter to collect packets before it initiates a
+ DMA event. This may increase network latency but also increases the chances
+ that the system will enter a lower power state.
+.IP
+Turning on DMA Coalescing may save energy with kernel 2.6.32 and later. This
+ will impart the greatest chance for your system to consume less power. DMA
+ Coalescing is effective in helping potentially saving the platform power only
+ when it is enabled across all active ports.
+.IP
+InterruptThrottleRate (ITR) should be set to dynamic. When ITR=0, DMA
+ Coalescing is automatically disabled. A whitepaper containing information on how to best configure your platform
+ is available on the Intel website.
+.B MDD (Malicious Driver Detection)
+.IP
+.B Valid Range:
+0, 1; 0 = Disable, 1 = Enable
+.B Default Value:
+1
+.IP
+This parameter is only relevant for I350 devices operating in SR-IOV mode. When
+this parameter is set, the driver detects malicious VF driver and disables its
+TX/RX queues until a VF driver reset occurs.
+.SH JUMBO FRAMES
+Jumbo Frames support is enabled by changing the MTU to a value larger than the default of 1500.Use the ifconfig command to increase the MTU size. For example:
+.IP
+ifconfig ethx mtu 9000 up
+.LP
+.B NOTE:
+Using Jumbo frames at 10 or 100 Mbps is not supported and may result in poor performance or loss of link.
+.LP
+Some Intel gigabit adapters that support Jumbo Frames have a frame size limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes.
+.LP
+See the section "Jumbo Frames" in README.
+.SH ethtool
+The driver utilizes the ethtool interface for driver configuration and diagnostics, as well as displaying statistical information. ethtool version 1.8.1 or later is required for this functionality.
+.LP
+The latest release of ethtool can be found from http://ftp.kernel.org/pub/software/network/ethtool/. The driver then must be recompiled in order to take advantage of the latest ethtool features.
+.LP
+ethtool 1.6 only supports a limited set of ethtool options. Support for a more complete ethtool feature set can be enabled by upgrading ethtool to ethtool-1.8.1.
+.SH SUPPORT
+For additional information, including supported adapters, building, and installation, see the README file included with the driver.
+.LP
+For general information, go to the Intel support website at:
+.IP
+.B http://support.intel.com
+.LP
diff --git a/kmod/igb/igb_hwmon.c b/kmod/igb/igb_hwmon.c
new file mode 100644
index 00000000..c5641e8e
--- /dev/null
+++ b/kmod/igb/igb_hwmon.c
@@ -0,0 +1,241 @@
+/*******************************************************************************
+
+ Intel(R) Gigabit Ethernet Linux driver
+ Copyright(c) 2007-2013 Intel Corporation.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms and conditions of the GNU General Public License,
+ version 2, as published by the Free Software Foundation.
+
+ This program is distributed in the hope it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+ The full GNU General Public License is included in this distribution in
+ the file called "COPYING".
+
+ Contact Information:
+ e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
+ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
+*******************************************************************************/
+
+#include "igb.h"
+#include "e1000_82575.h"
+#include "e1000_hw.h"
+#ifdef IGB_HWMON
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/sysfs.h>
+#include <linux/kobject.h>
+#include <linux/device.h>
+#include <linux/netdevice.h>
+#include <linux/hwmon.h>
+#include <linux/pci.h>
+
+/* hwmon callback functions */
+static ssize_t igb_hwmon_show_location(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hwmon_attr *igb_attr = container_of(attr, struct hwmon_attr,
+ dev_attr);
+ return sprintf(buf, "loc%u\n",
+ igb_attr->sensor->location);
+}
+
+static ssize_t igb_hwmon_show_temp(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hwmon_attr *igb_attr = container_of(attr, struct hwmon_attr,
+ dev_attr);
+ unsigned int value;
+
+ /* reset the temp field */
+ igb_attr->hw->mac.ops.get_thermal_sensor_data(igb_attr->hw);
+
+ value = igb_attr->sensor->temp;
+
+ /* display millidegree */
+ value *= 1000;
+
+ return sprintf(buf, "%u\n", value);
+}
+
+static ssize_t igb_hwmon_show_cautionthresh(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hwmon_attr *igb_attr = container_of(attr, struct hwmon_attr,
+ dev_attr);
+ unsigned int value = igb_attr->sensor->caution_thresh;
+
+ /* display millidegree */
+ value *= 1000;
+
+ return sprintf(buf, "%u\n", value);
+}
+
+static ssize_t igb_hwmon_show_maxopthresh(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hwmon_attr *igb_attr = container_of(attr, struct hwmon_attr,
+ dev_attr);
+ unsigned int value = igb_attr->sensor->max_op_thresh;
+
+ /* display millidegree */
+ value *= 1000;
+
+ return sprintf(buf, "%u\n", value);
+}
+
+/* igb_add_hwmon_attr - Create hwmon attr table for a hwmon sysfs file.
+ * @ adapter: pointer to the adapter structure
+ * @ offset: offset in the eeprom sensor data table
+ * @ type: type of sensor data to display
+ *
+ * For each file we want in hwmon's sysfs interface we need a device_attribute
+ * This is included in our hwmon_attr struct that contains the references to
+ * the data structures we need to get the data to display.
+ */
+static int igb_add_hwmon_attr(struct igb_adapter *adapter,
+ unsigned int offset, int type) {
+ int rc;
+ unsigned int n_attr;
+ struct hwmon_attr *igb_attr;
+
+ n_attr = adapter->igb_hwmon_buff.n_hwmon;
+ igb_attr = &adapter->igb_hwmon_buff.hwmon_list[n_attr];
+
+ switch (type) {
+ case IGB_HWMON_TYPE_LOC:
+ igb_attr->dev_attr.show = igb_hwmon_show_location;
+ snprintf(igb_attr->name, sizeof(igb_attr->name),
+ "temp%u_label", offset);
+ break;
+ case IGB_HWMON_TYPE_TEMP:
+ igb_attr->dev_attr.show = igb_hwmon_show_temp;
+ snprintf(igb_attr->name, sizeof(igb_attr->name),
+ "temp%u_input", offset);
+ break;
+ case IGB_HWMON_TYPE_CAUTION:
+ igb_attr->dev_attr.show = igb_hwmon_show_cautionthresh;
+ snprintf(igb_attr->name, sizeof(igb_attr->name),
+ "temp%u_max", offset);
+ break;
+ case IGB_HWMON_TYPE_MAX:
+ igb_attr->dev_attr.show = igb_hwmon_show_maxopthresh;
+ snprintf(igb_attr->name, sizeof(igb_attr->name),
+ "temp%u_crit", offset);
+ break;
+ default:
+ rc = -EPERM;
+ return rc;
+ }
+
+ /* These always the same regardless of type */
+ igb_attr->sensor =
+ &adapter->hw.mac.thermal_sensor_data.sensor[offset];
+ igb_attr->hw = &adapter->hw;
+ igb_attr->dev_attr.store = NULL;
+ igb_attr->dev_attr.attr.mode = S_IRUGO;
+ igb_attr->dev_attr.attr.name = igb_attr->name;
+ sysfs_attr_init(&igb_attr->dev_attr.attr);
+ rc = device_create_file(&adapter->pdev->dev,
+ &igb_attr->dev_attr);
+ if (rc == 0)
+ ++adapter->igb_hwmon_buff.n_hwmon;
+
+ return rc;
+}
+
+static void igb_sysfs_del_adapter(struct igb_adapter *adapter)
+{
+ int i;
+
+ if (adapter == NULL)
+ return;
+
+ for (i = 0; i < adapter->igb_hwmon_buff.n_hwmon; i++) {
+ device_remove_file(&adapter->pdev->dev,
+ &adapter->igb_hwmon_buff.hwmon_list[i].dev_attr);
+ }
+
+ kfree(adapter->igb_hwmon_buff.hwmon_list);
+
+ if (adapter->igb_hwmon_buff.device)
+ hwmon_device_unregister(adapter->igb_hwmon_buff.device);
+}
+
+/* called from igb_main.c */
+void igb_sysfs_exit(struct igb_adapter *adapter)
+{
+ igb_sysfs_del_adapter(adapter);
+}
+
+/* called from igb_main.c */
+int igb_sysfs_init(struct igb_adapter *adapter)
+{
+ struct hwmon_buff *igb_hwmon = &adapter->igb_hwmon_buff;
+ unsigned int i;
+ int n_attrs;
+ int rc = 0;
+
+ /* If this method isn't defined we don't support thermals */
+ if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL)
+ goto exit;
+
+ /* Don't create thermal hwmon interface if no sensors present */
+ rc = (adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw));
+ if (rc)
+ goto exit;
+
+ /* Allocation space for max attributes
+ * max num sensors * values (loc, temp, max, caution)
+ */
+ n_attrs = E1000_MAX_SENSORS * 4;
+ igb_hwmon->hwmon_list = kcalloc(n_attrs, sizeof(struct hwmon_attr),
+ GFP_KERNEL);
+ if (!igb_hwmon->hwmon_list) {
+ rc = -ENOMEM;
+ goto err;
+ }
+
+ igb_hwmon->device = hwmon_device_register(&adapter->pdev->dev);
+ if (IS_ERR(igb_hwmon->device)) {
+ rc = PTR_ERR(igb_hwmon->device);
+ goto err;
+ }
+
+ for (i = 0; i < E1000_MAX_SENSORS; i++) {
+
+ /* Only create hwmon sysfs entries for sensors that have
+ * meaningful data.
+ */
+ if (adapter->hw.mac.thermal_sensor_data.sensor[i].location == 0)
+ continue;
+
+ /* Bail if any hwmon attr struct fails to initialize */
+ rc = igb_add_hwmon_attr(adapter, i, IGB_HWMON_TYPE_CAUTION);
+ rc |= igb_add_hwmon_attr(adapter, i, IGB_HWMON_TYPE_LOC);
+ rc |= igb_add_hwmon_attr(adapter, i, IGB_HWMON_TYPE_TEMP);
+ rc |= igb_add_hwmon_attr(adapter, i, IGB_HWMON_TYPE_MAX);
+ if (rc)
+ goto err;
+ }
+
+ goto exit;
+
+err:
+ igb_sysfs_del_adapter(adapter);
+exit:
+ return rc;
+}
+#endif /* IGB_HWMON */
diff --git a/kmod/igb/igb_sysfs.c b/kmod/igb/igb_sysfs.c
deleted file mode 100644
index 27258925..00000000
--- a/kmod/igb/igb_sysfs.c
+++ /dev/null
@@ -1,1058 +0,0 @@
-/*******************************************************************************
-
- Intel(R) Gigabit Ethernet Linux driver
- Copyright(c) 2007-2013 Intel Corporation.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms and conditions of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- This program is distributed in the hope it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
- The full GNU General Public License is included in this distribution in
- the file called "COPYING".
-
- Contact Information:
- e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-
-*******************************************************************************/
-
-#include "igb.h"
-#include "e1000_82575.h"
-#include "e1000_hw.h"
-#ifdef IGB_SYSFS
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/sysfs.h>
-#include <linux/kobject.h>
-#include <linux/device.h>
-#include <linux/netdevice.h>
-
-static struct net_device_stats *sysfs_get_stats(struct net_device *netdev)
-{
-#ifndef HAVE_NETDEV_STATS_IN_NETDEV
- struct igb_adapter *adapter;
-#endif
- if (netdev == NULL)
- return NULL;
-
-#ifdef HAVE_NETDEV_STATS_IN_NETDEV
- /* only return the current stats */
- return &netdev->stats;
-#else
- adapter = netdev_priv(netdev);
-
- /* only return the current stats */
- return &adapter->net_stats;
-#endif /* HAVE_NETDEV_STATS_IN_NETDEV */
-}
-
-struct net_device *igb_get_netdev(struct kobject *kobj)
-{
- struct net_device *netdev;
- struct kobject *parent = kobj->parent;
- struct device *device_info_kobj;
-
- if (kobj == NULL)
- return NULL;
-
- device_info_kobj = container_of(parent, struct device, kobj);
- if (device_info_kobj == NULL)
- return NULL;
-
- netdev = container_of(device_info_kobj, struct net_device, dev);
- return netdev;
-}
-struct igb_adapter *igb_get_adapter(struct kobject *kobj)
-{
- struct igb_adapter *adapter;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return NULL;
- adapter = netdev_priv(netdev);
- return adapter;
-}
-
-bool igb_thermal_present(struct kobject *kobj)
-{
- s32 status;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
-
- if (adapter == NULL)
- return false;
-
- /*
- * Only set I2C bit-bang mode if an external thermal sensor is
- * supported on this device.
- */
- if (adapter->ets) {
- status = e1000_set_i2c_bb(&(adapter->hw));
- if (status != E1000_SUCCESS)
- return false;
- }
-
- status = e1000_init_thermal_sensor_thresh(&(adapter->hw));
- if (status != E1000_SUCCESS)
- return false;
-
- return true;
-}
-
-/*
- * Convert the directory to the sensor offset.
- *
- * Note: We know the name will be in the form of 'sensor_n' where 'n' is 0
- * - 'IGB_MAX_SENSORS'. E1000_MAX_SENSORS < 10.
- */
-static int igb_name_to_idx(const char *c) {
-
- /* find first digit */
- while (*c < '0' || *c > '9') {
- if (*c == '\n')
- return -1;
- c++;
- }
-
- return ((int)(*c - '0'));
-}
-
-/*
- * We are a statistics entry; we do not take in data-this should be the
- * same for all attributes
- */
-static ssize_t igb_store(struct kobject *kobj,
- struct kobj_attribute *attr,
- const char *buf, size_t count)
-{
- return -1;
-}
-
-static ssize_t igb_fwbanner(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- return snprintf(buf, PAGE_SIZE, "0x%08x\n", adapter->etrack_id);
-}
-
-static ssize_t igb_numeports(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- int ports = 0;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- /* CMW taking the original out so assigning ports generally
- * by mac type for now. Want to have the daemon handle this some
- * other way due to the variability of the 1GB parts.
- */
- switch (hw->mac.type) {
- case e1000_82575:
- ports = 2;
- break;
- case e1000_82576:
- ports = 2;
- break;
- case e1000_82580:
- case e1000_i350:
- ports = 4;
- break;
- case e1000_i210:
- case e1000_i211:
- ports = 1;
- break;
- default:
- break;
- }
-
- return snprintf(buf, PAGE_SIZE, "%d\n", ports);
-}
-
-static ssize_t igb_porttype(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- test_bit(__IGB_DOWN, &adapter->state));
-}
-
-static ssize_t igb_portspeed(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- int speed = 0;
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- switch (adapter->link_speed) {
- case E1000_STATUS_SPEED_10:
- speed = 10;
- break;;
- case E1000_STATUS_SPEED_100:
- speed = 100;
- break;
- case E1000_STATUS_SPEED_1000:
- speed = 1000;
- break;
- }
- return snprintf(buf, PAGE_SIZE, "%d\n", speed);
-}
-
-static ssize_t igb_wqlflag(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", adapter->wol);
-}
-
-static ssize_t igb_xflowctl(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", hw->fc.current_mode);
-}
-
-static ssize_t igb_rxdrops(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- net_stats = sysfs_get_stats(netdev);
- if (net_stats == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net stats\n");
-
- return snprintf(buf, PAGE_SIZE, "%lu\n",
- net_stats->rx_dropped);
-}
-
-static ssize_t igb_rxerrors(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- net_stats = sysfs_get_stats(netdev);
- if (net_stats == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net stats\n");
- return snprintf(buf, PAGE_SIZE, "%lu\n", net_stats->rx_errors);
-}
-
-static ssize_t igb_rxupacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", E1000_READ_REG(hw, E1000_TPR));
-}
-
-static ssize_t igb_rxmpacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", E1000_READ_REG(hw, E1000_MPRC));
-}
-
-static ssize_t igb_rxbpacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", E1000_READ_REG(hw, E1000_BPRC));
-}
-
-static ssize_t igb_txupacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", E1000_READ_REG(hw, E1000_TPT));
-}
-
-static ssize_t igb_txmpacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", E1000_READ_REG(hw, E1000_MPTC));
-}
-
-static ssize_t igb_txbpacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", E1000_READ_REG(hw, E1000_BPTC));
-
-}
-
-static ssize_t igb_txerrors(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- net_stats = sysfs_get_stats(netdev);
- if (net_stats == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net stats\n");
-
- return snprintf(buf, PAGE_SIZE, "%lu\n",
- net_stats->tx_errors);
-}
-
-static ssize_t igb_txdrops(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- net_stats = sysfs_get_stats(netdev);
- if (net_stats == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net stats\n");
- return snprintf(buf, PAGE_SIZE, "%lu\n",
- net_stats->tx_dropped);
-}
-
-static ssize_t igb_rxframes(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- net_stats = sysfs_get_stats(netdev);
- if (net_stats == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net stats\n");
-
- return snprintf(buf, PAGE_SIZE, "%lu\n",
- net_stats->rx_packets);
-}
-
-static ssize_t igb_rxbytes(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- net_stats = sysfs_get_stats(netdev);
- if (net_stats == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net stats\n");
-
- return snprintf(buf, PAGE_SIZE, "%lu\n",
- net_stats->rx_bytes);
-}
-
-static ssize_t igb_txframes(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- net_stats = sysfs_get_stats(netdev);
- if (net_stats == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net stats\n");
-
- return snprintf(buf, PAGE_SIZE, "%lu\n",
- net_stats->tx_packets);
-}
-
-static ssize_t igb_txbytes(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- net_stats = sysfs_get_stats(netdev);
- if (net_stats == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net stats\n");
-
- return snprintf(buf, PAGE_SIZE, "%lu\n",
- net_stats->tx_bytes);
-}
-
-static ssize_t igb_linkstat(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- bool link_up = false;
- int bitmask = 0;
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- if (test_bit(__IGB_DOWN, &adapter->state))
- bitmask |= 1;
-
- if (hw->mac.ops.check_for_link) {
- hw->mac.ops.check_for_link(hw);
- }
- else {
- /* always assume link is up, if no check link function */
- link_up = true;
- }
- if (link_up)
- bitmask |= 2;
- return snprintf(buf, PAGE_SIZE, "0x%X\n", bitmask);
-}
-
-static ssize_t igb_funcid(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- return snprintf(buf, PAGE_SIZE, "0x%lX\n", netdev->base_addr);
-}
-
-static ssize_t igb_funcvers(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- return snprintf(buf, PAGE_SIZE, "%s\n", igb_driver_version);
-}
-
-static ssize_t igb_macburn(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "0x%X%X%X%X%X%X\n",
- (unsigned int)hw->mac.perm_addr[0],
- (unsigned int)hw->mac.perm_addr[1],
- (unsigned int)hw->mac.perm_addr[2],
- (unsigned int)hw->mac.perm_addr[3],
- (unsigned int)hw->mac.perm_addr[4],
- (unsigned int)hw->mac.perm_addr[5]);
-}
-
-static ssize_t igb_macadmn(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- struct e1000_hw *hw;
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return snprintf(buf, PAGE_SIZE, "0x%X%X%X%X%X%X\n",
- (unsigned int)hw->mac.addr[0],
- (unsigned int)hw->mac.addr[1],
- (unsigned int)hw->mac.addr[2],
- (unsigned int)hw->mac.addr[3],
- (unsigned int)hw->mac.addr[4],
- (unsigned int)hw->mac.addr[5]);
-}
-
-static ssize_t igb_maclla1(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct e1000_hw *hw;
- u16 eeprom_buff[6];
- int first_word = 0x37;
- int word_count = 6;
- int rc;
-
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- return 0;
-
- rc = e1000_read_nvm(hw, first_word, word_count,
- eeprom_buff);
- if (rc != E1000_SUCCESS)
- return 0;
-
- switch (hw->bus.func) {
- case 0:
- return snprintf(buf, PAGE_SIZE, "0x%04X%04X%04X\n",
- eeprom_buff[0], eeprom_buff[1], eeprom_buff[2]);
- case 1:
- return snprintf(buf, PAGE_SIZE, "0x%04X%04X%04X\n",
- eeprom_buff[3], eeprom_buff[4], eeprom_buff[5]);
- }
- return snprintf(buf, PAGE_SIZE, "unexpected port %d\n", hw->bus.func);
-}
-
-static ssize_t igb_mtusize(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", netdev->mtu);
-}
-
-static ssize_t igb_featflag(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
-#ifdef HAVE_NDO_SET_FEATURES
- int bitmask = 0;
-#endif
- struct net_device *netdev = igb_get_netdev(kobj);
- struct igb_adapter *adapter = igb_get_adapter(kobj);
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
-#ifndef HAVE_NDO_SET_FEATURES
- /* igb_get_rx_csum(netdev) doesn't compile so hard code */
- return snprintf(buf, PAGE_SIZE, "%d\n",
- test_bit(IGB_RING_FLAG_RX_CSUM,
- &adapter->rx_ring[0]->flags));
-#else
- if (netdev->features & NETIF_F_RXCSUM)
- bitmask |= 1;
- return snprintf(buf, PAGE_SIZE, "%d\n", bitmask);
-#endif
-}
-
-static ssize_t igb_lsominct(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- return snprintf(buf, PAGE_SIZE, "%d\n", 1);
-}
-
-static ssize_t igb_prommode(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device *netdev = igb_get_netdev(kobj);
- if (netdev == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no net device\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- netdev->flags & IFF_PROMISC);
-}
-
-static ssize_t igb_txdscqsz(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", adapter->tx_ring[0]->count);
-}
-
-static ssize_t igb_rxdscqsz(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", adapter->rx_ring[0]->count);
-}
-
-static ssize_t igb_rxqavg(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- int index;
- int diff = 0;
- u16 ntc;
- u16 ntu;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- for (index = 0; index < adapter->num_rx_queues; index++) {
- ntc = adapter->rx_ring[index]->next_to_clean;
- ntu = adapter->rx_ring[index]->next_to_use;
-
- if (ntc >= ntu)
- diff += (ntc - ntu);
- else
- diff += (adapter->rx_ring[index]->count - ntu + ntc);
- }
- if (adapter->num_rx_queues <= 0)
- return snprintf(buf, PAGE_SIZE,
- "can't calculate, number of queues %d\n",
- adapter->num_rx_queues);
- return snprintf(buf, PAGE_SIZE, "%d\n", diff/adapter->num_rx_queues);
-}
-
-static ssize_t igb_txqavg(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- int index;
- int diff = 0;
- u16 ntc;
- u16 ntu;
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- for (index = 0; index < adapter->num_tx_queues; index++) {
- ntc = adapter->tx_ring[index]->next_to_clean;
- ntu = adapter->tx_ring[index]->next_to_use;
-
- if (ntc >= ntu)
- diff += (ntc - ntu);
- else
- diff += (adapter->tx_ring[index]->count - ntu + ntc);
- }
- if (adapter->num_tx_queues <= 0)
- return snprintf(buf, PAGE_SIZE,
- "can't calculate, number of queues %d\n",
- adapter->num_tx_queues);
- return snprintf(buf, PAGE_SIZE, "%d\n",
- diff/adapter->num_tx_queues);
-}
-
-static ssize_t igb_iovotype(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- return snprintf(buf, PAGE_SIZE, "2\n");
-}
-
-static ssize_t igb_funcnbr(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", adapter->vfs_allocated_count);
-}
-
-s32 igb_sysfs_get_thermal_data(struct kobject *kobj, char *buf)
-{
- s32 status;
- struct igb_adapter *adapter = igb_get_adapter(kobj->parent);
-
- if (adapter == NULL) {
- snprintf(buf, PAGE_SIZE, "error: missing adapter\n");
- return 0;
- }
-
- if (&adapter->hw == NULL) {
- snprintf(buf, PAGE_SIZE, "error: missing hw\n");
- return 0;
- }
-
- status = e1000_get_thermal_sensor_data_generic(&(adapter->hw));
- if (status != E1000_SUCCESS)
- snprintf(buf, PAGE_SIZE, "error: status %d returned\n", status);
-
- return status;
-}
-
-static ssize_t igb_sysfs_location(struct kobject *kobj,
- struct kobj_attribute *attr,
- char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj->parent);
- int idx;
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- idx = igb_name_to_idx(kobj->name);
- if (idx == -1)
- return snprintf(buf, PAGE_SIZE,
- "error: invalid sensor name %s\n", kobj->name);
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- adapter->hw.mac.thermal_sensor_data.sensor[idx].location);
-}
-
-static ssize_t igb_sysfs_temp(struct kobject *kobj,
- struct kobj_attribute *attr,
- char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj->parent);
- int idx;
-
- s32 status = igb_sysfs_get_thermal_data(kobj, buf);
-
- if (status != E1000_SUCCESS)
- return snprintf(buf, PAGE_SIZE, "error: status %d returned",
- status);
-
-
- idx = igb_name_to_idx(kobj->name);
- if (idx == -1)
- return snprintf(buf, PAGE_SIZE,
- "error: invalid sensor name %s\n", kobj->name);
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- adapter->hw.mac.thermal_sensor_data.sensor[idx].temp);
-}
-
-static ssize_t igb_sysfs_maxopthresh(struct kobject *kobj,
- struct kobj_attribute *attr,
- char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj->parent);
- int idx;
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- idx = igb_name_to_idx(kobj->name);
- if (idx == -1)
- return snprintf(buf, PAGE_SIZE,
- "error: invalid sensor name %s\n", kobj->name);
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- adapter->hw.mac.thermal_sensor_data.sensor[idx].max_op_thresh);
-}
-
-static ssize_t igb_sysfs_cautionthresh(struct kobject *kobj,
- struct kobj_attribute *attr,
- char *buf)
-{
- struct igb_adapter *adapter = igb_get_adapter(kobj->parent);
- int idx;
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- idx = igb_name_to_idx(kobj->name);
- if (idx == -1)
- return snprintf(buf, PAGE_SIZE,
- "error: invalid sensor name %s\n", kobj->name);
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- adapter->hw.mac.thermal_sensor_data.sensor[0].caution_thresh);
-}
-
-/* Initialize the attributes */
-static struct kobj_attribute igb_sysfs_location_attr =
- __ATTR(location, 0444, igb_sysfs_location, igb_store);
-static struct kobj_attribute igb_sysfs_temp_attr =
- __ATTR(temp, 0444, igb_sysfs_temp, igb_store);
-static struct kobj_attribute igb_sysfs_cautionthresh_attr =
- __ATTR(cautionthresh, 0444, igb_sysfs_cautionthresh, igb_store);
-static struct kobj_attribute igb_sysfs_maxopthresh_attr =
- __ATTR(maxopthresh, 0444, igb_sysfs_maxopthresh, igb_store);
-
-static struct kobj_attribute igb_sysfs_fwbanner_attr =
- __ATTR(fwbanner, 0444, igb_fwbanner, igb_store);
-static struct kobj_attribute igb_sysfs_numeports_attr =
- __ATTR(numeports, 0444, igb_numeports, igb_store);
-static struct kobj_attribute igb_sysfs_porttype_attr =
- __ATTR(porttype, 0444, igb_porttype, igb_store);
-static struct kobj_attribute igb_sysfs_portspeed_attr =
- __ATTR(portspeed, 0444, igb_portspeed, igb_store);
-static struct kobj_attribute igb_sysfs_wqlflag_attr =
- __ATTR(wqlflag, 0444, igb_wqlflag, igb_store);
-static struct kobj_attribute igb_sysfs_xflowctl_attr =
- __ATTR(xflowctl, 0444, igb_xflowctl, igb_store);
-static struct kobj_attribute igb_sysfs_rxdrops_attr =
- __ATTR(rxdrops, 0444, igb_rxdrops, igb_store);
-static struct kobj_attribute igb_sysfs_rxerrors_attr =
- __ATTR(rxerrors, 0444, igb_rxerrors, igb_store);
-static struct kobj_attribute igb_sysfs_rxupacks_attr =
- __ATTR(rxupacks, 0444, igb_rxupacks, igb_store);
-static struct kobj_attribute igb_sysfs_rxmpacks_attr =
- __ATTR(rxmpacks, 0444, igb_rxmpacks, igb_store);
-static struct kobj_attribute igb_sysfs_rxbpacks_attr =
- __ATTR(rxbpacks, 0444, igb_rxbpacks, igb_store);
-static struct kobj_attribute igb_sysfs_txupacks_attr =
- __ATTR(txupacks, 0444, igb_txupacks, igb_store);
-static struct kobj_attribute igb_sysfs_txmpacks_attr =
- __ATTR(txmpacks, 0444, igb_txmpacks, igb_store);
-static struct kobj_attribute igb_sysfs_txbpacks_attr =
- __ATTR(txbpacks, 0444, igb_txbpacks, igb_store);
-static struct kobj_attribute igb_sysfs_txerrors_attr =
- __ATTR(txerrors, 0444, igb_txerrors, igb_store);
-static struct kobj_attribute igb_sysfs_txdrops_attr =
- __ATTR(txdrops, 0444, igb_txdrops, igb_store);
-static struct kobj_attribute igb_sysfs_rxframes_attr =
- __ATTR(rxframes, 0444, igb_rxframes, igb_store);
-static struct kobj_attribute igb_sysfs_rxbytes_attr =
- __ATTR(rxbytes, 0444, igb_rxbytes, igb_store);
-static struct kobj_attribute igb_sysfs_txframes_attr =
- __ATTR(txframes, 0444, igb_txframes, igb_store);
-static struct kobj_attribute igb_sysfs_txbytes_attr =
- __ATTR(txbytes, 0444, igb_txbytes, igb_store);
-static struct kobj_attribute igb_sysfs_linkstat_attr =
- __ATTR(linkstat, 0444, igb_linkstat, igb_store);
-static struct kobj_attribute igb_sysfs_funcid_attr =
- __ATTR(funcid, 0444, igb_funcid, igb_store);
-static struct kobj_attribute igb_sysfs_funvers_attr =
- __ATTR(funcvers, 0444, igb_funcvers, igb_store);
-static struct kobj_attribute igb_sysfs_macburn_attr =
- __ATTR(macburn, 0444, igb_macburn, igb_store);
-static struct kobj_attribute igb_sysfs_macadmn_attr =
- __ATTR(macadmn, 0444, igb_macadmn, igb_store);
-static struct kobj_attribute igb_sysfs_maclla1_attr =
- __ATTR(maclla1, 0444, igb_maclla1, igb_store);
-static struct kobj_attribute igb_sysfs_mtusize_attr =
- __ATTR(mtusize, 0444, igb_mtusize, igb_store);
-static struct kobj_attribute igb_sysfs_featflag_attr =
- __ATTR(featflag, 0444, igb_featflag, igb_store);
-static struct kobj_attribute igb_sysfs_lsominct_attr =
- __ATTR(lsominct, 0444, igb_lsominct, igb_store);
-static struct kobj_attribute igb_sysfs_prommode_attr =
- __ATTR(prommode, 0444, igb_prommode, igb_store);
-static struct kobj_attribute igb_sysfs_txdscqsz_attr =
- __ATTR(txdscqsz, 0444, igb_txdscqsz, igb_store);
-static struct kobj_attribute igb_sysfs_rxdscqsz_attr =
- __ATTR(rxdscqsz, 0444, igb_rxdscqsz, igb_store);
-static struct kobj_attribute igb_sysfs_txqavg_attr =
- __ATTR(txqavg, 0444, igb_txqavg, igb_store);
-static struct kobj_attribute igb_sysfs_rxqavg_attr =
- __ATTR(rxqavg, 0444, igb_rxqavg, igb_store);
-static struct kobj_attribute igb_sysfs_iovotype_attr =
- __ATTR(iovotype, 0444, igb_iovotype, igb_store);
-static struct kobj_attribute igb_sysfs_funcnbr_attr =
- __ATTR(funcnbr, 0444, igb_funcnbr, igb_store);
-
-/* Add the attributes into an array, to be added to a group */
-static struct attribute *therm_attrs[] = {
- &igb_sysfs_location_attr.attr,
- &igb_sysfs_temp_attr.attr,
- &igb_sysfs_cautionthresh_attr.attr,
- &igb_sysfs_maxopthresh_attr.attr,
- NULL
-};
-
-static struct attribute *attrs[] = {
- &igb_sysfs_fwbanner_attr.attr,
- &igb_sysfs_numeports_attr.attr,
- &igb_sysfs_porttype_attr.attr,
- &igb_sysfs_portspeed_attr.attr,
- &igb_sysfs_wqlflag_attr.attr,
- &igb_sysfs_xflowctl_attr.attr,
- &igb_sysfs_rxdrops_attr.attr,
- &igb_sysfs_rxerrors_attr.attr,
- &igb_sysfs_rxupacks_attr.attr,
- &igb_sysfs_rxmpacks_attr.attr,
- &igb_sysfs_rxbpacks_attr.attr,
- &igb_sysfs_txdrops_attr.attr,
- &igb_sysfs_txerrors_attr.attr,
- &igb_sysfs_txupacks_attr.attr,
- &igb_sysfs_txmpacks_attr.attr,
- &igb_sysfs_txbpacks_attr.attr,
- &igb_sysfs_rxframes_attr.attr,
- &igb_sysfs_rxbytes_attr.attr,
- &igb_sysfs_txframes_attr.attr,
- &igb_sysfs_txbytes_attr.attr,
- &igb_sysfs_linkstat_attr.attr,
- &igb_sysfs_funcid_attr.attr,
- &igb_sysfs_funvers_attr.attr,
- &igb_sysfs_macburn_attr.attr,
- &igb_sysfs_macadmn_attr.attr,
- &igb_sysfs_maclla1_attr.attr,
- &igb_sysfs_mtusize_attr.attr,
- &igb_sysfs_featflag_attr.attr,
- &igb_sysfs_lsominct_attr.attr,
- &igb_sysfs_prommode_attr.attr,
- &igb_sysfs_txdscqsz_attr.attr,
- &igb_sysfs_rxdscqsz_attr.attr,
- &igb_sysfs_txqavg_attr.attr,
- &igb_sysfs_rxqavg_attr.attr,
- &igb_sysfs_iovotype_attr.attr,
- &igb_sysfs_funcnbr_attr.attr,
- NULL
-};
-
-/* add attributes to a group */
-static struct attribute_group therm_attr_group = {
- .attrs = therm_attrs,
-};
-
-/* add attributes to a group */
-static struct attribute_group attr_group = {
- .attrs = attrs,
-};
-
-void igb_del_adapter(struct igb_adapter *adapter)
-{
- int i;
-
- for (i = 0; i < E1000_MAX_SENSORS; i++) {
- if (adapter->therm_kobj[i] == NULL)
- continue;
- sysfs_remove_group(adapter->therm_kobj[i], &therm_attr_group);
- kobject_put(adapter->therm_kobj[i]);
- }
- if (adapter->info_kobj != NULL) {
- sysfs_remove_group(adapter->info_kobj, &attr_group);
- kobject_put(adapter->info_kobj);
- }
-}
-
-/* cleanup goes here */
-void igb_sysfs_exit(struct igb_adapter *adapter)
-{
- igb_del_adapter(adapter);
-}
-
-int igb_sysfs_init(struct igb_adapter *adapter)
-{
- struct net_device *netdev;
- int rc = 0;
- int i;
- char buf[16];
-
- if ( adapter == NULL )
- goto del_adapter;
- netdev = adapter->netdev;
- if (netdev == NULL)
- goto del_adapter;
-
- adapter->info_kobj = NULL;
- for (i = 0; i < E1000_MAX_SENSORS; i++)
- adapter->therm_kobj[i] = NULL;
-
- /* create stats kobj and attribute listings in kobj */
- adapter->info_kobj = kobject_create_and_add("info",
- &(netdev->dev.kobj));
- if (adapter->info_kobj == NULL)
- goto del_adapter;
- if (sysfs_create_group(adapter->info_kobj, &attr_group))
- goto del_adapter;
-
- /* Don't create thermal subkobjs if no data present */
- if (igb_thermal_present(adapter->info_kobj) != true)
- goto exit;
-
- for (i = 0; i < E1000_MAX_SENSORS; i++) {
-
- /*
- * Likewise only create individual kobjs that have
- * meaningful data.
- */
- if (adapter->hw.mac.thermal_sensor_data.sensor[i].location == 0)
- continue;
-
- /* directory named after sensor offset */
- snprintf(buf, sizeof(buf), "sensor_%d", i);
- adapter->therm_kobj[i] =
- kobject_create_and_add(buf, adapter->info_kobj);
- if (adapter->therm_kobj[i] == NULL)
- goto del_adapter;
- if (sysfs_create_group(adapter->therm_kobj[i],
- &therm_attr_group))
- goto del_adapter;
- }
-
- goto exit;
-
-del_adapter:
- if ( adapter != NULL )
- igb_del_adapter(adapter);
- rc = -1;
-exit:
- return rc;
-}
-
-#endif /* IGB_SYSFS */
diff --git a/kmod/igb/pci.updates b/kmod/igb/pci.updates
new file mode 100644
index 00000000..a240b31b
--- /dev/null
+++ b/kmod/igb/pci.updates
@@ -0,0 +1,19 @@
+# updates for the system pci.ids file
+#
+# IMPORTANT! Entries in this list must be sorted as they
+# would appear in the system pci.ids file. Entries
+# are sorted by ven, dev, subven, subdev
+# (numerical order).
+#
+8086 Intel Corporation
+ 1533 I210 Gigabit Network Connection
+ 103c 0003 Ethernet I210-T1 GbE NIC
+ 8086 0001 Ethernet Server Adapter I210-T1
+ 8086 0002 Ethernet Server Adapter I210-T1
+ 1534 I210 Gigabit Network Connection
+ 1535 I210 Gigabit Network Connection
+ 1536 I210 Gigabit Fiber Network Connection
+ 1537 I210 Gigabit Backplane Network Connection
+ 1538 I210 Gigabit Network Connection
+ 157b I210 Gigabit Network Connection
+ 157c I210 Gigabit Backplane Connection
diff --git a/kmod/igb/startup.sh b/kmod/igb/startup.sh
new file mode 100644
index 00000000..b8f87b6b
--- /dev/null
+++ b/kmod/igb/startup.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+INTERFACE=p2p1
+export INTERFACE
+
+rmmod igb
+rmmod igb_avb
+insmod ./igb_avb.ko
+sleep 1
+ifconfig $INTERFACE down
+echo 0 > /sys/class/net/$INTERFACE/queues/tx-0/xps_cpus
+echo 0 > /sys/class/net/$INTERFACE/queues/tx-1/xps_cpus
+echo f > /sys/class/net/$INTERFACE/queues/tx-2/xps_cpus
+echo f > /sys/class/net/$INTERFACE/queues/tx-3/xps_cpus
+ifconfig $INTERFACE up