[-]
[+]
|
Changed |
intel-ixgbe.changes
|
|
[-]
[+]
|
Changed |
intel-ixgbe.spec
^
|
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/README
^
|
@@ -1,7 +1,7 @@
Linux* Base Driver for the Intel(R) Ethernet 10 Gigabit PCI Express Family of
Adapters
=============================================================================
-September 25, 2012
+February 12, 2013
Contents
========
@@ -226,24 +226,41 @@
To build ixgbe driver with DCA:
------------------------------
-If your kernel supports DCA, the driver will build by default with DCA enabled.
+If your kernel supports DCA, the driver will build by default with DCA
+enabled.
Command Line Parameters
=======================
-
-If the driver is built as a module, the following optional parameters are
-used by entering them on the command line with the modprobe command using
+If the driver is built as a module, the following optional parameters are
+used by entering them on the command line with the modprobe command using
this syntax:
modprobe ixgbe [<option>=<VAL1>,<VAL2>,...]
+There needs to be a <VAL#> for each network port in the system supported
+by this driver. The values will be applied to each instance, in function
+order.
+
For example:
modprobe ixgbe InterruptThrottleRate=16000,16000
-The default value for each parameter is generally the recommended setting,
+In this case, there are two network ports supported by ixgbe in the system.
+The default value for each parameter is generally the recommended setting,
unless otherwise noted.
+
+NOTES: For more information about the AutoNeg, Duplex, and Speed parameters,
+ see the Speed and Duplex Configuration section in this document.
+
+ For more information about the InterruptThrottleRate,
+ parameter, see the application note at:
+ http://www.intel.com/design/network/applnots/ap450.htm
+
+ A descriptor describes a data buffer and attributes related to
+ the data buffer. This information is accessed by the hardware.
+
+
RSS - Receive Side Scaling (or multiple queues for receives)
------------------------------------------------------------
Valid Range: 0 - 16
@@ -450,7 +467,7 @@
Flow director is enabled only if the kernel is multiple TX queue capable.
-An included script (set_irq_affinity.sh) automates setting the IRQ to CPU
+An included script (set_irq_affinity) automates setting the IRQ to CPU
affinity.
You can verify that the driver is using Flow Director by looking at the counter
@@ -603,17 +620,21 @@
------------
The driver supports Jumbo Frames for all adapters. Jumbo Frames support is
enabled by changing the MTU to a value larger than the default of 1500.
- The maximum value for the MTU is 16110. Use the ifconfig command to
+ The maximum value for the MTU is 9710. Use the ifconfig command to
increase the MTU size. For example:
ifconfig ethX mtu 9000 up
- The maximum MTU setting for Jumbo Frames is 16110. This value coincides
- with the maximum Jumbo Frames size of 16128. This driver will attempt to
+ The maximum MTU setting for Jumbo Frames is 9710. This value coincides
+ with the maximum Jumbo Frames size of 9728. This driver will attempt to
use multiple page sized buffers to receive each jumbo packet. This
should help to avoid buffer starvation issues when allocating receive
packets.
+ For 82599-based network connections, if you are enabling jumbo frames in a
+ virtual function (VF), jumbo frames must first be enabled in the physical
+ function (PF). The VF MTU setting cannot be larger than the PF MTU.
+
ethtool
-------
The driver utilizes the ethtool interface for driver configuration and
@@ -700,6 +721,8 @@
Where x=the PF interface# n=the number of spoofed packets
+ Note that this feature can be disabled for a specific Virtual Function (VF).
+
Setting MAC Address, VLAN and Rate Limit Using IProute2 Tool
------------------------------------------------------------
You can set a MAC address of a Virtual Function (VF), a default VLAN and the
@@ -714,6 +737,17 @@
ethtool ethX
+ IEEE 1588 PTP
+ -------------
+ Precision Time Protocol (PTP) is used to synchronize clocks in a computer
+ network and is supported in the ixgbe driver.
+
+ The IXGBE_PTP is a compile time flag. The user may enable PTP at compile
+ time by adding CFLAGS_EXTRA="-DIXGBE_PTP" to the make file when it is being
+ compiled.
+
+ make CFLAGS_EXTRA="-DIXGBE_PTP" install
+
Performance Tuning
==================
@@ -893,9 +927,12 @@
hot-plug the VF device out of the VM it is assigned to or else shut down the
VM.
- Unloading Physical Function (PF) Driver Causes System Reboots When VM is
- Running and VF is Loaded on the VM
- -----------------------------------------------------------------------------
+ Unloading Physical Function (PF) Driver Might Cause Kernel Panick or System
+ Reboots When VM is Running and VF is Loaded on the VM
+ ---------------------------------------------------------------------------
+ On pre-3.2 Linux kernels unloading the Physical Function (PF) driver causes system
+ reboots when the VM is running and VF is loaded on the VM.
+
Do not unload the PF driver (ixgbe) while VFs are assigned to guests.
Running ethtool -t ethX command causes break between PF and test client
@@ -957,16 +994,17 @@
NOTE: Link time can take up to 30 seconds. Adjust LINKDELAY value
accordingly.
- Host may reboot after removing PF when VF is active in guest.
-
Alternatively, NetworkManager can be used to configure the interfaces,
which avoids the set timeout. For configuration instructions of
NetworkManager refer to the documentation provided by your distribution.
+ Host may reboot after removing PF when VF is active in guest
------------------------------------------------------------
Using kernel versions earlier than 3.2, do not unload the PF driver with
active VFs. Doing this will cause your VFs to stop working until you reload
- the PF driver and may cause a spontaneous reboot of your system.
+ the PF driver and may cause a spontaneous reboot of your system. Prior to
+ unloading the ixgbe PF driver, shutdown all VMs to ensure VFs are no longer
+ active and unloading ixgbevf driver first.
Software bridging does not work with SR-IOV Virtual Functions
-------------------------------------------------------------
@@ -994,7 +1032,7 @@
=======
Intel 10 Gigabit PCI Express Linux driver.
-Copyright(c) 1999 - 2012 Intel Corporation.
+Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/SUMS
^
|
@@ -1,46 +1,47 @@
-27861 5 ixgbe-3.11.33/pci.updates
-42124 3 ixgbe-3.11.33/scripts/set_irq_affinity.sh
-21465 8 ixgbe-3.11.33/ixgbe.7
-65473 48 ixgbe-3.11.33/src/ixgbe_phy.c
-05116 89 ixgbe-3.11.33/src/ixgbe_ethtool.c
-45722 4 ixgbe-3.11.33/src/ixgbe_dcb_82598.h
-32347 33 ixgbe-3.11.33/src/ixgbe_sriov.c
-65030 3 ixgbe-3.11.33/src/ixgbe_x540.h
-64412 2 ixgbe-3.11.33/src/ixgbe_82598.h
-61801 37 ixgbe-3.11.33/src/ixgbe_82598.c
-12289 29 ixgbe-3.11.33/src/kcompat.c
-63064 114 ixgbe-3.11.33/src/ixgbe_common.c
-07817 36 ixgbe-3.11.33/src/ixgbe_lib.c
-31666 27 ixgbe-3.11.33/src/ixgbe_fcoe.c
-29670 10 ixgbe-3.11.33/src/ixgbe_dcb_82598.c
-30046 29 ixgbe-3.11.33/src/ixgbe_ptp.c
-41055 126 ixgbe-3.11.33/src/ixgbe_type.h
-40273 3 ixgbe-3.11.33/src/ixgbe_82599.h
-35951 18 ixgbe-3.11.33/src/ixgbe_mbx.c
-32872 7 ixgbe-3.11.33/src/ixgbe_common.h
-18750 30 ixgbe-3.11.33/src/ixgbe_sysfs.c
-34165 253 ixgbe-3.11.33/src/ixgbe_main.c
-24091 96 ixgbe-3.11.33/src/kcompat.h
-47797 6 ixgbe-3.11.33/src/ixgbe_phy.h
-26351 5 ixgbe-3.11.33/src/ixgbe_dcb_82599.h
-12190 1 ixgbe-3.11.33/src/Module.supported
-51809 29 ixgbe-3.11.33/src/ixgbe_param.c
-12439 34 ixgbe-3.11.33/src/ixgbe_api.c
-05434 23 ixgbe-3.11.33/src/ixgbe_dcb_nl.c
-03102 20 ixgbe-3.11.33/src/ixgbe_dcb.c
-14817 25 ixgbe-3.11.33/src/ixgbe_procfs.c
-37507 8 ixgbe-3.11.33/src/ixgbe_api.h
-52926 6 ixgbe-3.11.33/src/ixgbe_dcb.h
-63796 3 ixgbe-3.11.33/src/ixgbe_fcoe.h
-10465 7 ixgbe-3.11.33/src/ixgbe_mbx.h
-03134 26 ixgbe-3.11.33/src/ixgbe_x540.c
-41050 68 ixgbe-3.11.33/src/ixgbe_82599.c
-40248 16 ixgbe-3.11.33/src/ixgbe_dcb_82599.c
-16762 29 ixgbe-3.11.33/src/ixgbe.h
-60875 3 ixgbe-3.11.33/src/ixgbe_sriov.h
-06906 5 ixgbe-3.11.33/src/ixgbe_osdep.h
-52269 30 ixgbe-3.11.33/src/kcompat_ethtool.c
-34490 12 ixgbe-3.11.33/src/Makefile
-39773 19 ixgbe-3.11.33/COPYING
-05151 10 ixgbe-3.11.33/ixgbe.spec
-24536 42 ixgbe-3.11.33/README
+63677 5 ixgbe-3.14.5/pci.updates
+42124 3 ixgbe-3.14.5/scripts/set_irq_affinity
+13138 8 ixgbe-3.14.5/ixgbe.7
+24885 48 ixgbe-3.14.5/src/ixgbe_phy.c
+12582 94 ixgbe-3.14.5/src/ixgbe_ethtool.c
+53082 4 ixgbe-3.14.5/src/ixgbe_dcb_82598.h
+15634 34 ixgbe-3.14.5/src/ixgbe_sriov.c
+47113 3 ixgbe-3.14.5/src/ixgbe_x540.h
+63396 2 ixgbe-3.14.5/src/ixgbe_82598.h
+43807 38 ixgbe-3.14.5/src/ixgbe_82598.c
+30053 38 ixgbe-3.14.5/src/kcompat.c
+38748 116 ixgbe-3.14.5/src/ixgbe_common.c
+06846 36 ixgbe-3.14.5/src/ixgbe_lib.c
+30496 27 ixgbe-3.14.5/src/ixgbe_fcoe.c
+00845 10 ixgbe-3.14.5/src/ixgbe_dcb_82598.c
+07581 8 ixgbe-3.14.5/src/ixgbe_debugfs.c
+53925 28 ixgbe-3.14.5/src/ixgbe_ptp.c
+20747 127 ixgbe-3.14.5/src/ixgbe_type.h
+40758 3 ixgbe-3.14.5/src/ixgbe_82599.h
+27148 18 ixgbe-3.14.5/src/ixgbe_mbx.c
+29177 7 ixgbe-3.14.5/src/ixgbe_common.h
+54347 8 ixgbe-3.14.5/src/ixgbe_sysfs.c
+06926 257 ixgbe-3.14.5/src/ixgbe_main.c
+06686 108 ixgbe-3.14.5/src/kcompat.h
+64754 6 ixgbe-3.14.5/src/ixgbe_phy.h
+64248 5 ixgbe-3.14.5/src/ixgbe_dcb_82599.h
+12190 1 ixgbe-3.14.5/src/Module.supported
+10002 29 ixgbe-3.14.5/src/ixgbe_param.c
+19628 34 ixgbe-3.14.5/src/ixgbe_api.c
+13020 23 ixgbe-3.14.5/src/ixgbe_dcb_nl.c
+23013 20 ixgbe-3.14.5/src/ixgbe_dcb.c
+05338 25 ixgbe-3.14.5/src/ixgbe_procfs.c
+44336 8 ixgbe-3.14.5/src/ixgbe_api.h
+04799 6 ixgbe-3.14.5/src/ixgbe_dcb.h
+57178 3 ixgbe-3.14.5/src/ixgbe_fcoe.h
+56528 7 ixgbe-3.14.5/src/ixgbe_mbx.h
+37917 28 ixgbe-3.14.5/src/ixgbe_x540.c
+18163 70 ixgbe-3.14.5/src/ixgbe_82599.c
+42081 16 ixgbe-3.14.5/src/ixgbe_dcb_82599.c
+19504 32 ixgbe-3.14.5/src/ixgbe.h
+63050 3 ixgbe-3.14.5/src/ixgbe_sriov.h
+41978 5 ixgbe-3.14.5/src/ixgbe_osdep.h
+39129 30 ixgbe-3.14.5/src/kcompat_ethtool.c
+36311 12 ixgbe-3.14.5/src/Makefile
+39773 19 ixgbe-3.14.5/COPYING
+10066 10 ixgbe-3.14.5/ixgbe.spec
+64067 43 ixgbe-3.14.5/README
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/ixgbe.7
^
|
@@ -4,7 +4,7 @@
.\"
.\" * Other names and brands may be claimed as the property of others.
.\"
-.TH ixgbe 1 "February 15, 2012"
+.TH ixgbe 1 "February 19, 2013"
.SH NAME
ixgbe \-This file describes the Linux* Base Driver for the 10 Gigabit Family of Adapters.
@@ -165,15 +165,6 @@
.IP
Low Latency Interrupt on VLAN priority threshold.
.LP
-.B FdirMode
-.IP
-.B Valid Range:
-0-2 (0=off, 1=ATR, 2=Perfect filter mode)
-.br
-.B Default Value: 1
-.IP
-Flow Director filtering modes.
-.LP
.B FdirPballoc
.IP
.B Valid Range:
@@ -187,7 +178,7 @@
.B AtrSampleRate
.IP
.B Valid Range:
-1-100
+0-255
.br
.B Default Value:
20
@@ -219,8 +210,8 @@
.IP
ifconfig eth<x> mtu 9000 up
.IP
-The maximum MTU setting for Jumbo Frames is 16110. This value coincides
-with the maximum Jumbo Frames size of 16128. This driver will attempt to
+The maximum MTU setting for Jumbo Frames is 9710. This value coincides
+with the maximum Jumbo Frames size of 9728. This driver will attempt to
use multiple page sized buffers to receive each jumbo packet. This
should help to avoid buffer starvation issues when allocating receive
packets.
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/ixgbe.spec
^
|
@@ -1,6 +1,6 @@
Name: ixgbe
Summary: Intel(R) 10GbE PCI Express Ethernet Connection
-Version: 3.11.33
+Version: 3.14.5
Release: 1
Source: %{name}-%{version}.tar.gz
Vendor: Intel Corporation
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/pci.updates
^
|
@@ -38,23 +38,25 @@
8086 000d Ethernet Mezzanine Adapter X520-KX4-2
10f8 82599EB 10 Gigabit Dual Port Backplane Connection
1028 1f63 Ethernet 10G 2P X520-k bNDC
- 103c 18d0 HP Ethernet 10Gb 2-port 560FLB Adapter
103c 17d2 HP Ethernet 10Gb 2-port 560M Adapter
+ 103c 18d0 HP Ethernet 10Gb 2-port 560FLB Adapter
8086 000c Ethernet X520 10GbE Dual Port KX4-KR Mezz
10f9 82599EB 10 Gigabit CX4 Dual Port Network Connection
10fb 82599EB 10-Gigabit SFI/SFP+ Network Connection
1028 1f72 Ethernet 10G 4P X520/I350 rNDC
103c 17d0 HP Ethernet 10Gb 2-port 560FLR-SFP+ Adapter
103c 17d3 HP Ethernet 10Gb 2-port 560SFP+ Adapter
+ 103c 211b HP Ethernet 10Gb 1-port P560FLR-SFP+ Adapter
+ 103c 2147 HP Ethernet 10Gb 1-port 561i Adapter
108e 7b11 Ethernet Server Adapter X520-2
8086 0002 Ethernet Server Adapter X520-DA2
8086 0003 Ethernet Server Adapter X520-2
8086 0006 Ethernet Server Adapter X520-1
8086 000a Ethernet Server Adapter X520-1
8086 000c Ethernet Server Adapter X520-2
+ 8086 0470 Ethernet 10GSFP+ DP Embedded CNA X520-2
8086 7a11 Ethernet Server Adapter X520-2
8086 7a12 Ethernet Server Adapter X520-2
- 8086 0470 Ethernet 10GSFP+ DP Embedded CNA X520-2
10fc 82599EB 10-Gigabit XAUI/BX4 Network Connection
1507 82599EB 10 Gigabit Network Connection
108e 7b10 Ethernet Express Module X520-P2
@@ -75,6 +77,7 @@
1528 Ethernet Controller X540-AT2
1028 1f61 Ethernet 10G 4P X540/I350 rNDC
103c 192d HP Ethernet 10Gb 2-port 561FLR-T Adapter
+ 103c 211a HP Ethernet 10Gb 2-port 561T Adapter
108e 7b14 Sun Dual Port 10 GbE PCIe 2.0 ExpressModule, Base-T
108e 7b15 Sun Dual Port 10 GbE PCIe 2.0 Low Profile Adapter, Base-T
1137 00bf Ethernet Converged Network Adapter X540-T2
@@ -86,10 +89,6 @@
8086 5003 Ethernet 10G 2P X540-t Adapter
1529 82599 10 Gigabit Dual Port Backplane Connection with FCoE
152a 82599 10 Gigabit Dual port Network Connection with FCoE
- 154a Ethernet Converged Network Adapter X520-4
- 8086 011a Ethernet Converged Network Adapter X520-4
- 8086 011b Ethernet Converged Network Adapter X520-4
- 8086 011c Ethernet Converged Network Adapter X520-4
154d 82599EB 10-Gigabit SFP+ Network Connection
8086 7b11 Ethernet 10G 2P X520 Adapter
154f 82599EB 10Gigabit Dual Port Network Connection
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/scripts/set_irq_affinity
^
|
(renamed to scripts/set_irq_affinity)
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/scripts/set_irq_affinity
^
|
(renamed to scripts/set_irq_affinity)
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/Makefile
^
|
@@ -1,7 +1,7 @@
################################################################################
#
# Intel 10 Gigabit PCI Express Linux driver
-# Copyright(c) 1999 - 2012 Intel Corporation.
+# Copyright(c) 1999 - 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,
@@ -31,13 +31,20 @@
# core driver files
CFILES = ixgbe_main.c ixgbe_common.c ixgbe_api.c ixgbe_param.c \
ixgbe_lib.c ixgbe_ethtool.c kcompat.c ixgbe_82598.c \
- ixgbe_82599.c ixgbe_ptp.c ixgbe_x540.c \
+ ixgbe_82599.c ixgbe_x540.c \
ixgbe_sriov.c ixgbe_mbx.c \
ixgbe_dcb.c ixgbe_dcb_82598.c \
ixgbe_dcb_82599.c \
ixgbe_sysfs.c \
ixgbe_procfs.c \
ixgbe_phy.c
+
+# PTP support is set by CFLAGS compile directive, so we don't need to compile
+# ixgbe_ptp.c unless it is set.
+ifneq (,$(findstring -DIXGBE_PTP, $(CFLAGS_EXTRA)))
+CFILES += ixgbe_ptp.c
+endif
+
HFILES = ixgbe.h ixgbe_common.h ixgbe_api.h ixgbe_osdep.h kcompat.h \
ixgbe_sriov.h ixgbe_mbx.h \
ixgbe_dcb.h \
@@ -88,6 +95,7 @@
VSP := $(KOBJ)/include/generated/utsrelease.h \
$(KOBJ)/include/linux/utsrelease.h \
$(KOBJ)/include/linux/version.h \
+ $(KOBJ)/include/generated/uapi/linux/version.h \
/boot/vmlinuz.version.h
# Config file Search Path
@@ -152,7 +160,7 @@
EXTRA_CFLAGS += -DDRIVER_NAME_CAPS=$(shell echo $(DRIVER_NAME) | tr '[a-z]' '[A-Z]')
# standard flags for module builds
EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
-EXTRA_CFLAGS += -I$(KSRC)/include -I.
+EXTRA_CFLAGS += -I$(KSRC)/generated/uapi -I$(KSRC)/include -I.
EXTRA_CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
echo "-DMODVERSIONS -DEXPORT_SYMTAB \
-include $(KSRC)/include/linux/modversions.h")
@@ -200,6 +208,13 @@
HFILES += ixgbe_fcoe.h
endif
+# Add Debug FS source if DEBUG_FS is supported by the kernel
+DEBUGFS := $(shell grep -wE 'CONFIG_DEBUG_FS' $(CONFIG_FILE) | \
+ awk '{print $$3}')
+ifeq ($(DEBUGFS), 1)
+ CFILES += ixgbe_debugfs.c
+endif
+
# set the install path before and after 3.2.0
ifeq (1,$(shell [ $(KVER_CODE) -lt 197120 ] && echo 1 || echo 0))
INSTDIR := /lib/modules/$(KVER)/kernel/drivers/net/$(DRIVER_NAME)
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -30,6 +30,8 @@
#ifndef IXGBE_NO_LRO
#include <net/tcp.h>
+#else
+#include <net/ip.h>
#endif
#include <linux/pci.h>
@@ -65,13 +67,15 @@
#include "ixgbe_api.h"
+#include "ixgbe_common.h"
+
#define PFX "ixgbe: "
#define DPRINTK(nlevel, klevel, fmt, args...) \
((void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
__func__ , ## args)))
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
#include <linux/clocksource.h>
#include <linux/net_tstamp.h>
#include <linux/ptp_clock_kernel.h>
@@ -126,15 +130,23 @@
/* How many Rx Buffers do we bundle into one write to the hardware ? */
#define IXGBE_RX_BUFFER_WRITE 16 /* Must be power of 2 */
-#define IXGBE_TX_FLAGS_CSUM (u32)(1)
-#define IXGBE_TX_FLAGS_HW_VLAN (u32)(1 << 1)
-#define IXGBE_TX_FLAGS_SW_VLAN (u32)(1 << 2)
-#define IXGBE_TX_FLAGS_TSO (u32)(1 << 3)
-#define IXGBE_TX_FLAGS_IPV4 (u32)(1 << 4)
-#define IXGBE_TX_FLAGS_FCOE (u32)(1 << 5)
-#define IXGBE_TX_FLAGS_FSO (u32)(1 << 6)
-#define IXGBE_TX_FLAGS_TXSW (u32)(1 << 7)
-#define IXGBE_TX_FLAGS_TSTAMP (u32)(1 << 8)
+enum ixgbe_tx_flags {
+ /* cmd_type flags */
+ IXGBE_TX_FLAGS_HW_VLAN = 0x01,
+ IXGBE_TX_FLAGS_TSO = 0x02,
+ IXGBE_TX_FLAGS_TSTAMP = 0x04,
+
+ /* olinfo flags */
+ IXGBE_TX_FLAGS_CC = 0x08,
+ IXGBE_TX_FLAGS_IPV4 = 0x10,
+ IXGBE_TX_FLAGS_CSUM = 0x20,
+
+ /* software defined flags */
+ IXGBE_TX_FLAGS_SW_VLAN = 0x40,
+ IXGBE_TX_FLAGS_FCOE = 0x80,
+};
+
+/* VLAN info */
#define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000
#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0xe0000000
#define IXGBE_TX_FLAGS_VLAN_PRIO_SHIFT 29
@@ -249,10 +261,12 @@
/* Tx Descriptors needed, worst case */
#define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IXGBE_MAX_DATA_PER_TXD)
-#ifdef MAX_SKB_FRAGS
+#ifndef MAX_SKB_FRAGS
+#define DESC_NEEDED 4
+#elif (MAX_SKB_FRAGS < 16)
#define DESC_NEEDED ((MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE)) + 4)
#else
-#define DESC_NEEDED 4
+#define DESC_NEEDED (MAX_SKB_FRAGS + 4)
#endif
/* wrapper around a pointer to a socket buffer,
@@ -300,6 +314,7 @@
enum ixgbe_ring_state_t {
__IXGBE_TX_FDIR_INIT_DONE,
+ __IXGBE_TX_XPS_INIT_DONE,
__IXGBE_TX_DETECT_HANG,
__IXGBE_HANG_CHECK_ARMED,
__IXGBE_RX_RSC_ENABLED,
@@ -310,6 +325,7 @@
#ifdef IXGBE_FCOE
__IXGBE_RX_FCOE,
#endif
+ __IXGBE_RX_BUILD_SKB_ENABLED,
};
#define check_for_tx_hang(ring) \
@@ -328,6 +344,12 @@
set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
#define clear_ring_rsc_enabled(ring) \
clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
+#define ring_uses_build_skb(ring) \
+ test_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &(ring)->state)
+#define set_ring_build_skb_enabled(ring) \
+ set_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &(ring)->state)
+#define clear_ring_build_skb_enabled(ring) \
+ clear_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &(ring)->state)
#define netdev_ring(ring) (ring->netdev)
#define ring_queue_index(ring) (ring->queue_index)
@@ -358,6 +380,10 @@
u16 next_to_use;
u16 next_to_clean;
+#ifdef HAVE_PTP_1588_CLOCK
+ unsigned long last_rx_timestamp;
+
+#endif
union {
#ifdef CONFIG_IXGBE_DISABLE_PACKET_SPLIT
u16 rx_buf_len;
@@ -392,14 +418,14 @@
#define IXGBE_MAX_DCB_INDICES 8
#define IXGBE_MAX_RSS_INDICES 16
#define IXGBE_MAX_VMDQ_INDICES 64
-#define IXGBE_MAX_FDIR_INDICES 64
+#define IXGBE_MAX_FDIR_INDICES 63
#ifdef IXGBE_FCOE
#define IXGBE_MAX_FCOE_INDICES 8
#define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + IXGBE_MAX_FCOE_INDICES)
#define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + IXGBE_MAX_FCOE_INDICES)
#else
-#define MAX_RX_QUEUES IXGBE_MAX_FDIR_INDICES
-#define MAX_TX_QUEUES IXGBE_MAX_FDIR_INDICES
+#define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1)
+#define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + 1)
#endif /* IXGBE_FCOE */
struct ixgbe_ring_feature {
u16 limit; /* upper limit on feature indices */
@@ -488,6 +514,26 @@
/* for dynamic allocation of rings associated with this q_vector */
struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp;
};
+#ifdef IXGBE_HWMON
+
+#define IXGBE_HWMON_TYPE_LOC 0
+#define IXGBE_HWMON_TYPE_TEMP 1
+#define IXGBE_HWMON_TYPE_CAUTION 2
+#define IXGBE_HWMON_TYPE_MAX 3
+
+struct hwmon_attr {
+ struct device_attribute dev_attr;
+ struct ixgbe_hw *hw;
+ struct ixgbe_thermal_diode_data *sensor;
+ char name[12];
+};
+
+struct hwmon_buff {
+ struct device *device;
+ struct hwmon_attr *hwmon_list;
+ unsigned int n_hwmon;
+};
+#endif /* IXGBE_HWMON */
/*
* microsecond values for various ITR rates shifted by 2 to fit itr register
@@ -620,6 +666,18 @@
#define IXGBE_FLAG_SRIOV_REPLICATION_ENABLE (u32)(1 << 21)
#define IXGBE_FLAG_SRIOV_L2SWITCH_ENABLE (u32)(1 << 22)
#define IXGBE_FLAG_SRIOV_L2LOOPBACK_ENABLE (u32)(1 << 23)
+#define IXGBE_FLAG_RX_HWTSTAMP_ENABLED (u32)(1 << 24)
+
+/* preset defaults */
+#define IXGBE_FLAGS_82598_INIT (IXGBE_FLAG_MSI_CAPABLE | \
+ IXGBE_FLAG_MSIX_CAPABLE | \
+ IXGBE_FLAG_MQ_CAPABLE)
+
+#define IXGBE_FLAGS_82599_INIT (IXGBE_FLAGS_82598_INIT | \
+ IXGBE_FLAG_SRIOV_CAPABLE)
+
+#define IXGBE_FLAGS_X540_INIT IXGBE_FLAGS_82599_INIT
+
u32 flags2;
#ifndef IXGBE_NO_HW_RSC
@@ -748,16 +806,19 @@
u32 led_reg;
#endif
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_caps;
+ struct work_struct ptp_tx_work;
+ struct sk_buff *ptp_tx_skb;
+ unsigned long ptp_tx_start;
unsigned long last_overflow_check;
+ unsigned long last_rx_ptp_check;
spinlock_t tmreg_lock;
struct cyclecounter hw_cc;
struct timecounter hw_tc;
- int rx_hwtstamp_filter;
u32 base_incval;
-#endif /* CONFIG_IXGBE_PTP */
+#endif /* HAVE_PTP_1588_CLOCK */
DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS);
unsigned int num_vfs;
@@ -771,8 +832,9 @@
#endif
struct ixgbe_mac_addr *mac_table;
#ifdef IXGBE_SYSFS
- struct kobject *info_kobj;
- struct kobject *therm_kobj[IXGBE_MAX_SENSORS];
+#ifdef IXGBE_HWMON
+ struct hwmon_buff ixgbe_hwmon_buff;
+#endif /* IXGBE_HWMON */
#else /* IXGBE_SYSFS */
#ifdef IXGBE_PROCFS
struct proc_dir_entry *eth_dir;
@@ -782,6 +844,9 @@
#endif /* IXGBE_PROCFS */
#endif /* IXGBE_SYSFS */
+#ifdef HAVE_IXGBE_DEBUG_FS
+ struct dentry *ixgbe_dbg_adapter;
+#endif /*HAVE_IXGBE_DEBUG_FS*/
u8 default_up;
};
@@ -930,6 +995,13 @@
#endif
#endif /* IXGBE_FCOE */
+#ifdef HAVE_IXGBE_DEBUG_FS
+extern void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter);
+extern void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter);
+extern void ixgbe_dbg_init(void);
+extern void ixgbe_dbg_exit(void);
+#endif /* HAVE_IXGBE_DEBUG_FS */
+
#ifdef CONFIG_DCB
#ifdef HAVE_DCBNL_IEEE
s32 ixgbe_dcb_hw_ets(struct ixgbe_hw *hw, struct ieee_ets *ets, int max_frame);
@@ -953,21 +1025,34 @@
extern void ixgbe_vlan_mode(struct net_device *, u32);
#endif
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
extern void ixgbe_ptp_init(struct ixgbe_adapter *adapter);
extern void ixgbe_ptp_stop(struct ixgbe_adapter *adapter);
extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter);
-extern void ixgbe_ptp_tx_hwtstamp(struct ixgbe_q_vector *q_vector,
- struct sk_buff *skb);
-extern void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector,
- union ixgbe_adv_rx_desc *rx_desc,
+extern void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter);
+extern void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector,
struct sk_buff *skb);
+static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring,
+ union ixgbe_adv_rx_desc *rx_desc,
+ struct sk_buff *skb)
+{
+ if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS)))
+ return;
+
+ __ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, skb);
+
+ /* Update the last_rx_timestamp timer in order to enable watchdog check
+ * for error case of latched timestamp on a dropped packet.
+ */
+ rx_ring->last_rx_timestamp = jiffies;
+}
+
extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
struct ifreq *ifr, int cmd);
extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter);
extern void ixgbe_ptp_reset(struct ixgbe_adapter *adapter);
extern void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr);
-#endif /* CONFIG_IXGBE_PTP */
+#endif /* HAVE_PTP_1588_CLOCK */
extern void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter);
#endif /* _IXGBE_H_ */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_82598.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -42,18 +42,17 @@
bool link_up_wait_to_complete);
static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete);
static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete);
static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw);
static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw);
static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
u32 headroom, int strategy);
-
+static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset,
+ u8 *sff8472_data);
/**
* ixgbe_set_pcie_completion_timeout - set pci-e completion timeout
* @hw: pointer to the HW structure
@@ -145,6 +144,7 @@
/* SFP+ Module */
phy->ops.read_i2c_eeprom = &ixgbe_read_i2c_eeprom_82598;
+ phy->ops.read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_82598;
/* Link */
mac->ops.check_link = &ixgbe_check_mac_link_82598;
@@ -156,6 +156,8 @@
/* Manageability interface */
mac->ops.set_fw_drv_ver = NULL;
+ mac->ops.get_rtrup2tc = NULL;
+
return ret_val;
}
@@ -688,15 +690,15 @@
* ixgbe_setup_mac_link_82598 - Set MAC link speed
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed
*
* Set the link speed in the AUTOC register and restarts link.
**/
static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
- ixgbe_link_speed speed, bool autoneg,
+ ixgbe_link_speed speed,
bool autoneg_wait_to_complete)
{
+ bool autoneg = false;
s32 status = 0;
ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
@@ -740,20 +742,18 @@
* ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true if waiting is needed to complete
*
* Sets the link speed in the AUTOC register in the MAC and restarts link.
**/
static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete)
{
s32 status;
/* Setup the PHY according to input speed */
- status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
+ status = hw->phy.ops.setup_link_speed(hw, speed,
autoneg_wait_to_complete);
/* Set up MAC */
ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
@@ -1061,15 +1061,16 @@
}
/**
- * ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface.
+ * ixgbe_read_i2c_phy_82598 - Reads 8 bit word over I2C interface.
* @hw: pointer to hardware structure
- * @byte_offset: EEPROM byte offset to read
+ * @dev_addr: address to read from
+ * @byte_offset: byte offset to read from dev_addr
* @eeprom_data: value read
*
* Performs 8 byte read operation to SFP module's EEPROM over I2C interface.
**/
-s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
- u8 *eeprom_data)
+static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,
+ u8 byte_offset, u8 *eeprom_data)
{
s32 status = 0;
u16 sfp_addr = 0;
@@ -1083,7 +1084,7 @@
* 0xC30D. These registers are used to talk to the SFP+
* module's EEPROM through the SDA/SCL (I2C) interface.
*/
- sfp_addr = (IXGBE_I2C_EEPROM_DEV_ADDR << 8) + byte_offset;
+ sfp_addr = (dev_addr << 8) + byte_offset;
sfp_addr = (sfp_addr | IXGBE_I2C_EEPROM_READ_MASK);
hw->phy.ops.write_reg(hw,
IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
@@ -1115,7 +1116,6 @@
*eeprom_data = (u8)(sfp_data >> 8);
} else {
status = IXGBE_ERR_PHY;
- goto out;
}
out:
@@ -1123,6 +1123,36 @@
}
/**
+ * ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface.
+ * @hw: pointer to hardware structure
+ * @byte_offset: EEPROM byte offset to read
+ * @eeprom_data: value read
+ *
+ * Performs 8 byte read operation to SFP module's EEPROM over I2C interface.
+ **/
+s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
+ u8 *eeprom_data)
+{
+ return ixgbe_read_i2c_phy_82598(hw, IXGBE_I2C_EEPROM_DEV_ADDR,
+ byte_offset, eeprom_data);
+}
+
+/**
+ * ixgbe_read_i2c_sff8472_82598 - Reads 8 bit word over I2C interface.
+ * @hw: pointer to hardware structure
+ * @byte_offset: byte offset at address 0xA2
+ * @eeprom_data: value read
+ *
+ * Performs 8 byte read operation to SFP module's SFF-8472 data over I2C
+ **/
+static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset,
+ u8 *sff8472_data)
+{
+ return ixgbe_read_i2c_phy_82598(hw, IXGBE_I2C_EEPROM_DEV_ADDR2,
+ byte_offset, sff8472_data);
+}
+
+/**
* ixgbe_get_supported_physical_layer_82598 - Returns physical layer type
* @hw: pointer to hardware structure
*
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_82598.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_82599.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -33,7 +33,6 @@
static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete);
static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw);
static s32 ixgbe_read_eeprom_82599(struct ixgbe_hw *hw,
@@ -41,12 +40,35 @@
static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset,
u16 words, u16 *data);
+static bool ixgbe_mng_enabled(struct ixgbe_hw *hw)
+{
+ u32 fwsm, manc, factps;
+
+ fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM);
+ if ((fwsm & IXGBE_FWSM_MODE_MASK) != IXGBE_FWSM_FW_MODE_PT)
+ return false;
+
+ manc = IXGBE_READ_REG(hw, IXGBE_MANC);
+ if (!(manc & IXGBE_MANC_RCV_TCO_EN))
+ return false;
+
+ factps = IXGBE_READ_REG(hw, IXGBE_FACTPS);
+ if (factps & IXGBE_FACTPS_MNGCG)
+ return false;
+
+ return true;
+}
+
void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
{
struct ixgbe_mac_info *mac = &hw->mac;
- /* enable the laser control functions for SFP+ fiber */
- if (mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) {
+ /*
+ * enable the laser control functions for SFP+ fiber
+ * and MNG not enabled
+ */
+ if ((mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
+ !hw->mng_fw_enabled) {
mac->ops.disable_tx_laser =
&ixgbe_disable_tx_laser_multispeed_fiber;
mac->ops.enable_tx_laser =
@@ -173,9 +195,9 @@
}
/* Restart DSP and set SFI mode */
- IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (IXGBE_READ_REG(hw,
- IXGBE_AUTOC) | IXGBE_AUTOC_LMS_10G_SERIAL));
-
+ IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((hw->mac.orig_autoc) |
+ IXGBE_AUTOC_LMS_10G_SERIAL));
+ hw->mac.cached_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
ret_val = ixgbe_reset_pipeline_82599(hw);
if (got_lock) {
@@ -211,7 +233,7 @@
struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
s32 ret_val;
- ret_val = ixgbe_init_phy_ops_generic(hw);
+ ixgbe_init_phy_ops_generic(hw);
ret_val = ixgbe_init_ops_generic(hw);
/* PHY */
@@ -253,6 +275,7 @@
mac->ops.get_link_capabilities = &ixgbe_get_link_capabilities_82599;
mac->ops.check_link = &ixgbe_check_mac_link_generic;
mac->ops.setup_rxpba = &ixgbe_set_rxpba_generic;
+ mac->ops.mng_enabled = &ixgbe_mng_enabled;
ixgbe_init_mac_link_ops_82599(hw);
mac->mcft_size = 128;
@@ -280,6 +303,8 @@
mac->ops.init_thermal_sensor_thresh =
&ixgbe_init_thermal_sensor_thresh_generic;
+ mac->ops.get_rtrup2tc = &ixgbe_dcb_get_rtrup2tc_generic;
+
return ret_val;
}
@@ -287,13 +312,13 @@
* ixgbe_get_link_capabilities_82599 - Determines link capabilities
* @hw: pointer to hardware structure
* @speed: pointer to link speed
- * @negotiation: true when autoneg or autotry is enabled
+ * @autoneg: true when autoneg or autotry is enabled
*
* Determines the link capabilities by reading the AUTOC register.
**/
s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
ixgbe_link_speed *speed,
- bool *negotiation)
+ bool *autoneg)
{
s32 status = 0;
u32 autoc = 0;
@@ -304,7 +329,7 @@
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) {
*speed = IXGBE_LINK_SPEED_1GB_FULL;
- *negotiation = true;
+ *autoneg = true;
goto out;
}
@@ -321,22 +346,22 @@
switch (autoc & IXGBE_AUTOC_LMS_MASK) {
case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
*speed = IXGBE_LINK_SPEED_1GB_FULL;
- *negotiation = false;
+ *autoneg = false;
break;
case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
*speed = IXGBE_LINK_SPEED_10GB_FULL;
- *negotiation = false;
+ *autoneg = false;
break;
case IXGBE_AUTOC_LMS_1G_AN:
*speed = IXGBE_LINK_SPEED_1GB_FULL;
- *negotiation = true;
+ *autoneg = true;
break;
case IXGBE_AUTOC_LMS_10G_SERIAL:
*speed = IXGBE_LINK_SPEED_10GB_FULL;
- *negotiation = false;
+ *autoneg = false;
break;
case IXGBE_AUTOC_LMS_KX4_KX_KR:
@@ -348,7 +373,7 @@
*speed |= IXGBE_LINK_SPEED_10GB_FULL;
if (autoc & IXGBE_AUTOC_KX_SUPP)
*speed |= IXGBE_LINK_SPEED_1GB_FULL;
- *negotiation = true;
+ *autoneg = true;
break;
case IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII:
@@ -359,12 +384,12 @@
*speed |= IXGBE_LINK_SPEED_10GB_FULL;
if (autoc & IXGBE_AUTOC_KX_SUPP)
*speed |= IXGBE_LINK_SPEED_1GB_FULL;
- *negotiation = true;
+ *autoneg = true;
break;
case IXGBE_AUTOC_LMS_SGMII_1G_100M:
*speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_100_FULL;
- *negotiation = false;
+ *autoneg = false;
break;
default:
@@ -376,7 +401,7 @@
if (hw->phy.multispeed_fiber) {
*speed |= IXGBE_LINK_SPEED_10GB_FULL |
IXGBE_LINK_SPEED_1GB_FULL;
- *negotiation = true;
+ *autoneg = true;
}
out:
@@ -417,7 +442,6 @@
case IXGBE_DEV_ID_82599_SFP_FCOE:
case IXGBE_DEV_ID_82599_SFP_EM:
case IXGBE_DEV_ID_82599_SFP_SF2:
- case IXGBE_DEV_ID_82599_SFP_SF_QP:
case IXGBE_DEV_ID_82599EN_SFP:
media_type = ixgbe_media_type_fiber;
break;
@@ -562,17 +586,17 @@
}
}
+
/**
* ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed
*
* Set the link speed in the AUTOC register and restarts link.
**/
s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
- ixgbe_link_speed speed, bool autoneg,
+ ixgbe_link_speed speed,
bool autoneg_wait_to_complete)
{
s32 status = 0;
@@ -581,11 +605,10 @@
u32 speedcnt = 0;
u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
u32 i = 0;
- bool link_up = false;
- bool negotiation;
+ bool autoneg, link_up = false;
/* Mask off requested but non-supported speeds */
- status = ixgbe_get_link_capabilities(hw, &link_speed, &negotiation);
+ status = ixgbe_get_link_capabilities(hw, &link_speed, &autoneg);
if (status != 0)
return status;
@@ -617,7 +640,6 @@
status = ixgbe_setup_mac_link_82599(hw,
IXGBE_LINK_SPEED_10GB_FULL,
- autoneg,
autoneg_wait_to_complete);
if (status != 0)
return status;
@@ -669,7 +691,6 @@
status = ixgbe_setup_mac_link_82599(hw,
IXGBE_LINK_SPEED_1GB_FULL,
- autoneg,
autoneg_wait_to_complete);
if (status != 0)
return status;
@@ -696,7 +717,7 @@
*/
if (speedcnt > 1)
status = ixgbe_setup_mac_link_multispeed_fiber(hw,
- highest_link_speed, autoneg, autoneg_wait_to_complete);
+ highest_link_speed, autoneg_wait_to_complete);
out:
/* Set autoneg_advertised value based on input link speed */
@@ -715,13 +736,12 @@
* ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed
*
* Implements the Intel SmartSpeed algorithm.
**/
s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
- ixgbe_link_speed speed, bool autoneg,
+ ixgbe_link_speed speed,
bool autoneg_wait_to_complete)
{
s32 status = 0;
@@ -752,7 +772,7 @@
/* First, try to get link with full advertisement */
hw->phy.smart_speed_active = false;
for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) {
- status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
+ status = ixgbe_setup_mac_link_82599(hw, speed,
autoneg_wait_to_complete);
if (status != 0)
goto out;
@@ -787,7 +807,7 @@
/* Turn SmartSpeed on to disable KR support */
hw->phy.smart_speed_active = true;
- status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
+ status = ixgbe_setup_mac_link_82599(hw, speed,
autoneg_wait_to_complete);
if (status != 0)
goto out;
@@ -812,7 +832,7 @@
/* We didn't get link. Turn SmartSpeed back off. */
hw->phy.smart_speed_active = false;
- status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
+ status = ixgbe_setup_mac_link_82599(hw, speed,
autoneg_wait_to_complete);
out:
@@ -826,22 +846,19 @@
* ixgbe_setup_mac_link_82599 - Set MAC link speed
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed
*
* Set the link speed in the AUTOC register and restarts link.
**/
s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
- ixgbe_link_speed speed, bool autoneg,
+ ixgbe_link_speed speed,
bool autoneg_wait_to_complete)
{
+ bool autoneg = false;
s32 status = 0;
- u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
+ u32 autoc, pma_pmd_1g, link_mode, start_autoc;
u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
- u32 start_autoc = autoc;
u32 orig_autoc = 0;
- u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
- u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
u32 links_reg;
u32 i;
@@ -862,9 +879,14 @@
/* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
if (hw->mac.orig_link_settings_stored)
- orig_autoc = hw->mac.orig_autoc;
+ autoc = hw->mac.orig_autoc;
else
- orig_autoc = autoc;
+ autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
+
+ orig_autoc = autoc;
+ start_autoc = hw->mac.cached_autoc;
+ link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
+ pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
@@ -920,6 +942,7 @@
/* Restart link */
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
+ hw->mac.cached_autoc = autoc;
ixgbe_reset_pipeline_82599(hw);
if (got_lock) {
@@ -961,20 +984,18 @@
* ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true if waiting is needed to complete
*
* Restarts link on PHY and MAC based on settings passed in.
**/
static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete)
{
s32 status;
/* Setup the PHY according to input speed */
- status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
+ status = hw->phy.ops.setup_link_speed(hw, speed,
autoneg_wait_to_complete);
/* Set up MAC */
ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete);
@@ -994,7 +1015,8 @@
{
ixgbe_link_speed link_speed;
s32 status;
- u32 ctrl, i, autoc, autoc2;
+ u32 ctrl, i, autoc2;
+ u32 curr_lms;
bool link_up = false;
/* Call adapter stop to disable tx/rx and clear interrupts */
@@ -1026,6 +1048,13 @@
if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL)
hw->phy.ops.reset(hw);
+ /* remember AUTOC from before we reset */
+ if (hw->mac.cached_autoc)
+ curr_lms = hw->mac.cached_autoc & IXGBE_AUTOC_LMS_MASK;
+ else
+ curr_lms = IXGBE_READ_REG(hw, IXGBE_AUTOC) &
+ IXGBE_AUTOC_LMS_MASK;
+
mac_reset_top:
/*
* Issue global reset to the MAC. Needs to be SW reset if link is up.
@@ -1074,14 +1103,35 @@
* stored off yet. Otherwise restore the stored original
* values since the reset operation sets back to defaults.
*/
- autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
+ hw->mac.cached_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
+
+ /* Enable link if disabled in NVM */
+ if (autoc2 & IXGBE_AUTOC2_LINK_DISABLE_MASK) {
+ autoc2 &= ~IXGBE_AUTOC2_LINK_DISABLE_MASK;
+ IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2);
+ IXGBE_WRITE_FLUSH(hw);
+ }
+
if (hw->mac.orig_link_settings_stored == false) {
- hw->mac.orig_autoc = autoc;
+ hw->mac.orig_autoc = hw->mac.cached_autoc;
hw->mac.orig_autoc2 = autoc2;
hw->mac.orig_link_settings_stored = true;
} else {
- if (autoc != hw->mac.orig_autoc) {
+
+ /* If MNG FW is running on a multi-speed device that
+ * doesn't autoneg with out driver support we need to
+ * leave LMS in the state it was before we MAC reset.
+ * Likewise if we support WoL we don't want change the
+ * LMS state.
+ */
+ if ((hw->phy.multispeed_fiber && hw->mng_fw_enabled) ||
+ hw->wol_supported)
+ hw->mac.orig_autoc =
+ (hw->mac.orig_autoc & ~IXGBE_AUTOC_LMS_MASK) |
+ curr_lms;
+
+ if (hw->mac.cached_autoc != hw->mac.orig_autoc) {
/* Need SW/FW semaphore around AUTOC writes if LESM is
* on, likewise reset_pipeline requires us to hold
* this lock as it also writes to AUTOC.
@@ -1099,6 +1149,7 @@
}
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc);
+ hw->mac.cached_autoc = hw->mac.orig_autoc;
ixgbe_reset_pipeline_82599(hw);
if (got_lock)
@@ -2258,10 +2309,19 @@
**/
s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
{
- s32 i, autoc_reg, ret_val;
- s32 anlp1_reg = 0;
+ s32 ret_val;
+ u32 anlp1_reg = 0;
+ u32 i, autoc_reg, autoc2_reg;
+
+ /* Enable link if disabled in NVM */
+ autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
+ if (autoc2_reg & IXGBE_AUTOC2_LINK_DISABLE_MASK) {
+ autoc2_reg &= ~IXGBE_AUTOC2_LINK_DISABLE_MASK;
+ IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg);
+ IXGBE_WRITE_FLUSH(hw);
+ }
- autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
+ autoc_reg = hw->mac.cached_autoc;
autoc_reg |= IXGBE_AUTOC_AN_RESTART;
/* Write AUTOC register with toggled LMS[2] bit and Restart_AN */
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg ^ IXGBE_AUTOC_LMS_1G_AN);
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_82599.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -35,15 +35,15 @@
void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
- ixgbe_link_speed speed, bool autoneg,
+ ixgbe_link_speed speed,
bool autoneg_wait_to_complete);
s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
- ixgbe_link_speed speed, bool autoneg,
+ ixgbe_link_speed speed,
bool autoneg_wait_to_complete);
s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
bool autoneg_wait_to_complete);
s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed speed,
- bool autoneg, bool autoneg_wait_to_complete);
+ bool autoneg_wait_to_complete);
s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw);
void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw);
s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw);
@@ -54,5 +54,4 @@
s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw);
u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw);
s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval);
-bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
#endif /* _IXGBE_82599_H_ */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_api.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -28,6 +28,19 @@
#include "ixgbe_api.h"
#include "ixgbe_common.h"
+/**
+ * ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
+ * @hw: pointer to hardware structure
+ * @map: pointer to u8 arr for returning map
+ *
+ * Read the rtrup2tc HW register and resolve its content into map
+ **/
+void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map)
+{
+ return ixgbe_call_func(hw, hw->mac.ops.get_rtrup2tc,(hw, map),
+ IXGBE_NOT_IMPLEMENTED);
+}
+
/**
* ixgbe_init_shared_code - Initialize the shared code
* @hw: pointer to hardware structure
@@ -103,7 +116,6 @@
case IXGBE_DEV_ID_82599_SFP_FCOE:
case IXGBE_DEV_ID_82599_SFP_EM:
case IXGBE_DEV_ID_82599_SFP_SF2:
- case IXGBE_DEV_ID_82599_SFP_SF_QP:
case IXGBE_DEV_ID_82599EN_SFP:
case IXGBE_DEV_ID_82599_CX4:
case IXGBE_DEV_ID_82599_LS:
@@ -124,6 +136,18 @@
}
/**
+ * ixgbe_mng_fw_enable - Return condition of MNG FW
+ * @hw: pointer to hardware structure
+ *
+ * Return either true/false base on if MNG FW is on.
+ **/
+s32 ixgbe_mng_fw_enable(struct ixgbe_hw *hw)
+{
+ return ixgbe_call_func(hw, hw->mac.ops.mng_enabled, (hw),
+ IXGBE_NOT_IMPLEMENTED);
+}
+
+/**
* ixgbe_init_hw - Initialize the hardware
* @hw: pointer to hardware structure
*
@@ -457,16 +481,14 @@
* ixgbe_setup_phy_link_speed - Set auto advertise
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
*
* Sets the auto advertised capabilities
**/
s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete)
{
return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
- autoneg, autoneg_wait_to_complete),
+ autoneg_wait_to_complete),
IXGBE_NOT_IMPLEMENTED);
}
@@ -526,17 +548,15 @@
* ixgbe_setup_link - Set link speed
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
*
* Configures link settings. Restarts the link.
* Performs autonegotiation if needed.
**/
s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete)
{
return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
- autoneg, autoneg_wait_to_complete),
+ autoneg_wait_to_complete),
IXGBE_NOT_IMPLEMENTED);
}
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_api.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -30,6 +30,8 @@
#include "ixgbe_type.h"
+void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map);
+
s32 ixgbe_init_shared_code(struct ixgbe_hw *hw);
extern s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw);
@@ -62,13 +64,12 @@
bool *link_up);
s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw,
ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete);
void ixgbe_disable_tx_laser(struct ixgbe_hw *hw);
void ixgbe_enable_tx_laser(struct ixgbe_hw *hw);
void ixgbe_flap_tx_laser(struct ixgbe_hw *hw);
s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
- bool autoneg, bool autoneg_wait_to_complete);
+ bool autoneg_wait_to_complete);
s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
bool *link_up, bool link_up_wait_to_complete);
s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
@@ -127,6 +128,7 @@
s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval);
s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw);
s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw);
+s32 ixgbe_mng_fw_enable(struct ixgbe_hw *hw);
s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw);
s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl);
s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl);
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_common.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -27,6 +27,8 @@
#include "ixgbe_common.h"
#include "ixgbe_phy.h"
+#include "ixgbe_dcb.h"
+#include "ixgbe_dcb_82599.h"
#include "ixgbe_api.h"
static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw);
@@ -138,13 +140,12 @@
* function check the device id to see if the associated phy supports
* autoneg flow control.
**/
-static s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
+s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
{
switch (hw->device_id) {
- case IXGBE_DEV_ID_X540T:
- return 0;
case IXGBE_DEV_ID_82599_T3_LOM:
+ case IXGBE_DEV_ID_X540T:
return 0;
default:
return IXGBE_ERR_FC_NOT_SUPPORTED;
@@ -673,21 +674,18 @@
}
/**
- * ixgbe_get_bus_info_generic - Generic set PCI bus info
+ * ixgbe_set_pci_config_data_generic - Generic store PCI bus info
* @hw: pointer to hardware structure
+ * @link_status: the link status returned by the PCI config space
*
- * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
+ * Stores the PCI bus info (speed, width, type) within the ixgbe_hw structure
**/
-s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw)
+void ixgbe_set_pci_config_data_generic(struct ixgbe_hw *hw, u16 link_status)
{
struct ixgbe_mac_info *mac = &hw->mac;
- u16 link_status;
hw->bus.type = ixgbe_bus_type_pci_express;
- /* Get the negotiated link width and speed from PCI config space */
- link_status = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_LINK_STATUS);
-
switch (link_status & IXGBE_PCI_LINK_WIDTH) {
case IXGBE_PCI_LINK_WIDTH_1:
hw->bus.width = ixgbe_bus_width_pcie_x1;
@@ -722,6 +720,23 @@
}
mac->ops.set_lan_id(hw);
+}
+
+/**
+ * ixgbe_get_bus_info_generic - Generic set PCI bus info
+ * @hw: pointer to hardware structure
+ *
+ * Gets the PCI bus info (speed, width, type) then calls helper function to
+ * store this data within the ixgbe_hw structure.
+ **/
+s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw)
+{
+ u16 link_status;
+
+ /* Get the negotiated link width and speed from PCI config space */
+ link_status = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_LINK_STATUS);
+
+ ixgbe_set_pci_config_data_generic(hw, link_status);
return 0;
}
@@ -1206,7 +1221,7 @@
}
for (i = 0; i < words; i++) {
- eerd = ((offset + i) << IXGBE_EEPROM_RW_ADDR_SHIFT) +
+ eerd = ((offset + i) << IXGBE_EEPROM_RW_ADDR_SHIFT) |
IXGBE_EEPROM_RW_REG_START;
IXGBE_WRITE_REG(hw, IXGBE_EERD, eerd);
@@ -2626,6 +2641,53 @@
}
}
+/*
+ * ixgbe_pcie_timeout_poll - Return number of times to poll for completion
+ * @hw: pointer to hardware structure
+ *
+ * System-wide timeout range is encoded in PCIe Device Control2 register.
+ *
+ * Add 10% to specified maximum and return the number of times to poll for
+ * completion timeout, in units of 100 microsec. Never return less than
+ * 800 = 80 millisec.
+ */
+static u32 ixgbe_pcie_timeout_poll(struct ixgbe_hw *hw)
+{
+ s16 devctl2;
+ u32 pollcnt;
+
+ devctl2 = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_DEVICE_CONTROL2);
+ devctl2 &= IXGBE_PCIDEVCTRL2_TIMEO_MASK;
+
+ switch (devctl2) {
+ case IXGBE_PCIDEVCTRL2_65_130ms:
+ pollcnt = 1300; /* 130 millisec */
+ break;
+ case IXGBE_PCIDEVCTRL2_260_520ms:
+ pollcnt = 5200; /* 520 millisec */
+ break;
+ case IXGBE_PCIDEVCTRL2_1_2s:
+ pollcnt = 20000; /* 2 sec */
+ break;
+ case IXGBE_PCIDEVCTRL2_4_8s:
+ pollcnt = 80000; /* 8 sec */
+ break;
+ case IXGBE_PCIDEVCTRL2_17_34s:
+ pollcnt = 34000; /* 34 sec */
+ break;
+ case IXGBE_PCIDEVCTRL2_50_100us: /* 100 microsecs */
+ case IXGBE_PCIDEVCTRL2_1_2ms: /* 2 millisecs */
+ case IXGBE_PCIDEVCTRL2_16_32ms: /* 32 millisec */
+ case IXGBE_PCIDEVCTRL2_16_32ms_def: /* 32 millisec default */
+ default:
+ pollcnt = 800; /* 80 millisec minimum */
+ break;
+ }
+
+ /* add 10% to spec maximum */
+ return (pollcnt * 11) / 10;
+}
+
/**
* ixgbe_disable_pcie_master - Disable PCI-express master access
* @hw: pointer to hardware structure
@@ -2638,12 +2700,12 @@
s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
{
s32 status = 0;
- u32 i;
+ u32 i, poll;
/* Always set this bit to ensure any future transactions are blocked */
IXGBE_WRITE_REG(hw, IXGBE_CTRL, IXGBE_CTRL_GIO_DIS);
- /* Exit if master requets are blocked */
+ /* Exit if master requests are blocked */
if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO))
goto out;
@@ -2669,7 +2731,8 @@
* Before proceeding, make sure that the PCIe block does not have
* transactions pending.
*/
- for (i = 0; i < IXGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) {
+ poll = ixgbe_pcie_timeout_poll(hw);
+ for (i = 0; i < poll; i++) {
udelay(100);
if (!(IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_DEVICE_STATUS) &
IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING))
@@ -3729,7 +3792,7 @@
* Calculates the checksum for some buffer on a specified length. The
* checksum calculated is returned.
**/
-static u8 ixgbe_calculate_checksum(u8 *buffer, u32 length)
+u8 ixgbe_calculate_checksum(u8 *buffer, u32 length)
{
u32 i;
u8 sum = 0;
@@ -3752,8 +3815,8 @@
* Communicates with the manageability block. On success return 0
* else return IXGBE_ERR_HOST_INTERFACE_COMMAND.
**/
-static s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
- u32 length)
+s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
+ u32 length)
{
u32 hicr, i, bi;
u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
@@ -4148,3 +4211,20 @@
}
+/**
+ * ixgbe_dcb_get_rtrup2tc_generic - read rtrup2tc reg
+ * @hw: pointer to hardware structure
+ * @map: pointer to u8 arr for returning map
+ *
+ * Read the rtrup2tc HW register and resolve its content into map
+ **/
+void ixgbe_dcb_get_rtrup2tc_generic(struct ixgbe_hw *hw, u8 *map)
+{
+ u32 reg, i;
+
+ reg = IXGBE_READ_REG(hw, IXGBE_RTRUP2TC);
+ for (i = 0; i < IXGBE_DCB_MAX_USER_PRIORITY; i++)
+ map[i] = IXGBE_RTRUP2TC_UP_MASK &
+ (reg >> (i * IXGBE_RTRUP2TC_UP_SHIFT));
+ return;
+}
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_common.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -30,8 +30,8 @@
#include "ixgbe_type.h"
+void ixgbe_dcb_get_rtrup2tc_generic(struct ixgbe_hw *hw, u8 *map);
u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw);
-
s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw);
s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw);
s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw);
@@ -41,6 +41,7 @@
u32 pba_num_size);
s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr);
s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw);
+void ixgbe_set_pci_config_data_generic(struct ixgbe_hw *hw, u16 link_status);
void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw);
s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw);
@@ -83,6 +84,7 @@
s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw);
s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw);
+s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw);
void ixgbe_fc_autoneg(struct ixgbe_hw *hw);
s32 ixgbe_validate_mac_addr(u8 *mac_addr);
@@ -123,6 +125,9 @@
int strategy);
s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
u8 build, u8 ver);
+u8 ixgbe_calculate_checksum(u8 *buffer, u32 length);
+s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
+ u32 length);
void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
extern s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_dcb.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_dcb.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_dcb_82598.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_dcb_82598.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_dcb_82599.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_dcb_82599.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -44,6 +44,7 @@
/* Receive UP2TC mapping */
#define IXGBE_RTRUP2TC_UP_SHIFT 3
+#define IXGBE_RTRUP2TC_UP_MASK 7
/* Transmit UP2TC mapping */
#define IXGBE_RTTUP2TC_UP_SHIFT 3
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_dcb_nl.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -298,7 +298,6 @@
*pfc = adapter->dcb_cfg.tc_config[tc].pfc;
}
-#ifdef IXGBE_FCOE
static void ixgbe_dcbnl_devreset(struct net_device *dev)
{
struct ixgbe_adapter *adapter = netdev_priv(dev);
@@ -326,7 +325,6 @@
clear_bit(__IXGBE_RESETTING, &adapter->state);
}
-#endif
static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
@@ -622,6 +620,7 @@
int max_frame = dev->mtu + ETH_HLEN + ETH_FCS_LEN;
int i, err = 0;
__u8 max_tc = 0;
+ __u8 map_chg = 0;
if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))
return -EINVAL;
@@ -631,15 +630,25 @@
GFP_KERNEL);
if (!adapter->ixgbe_ieee_ets)
return -ENOMEM;
+ /* initialize UP2TC mappings to invalid value */
+ for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
+ adapter->ixgbe_ieee_ets->prio_tc[i] =
+ IEEE_8021QAZ_MAX_TCS;
+ /* if possible, update UP2TC mappings from HW */
+ if (adapter->hw.mac.ops.get_rtrup2tc)
+ adapter->hw.mac.ops.get_rtrup2tc(&adapter->hw,
+ adapter->ixgbe_ieee_ets->prio_tc);
}
- memcpy(adapter->ixgbe_ieee_ets, ets, sizeof(*adapter->ixgbe_ieee_ets));
-
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
if (ets->prio_tc[i] > max_tc)
max_tc = ets->prio_tc[i];
+ if (ets->prio_tc[i] != adapter->ixgbe_ieee_ets->prio_tc[i])
+ map_chg = 1;
}
+ memcpy(adapter->ixgbe_ieee_ets, ets, sizeof(*adapter->ixgbe_ieee_ets));
+
if (max_tc)
max_tc++;
@@ -648,6 +657,8 @@
if (max_tc != netdev_get_num_tc(dev))
err = ixgbe_setup_tc(dev, max_tc);
+ else if (map_chg)
+ ixgbe_dcbnl_devreset(dev);
if (err)
goto err_out;
|
[-]
[+]
|
Added |
ixgbe-3.14.5.tar.bz2/src/ixgbe_debugfs.c
^
|
@@ -0,0 +1,284 @@
+/*******************************************************************************
+
+ Intel 10 Gigabit PCI Express Linux driver
+ Copyright(c) 1999 - 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 "ixgbe.h"
+
+#ifdef HAVE_IXGBE_DEBUG_FS
+#include <linux/debugfs.h>
+#include <linux/module.h>
+
+static struct dentry *ixgbe_dbg_root;
+
+static char ixgbe_dbg_reg_ops_buf[256] = "";
+
+/**
+ * ixgbe_dbg_reg_ops_read - read for reg_ops datum
+ * @filp: the opened file
+ * @buffer: where to write the data for the user to read
+ * @count: the size of the user's buffer
+ * @ppos: file position offset
+ **/
+static ssize_t ixgbe_dbg_reg_ops_read(struct file *filp, char __user *buffer,
+ size_t count, loff_t *ppos)
+{
+ struct ixgbe_adapter *adapter = filp->private_data;
+ char *buf;
+ int len;
+
+ /* don't allow partial reads */
+ if (*ppos != 0)
+ return 0;
+
+ buf = kasprintf(GFP_KERNEL, "%s: %s\n",
+ adapter->netdev->name,
+ ixgbe_dbg_reg_ops_buf);
+ if (!buf)
+ return -ENOMEM;
+
+ if (count < strlen(buf)) {
+ kfree(buf);
+ return -ENOSPC;
+ }
+
+ len = simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
+
+ kfree(buf);
+ return len;
+}
+
+/**
+ * ixgbe_dbg_reg_ops_write - write into reg_ops datum
+ * @filp: the opened file
+ * @buffer: where to find the user's data
+ * @count: the length of the user's data
+ * @ppos: file position offset
+ **/
+static ssize_t ixgbe_dbg_reg_ops_write(struct file *filp,
+ const char __user *buffer,
+ size_t count, loff_t *ppos)
+{
+ struct ixgbe_adapter *adapter = filp->private_data;
+ int len;
+
+ /* don't allow partial writes */
+ if (*ppos != 0)
+ return 0;
+ if (count >= sizeof(ixgbe_dbg_reg_ops_buf))
+ return -ENOSPC;
+
+ len = simple_write_to_buffer(ixgbe_dbg_reg_ops_buf,
+ sizeof(ixgbe_dbg_reg_ops_buf)-1,
+ ppos,
+ buffer,
+ count);
+ if (len < 0)
+ return len;
+
+ ixgbe_dbg_reg_ops_buf[len] = '\0';
+
+ if (strncmp(ixgbe_dbg_reg_ops_buf, "write", 5) == 0) {
+ u32 reg, value;
+ int cnt;
+ cnt = sscanf(&ixgbe_dbg_reg_ops_buf[5], "%x %x", ®, &value);
+ if (cnt == 2) {
+ IXGBE_WRITE_REG(&adapter->hw, reg, value);
+ value = IXGBE_READ_REG(&adapter->hw, reg);
+ e_dev_info("write: 0x%08x = 0x%08x\n", reg, value);
+ } else {
+ e_dev_info("write <reg> <value>\n");
+ }
+ } else if (strncmp(ixgbe_dbg_reg_ops_buf, "read", 4) == 0) {
+ u32 reg, value;
+ int cnt;
+ cnt = sscanf(&ixgbe_dbg_reg_ops_buf[4], "%x", ®);
+ if (cnt == 1) {
+ value = IXGBE_READ_REG(&adapter->hw, reg);
+ e_dev_info("read 0x%08x = 0x%08x\n", reg, value);
+ } else {
+ e_dev_info("read <reg>\n");
+ }
+ } else {
+ e_dev_info("Unknown command %s\n", ixgbe_dbg_reg_ops_buf);
+ e_dev_info("Available commands:\n");
+ e_dev_info(" read <reg>\n");
+ e_dev_info(" write <reg> <value>\n");
+ }
+ return count;
+}
+
+static const struct file_operations ixgbe_dbg_reg_ops_fops = {
+ .owner = THIS_MODULE,
+ .open = simple_open,
+ .read = ixgbe_dbg_reg_ops_read,
+ .write = ixgbe_dbg_reg_ops_write,
+};
+
+static char ixgbe_dbg_netdev_ops_buf[256] = "";
+
+/**
+ * ixgbe_dbg_netdev_ops_read - read for netdev_ops datum
+ * @filp: the opened file
+ * @buffer: where to write the data for the user to read
+ * @count: the size of the user's buffer
+ * @ppos: file position offset
+ **/
+static ssize_t ixgbe_dbg_netdev_ops_read(struct file *filp,
+ char __user *buffer,
+ size_t count, loff_t *ppos)
+{
+ struct ixgbe_adapter *adapter = filp->private_data;
+ char *buf;
+ int len;
+
+ /* don't allow partial reads */
+ if (*ppos != 0)
+ return 0;
+
+ buf = kasprintf(GFP_KERNEL, "%s: %s\n",
+ adapter->netdev->name,
+ ixgbe_dbg_netdev_ops_buf);
+ if (!buf)
+ return -ENOMEM;
+
+ if (count < strlen(buf)) {
+ kfree(buf);
+ return -ENOSPC;
+ }
+
+ len = simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
+
+ kfree(buf);
+ return len;
+}
+
+/**
+ * ixgbe_dbg_netdev_ops_write - write into netdev_ops datum
+ * @filp: the opened file
+ * @buffer: where to find the user's data
+ * @count: the length of the user's data
+ * @ppos: file position offset
+ **/
+static ssize_t ixgbe_dbg_netdev_ops_write(struct file *filp,
+ const char __user *buffer,
+ size_t count, loff_t *ppos)
+{
+ struct ixgbe_adapter *adapter = filp->private_data;
+ int len;
+
+ /* don't allow partial writes */
+ if (*ppos != 0)
+ return 0;
+ if (count >= sizeof(ixgbe_dbg_netdev_ops_buf))
+ return -ENOSPC;
+
+ len = simple_write_to_buffer(ixgbe_dbg_netdev_ops_buf,
+ sizeof(ixgbe_dbg_netdev_ops_buf)-1,
+ ppos,
+ buffer,
+ count);
+ if (len < 0)
+ return len;
+
+ ixgbe_dbg_netdev_ops_buf[len] = '\0';
+
+ if (strncmp(ixgbe_dbg_netdev_ops_buf, "tx_timeout", 10) == 0) {
+#ifdef HAVE_NET_DEVICE_OPS
+ adapter->netdev->netdev_ops->ndo_tx_timeout(adapter->netdev);
+#else
+ adapter->netdev->tx_timeout(adapter->netdev);
+#endif /* HAVE_NET_DEVICE_OPS */
+ e_dev_info("tx_timeout called\n");
+ } else {
+ e_dev_info("Unknown command: %s\n", ixgbe_dbg_netdev_ops_buf);
+ e_dev_info("Available commands:\n");
+ e_dev_info(" tx_timeout\n");
+ }
+ return count;
+}
+
+static struct file_operations ixgbe_dbg_netdev_ops_fops = {
+ .owner = THIS_MODULE,
+ .open = simple_open,
+ .read = ixgbe_dbg_netdev_ops_read,
+ .write = ixgbe_dbg_netdev_ops_write,
+};
+
+/**
+ * ixgbe_dbg_adapter_init - setup the debugfs directory for the adapter
+ * @adapter: the adapter that is starting up
+ **/
+void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter)
+{
+ const char *name = pci_name(adapter->pdev);
+ struct dentry *pfile;
+ adapter->ixgbe_dbg_adapter = debugfs_create_dir(name, ixgbe_dbg_root);
+ if (adapter->ixgbe_dbg_adapter) {
+ pfile = debugfs_create_file("reg_ops", 0600,
+ adapter->ixgbe_dbg_adapter, adapter,
+ &ixgbe_dbg_reg_ops_fops);
+ if (!pfile)
+ e_dev_err("debugfs reg_ops for %s failed\n", name);
+ pfile = debugfs_create_file("netdev_ops", 0600,
+ adapter->ixgbe_dbg_adapter, adapter,
+ &ixgbe_dbg_netdev_ops_fops);
+ if (!pfile)
+ e_dev_err("debugfs netdev_ops for %s failed\n", name);
+ } else {
+ e_dev_err("debugfs entry for %s failed\n", name);
+ }
+}
+
+/**
+ * ixgbe_dbg_adapter_exit - clear out the adapter's debugfs entries
+ * @pf: the pf that is stopping
+ **/
+void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter)
+{
+ if (adapter->ixgbe_dbg_adapter)
+ debugfs_remove_recursive(adapter->ixgbe_dbg_adapter);
+ adapter->ixgbe_dbg_adapter = NULL;
+}
+
+/**
+ * ixgbe_dbg_init - start up debugfs for the driver
+ **/
+void ixgbe_dbg_init(void)
+{
+ ixgbe_dbg_root = debugfs_create_dir(ixgbe_driver_name, NULL);
+ if (ixgbe_dbg_root == NULL)
+ pr_err("init of debugfs failed\n");
+}
+
+/**
+ * ixgbe_dbg_exit - clean out the driver's debugfs entries
+ **/
+void ixgbe_dbg_exit(void)
+{
+ debugfs_remove_recursive(ixgbe_dbg_root);
+}
+
+#endif /* HAVE_IXGBE_DEBUG_FS */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_ethtool.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -177,7 +177,7 @@
struct ixgbe_hw *hw = &adapter->hw;
ixgbe_link_speed supported_link;
u32 link_speed = 0;
- bool autoneg;
+ bool autoneg = false;
bool link_up;
hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg);
@@ -364,10 +364,10 @@
return err;
/* this sets the link speed and restarts auto-neg */
hw->mac.autotry_restart = true;
- err = hw->mac.ops.setup_link(hw, advertised, true, true);
+ err = hw->mac.ops.setup_link(hw, advertised, true);
if (err) {
e_info(probe, "setup link failed with code %d\n", err);
- hw->mac.ops.setup_link(hw, old, true, true);
+ hw->mac.ops.setup_link(hw, old, true);
}
}
return err;
@@ -406,6 +406,12 @@
(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
return -EINVAL;
+
+ /* some devices do not support autoneg of flow control */
+ if ((pause->autoneg == AUTONEG_ENABLE) &&
+ (ixgbe_device_supports_autoneg_fc(hw) != 0))
+ return -EINVAL;
+
fc.disable_fc_autoneg = (pause->autoneg != AUTONEG_ENABLE);
if ((pause->rx_pause && pause->tx_pause) || pause->autoneg)
@@ -912,9 +918,9 @@
struct ethtool_ringparam *ring)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
- struct ixgbe_ring *tx_ring = NULL, *rx_ring = NULL;
- u32 new_rx_count, new_tx_count;
+ struct ixgbe_ring *temp_ring;
int i, err = 0;
+ u32 new_rx_count, new_tx_count;
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
return -EINVAL;
@@ -927,10 +933,11 @@
IXGBE_MIN_RXD, IXGBE_MAX_RXD);
new_rx_count = ALIGN(new_rx_count, IXGBE_REQ_RX_DESCRIPTOR_MULTIPLE);
- /* if nothing to do return success */
if ((new_tx_count == adapter->tx_ring_count) &&
- (new_rx_count == adapter->rx_ring_count))
+ (new_rx_count == adapter->rx_ring_count)) {
+ /* nothing to do */
return 0;
+ }
while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
usleep_range(1000, 2000);
@@ -945,98 +952,81 @@
goto clear_reset;
}
- /* alloc updated Tx resources */
- if (new_tx_count != adapter->tx_ring_count) {
- tx_ring = vmalloc(adapter->num_tx_queues * sizeof(*tx_ring));
- if (!tx_ring) {
- err = -ENOMEM;
- goto clear_reset;
- }
+ /* allocate temporary buffer to store rings in */
+ i = max_t(int, adapter->num_tx_queues, adapter->num_rx_queues);
+ temp_ring = vmalloc(i * sizeof(struct ixgbe_ring));
+ if (!temp_ring) {
+ err = -ENOMEM;
+ goto clear_reset;
+ }
+
+ ixgbe_down(adapter);
+
+ /*
+ * Setup new Tx resources and free the old Tx resources in that order.
+ * We can then assign the new resources to the rings via a memcpy.
+ * The advantage to this approach is that we are guaranteed to still
+ * have resources even in the case of an allocation failure.
+ */
+ if (new_tx_count != adapter->tx_ring_count) {
for (i = 0; i < adapter->num_tx_queues; i++) {
- /* clone ring and setup updated count */
- tx_ring[i] = *adapter->tx_ring[i];
- tx_ring[i].count = new_tx_count;
- err = ixgbe_setup_tx_resources(&tx_ring[i]);
+ memcpy(&temp_ring[i], adapter->tx_ring[i],
+ sizeof(struct ixgbe_ring));
+
+ temp_ring[i].count = new_tx_count;
+ err = ixgbe_setup_tx_resources(&temp_ring[i]);
if (err) {
while (i) {
i--;
- ixgbe_free_tx_resources(&tx_ring[i]);
+ ixgbe_free_tx_resources(&temp_ring[i]);
}
+ goto err_setup;
+ }
+ }
- vfree(tx_ring);
- tx_ring = NULL;
+ for (i = 0; i < adapter->num_tx_queues; i++) {
+ ixgbe_free_tx_resources(adapter->tx_ring[i]);
- goto clear_reset;
- }
+ memcpy(adapter->tx_ring[i], &temp_ring[i],
+ sizeof(struct ixgbe_ring));
}
+
+ adapter->tx_ring_count = new_tx_count;
}
- /* alloc updated Rx resources */
+ /* Repeat the process for the Rx rings if needed */
if (new_rx_count != adapter->rx_ring_count) {
- rx_ring = vmalloc(adapter->num_rx_queues * sizeof(*rx_ring));
- if (!rx_ring) {
- err = -ENOMEM;
- goto clear_reset;
- }
-
for (i = 0; i < adapter->num_rx_queues; i++) {
- /* clone ring and setup updated count */
- rx_ring[i] = *adapter->rx_ring[i];
- rx_ring[i].count = new_rx_count;
- err = ixgbe_setup_rx_resources(&rx_ring[i]);
+ memcpy(&temp_ring[i], adapter->rx_ring[i],
+ sizeof(struct ixgbe_ring));
+
+ temp_ring[i].count = new_rx_count;
+ err = ixgbe_setup_rx_resources(&temp_ring[i]);
if (err) {
while (i) {
i--;
- ixgbe_free_rx_resources(&rx_ring[i]);
+ ixgbe_free_rx_resources(&temp_ring[i]);
}
-
- vfree(rx_ring);
- rx_ring = NULL;
-
- goto clear_reset;
+ goto err_setup;
}
}
- }
-
- /* bring interface down to prepare for update */
- ixgbe_down(adapter);
-
- /* Tx */
- if (tx_ring) {
- for (i = 0; i < adapter->num_tx_queues; i++) {
- ixgbe_free_tx_resources(adapter->tx_ring[i]);
- *adapter->tx_ring[i] = tx_ring[i];
- }
- adapter->tx_ring_count = new_tx_count;
- vfree(tx_ring);
- tx_ring = NULL;
- }
- /* Rx */
- if (rx_ring) {
for (i = 0; i < adapter->num_rx_queues; i++) {
ixgbe_free_rx_resources(adapter->rx_ring[i]);
- *adapter->rx_ring[i] = rx_ring[i];
+
+ memcpy(adapter->rx_ring[i], &temp_ring[i],
+ sizeof(struct ixgbe_ring));
}
- adapter->rx_ring_count = new_rx_count;
- vfree(rx_ring);
- rx_ring = NULL;
+ adapter->rx_ring_count = new_rx_count;
}
- /* restore interface using new values */
+err_setup:
ixgbe_up(adapter);
-
+ vfree(temp_ring);
clear_reset:
- /* free Tx resources if Rx error is encountered */
- if (tx_ring) {
- for (i = 0; i < adapter->num_tx_queues; i++)
- ixgbe_free_tx_resources(&tx_ring[i]);
- vfree(tx_ring);
- }
-
clear_bit(__IXGBE_RESETTING, &adapter->state);
return err;
}
@@ -1887,19 +1877,11 @@
struct ethtool_test *eth_test, u64 *data)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
+ struct ixgbe_hw *hw = &adapter->hw;
bool if_running = netif_running(netdev);
set_bit(__IXGBE_TESTING, &adapter->state);
if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
- /* Offline tests */
-
- e_info(hw, "offline testing starting\n");
-
- /* Link test performed before hardware reset so autoneg doesn't
- * interfere with test result */
- if (ixgbe_link_test(adapter, &data[4]))
- eth_test->flags |= ETH_TEST_FL_FAILED;
-
if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
int i;
for (i = 0; i < adapter->num_vfs; i++) {
@@ -1920,12 +1902,23 @@
}
}
+ /* Offline tests */
+ e_info(hw, "offline testing starting\n");
+
if (if_running)
/* indicate we're in test mode */
dev_close(netdev);
- else
- ixgbe_reset(adapter);
+ /* bringing the adapter down disables SFP+ Optics */
+ if (hw->mac.ops.enable_tx_laser)
+ hw->mac.ops.enable_tx_laser(hw);
+
+ /* Link test performed before hardware reset so autoneg doesn't
+ * interfere with test result */
+ if (ixgbe_link_test(adapter, &data[4]))
+ eth_test->flags |= ETH_TEST_FL_FAILED;
+
+ ixgbe_reset(adapter);
e_info(hw, "register testing starting\n");
if (ixgbe_reg_test(adapter, &data[0]))
eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -1957,16 +1950,21 @@
skip_loopback:
ixgbe_reset(adapter);
+ /* clear testing bit and return adapter to previous state */
clear_bit(__IXGBE_TESTING, &adapter->state);
if (if_running)
dev_open(netdev);
} else {
e_info(hw, "online testing starting\n");
+ /* if adapter is down, SFP+ optics will be disabled */
+ if (!if_running && hw->mac.ops.enable_tx_laser)
+ hw->mac.ops.enable_tx_laser(hw);
+
/* Online tests */
if (ixgbe_link_test(adapter, &data[4]))
eth_test->flags |= ETH_TEST_FL_FAILED;
- /* Online tests aren't run; pass by default */
+ /* Offline tests aren't run; pass by default */
data[0] = 0;
data[1] = 0;
data[2] = 0;
@@ -1974,6 +1972,11 @@
clear_bit(__IXGBE_TESTING, &adapter->state);
}
+
+ /* if adapter was down, disable SFP+ optics again */
+ if (!if_running && hw->mac.ops.disable_tx_laser)
+ hw->mac.ops.disable_tx_laser(hw);
+
skip_ol_tests:
msleep_interruptible(4 * 1000);
}
@@ -2997,7 +3000,7 @@
struct ixgbe_adapter *adapter = netdev_priv(dev);
switch (adapter->hw.mac.type) {
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
case ixgbe_mac_X540:
case ixgbe_mac_82599EB:
info->so_timestamping =
@@ -3021,9 +3024,17 @@
(1 << HWTSTAMP_FILTER_NONE) |
(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
+ (1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
+ (1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT) |
+ (1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
+ (1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
+ (1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
+ (1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ) |
+ (1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
+ (1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
break;
-#endif /* CONFIG_IXGBE_PTP */
+#endif /* HAVE_PTP_1588_CLOCK */
default:
return ethtool_op_get_ts_info(dev, info);
break;
@@ -3033,6 +3044,116 @@
#endif /* HAVE_ETHTOOL_GET_TS_INFO */
#endif /* ETHTOOL_GRXRINGS */
+#ifdef ETHTOOL_SCHANNELS
+static unsigned int ixgbe_max_channels(struct ixgbe_adapter *adapter)
+{
+ unsigned int max_combined;
+ u8 tcs = netdev_get_num_tc(adapter->netdev);
+
+ if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
+ /* We only support one q_vector without MSI-X */
+ max_combined = 1;
+ } else if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
+ /* SR-IOV currently only allows one queue on the PF */
+ max_combined = 1;
+ } else if (tcs > 1) {
+ /* For DCB report channels per traffic class */
+ if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
+ /* 8 TC w/ 4 queues per TC */
+ max_combined = 4;
+ } else if (tcs > 4) {
+ /* 8 TC w/ 8 queues per TC */
+ max_combined = 8;
+ } else {
+ /* 4 TC w/ 16 queues per TC */
+ max_combined = 16;
+ }
+ } else if (adapter->atr_sample_rate) {
+ /* support up to 64 queues with ATR */
+ max_combined = IXGBE_MAX_FDIR_INDICES;
+ } else {
+ /* support up to 16 queues with RSS */
+ max_combined = IXGBE_MAX_RSS_INDICES;
+ }
+
+ return max_combined;
+}
+
+static void ixgbe_get_channels(struct net_device *dev,
+ struct ethtool_channels *ch)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(dev);
+
+ /* report maximum channels */
+ ch->max_combined = ixgbe_max_channels(adapter);
+
+ /* report info for other vector */
+ if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) {
+ ch->max_other = NON_Q_VECTORS;
+ ch->other_count = NON_Q_VECTORS;
+ }
+
+ /* record RSS queues */
+ ch->combined_count = adapter->ring_feature[RING_F_RSS].indices;
+
+ /* nothing else to report if RSS is disabled */
+ if (ch->combined_count == 1)
+ return;
+
+ /* we do not support ATR queueing if SR-IOV is enabled */
+ if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
+ return;
+
+ /* same thing goes for being DCB enabled */
+ if (netdev_get_num_tc(dev) > 1)
+ return;
+
+ /* if ATR is disabled we can exit */
+ if (!adapter->atr_sample_rate)
+ return;
+
+ /* report flow director queues as maximum channels */
+ ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices;
+}
+
+static int ixgbe_set_channels(struct net_device *dev,
+ struct ethtool_channels *ch)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(dev);
+ unsigned int count = ch->combined_count;
+
+ /* verify they are not requesting separate vectors */
+ if (!count || ch->rx_count || ch->tx_count)
+ return -EINVAL;
+
+ /* verify other_count has not changed */
+ if (ch->other_count != NON_Q_VECTORS)
+ return -EINVAL;
+
+ /* verify the number of channels does not exceed hardware limits */
+ if (count > ixgbe_max_channels(adapter))
+ return -EINVAL;
+
+ /* update feature limits from largest to smallest supported values */
+ adapter->ring_feature[RING_F_FDIR].limit = count;
+
+ /* cap RSS limit at 16 */
+ if (count > IXGBE_MAX_RSS_INDICES)
+ count = IXGBE_MAX_RSS_INDICES;
+ adapter->ring_feature[RING_F_RSS].limit = count;
+
+#ifdef IXGBE_FCOE
+ /* cap FCoE limit at 8 */
+ if (count > IXGBE_FCRETA_SIZE)
+ count = IXGBE_FCRETA_SIZE;
+ adapter->ring_feature[RING_F_FCOE].limit = count;
+
+#endif
+ /* use setup TC to update any traffic class queue mapping */
+ return ixgbe_setup_tc(dev, netdev_get_num_tc(dev));
+}
+
+#endif /* ETHTOOL_SCHANNELS */
static struct ethtool_ops ixgbe_ethtool_ops = {
.get_settings = ixgbe_get_settings,
.set_settings = ixgbe_set_settings,
@@ -3057,11 +3178,13 @@
#endif /* HAVE_ETHTOOL_GET_SSET_COUNT */
.self_test = ixgbe_diag_test,
.get_strings = ixgbe_get_strings,
+#ifndef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT
#ifdef HAVE_ETHTOOL_SET_PHYS_ID
.set_phys_id = ixgbe_set_phys_id,
#else
.phys_id = ixgbe_phys_id,
#endif /* HAVE_ETHTOOL_SET_PHYS_ID */
+#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */
#ifndef HAVE_ETHTOOL_GET_SSET_COUNT
.get_stats_count = ixgbe_get_stats_count,
#else /* HAVE_ETHTOOL_GET_SSET_COUNT */
@@ -3096,14 +3219,36 @@
.set_rx_ntuple = ixgbe_set_rx_ntuple,
#endif
#endif
+#ifndef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT
+#ifdef ETHTOOL_SCHANNELS
+ .get_channels = ixgbe_get_channels,
+ .set_channels = ixgbe_set_channels,
+#endif
#ifdef HAVE_ETHTOOL_GET_TS_INFO
.get_ts_info = ixgbe_get_ts_info,
#endif
+#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */
+};
+
+#ifdef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT
+static const struct ethtool_ops_ext ixgbe_ethtool_ops_ext = {
+ .size = sizeof(struct ethtool_ops_ext),
+ .get_ts_info = ixgbe_get_ts_info,
+ .set_phys_id = ixgbe_set_phys_id,
+ .get_channels = ixgbe_get_channels,
+ .set_channels = ixgbe_set_channels,
};
void ixgbe_set_ethtool_ops(struct net_device *netdev)
{
SET_ETHTOOL_OPS(netdev, &ixgbe_ethtool_ops);
+ set_ethtool_ops_ext(netdev, &ixgbe_ethtool_ops_ext);
+}
+#else
+void ixgbe_set_ethtool_ops(struct net_device *netdev)
+{
+ SET_ETHTOOL_OPS(netdev, &ixgbe_ethtool_ops);
}
+#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */
#endif /* SIOCETHTOOL */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_fcoe.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -79,7 +79,7 @@
if (!netdev)
goto out_ddp_put;
- if (xid >= IXGBE_FCOE_DDP_MAX)
+ if (xid > netdev->fcoe_ddp_xid)
goto out_ddp_put;
adapter = netdev_priv(netdev);
@@ -99,11 +99,11 @@
IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCDMARW,
(xid | IXGBE_FCDMARW_WE));
- /* guaranteed to be invalidated after 100us */
IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCDMARW,
(xid | IXGBE_FCDMARW_RE));
fcbuff = IXGBE_READ_REG(&adapter->hw, IXGBE_FCBUFF);
spin_unlock_bh(&fcoe->lock);
+ /* guaranteed to be invalidated after 100us */
if (fcbuff & IXGBE_FCBUFF_VALID)
udelay(100);
}
@@ -154,7 +154,7 @@
return 0;
adapter = netdev_priv(netdev);
- if (xid >= IXGBE_FCOE_DDP_MAX) {
+ if (xid > netdev->fcoe_ddp_xid) {
e_warn(drv, "xid=0x%x out-of-range\n", xid);
return 0;
}
@@ -374,7 +374,7 @@
struct ixgbe_fcoe *fcoe = &adapter->fcoe;
struct ixgbe_fcoe_ddp *ddp;
struct fc_frame_header *fh;
- int rc = -EINVAL;
+ int rc = -EINVAL, ddp_max;
__le32 fcerr = ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_ERR_FCERR);
__le32 ddp_err;
u32 fctl;
@@ -399,7 +399,9 @@
else
xid = ntohs(fh->fh_rx_id);
- if (xid >= IXGBE_FCOE_DDP_MAX)
+ ddp_max = IXGBE_FCOE_DDP_MAX;
+
+ if (xid >= ddp_max)
goto ddp_out;
ddp = &fcoe->ddp[xid];
@@ -553,15 +555,14 @@
first->gso_segs = DIV_ROUND_UP(skb->len - *hdr_len,
skb_shinfo(skb)->gso_size);
first->bytecount += (first->gso_segs - 1) * *hdr_len;
- first->tx_flags |= IXGBE_TX_FLAGS_FSO;
+ first->tx_flags |= IXGBE_TX_FLAGS_TSO;
}
/* set flag indicating FCOE to ixgbe_tx_map call */
- first->tx_flags |= IXGBE_TX_FLAGS_FCOE;
+ first->tx_flags |= IXGBE_TX_FLAGS_FCOE | IXGBE_TX_FLAGS_CC;
- /* mss_l4len_id: use 1 for FSO as TSO, no need for L4LEN */
+ /* mss_l4len_id: use 0 for FSO as TSO, no need for L4LEN */
mss_l4len_idx = skb_shinfo(skb)->gso_size << IXGBE_ADVTXD_MSS_SHIFT;
- mss_l4len_idx |= 1 << IXGBE_ADVTXD_IDX_SHIFT;
/* vlan_macip_lens: HEADLEN, MACLEN, VLAN tag */
vlan_macip_lens = skb_transport_offset(skb) +
@@ -622,8 +623,10 @@
{
struct ixgbe_ring_feature *fcoe = &adapter->ring_feature[RING_F_FCOE];
struct ixgbe_hw *hw = &adapter->hw;
- int i, fcoe_q, fcoe_i;
+ int i, fcoe_i;
+ u32 fcoe_q, fcoe_q_h = 0;
u32 etqf;
+ int fcreta_size;
/* Minimal funcionality for FCoE requires at least CRC offloads */
if (!(adapter->netdev->features & NETIF_F_FCOE_CRC))
@@ -643,10 +646,13 @@
return;
/* Use one or more Rx queues for FCoE by redirection table */
- for (i = 0; i < IXGBE_FCRETA_SIZE; i++) {
+ fcreta_size = IXGBE_FCRETA_SIZE;
+
+ for (i = 0; i < fcreta_size; i++) {
fcoe_i = fcoe->offset + (i % fcoe->indices);
fcoe_i &= IXGBE_FCRETA_ENTRY_MASK;
fcoe_q = adapter->rx_ring[fcoe_i]->reg_idx;
+ fcoe_q |= fcoe_q_h;
IXGBE_WRITE_REG(hw, IXGBE_FCRETA(i), fcoe_q);
}
IXGBE_WRITE_REG(hw, IXGBE_FCRECTL, IXGBE_FCRECTL_ENA);
@@ -667,7 +673,6 @@
/* Configure FCoE Rx control */
IXGBE_WRITE_REG(hw, IXGBE_FCRXCTRL,
- IXGBE_FCRXCTRL_FCOELLI |
IXGBE_FCRXCTRL_FCCRCBO |
(FC_FCOE_VER << IXGBE_FCRXCTRL_FCOEVER_SHIFT));
}
@@ -683,13 +688,15 @@
void ixgbe_free_fcoe_ddp_resources(struct ixgbe_adapter *adapter)
{
struct ixgbe_fcoe *fcoe = &adapter->fcoe;
- int cpu, i;
+ int cpu, i, ddp_max;
/* do nothing if no DDP pools were allocated */
if (!fcoe->ddp_pool)
return;
- for (i = 0; i < IXGBE_FCOE_DDP_MAX; i++)
+ ddp_max = IXGBE_FCOE_DDP_MAX;
+
+ for (i = 0; i < ddp_max; i++)
ixgbe_fcoe_ddp_put(adapter->netdev, i);
for_each_possible_cpu(cpu)
@@ -776,6 +783,7 @@
adapter->netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
+
return 0;
}
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_fcoe.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_lib.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -424,7 +424,6 @@
fcoe = &adapter->ring_feature[RING_F_FCOE];
/* limit ourselves based on feature limits */
- fcoe_i = min_t(u16, fcoe_i, num_online_cpus());
fcoe_i = min_t(u16, fcoe_i, fcoe->limit);
if (fcoe_i) {
@@ -640,9 +639,6 @@
fcoe_i = min_t(u16, fcoe_i, fcoe->limit);
if (vmdq_i > 1 && fcoe_i) {
- /* reserve no more than number of CPUs */
- fcoe_i = min_t(u16, fcoe_i, num_online_cpus());
-
/* alloc queues for FCoE separately */
fcoe->indices = fcoe_i;
fcoe->offset = vmdq_i * rss_i;
@@ -700,8 +696,7 @@
if (rss_i > 1 && adapter->atr_sample_rate) {
f = &adapter->ring_feature[RING_F_FDIR];
- f->indices = min_t(u16, num_online_cpus(), f->limit);
- rss_i = max_t(u16, rss_i, f->indices);
+ rss_i = f->indices = f->limit;
if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
@@ -857,6 +852,7 @@
int node = -1;
#ifdef HAVE_IRQ_AFFINITY_HINT
int cpu = -1;
+ u8 tcs = netdev_get_num_tc(adapter->netdev);
#endif
int ring_count, size;
@@ -866,10 +862,13 @@
#ifdef HAVE_IRQ_AFFINITY_HINT
/* customize cpu for Flow Director mapping */
- if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
- if (cpu_online(v_idx)) {
- cpu = v_idx;
- node = cpu_to_node(cpu);
+ if ((tcs <= 1) && !(adapter->flags & IXGBE_FLAG_VMDQ_ENABLED)) {
+ u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
+ if (rss_i > 1 && adapter->atr_sample_rate) {
+ if (cpu_online(v_idx)) {
+ cpu = v_idx;
+ node = cpu_to_node(cpu);
+ }
}
}
@@ -885,8 +884,6 @@
#ifdef HAVE_IRQ_AFFINITY_HINT
if (cpu != -1)
cpumask_set_cpu(cpu, &q_vector->affinity_mask);
- else
- cpumask_copy(&q_vector->affinity_mask, cpu_online_mask);
#endif
q_vector->numa_node = node;
@@ -914,6 +911,21 @@
/* initialize pointer to rings */
ring = q_vector->ring;
+ /* intialize ITR */
+ if (txr_count && !rxr_count) {
+ /* tx only vector */
+ if (adapter->tx_itr_setting == 1)
+ q_vector->itr = IXGBE_10K_ITR;
+ else
+ q_vector->itr = adapter->tx_itr_setting;
+ } else {
+ /* rx or rx/tx vector */
+ if (adapter->rx_itr_setting == 1)
+ q_vector->itr = IXGBE_20K_ITR;
+ else
+ q_vector->itr = adapter->rx_itr_setting;
+ }
+
while (txr_count) {
/* assign generic ring traits */
ring->dev = pci_dev_to_dev(adapter->pdev);
@@ -1180,11 +1192,9 @@
/* disable VMDq */
adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED;
-
#ifdef CONFIG_PCI_IOV
/* disable SR-IOV */
ixgbe_disable_sriov(adapter);
-
#endif /* CONFIG_PCI_IOV */
/* disable RSS */
adapter->ring_feature[RING_F_RSS].limit = 1;
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_main.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -70,11 +70,11 @@
#define BYPASS_TAG
-#define DRV_VERSION __stringify(3.11.33) DRIVERIOV DRV_HW_PERF FPGA \
+#define DRV_VERSION __stringify(3.14.5) DRIVERIOV DRV_HW_PERF FPGA \
VMDQ_TAG BYPASS_TAG
const char ixgbe_driver_version[] = DRV_VERSION;
static const char ixgbe_copyright[] =
- "Copyright (c) 1999-2012 Intel Corporation.";
+ "Copyright (c) 1999-2013 Intel Corporation.";
/* ixgbe_pci_tbl - PCI Device ID Table
*
@@ -112,7 +112,6 @@
{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_SFP_SF2)},
{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_LS)},
{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599EN_SFP)},
- {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_SFP_SF_QP)},
/* required last entry */
{0, }
};
@@ -135,6 +134,7 @@
#define DEFAULT_DEBUG_LEVEL_SHIFT 3
+
static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter)
{
if (!test_bit(__IXGBE_DOWN, &adapter->state) &&
@@ -458,7 +458,7 @@
break;
/* prevent any other reads prior to eop_desc */
- rmb();
+ read_barrier_depends();
/* if DD is not set pending work has not been completed */
if (!(eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)))
@@ -471,14 +471,6 @@
total_bytes += tx_buffer->bytecount;
total_packets += tx_buffer->gso_segs;
-#ifdef CONFIG_IXGBE_PTP
- if (unlikely(tx_buffer->tx_flags &
- IXGBE_TX_FLAGS_TSTAMP))
- ixgbe_ptp_tx_hwtstamp(q_vector,
- tx_buffer->skb);
-
-
-#endif
/* free the skb */
dev_kfree_skb_any(tx_buffer->skb);
@@ -908,6 +900,16 @@
return true;
}
+static inline unsigned int ixgbe_rx_offset(struct ixgbe_ring *rx_ring)
+{
+#ifdef HAVE_SKB_HEAD_FRAG
+ if (ring_uses_build_skb(rx_ring))
+ return NET_SKB_PAD + NET_IP_ALIGN;
+ else
+#endif
+ return 0;
+}
+
#endif /* CONFIG_IXGBE_DISABLE_PACKET_SPLIT */
/**
* ixgbe_alloc_rx_buffers - Replace used receive buffers
@@ -943,7 +945,9 @@
#ifdef CONFIG_IXGBE_DISABLE_PACKET_SPLIT
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma);
#else
- rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + bi->page_offset);
+ rx_desc->read.pkt_addr = cpu_to_le64(bi->dma +
+ bi->page_offset +
+ ixgbe_rx_offset(rx_ring));
#endif
rx_desc++;
@@ -1170,9 +1174,10 @@
lroh->ts[2] = IXGBE_CB(skb)->tsecr;
lroh->ts[1] = htonl(IXGBE_CB(skb)->tsval);
}
-#ifdef NETIF_F_TSO
+#ifdef NETIF_F_GSO
skb_shinfo(skb)->gso_size = IXGBE_CB(skb)->mss;
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
#endif
}
@@ -1264,11 +1269,40 @@
{
struct skb_shared_info *sh_info;
struct skb_shared_info *new_skb_info;
- u16 data_len;
+ unsigned int data_len;
sh_info = skb_shinfo(lro_skb);
new_skb_info = skb_shinfo(new_skb);
+#ifdef HAVE_SKB_HEAD_FRAG
+ if (skb_headlen(new_skb) && new_skb->head_frag) {
+ skb_frag_t *frag = sh_info->frags + sh_info->nr_frags;
+ struct page *page = virt_to_head_page(new_skb->head);
+
+ frag->page.p = page;
+ frag->page_offset = new_skb->data -
+ (unsigned char *)page_address(page);
+ skb_frag_size_set(frag, skb_headlen(new_skb));
+
+ /* copy frags into the last skb */
+ memcpy(&frag[1], new_skb_info->frags,
+ new_skb_info->nr_frags * sizeof(skb_frag_t));
+
+ /* copy size data over */
+ sh_info->nr_frags += new_skb_info->nr_frags + 1;
+ data_len = IXGBE_CB(new_skb)->mss;
+ lro_skb->len += data_len;
+ lro_skb->data_len += data_len;
+ lro_skb->truesize += new_skb->truesize -
+ SKB_DATA_ALIGN(sizeof(struct sk_buff));
+
+ /* free new_skb head */
+ kfree_skb_partial(new_skb, true);
+
+ return;
+ }
+
+#endif
/* copy frags into the last skb */
memcpy(sh_info->frags + sh_info->nr_frags,
new_skb_info->frags,
@@ -1357,32 +1391,29 @@
data_len = IXGBE_CB(new_skb)->mss;
- /*
- * malformed header, no tcp data, resultant packet would
- * be too large, or new skb is larger than our current mss.
+ /* Check for all of the above below
+ * malformed header
+ * no tcp data
+ * resultant packet would be too large
+ * new skb is larger than our current mss
+ * data would remain in header
+ * we would consume more frags then the sk_buff contains
+ * ack sequence numbers changed
+ * window size has changed
*/
if (data_len == 0 ||
data_len > IXGBE_CB(lro_skb)->mss ||
- data_len > IXGBE_CB(lro_skb)->free) {
- ixgbe_lro_flush(q_vector, lro_skb);
- break;
- }
-
+ data_len > IXGBE_CB(lro_skb)->free ||
#ifndef CONFIG_IXGBE_DISABLE_PACKET_SPLIT
- /*
- * Data would remain in header or consume more frags
- * then the sk_buff can contain.
- */
- if (data_len != new_skb->data_len ||
+#ifdef HAVE_SKB_HEAD_FRAG
+ (data_len != new_skb->data_len && !new_skb->head_frag) ||
+#else
+ data_len != new_skb->data_len ||
+#endif
skb_shinfo(new_skb)->nr_frags >=
- (MAX_SKB_FRAGS - skb_shinfo(lro_skb)->nr_frags)) {
- ixgbe_lro_flush(q_vector, lro_skb);
- break;
- }
-
+ (MAX_SKB_FRAGS - skb_shinfo(lro_skb)->nr_frags) ||
#endif
- /* ack sequence numbers or window size has changed */
- if (ixgbe_lro_hdr(lro_skb)->th.ack_seq != lroh->th.ack_seq ||
+ ixgbe_lro_hdr(lro_skb)->th.ack_seq != lroh->th.ack_seq ||
ixgbe_lro_hdr(lro_skb)->th.window != lroh->th.window) {
ixgbe_lro_flush(q_vector, lro_skb);
break;
@@ -1410,7 +1441,8 @@
ixgbe_add_active_tail(lro_skb, new_skb);
#endif
- if ((data_len < IXGBE_CB(lro_skb)->mss) || lroh->th.psh) {
+ if ((data_len < IXGBE_CB(lro_skb)->mss) || lroh->th.psh ||
+ skb_shinfo(lro_skb)->nr_frags == MAX_SKB_FRAGS) {
ixgbe_lro_hdr(lro_skb)->th.psh |= lroh->th.psh;
ixgbe_lro_flush(q_vector, lro_skb);
}
@@ -1507,9 +1539,9 @@
if (hlen < sizeof(struct iphdr))
return hdr.network - data;
- /* record next protocol */
- nexthdr = hdr.ipv4->protocol;
- hdr.network += hlen;
+ /* record next protocol if header is present */
+ if (!(hdr.ipv4->frag_off & htons(IP_OFFSET)))
+ nexthdr = hdr.ipv4->protocol;
#ifdef NETIF_F_TSO6
} else if (protocol == __constant_htons(ETH_P_IPV6)) {
if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr)))
@@ -1517,18 +1549,21 @@
/* record next protocol */
nexthdr = hdr.ipv6->nexthdr;
- hdr.network += sizeof(struct ipv6hdr);
+ hlen = sizeof(struct ipv6hdr);
#endif /* NETIF_F_TSO6 */
#ifdef IXGBE_FCOE
} else if (protocol == __constant_htons(ETH_P_FCOE)) {
if ((hdr.network - data) > (max_len - FCOE_HEADER_LEN))
return max_len;
- hdr.network += FCOE_HEADER_LEN;
+ hlen = FCOE_HEADER_LEN;
#endif
} else {
return hdr.network - data;
}
+ /* relocate pointer to start of L4 header */
+ hdr.network += hlen;
+
/* finally sort out TCP/UDP */
if (nexthdr == IPPROTO_TCP) {
if ((hdr.network - data) > (max_len - sizeof(struct tcphdr)))
@@ -1575,6 +1610,7 @@
/* set gso_size to avoid messing up TCP MSS */
skb_shinfo(skb)->gso_size = DIV_ROUND_UP((skb->len - hdr_len),
IXGBE_CB(skb)->append_cnt);
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
}
#endif /* NETIF_F_GSO */
@@ -1626,6 +1662,10 @@
union ixgbe_adv_rx_desc *rx_desc,
struct sk_buff *skb)
{
+#ifdef HAVE_PTP_1588_CLOCK
+ u32 flags = rx_ring->q_vector->adapter->flags;
+
+#endif
ixgbe_update_rsc_stats(rx_ring, skb);
#ifdef NETIF_F_RXHASH
@@ -1633,8 +1673,9 @@
#endif /* NETIF_F_RXHASH */
ixgbe_rx_checksum(rx_ring, rx_desc, skb);
-#ifdef CONFIG_IXGBE_PTP
- ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb);
+#ifdef HAVE_PTP_1588_CLOCK
+ if (unlikely(flags & IXGBE_FLAG_RX_HWTSTAMP_ENABLED))
+ ixgbe_ptp_rx_hwtstamp(rx_ring, rx_desc, skb);
#endif
ixgbe_rx_vlan(rx_ring, rx_desc, skb);
@@ -1880,6 +1921,42 @@
DMA_FROM_DEVICE);
}
+static bool ixgbe_can_reuse_rx_page(struct ixgbe_ring *rx_ring,
+ struct ixgbe_rx_buffer *rx_buffer,
+ struct page *page,
+ unsigned int truesize)
+{
+#if (PAGE_SIZE >= 8192)
+ unsigned int last_offset = ixgbe_rx_pg_size(rx_ring) -
+ ixgbe_rx_bufsz(rx_ring);
+
+#endif
+ /* avoid re-using remote pages */
+ if (unlikely(page_to_nid(page) != numa_node_id()))
+ return false;
+
+#if (PAGE_SIZE < 8192)
+ /* if we are only owner of page we can reuse it */
+ if (unlikely(page_count(page) != 1))
+ return false;
+
+ /* flip page offset to other buffer */
+ rx_buffer->page_offset ^= truesize;
+
+#else
+ /* move offset up to the next cache line */
+ rx_buffer->page_offset += truesize;
+
+ if (rx_buffer->page_offset > last_offset)
+ return false;
+#endif
+
+ /* bump ref count on page before it is given to the stack */
+ get_page(page);
+
+ return true;
+}
+
/**
* ixgbe_add_rx_frag - Add contents of Rx buffer to sk_buff
* @rx_ring: rx descriptor ring to transact packets on
@@ -1906,8 +1983,6 @@
unsigned int truesize = ixgbe_rx_bufsz(rx_ring);
#else
unsigned int truesize = ALIGN(size, L1_CACHE_BYTES);
- unsigned int last_offset = ixgbe_rx_pg_size(rx_ring) -
- ixgbe_rx_bufsz(rx_ring);
#endif
if ((size <= IXGBE_RX_HDR_SIZE) && !skb_is_nonlinear(skb)) {
@@ -1927,31 +2002,79 @@
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
rx_buffer->page_offset, size, truesize);
- /* avoid re-using remote pages */
- if (unlikely(page_to_nid(page) != numa_node_id()))
- return false;
+ return ixgbe_can_reuse_rx_page(rx_ring, rx_buffer, page, truesize);
+}
+#ifdef HAVE_SKB_HEAD_FRAG
+static struct sk_buff *ixgbe_build_rx_buffer(struct ixgbe_ring *rx_ring,
+ union ixgbe_adv_rx_desc *rx_desc)
+{
+ struct ixgbe_rx_buffer *rx_buffer;
+ struct sk_buff *skb;
+ struct page *page;
+ void *page_addr;
+ unsigned int size = le16_to_cpu(rx_desc->wb.upper.length);
#if (PAGE_SIZE < 8192)
- /* if we are only owner of page we can reuse it */
- if (unlikely(page_count(page) != 1))
- return false;
-
- /* flip page offset to other buffer */
- rx_buffer->page_offset ^= truesize;
+ unsigned int truesize = ixgbe_rx_bufsz(rx_ring);
#else
- /* move offset up to the next cache line */
- rx_buffer->page_offset += truesize;
+ unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
+ SKB_DATA_ALIGN(NET_SKB_PAD +
+ NET_IP_ALIGN +
+ size);
+#endif
- if (rx_buffer->page_offset > last_offset)
- return false;
+ /* If we spanned a buffer we have a huge mess so test for it */
+ BUG_ON(unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP)));
+
+ rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean];
+ page = rx_buffer->page;
+ prefetchw(page);
+
+ page_addr = page_address(page) + rx_buffer->page_offset;
+
+ /* prefetch first cache line of first page */
+ prefetch(page_addr + NET_SKB_PAD + NET_IP_ALIGN);
+#if L1_CACHE_BYTES < 128
+ prefetch(page_addr + L1_CACHE_BYTES + NET_SKB_PAD + NET_IP_ALIGN);
#endif
- /* bump ref count on page before it is given to the stack */
- get_page(page);
+ /* build an skb to go around the page buffer */
+ skb = build_skb(page_addr, truesize);
+ if (unlikely(!skb)) {
+ rx_ring->rx_stats.alloc_rx_buff_failed++;
+ return NULL;
+ }
- return true;
+ /* we are reusing so sync this buffer for CPU use */
+ dma_sync_single_range_for_cpu(rx_ring->dev,
+ rx_buffer->dma,
+ rx_buffer->page_offset,
+ ixgbe_rx_bufsz(rx_ring),
+ DMA_FROM_DEVICE);
+
+ /* update pointers within the skb to store the data */
+ skb_reserve(skb, NET_IP_ALIGN + NET_SKB_PAD);
+ __skb_put(skb, size);
+
+ if (ixgbe_can_reuse_rx_page(rx_ring, rx_buffer, page, truesize)) {
+ /* hand second half of page back to the ring */
+ ixgbe_reuse_rx_page(rx_ring, rx_buffer);
+ } else {
+ /* we are not reusing the buffer so unmap it */
+ dma_unmap_page(rx_ring->dev, rx_buffer->dma,
+ ixgbe_rx_pg_size(rx_ring),
+ DMA_FROM_DEVICE);
+ }
+
+ /* clear contents of buffer_info */
+ rx_buffer->skb = NULL;
+ rx_buffer->dma = 0;
+ rx_buffer->page = NULL;
+
+ return skb;
}
+#endif /* HAVE_SKB_HEAD_FRAG */
static struct sk_buff *ixgbe_fetch_rx_buffer(struct ixgbe_ring *rx_ring,
union ixgbe_adv_rx_desc *rx_desc)
{
@@ -2081,7 +2204,12 @@
rmb();
/* retrieve a buffer from the ring */
- skb = ixgbe_fetch_rx_buffer(rx_ring, rx_desc);
+#ifdef HAVE_SKB_HEAD_FRAG
+ if (ring_uses_build_skb(rx_ring))
+ skb = ixgbe_build_rx_buffer(rx_ring, rx_desc);
+ else
+#endif
+ skb = ixgbe_fetch_rx_buffer(rx_ring, rx_desc);
/* exit if we failed to retrieve a buffer */
if (!skb)
@@ -2099,7 +2227,6 @@
/* probably a little skewed due to removing CRC */
total_rx_bytes += skb->len;
- total_rx_packets++;
/* populate checksum, timestamp, VLAN, and protocol */
ixgbe_process_skb_fields(rx_ring, rx_desc, skb);
@@ -2122,8 +2249,8 @@
ixgbe_rx_skb(q_vector, rx_ring, rx_desc, skb);
/* update budget accounting */
- budget--;
- } while (likely(budget));
+ total_rx_packets++;
+ } while (likely(total_rx_packets < budget));
#ifdef IXGBE_FCOE
/* include DDPed FCoE data */
@@ -2152,7 +2279,7 @@
ixgbe_lro_flush_all(q_vector);
#endif /* IXGBE_NO_LRO */
- return !!budget;
+ return (total_rx_packets < budget);
}
#else /* CONFIG_IXGBE_DISABLE_PACKET_SPLIT */
@@ -2258,7 +2385,6 @@
/* probably a little skewed due to removing CRC */
total_rx_bytes += skb->len;
- total_rx_packets++;
/* populate checksum, timestamp, VLAN, and protocol */
ixgbe_process_skb_fields(rx_ring, rx_desc, skb);
@@ -2281,8 +2407,8 @@
ixgbe_rx_skb(q_vector, rx_ring, rx_desc, skb);
/* update budget accounting */
- budget--;
- } while (likely(budget));
+ total_rx_packets++;
+ } while (likely(total_rx_packets < budget));
#ifdef IXGBE_FCOE
/* include DDPed FCoE data */
@@ -2311,7 +2437,7 @@
ixgbe_lro_flush_all(q_vector);
#endif /* IXGBE_NO_LRO */
- return !!budget;
+ return (total_rx_packets < budget);
}
#endif /* CONFIG_IXGBE_DISABLE_PACKET_SPLIT */
@@ -2347,20 +2473,6 @@
ixgbe_for_each_ring(ring, q_vector->tx)
ixgbe_set_ivar(adapter, 1, ring->reg_idx, v_idx);
- if (q_vector->tx.ring && !q_vector->rx.ring) {
- /* tx only vector */
- if (adapter->tx_itr_setting == 1)
- q_vector->itr = IXGBE_10K_ITR;
- else
- q_vector->itr = adapter->tx_itr_setting;
- } else {
- /* rx or rx/tx vector */
- if (adapter->rx_itr_setting == 1)
- q_vector->itr = IXGBE_20K_ITR;
- else
- q_vector->itr = adapter->rx_itr_setting;
- }
-
ixgbe_write_eitr(q_vector);
}
@@ -2428,6 +2540,8 @@
*/
/* what was last interrupt timeslice? */
timepassed_us = q_vector->itr >> 2;
+ if (timepassed_us == 0)
+ return;
bytes_perint = bytes / timepassed_us; /* bytes/usec */
switch (itr_setting) {
@@ -2561,10 +2675,10 @@
return;
if (!(eicr & IXGBE_EICR_LSC) && hw->mac.ops.check_link) {
- u32 autoneg;
+ u32 speed;
bool link_up = false;
- hw->mac.ops.check_link(hw, &autoneg, &link_up, false);
+ hw->mac.ops.check_link(hw, &speed, &link_up, false);
if (link_up)
return;
@@ -2753,16 +2867,15 @@
case ixgbe_mac_X540:
mask |= IXGBE_EIMS_ECC;
mask |= IXGBE_EIMS_MAILBOX;
+#ifdef HAVE_PTP_1588_CLOCK
+ mask |= IXGBE_EIMS_TIMESYNC;
+#endif
+
break;
default:
break;
}
-#ifdef CONFIG_IXGBE_PTP
- if (adapter->hw.mac.type == ixgbe_mac_X540)
- mask |= IXGBE_EIMS_TIMESYNC;
-#endif
-
if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) &&
!(adapter->flags2 & IXGBE_FLAG2_FDIR_REQUIRES_REINIT))
mask |= IXGBE_EIMS_FLOW_DIR;
@@ -2787,6 +2900,16 @@
* with the write to EICR.
*/
eicr = IXGBE_READ_REG(hw, IXGBE_EICS);
+
+ /* The lower 16bits of the EICR register are for the queue interrupts
+ * which should be masked here in order to not accidently clear them if
+ * the bits are high when ixgbe_msix_other is called. There is a race
+ * condition otherwise which results in possible performance loss
+ * especially if the ixgbe_msix_other interrupt is triggering
+ * consistently (as it would when PPS is turned on for the X540 device)
+ */
+ eicr &= 0xFFFF0000;
+
IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr);
if (eicr & IXGBE_EICR_LSC)
@@ -2799,8 +2922,10 @@
case ixgbe_mac_82599EB:
case ixgbe_mac_X540:
if (eicr & IXGBE_EICR_ECC) {
- e_info(link, "Received unrecoverable ECC Err, please "
- "reboot\n");
+ e_info(link, "Received unrecoverable ECC Err,"
+ "initiating reset.\n");
+ adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED;
+ ixgbe_service_event_schedule(adapter);
IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_ECC);
}
#ifdef HAVE_TX_MQ
@@ -2836,7 +2961,7 @@
ixgbe_check_fan_failure(adapter, eicr);
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
if (unlikely(eicr & IXGBE_EICR_TIMESYNC))
ixgbe_ptp_check_pps_event(adapter, eicr);
#endif
@@ -3019,7 +3144,7 @@
*/
if (!test_bit(__IXGBE_DOWN, &adapter->state))
ixgbe_irq_enable(adapter, true, true);
- return IRQ_NONE; /* Not our interrupt */
+ return IRQ_NONE; /* Not our interrupt */
}
if (eicr & IXGBE_EICR_LSC)
@@ -3028,9 +3153,13 @@
switch (hw->mac.type) {
case ixgbe_mac_82599EB:
case ixgbe_mac_X540:
- if (eicr & IXGBE_EICR_ECC)
- e_info(link, "Received unrecoverable ECC Err, please "
- "reboot\n");
+ if (eicr & IXGBE_EICR_ECC) {
+ e_info(link, "Received unrecoverable ECC Err,"
+ "initiating reset.\n");
+ adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED;
+ ixgbe_service_event_schedule(adapter);
+ IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_ECC);
+ }
ixgbe_check_sfp_event(adapter, eicr);
ixgbe_check_overtemp_event(adapter, eicr);
break;
@@ -3039,7 +3168,7 @@
}
ixgbe_check_fan_failure(adapter, eicr);
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
if (unlikely(eicr & IXGBE_EICR_TIMESYNC))
ixgbe_ptp_check_pps_event(adapter, eicr);
#endif
@@ -3152,12 +3281,6 @@
{
struct ixgbe_q_vector *q_vector = adapter->q_vector[0];
- /* rx/tx vector */
- if (adapter->rx_itr_setting == 1)
- q_vector->itr = IXGBE_20K_ITR;
- else
- q_vector->itr = adapter->rx_itr_setting;
-
ixgbe_write_eitr(q_vector);
ixgbe_set_ivar(adapter, 0, 0, 0);
@@ -3233,6 +3356,16 @@
ring->atr_sample_rate = 0;
}
+ /* initialize XPS */
+ if (!test_and_set_bit(__IXGBE_TX_XPS_INIT_DONE, &ring->state)) {
+ struct ixgbe_q_vector *q_vector = ring->q_vector;
+
+ if (q_vector)
+ netif_set_xps_queue(adapter->netdev,
+ &q_vector->affinity_mask,
+ ring->queue_index);
+ }
+
clear_bit(__IXGBE_HANG_CHECK_ARMED, &ring->state);
/* enable queue */
@@ -3676,7 +3809,8 @@
if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
break;
rxdctl |= ring->rx_buf_len | IXGBE_RXDCTL_RLPML_EN;
-#endif
+#endif /* CONFIG_IXGBE_DISABLE_PACKET_SPLIT */
+ break;
default:
break;
}
@@ -3871,11 +4005,21 @@
*/
for (i = 0; i < adapter->num_rx_queues; i++) {
rx_ring = adapter->rx_ring[i];
- /* RSC enablement is done by on demand in ESX. */
+ clear_ring_rsc_enabled(rx_ring);
+ clear_ring_build_skb_enabled(rx_ring);
+
+#ifdef HAVE_SKB_HEAD_FRAG
+#define IXGBE_MAX_BUILD_SKB_SIZE \
+ (SKB_WITH_OVERHEAD(IXGBE_RXBUFFER_2K) - (NET_SKB_PAD + NET_IP_ALIGN))
+
+#endif
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
set_ring_rsc_enabled(rx_ring);
- else
- clear_ring_rsc_enabled(rx_ring);
+#ifdef HAVE_SKB_HEAD_FRAG
+ else if ((max_frame <= (ETH_FRAME_LEN + ETH_FCS_LEN)) &&
+ (max_frame <= IXGBE_MAX_BUILD_SKB_SIZE))
+ set_ring_build_skb_enabled(rx_ring);
+#endif
#ifdef CONFIG_IXGBE_DISABLE_PACKET_SPLIT
rx_ring->rx_buf_len = rx_buf_len;
@@ -4269,10 +4413,10 @@
return 0;
- hw->mac.ops.update_mc_addr_list(hw, NULL, 0,
- ixgbe_addr_list_itr, true);
-
- if (!netdev_mc_empty(netdev)) {
+ if (netdev_mc_empty(netdev)) {
+ hw->mac.ops.update_mc_addr_list(hw, NULL, 0,
+ ixgbe_addr_list_itr, true);
+ } else {
#ifdef NETDEV_HW_ADDR_T_MULTICAST
ha = list_first_entry(&netdev->mc.list,
struct netdev_hw_addr, list);
@@ -4283,7 +4427,7 @@
addr_count = netdev_mc_count(netdev);
hw->mac.ops.update_mc_addr_list(hw, addr_list, addr_count,
- ixgbe_addr_list_itr, false);
+ ixgbe_addr_list_itr, true);
}
#ifdef CONFIG_PCI_IOV
@@ -4752,7 +4896,6 @@
if (!(adapter->flags & IXGBE_FLAG_MSI_ENABLED) &&
!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED))
return;
-
if (adapter->hw.mac.type != ixgbe_mac_82598EB) {
ixgbe_configure_lli_82599(adapter);
return;
@@ -5040,25 +5183,25 @@
**/
static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw)
{
- u32 autoneg;
- bool negotiation, link_up = false;
+ u32 speed;
+ bool autoneg, link_up = false;
u32 ret = IXGBE_ERR_LINK_SETUP;
if (hw->mac.ops.check_link)
- ret = hw->mac.ops.check_link(hw, &autoneg, &link_up, false);
+ ret = hw->mac.ops.check_link(hw, &speed, &link_up, false);
if (ret)
goto link_cfg_out;
- autoneg = hw->phy.autoneg_advertised;
- if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
- ret = hw->mac.ops.get_link_capabilities(hw, &autoneg,
- &negotiation);
+ speed = hw->phy.autoneg_advertised;
+ if ((!speed) && (hw->mac.ops.get_link_capabilities))
+ ret = hw->mac.ops.get_link_capabilities(hw, &speed,
+ &autoneg);
if (ret)
goto link_cfg_out;
if (hw->mac.ops.setup_link)
- ret = hw->mac.ops.setup_link(hw, autoneg, negotiation, link_up);
+ ret = hw->mac.ops.setup_link(hw, speed, link_up);
link_cfg_out:
return ret;
}
@@ -5189,11 +5332,8 @@
else
ixgbe_configure_msi_and_legacy(adapter);
- /* enable the optics for both mult-speed fiber and 82599 SFP+ fiber */
- if (hw->mac.ops.enable_tx_laser &&
- ((hw->phy.multispeed_fiber) ||
- ((hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
- (hw->mac.type == ixgbe_mac_82599EB))))
+ /* enable the optics for 82599 SFP+ fiber */
+ if (hw->mac.ops.enable_tx_laser)
hw->mac.ops.enable_tx_laser(hw);
clear_bit(__IXGBE_DOWN, &adapter->state);
@@ -5323,7 +5463,7 @@
if (hw->mac.san_mac_rar_index)
hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0));
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED)
ixgbe_ptp_reset(adapter);
#endif
@@ -5540,11 +5680,8 @@
if (!pci_channel_offline(adapter->pdev))
#endif
ixgbe_reset(adapter);
- /* power down the optics for multispeed fiber and 82599 SFP+ fiber */
- if (hw->mac.ops.disable_tx_laser &&
- ((hw->phy.multispeed_fiber) ||
- ((hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
- (hw->mac.type == ixgbe_mac_82599EB))))
+ /* power down the optics for 82599 SFP+ fiber */
+ if (hw->mac.ops.disable_tx_laser)
hw->mac.ops.disable_tx_laser(hw);
ixgbe_clean_all_tx_rings(adapter);
@@ -5569,6 +5706,8 @@
struct ixgbe_hw *hw = &adapter->hw;
struct pci_dev *pdev = adapter->pdev;
int err;
+ unsigned int fdir;
+ u32 fwsm;
#ifdef CONFIG_DCB
struct ixgbe_dcb_tc_config *tc;
int j, bwg_pct;
@@ -5590,45 +5729,46 @@
adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) *
hw->mac.num_rar_entries,
GFP_ATOMIC);
- /* Set capability flags */
- switch (hw->mac.type) {
- case ixgbe_mac_82598EB:
- adapter->flags |= IXGBE_FLAG_MSI_CAPABLE |
- IXGBE_FLAG_MSIX_CAPABLE |
- IXGBE_FLAG_MQ_CAPABLE;
+
+ /* Set common capability flags and settings */
#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
- adapter->flags |= IXGBE_FLAG_DCA_CAPABLE;
+ adapter->flags |= IXGBE_FLAG_DCA_CAPABLE;
#endif
- adapter->flags &= ~IXGBE_FLAG_SRIOV_CAPABLE;
+#ifdef IXGBE_FCOE
+ adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE;
+ adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
+#ifdef CONFIG_DCB
+ /* Default traffic class to use for FCoE */
+ adapter->fcoe.up = IXGBE_FCOE_DEFUP;
+ adapter->fcoe.up_set = IXGBE_FCOE_DEFUP;
+#endif /* IXGBE_DCB */
+#endif /* IXGBE_FCOE */
+ adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE;
+ fdir = min_t(int, IXGBE_MAX_FDIR_INDICES, num_online_cpus());
+ adapter->ring_feature[RING_F_FDIR].limit = fdir;
+ adapter->max_q_vectors = IXGBE_MAX_MSIX_Q_VECTORS_82599;
+
+ /* Set MAC specific capability flags and exceptions */
+ switch (hw->mac.type) {
+ case ixgbe_mac_82598EB:
+ adapter->flags |= IXGBE_FLAGS_82598_INIT;
adapter->flags2 &= ~IXGBE_FLAG2_RSC_CAPABLE;
if (hw->device_id == IXGBE_DEV_ID_82598AT)
adapter->flags |= IXGBE_FLAG_FAN_FAIL_CAPABLE;
adapter->max_q_vectors = IXGBE_MAX_MSIX_Q_VECTORS_82598;
- break;
- case ixgbe_mac_X540:
- adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE;
- case ixgbe_mac_82599EB:
- adapter->flags |= IXGBE_FLAG_MSI_CAPABLE |
- IXGBE_FLAG_MSIX_CAPABLE |
- IXGBE_FLAG_MQ_CAPABLE;
-#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
- adapter->flags |= IXGBE_FLAG_DCA_CAPABLE;
-#endif
- adapter->flags |= IXGBE_FLAG_SRIOV_CAPABLE;
- adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE;
+ adapter->ring_feature[RING_F_FDIR].limit = 0;
#ifdef IXGBE_FCOE
- adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE;
- adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
+ adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE;
#ifdef CONFIG_DCB
- /* Default traffic class to use for FCoE */
- adapter->fcoe.up = IXGBE_FCOE_DEFUP;
- adapter->fcoe.up_set = IXGBE_FCOE_DEFUP;
-#endif
-#endif
- adapter->ring_feature[RING_F_FDIR].limit =
- IXGBE_MAX_FDIR_INDICES;
+ adapter->fcoe.up = 0;
+ adapter->fcoe.up_set = 0;
+#endif /* IXGBE_DCB */
+#endif /* IXGBE_FCOE */
+ break;
+ case ixgbe_mac_82599EB:
+ adapter->flags |= IXGBE_FLAGS_82599_INIT;
if (hw->device_id == IXGBE_DEV_ID_82599_T3_LOM)
adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE;
#ifndef IXGBE_NO_SMART_SPEED
@@ -5636,7 +5776,13 @@
#else
hw->phy.smart_speed = ixgbe_smart_speed_off;
#endif
- adapter->max_q_vectors = IXGBE_MAX_MSIX_Q_VECTORS_82599;
+ break;
+ case ixgbe_mac_X540:
+ adapter->flags |= IXGBE_FLAGS_X540_INIT;
+ fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM);
+ if (fwsm & IXGBE_FWSM_TS_ENABLED)
+ adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE;
+ break;
default:
break;
}
@@ -5712,7 +5858,8 @@
ixgbe_pbthresh_setup(adapter);
hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE;
hw->fc.send_xon = true;
- hw->fc.disable_fc_autoneg = false;
+ hw->fc.disable_fc_autoneg =
+ (ixgbe_device_supports_autoneg_fc(hw) == 0) ? false : true;
/* set default ring sizes */
adapter->tx_ring_count = IXGBE_DEFAULT_TXD;
@@ -5990,7 +6137,7 @@
*/
if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) &&
(adapter->hw.mac.type == ixgbe_mac_82599EB) &&
- (max_frame > MAXIMUM_ETHERNET_VLAN_SIZE))
+ (max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN)))
e_warn(probe, "Setting MTU > 1500 will disable legacy VFs\n");
e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu);
@@ -6054,9 +6201,9 @@
if (err)
goto err_set_queues;
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
ixgbe_ptp_init(adapter);
-#endif /* CONFIG_IXGBE_PTP*/
+#endif /* HAVE_PTP_1588_CLOCK*/
ixgbe_up_complete(adapter);
@@ -6089,7 +6236,7 @@
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
ixgbe_ptp_stop(adapter);
#endif
@@ -6193,14 +6340,8 @@
if (wufc) {
ixgbe_set_rx_mode(netdev);
- /*
- * enable the optics for both mult-speed fiber and
- * 82599 SFP+ fiber as we can WoL.
- */
- if (hw->mac.ops.enable_tx_laser &&
- (hw->phy.multispeed_fiber ||
- (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber &&
- hw->mac.type == ixgbe_mac_82599EB)))
+ /* enable the optics for 82599 SFP+ fiber as we can WoL */
+ if (hw->mac.ops.enable_tx_laser)
hw->mac.ops.enable_tx_laser(hw);
/* turn on all-multi mode if wake on multicast is enabled */
@@ -6738,8 +6879,8 @@
flow_tx = !!(rmcs & IXGBE_RMCS_TFCE_802_3X);
}
break;
- case ixgbe_mac_X540:
- case ixgbe_mac_82599EB: {
+ case ixgbe_mac_82599EB:
+ case ixgbe_mac_X540: {
u32 mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN);
u32 fccfg = IXGBE_READ_REG(hw, IXGBE_FCCFG);
flow_rx = !!(mflcn & IXGBE_MFLCN_RFCE);
@@ -6752,7 +6893,9 @@
break;
}
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
+ adapter->last_rx_ptp_check = jiffies;
+
if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED)
ixgbe_ptp_start_cyclecounter(adapter);
@@ -6803,7 +6946,7 @@
if (ixgbe_is_sfp(hw) && hw->mac.type == ixgbe_mac_82598EB)
adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP;
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED)
ixgbe_ptp_start_cyclecounter(adapter);
@@ -6840,6 +6983,7 @@
* to get done, so reset controller to flush Tx.
* (Do the reset outside of interrupt context).
*/
+ e_warn(drv, "initiating reset due to lost link with pending Tx work\n");
adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED;
}
}
@@ -6965,8 +7109,8 @@
static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
- u32 autoneg;
- bool negotiation;
+ u32 speed;
+ bool autoneg = false;
if (!(adapter->flags & IXGBE_FLAG_NEED_LINK_CONFIG))
return;
@@ -6977,11 +7121,11 @@
adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
- autoneg = hw->phy.autoneg_advertised;
- if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
- hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation);
+ speed = hw->phy.autoneg_advertised;
+ if ((!speed) && (hw->mac.ops.get_link_capabilities))
+ hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg);
if (hw->mac.ops.setup_link)
- hw->mac.ops.setup_link(hw, autoneg, negotiation, true);
+ hw->mac.ops.setup_link(hw, speed, true);
adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
adapter->link_check_timeout = jiffies;
@@ -7104,7 +7248,6 @@
struct ixgbe_adapter *adapter = container_of(work,
struct ixgbe_adapter,
service_task);
-
ixgbe_reset_subtask(adapter);
ixgbe_sfp_detection_subtask(adapter);
ixgbe_sfp_link_config_subtask(adapter);
@@ -7114,8 +7257,11 @@
ixgbe_fdir_reinit_subtask(adapter);
#endif
ixgbe_check_hang_subtask(adapter);
-#ifdef CONFIG_IXGBE_PTP
- ixgbe_ptp_overflow_check(adapter);
+#ifdef HAVE_PTP_1588_CLOCK
+ if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED) {
+ ixgbe_ptp_overflow_check(adapter);
+ ixgbe_ptp_rx_hang(adapter);
+ }
#endif
ixgbe_service_event_complete(adapter);
@@ -7130,6 +7276,9 @@
u32 vlan_macip_lens, type_tucmd;
u32 mss_l4len_idx, l4len;
+ if (skb->ip_summed != CHECKSUM_PARTIAL)
+ return 0;
+
if (!skb_is_gso(skb))
#endif /* NETIF_F_TSO */
return 0;
@@ -7176,10 +7325,9 @@
first->gso_segs = skb_shinfo(skb)->gso_segs;
first->bytecount += (first->gso_segs - 1) * *hdr_len;
- /* mss_l4len_id: use 1 as index for TSO */
+ /* mss_l4len_id: use 0 as index for TSO */
mss_l4len_idx = l4len << IXGBE_ADVTXD_L4LEN_SHIFT;
mss_l4len_idx |= skb_shinfo(skb)->gso_size << IXGBE_ADVTXD_MSS_SHIFT;
- mss_l4len_idx |= 1 << IXGBE_ADVTXD_IDX_SHIFT;
/* vlan_macip_lens: HEADLEN, MACLEN, VLAN tag */
vlan_macip_lens = skb_network_header_len(skb);
@@ -7203,7 +7351,7 @@
if (skb->ip_summed != CHECKSUM_PARTIAL) {
if (!(first->tx_flags & IXGBE_TX_FLAGS_HW_VLAN) &&
- !(first->tx_flags & IXGBE_TX_FLAGS_TXSW))
+ !(first->tx_flags & IXGBE_TX_FLAGS_CC))
return;
} else {
u8 l4_hdr = 0;
@@ -7266,28 +7414,29 @@
type_tucmd, mss_l4len_idx);
}
-static __le32 ixgbe_tx_cmd_type(u32 tx_flags)
+#define IXGBE_SET_FLAG(_input, _flag, _result) \
+ ((_flag <= _result) ? \
+ ((u32)(_input & _flag) * (_result / _flag)) : \
+ ((u32)(_input & _flag) / (_flag / _result)))
+
+static u32 ixgbe_tx_cmd_type(struct sk_buff *skb, u32 tx_flags)
{
/* set type for advanced descriptor with frame checksum insertion */
- __le32 cmd_type = cpu_to_le32(IXGBE_ADVTXD_DTYP_DATA |
- IXGBE_ADVTXD_DCMD_IFCS |
- IXGBE_ADVTXD_DCMD_DEXT);
+ u32 cmd_type = IXGBE_ADVTXD_DTYP_DATA |
+ IXGBE_ADVTXD_DCMD_DEXT |
+ IXGBE_ADVTXD_DCMD_IFCS;
/* set HW vlan bit if vlan is present */
- if (tx_flags & IXGBE_TX_FLAGS_HW_VLAN)
- cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_VLE);
-#ifdef CONFIG_IXGBE_PTP
- if (tx_flags & IXGBE_TX_FLAGS_TSTAMP)
- cmd_type |= cpu_to_le32(IXGBE_ADVTXD_MAC_TSTAMP);
+ cmd_type |= IXGBE_SET_FLAG(tx_flags, IXGBE_TX_FLAGS_HW_VLAN,
+ IXGBE_ADVTXD_DCMD_VLE);
-#endif
/* set segmentation enable bits for TSO/FSO */
-#ifdef IXGBE_FCOE
- if (tx_flags & (IXGBE_TX_FLAGS_TSO | IXGBE_TX_FLAGS_FSO))
-#else
- if (tx_flags & IXGBE_TX_FLAGS_TSO)
-#endif
- cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_TSE);
+ cmd_type |= IXGBE_SET_FLAG(tx_flags, IXGBE_TX_FLAGS_TSO,
+ IXGBE_ADVTXD_DCMD_TSE);
+
+ /* set timestamp bit if present */
+ cmd_type |= IXGBE_SET_FLAG(tx_flags, IXGBE_TX_FLAGS_TSTAMP,
+ IXGBE_ADVTXD_MAC_TSTAMP);
return cmd_type;
}
@@ -7295,36 +7444,27 @@
static void ixgbe_tx_olinfo_status(union ixgbe_adv_tx_desc *tx_desc,
u32 tx_flags, unsigned int paylen)
{
- __le32 olinfo_status = cpu_to_le32(paylen << IXGBE_ADVTXD_PAYLEN_SHIFT);
+ u32 olinfo_status = paylen << IXGBE_ADVTXD_PAYLEN_SHIFT;
/* enable L4 checksum for TSO and TX checksum offload */
- if (tx_flags & IXGBE_TX_FLAGS_CSUM)
- olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_POPTS_TXSM);
+ olinfo_status |= IXGBE_SET_FLAG(tx_flags,
+ IXGBE_TX_FLAGS_CSUM,
+ IXGBE_ADVTXD_POPTS_TXSM);
/* enble IPv4 checksum for TSO */
- if (tx_flags & IXGBE_TX_FLAGS_IPV4)
- olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_POPTS_IXSM);
-
- /* use index 1 context for TSO/FSO/FCOE */
-#ifdef IXGBE_FCOE
- if (tx_flags & (IXGBE_TX_FLAGS_TSO | IXGBE_TX_FLAGS_FCOE))
-#else
- if (tx_flags & IXGBE_TX_FLAGS_TSO)
-#endif
- olinfo_status |= cpu_to_le32(1 << IXGBE_ADVTXD_IDX_SHIFT);
+ olinfo_status |= IXGBE_SET_FLAG(tx_flags,
+ IXGBE_TX_FLAGS_IPV4,
+ IXGBE_ADVTXD_POPTS_IXSM);
/*
* Check Context must be set if Tx switch is enabled, which it
* always is for case where virtual functions are running
*/
-#ifdef IXGBE_FCOE
- if (tx_flags & (IXGBE_TX_FLAGS_TXSW | IXGBE_TX_FLAGS_FCOE))
-#else
- if (tx_flags & IXGBE_TX_FLAGS_TXSW)
-#endif
- olinfo_status |= cpu_to_le32(IXGBE_ADVTXD_CC);
+ olinfo_status |= IXGBE_SET_FLAG(tx_flags,
+ IXGBE_TX_FLAGS_CC,
+ IXGBE_ADVTXD_CC);
- tx_desc->read.olinfo_status = olinfo_status;
+ tx_desc->read.olinfo_status = cpu_to_le32(olinfo_status);
}
#define IXGBE_TXD_CMD (IXGBE_TXD_CMD_EOP | \
@@ -7334,24 +7474,22 @@
struct ixgbe_tx_buffer *first,
const u8 hdr_len)
{
- dma_addr_t dma;
struct sk_buff *skb = first->skb;
struct ixgbe_tx_buffer *tx_buffer;
union ixgbe_adv_tx_desc *tx_desc;
-#ifdef MAX_SKB_FRAGS
- struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
- unsigned int data_len = skb->data_len;
-#endif
- unsigned int size = skb_headlen(skb);
- unsigned int paylen = skb->len - hdr_len;
+ struct skb_frag_struct *frag;
+ dma_addr_t dma;
+ unsigned int data_len, size;
u32 tx_flags = first->tx_flags;
- __le32 cmd_type;
+ u32 cmd_type = ixgbe_tx_cmd_type(skb, tx_flags);
u16 i = tx_ring->next_to_use;
tx_desc = IXGBE_TX_DESC(tx_ring, i);
- ixgbe_tx_olinfo_status(tx_desc, tx_flags, paylen);
- cmd_type = ixgbe_tx_cmd_type(tx_flags);
+ ixgbe_tx_olinfo_status(tx_desc, tx_flags, skb->len - hdr_len);
+
+ size = skb_headlen(skb);
+ data_len = skb->data_len;
#ifdef IXGBE_FCOE
if (tx_flags & IXGBE_TX_FLAGS_FCOE) {
@@ -7365,21 +7503,22 @@
#endif
dma = dma_map_single(tx_ring->dev, skb->data, size, DMA_TO_DEVICE);
- if (dma_mapping_error(tx_ring->dev, dma))
- goto dma_error;
- /* record length, and DMA address */
- dma_unmap_len_set(first, len, size);
- dma_unmap_addr_set(first, dma, dma);
+ tx_buffer = first;
- tx_desc->read.buffer_addr = cpu_to_le64(dma);
+ for (frag = &skb_shinfo(skb)->frags[0];; frag++) {
+ if (dma_mapping_error(tx_ring->dev, dma))
+ goto dma_error;
+
+ /* record length, and DMA address */
+ dma_unmap_len_set(tx_buffer, len, size);
+ dma_unmap_addr_set(tx_buffer, dma, dma);
+
+ tx_desc->read.buffer_addr = cpu_to_le64(dma);
-#ifdef MAX_SKB_FRAGS
- for (;;) {
-#endif
while (unlikely(size > IXGBE_MAX_DATA_PER_TXD)) {
tx_desc->read.cmd_type_len =
- cmd_type | cpu_to_le32(IXGBE_MAX_DATA_PER_TXD);
+ cpu_to_le32(cmd_type ^ IXGBE_MAX_DATA_PER_TXD);
i++;
tx_desc++;
@@ -7387,19 +7526,18 @@
tx_desc = IXGBE_TX_DESC(tx_ring, 0);
i = 0;
}
+ tx_desc->read.olinfo_status = 0;
dma += IXGBE_MAX_DATA_PER_TXD;
size -= IXGBE_MAX_DATA_PER_TXD;
tx_desc->read.buffer_addr = cpu_to_le64(dma);
- tx_desc->read.olinfo_status = 0;
}
-#ifdef MAX_SKB_FRAGS
if (likely(!data_len))
break;
- tx_desc->read.cmd_type_len = cmd_type | cpu_to_le32(size);
+ tx_desc->read.cmd_type_len = cpu_to_le32(cmd_type ^ size);
i++;
tx_desc++;
@@ -7407,6 +7545,7 @@
tx_desc = IXGBE_TX_DESC(tx_ring, 0);
i = 0;
}
+ tx_desc->read.olinfo_status = 0;
#ifdef IXGBE_FCOE
size = min_t(unsigned int, data_len, skb_frag_size(frag));
@@ -7417,23 +7556,13 @@
dma = skb_frag_dma_map(tx_ring->dev, frag, 0, size,
DMA_TO_DEVICE);
- if (dma_mapping_error(tx_ring->dev, dma))
- goto dma_error;
tx_buffer = &tx_ring->tx_buffer_info[i];
- dma_unmap_len_set(tx_buffer, len, size);
- dma_unmap_addr_set(tx_buffer, dma, dma);
-
- tx_desc->read.buffer_addr = cpu_to_le64(dma);
- tx_desc->read.olinfo_status = 0;
-
- frag++;
}
-#endif /* MAX_SKB_FRAGS */
/* write last descriptor with RS and EOP bits */
- cmd_type |= cpu_to_le32(size) | cpu_to_le32(IXGBE_TXD_CMD);
- tx_desc->read.cmd_type_len = cmd_type;
+ cmd_type |= size | IXGBE_TXD_CMD;
+ tx_desc->read.cmd_type_len = cpu_to_le32(cmd_type);
/* set the timestamp */
first->time_stamp = jiffies;
@@ -7599,60 +7728,40 @@
}
#ifdef HAVE_NETDEV_SELECT_QUEUE
+#ifdef IXGBE_FCOE
static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
{
struct ixgbe_adapter *adapter = netdev_priv(dev);
- int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) :
- smp_processor_id();
-#ifdef IXGBE_FCOE
- __be16 protocol = vlan_get_protocol(skb);
+ struct ixgbe_ring_feature *f;
+ int txq;
- if ((protocol == __constant_htons(ETH_P_FCOE)) ||
- (protocol == __constant_htons(ETH_P_FIP))) {
- if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
- struct ixgbe_ring_feature *f;
-
- f = &adapter->ring_feature[RING_F_FCOE];
-
- while (txq >= f->indices)
- txq -= f->indices;
- txq += f->offset;
-
- return txq;
- } else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
- txq = adapter->fcoe.up;
- return txq;
- }
+ /*
+ * only execute the code below if protocol is FCoE
+ * or FIP and we have FCoE enabled on the adapter
+ */
+ switch (vlan_get_protocol(skb)) {
+ case __constant_htons(ETH_P_FCOE):
+ case __constant_htons(ETH_P_FIP):
+ adapter = netdev_priv(dev);
+
+ if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
+ break;
+ default:
+ return __netdev_pick_tx(dev, skb);
}
-#endif /* IXGBE_FCOE */
-#ifndef HAVE_MQPRIO
- if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
- struct ixgbe_ring_feature *f;
- if (skb->priority == TC_PRIO_CONTROL)
- txq = adapter->dcb_tc - 1;
- else
- txq = (skb->vlan_tci & IXGBE_TX_FLAGS_VLAN_PRIO_MASK)
- >> 13;
+ f = &adapter->ring_feature[RING_F_FCOE];
- f = &adapter->ring_feature[RING_F_RSS];
- txq *= f->indices;
- txq += __skb_tx_hash(dev, skb, f->indices);
+ txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) :
+ smp_processor_id();
- return txq;
- }
+ while (txq >= f->indices)
+ txq -= f->indices;
-#endif
- if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
- while (unlikely(txq >= dev->real_num_tx_queues))
- txq -= dev->real_num_tx_queues;
- return txq;
- }
-
- return __skb_tx_hash(dev, skb,
- adapter->ring_feature[RING_F_RSS].indices);
+ return txq + f->offset;
}
+#endif /* IXGBE_FCOE */
#endif /* HAVE_NETDEV_SELECT_QUEUE */
netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
struct ixgbe_adapter *adapter,
@@ -7661,11 +7770,9 @@
struct ixgbe_tx_buffer *first;
int tso;
u32 tx_flags = 0;
-#ifdef MAX_SKB_FRAGS
#if PAGE_SIZE > IXGBE_MAX_DATA_PER_TXD
unsigned short f;
#endif
-#endif
u16 count = TXD_USE_COUNT(skb_headlen(skb));
__be16 protocol = skb->protocol;
u8 hdr_len = 0;
@@ -7677,14 +7784,12 @@
* + 1 desc for context descriptor,
* otherwise try next time
*/
-#ifdef MAX_SKB_FRAGS
#if PAGE_SIZE > IXGBE_MAX_DATA_PER_TXD
for (f = 0; f < skb_shinfo(skb)->nr_frags; f++)
count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size);
#else
count += skb_shinfo(skb)->nr_frags;
#endif
-#endif
if (ixgbe_maybe_stop_tx(tx_ring, count + 3)) {
tx_ring->tx_stats.tx_busy++;
return NETDEV_TX_BUSY;
@@ -7713,10 +7818,15 @@
tx_flags |= IXGBE_TX_FLAGS_SW_VLAN;
}
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
tx_flags |= IXGBE_TX_FLAGS_TSTAMP;
+
+ /* schedule check for Tx timestamp */
+ adapter->ptp_tx_skb = skb_get(skb);
+ adapter->ptp_tx_start = jiffies;
+ schedule_work(&adapter->ptp_tx_work);
}
#endif
@@ -7726,7 +7836,7 @@
* Tx switch had been disabled.
*/
if (adapter->flags & IXGBE_FLAG_SRIOV_L2SWITCH_ENABLE)
- tx_flags |= IXGBE_TX_FLAGS_TXSW;
+ tx_flags |= IXGBE_TX_FLAGS_CC;
#endif
#ifdef HAVE_TX_MQ
@@ -7961,12 +8071,12 @@
static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
{
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
struct ixgbe_adapter *adapter = netdev_priv(netdev);
#endif
switch (cmd) {
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
case SIOCSHWTSTAMP:
return ixgbe_ptp_hwtstamp_ioctl(adapter, ifr, cmd);
#endif
@@ -8250,7 +8360,13 @@
.ndo_open = ixgbe_open,
.ndo_stop = ixgbe_close,
.ndo_start_xmit = ixgbe_xmit_frame,
+#ifdef IXGBE_FCOE
.ndo_select_queue = ixgbe_select_queue,
+#else
+#ifndef HAVE_MQPRIO
+ .ndo_select_queue = __netdev_pick_tx,
+#endif
+#endif
.ndo_set_rx_mode = ixgbe_set_rx_mode,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = ixgbe_set_mac,
@@ -8332,7 +8448,11 @@
dev->poll_controller = &ixgbe_netpoll;
#endif
#ifdef HAVE_NETDEV_SELECT_QUEUE
+#ifdef IXGBE_FCOE
dev->select_queue = &ixgbe_select_queue;
+#else
+ dev->select_queue = &__netdev_pick_tx;
+#endif
#endif /* HAVE_NETDEV_SELECT_QUEUE */
#endif /* HAVE_NET_DEVICE_OPS */
ixgbe_set_ethtool_ops(dev);
@@ -8365,6 +8485,7 @@
/* only support first port */
if (hw->bus.func != 0)
break;
+ case IXGBE_SUBDEV_ID_82599_SP_560FLR:
case IXGBE_SUBDEV_ID_82599_SFP:
case IXGBE_SUBDEV_ID_82599_RNDC:
case IXGBE_SUBDEV_ID_82599_ECNA_DP:
@@ -8420,7 +8541,7 @@
u8 part_str[IXGBE_PBANUM_LENGTH];
enum ixgbe_mac_type mac_type = ixgbe_mac_unknown;
#ifdef HAVE_TX_MQ
- unsigned int indices = num_possible_cpus();
+ unsigned int indices = MAX_TX_QUEUES;
#endif /* HAVE_TX_MQ */
#ifdef IXGBE_FCOE
u16 device_caps;
@@ -8487,23 +8608,13 @@
pci_set_master(pdev);
#ifdef HAVE_TX_MQ
+ if (mac_type == ixgbe_mac_82598EB) {
#ifdef CONFIG_DCB
- indices *= IXGBE_DCB_MAX_TRAFFIC_CLASS;
-#endif /* CONFIG_DCB */
-
-#ifdef IXGBE_FCOE
- indices += min_t(unsigned int, num_possible_cpus(),
- IXGBE_MAX_FCOE_INDICES);
-#endif
-
- if (mac_type == ixgbe_mac_82598EB)
-#ifdef CONFIG_DCB
- indices = min_t(unsigned int, indices, IXGBE_MAX_DCB_INDICES * 4);
+ indices = IXGBE_MAX_DCB_INDICES * 4;
#else
- indices = min_t(unsigned int, indices, IXGBE_MAX_RSS_INDICES);
+ indices = IXGBE_MAX_RSS_INDICES;
#endif
- else
- indices = min_t(unsigned int, indices, IXGBE_MAX_FDIR_INDICES);
+ }
netdev = alloc_etherdev_mq(sizeof(struct ixgbe_adapter), indices);
#else /* HAVE_TX_MQ */
@@ -8551,6 +8662,10 @@
if (err)
goto err_sw_init;
+ /* Cache if MNG FW is up so we don't have to read the REG later */
+ if (hw->mac.ops.mng_enabled)
+ hw->mng_fw_enabled = hw->mac.ops.mng_enabled(hw);
+
/* Make it possible the adapter to be woken up via WOL */
switch (adapter->hw.mac.type) {
case ixgbe_mac_82599EB:
@@ -8599,7 +8714,6 @@
ixgbe_enable_sriov(adapter);
#endif /* CONFIG_PCI_IOV */
-#ifdef MAX_SKB_FRAGS
netdev->features |= NETIF_F_SG |
NETIF_F_IP_CSUM;
@@ -8681,6 +8795,12 @@
#endif
}
}
+#ifdef IFF_UNICAST_FLT
+ netdev->priv_flags |= IFF_UNICAST_FLT;
+#endif
+#ifdef IFF_SUPP_NOFCS
+ netdev->priv_flags |= IFF_SUPP_NOFCS;
+#endif
#ifdef CONFIG_DCB
netdev->dcbnl_ops = &dcbnl_ops;
#endif
@@ -8688,6 +8808,8 @@
#ifdef IXGBE_FCOE
#ifdef NETIF_F_FSO
if (adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) {
+ unsigned int fcoe_l;
+
hw->mac.ops.get_device_caps(hw, &device_caps);
if (device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS) {
adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
@@ -8704,7 +8826,8 @@
#endif /* HAVE_NETDEV_OPS_FCOE_ENABLE */
}
- adapter->ring_feature[RING_F_FCOE].limit = IXGBE_FCRETA_SIZE;
+ fcoe_l = min_t(int, IXGBE_FCRETA_SIZE, num_online_cpus());
+ adapter->ring_feature[RING_F_FCOE].limit = fcoe_l;
#ifdef HAVE_NETDEV_VLAN_FEATURES
netdev->vlan_features |= NETIF_F_FSO |
@@ -8720,7 +8843,6 @@
netdev->vlan_features |= NETIF_F_HIGHDMA;
#endif /* HAVE_NETDEV_VLAN_FEATURES */
}
-#endif /* MAX_SKB_FRAGS */
/* make sure the EEPROM is good */
if (hw->eeprom.ops.validate_checksum &&
@@ -8768,15 +8890,13 @@
/* WOL not supported for all devices */
adapter->wol = 0;
hw->eeprom.ops.read(hw, 0x2c, &adapter->eeprom_cap);
- if (ixgbe_wol_supported(adapter, pdev->device, pdev->subsystem_device))
+ hw->wol_supported = ixgbe_wol_supported(adapter, pdev->device,
+ pdev->subsystem_device);
+ if (hw->wol_supported)
adapter->wol = IXGBE_WUFC_MAG;
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
-#ifdef CONFIG_IXGBE_PTP
- ixgbe_ptp_init(adapter);
-
-#endif
/*
* Save off EEPROM version number and Option Rom version which
* together make a unique identify for the eeprom
@@ -8822,8 +8942,8 @@
"hardware.\n");
}
/* pick up the PCI bus settings for reporting later */
- if (hw->mac.ops.get_bus_info)
- hw->mac.ops.get_bus_info(hw);
+ if (hw->mac.ops.get_bus_info)
+ hw->mac.ops.get_bus_info(hw);
strcpy(netdev->name, "eth%d");
err = register_netdev(netdev);
@@ -8832,11 +8952,8 @@
adapter->netdev_registered = true;
- /* power down the optics for multispeed fiber and 82599 SFP+ fiber */
- if (hw->mac.ops.disable_tx_laser &&
- ((hw->phy.multispeed_fiber) ||
- ((hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
- (hw->mac.type == ixgbe_mac_82599EB))))
+ /* power down the optics for 82599 SFP+ fiber */
+ if (hw->mac.ops.disable_tx_laser)
hw->mac.ops.disable_tx_laser(hw);
/* carrier off reporting is important to ethtool even BEFORE open */
@@ -8961,6 +9078,16 @@
e_err(probe, "failed to allocate procfs resources\n");
#endif /* IXGBE_PROCFS */
#endif /* IXGBE_SYSFS */
+#ifdef HAVE_IXGBE_DEBUG_FS
+
+ ixgbe_dbg_adapter_init(adapter);
+#endif /* HAVE_IXGBE_DEBUG_FS */
+
+ /* Need link setup for MNG FW, else wait for IXGBE_UP */
+ if (hw->mng_fw_enabled && hw->mac.ops.setup_link)
+ hw->mac.ops.setup_link(hw,
+ IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL,
+ true);
return 0;
@@ -8999,7 +9126,10 @@
struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct net_device *netdev = adapter->netdev;
+#ifdef HAVE_IXGBE_DEBUG_FS
+ ixgbe_dbg_adapter_exit(adapter);
+#endif /*HAVE_IXGBE_DEBUG_FS */
set_bit(__IXGBE_DOWN, &adapter->state);
cancel_work_sync(&adapter->service_task);
@@ -9108,7 +9238,7 @@
goto skip_bad_vf_detection;
bdev = pdev->bus->self;
- while (bdev && (bdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT))
+ while (bdev && (pci_pcie_type(bdev) != PCI_EXP_TYPE_ROOT_PORT))
bdev = bdev->bus->self;
if (!bdev)
@@ -9165,6 +9295,8 @@
if (vfdev) {
e_dev_err("Issuing VFLR to VF %d\n", vf);
pci_write_config_dword(vfdev, 0xA8, 0x00008000);
+ /* Free device reference count */
+ pci_dev_put(vfdev);
}
pci_cleanup_aer_uncorrect_error_status(pdev);
@@ -9258,13 +9390,17 @@
netif_device_attach(netdev);
}
+#ifdef HAVE_CONST_STRUCT_PCI_ERROR_HANDLERS
+static const struct pci_error_handlers ixgbe_err_handler = {
+#else
static struct pci_error_handlers ixgbe_err_handler = {
+#endif
.error_detected = ixgbe_io_error_detected,
.slot_reset = ixgbe_io_slot_reset,
.resume = ixgbe_io_resume,
};
+#endif /* HAVE_PCI_ERS */
-#endif
static struct pci_driver ixgbe_driver = {
.name = ixgbe_driver_name,
.id_table = ixgbe_pci_tbl,
@@ -9308,6 +9444,9 @@
pr_info("Procfs failed to initialize topdir\n");
#endif
+#ifdef HAVE_IXGBE_DEBUG_FS
+ ixgbe_dbg_init();
+#endif /* HAVE_IXGBE_DEBUG_FS */
#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
dca_register_notify(&dca_notifier);
#endif
@@ -9333,6 +9472,9 @@
#ifdef IXGBE_PROCFS
ixgbe_procfs_topdir_exit();
#endif
+#ifdef HAVE_IXGBE_DEBUG_FS
+ ixgbe_dbg_exit();
+#endif /* HAVE_IXGBE_DEBUG_FS */
}
#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_mbx.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_mbx.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_osdep.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_param.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -409,6 +409,7 @@
int bd = adapter->bd_number;
u32 *aflags = &adapter->flags;
struct ixgbe_ring_feature *feature = adapter->ring_feature;
+ unsigned int vmdq;
if (bd >= IXGBE_MAX_NIC) {
printk(KERN_NOTICE
@@ -618,7 +619,7 @@
#ifdef module_param_array
if (num_VMDQ > bd) {
#endif
- unsigned int vmdq = VMDQ[bd];
+ vmdq = VMDQ[bd];
ixgbe_validate_option(&vmdq, &opt);
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_phy.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -40,6 +40,8 @@
static void ixgbe_lower_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl);
static s32 ixgbe_set_i2c_data(struct ixgbe_hw *hw, u32 *i2cctl, bool data);
static bool ixgbe_get_i2c_data(u32 *i2cctl);
+static s32 ixgbe_read_i2c_sff8472_generic(struct ixgbe_hw *hw, u8 byte_offset,
+ u8 *sff8472_data);
/**
* ixgbe_init_phy_ops_generic - Inits PHY function ptrs
@@ -62,6 +64,7 @@
phy->ops.get_firmware_version = ixgbe_get_phy_firmware_version_generic;
phy->ops.read_i2c_byte = &ixgbe_read_i2c_byte_generic;
phy->ops.write_i2c_byte = &ixgbe_write_i2c_byte_generic;
+ phy->ops.read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_generic;
phy->ops.read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic;
phy->ops.write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic;
phy->ops.i2c_bus_clear = &ixgbe_i2c_bus_clear;
@@ -538,11 +541,9 @@
* ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
**/
s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw,
ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete)
{
@@ -925,9 +926,7 @@
IXGBE_SFF_IDENTIFIER,
&identifier);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
/* LAN ID is needed for sfp_type determination */
@@ -941,26 +940,20 @@
IXGBE_SFF_1GBE_COMP_CODES,
&comp_codes_1g);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_10GBE_COMP_CODES,
&comp_codes_10g);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_CABLE_TECHNOLOGY,
&cable_tech);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
/* ID Module
@@ -1058,27 +1051,21 @@
IXGBE_SFF_VENDOR_OUI_BYTE0,
&oui_bytes[0]);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_VENDOR_OUI_BYTE1,
&oui_bytes[1]);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
status = hw->phy.ops.read_i2c_eeprom(hw,
IXGBE_SFF_VENDOR_OUI_BYTE2,
&oui_bytes[2]);
- if (status == IXGBE_ERR_SWFW_SYNC ||
- status == IXGBE_ERR_I2C ||
- status == IXGBE_ERR_SFP_NOT_PRESENT)
+ if (status != 0)
goto err_read_i2c_eeprom;
vendor_oui =
@@ -1285,6 +1272,22 @@
}
/**
+ * ixgbe_read_i2c_sff8472_generic - Reads 8 bit word over I2C interface
+ * @hw: pointer to hardware structure
+ * @byte_offset: byte offset at address 0xA2
+ * @eeprom_data: value read
+ *
+ * Performs byte read operation to SFP module's SFF-8472 data over I2C
+ **/
+static s32 ixgbe_read_i2c_sff8472_generic(struct ixgbe_hw *hw, u8 byte_offset,
+ u8 *sff8472_data)
+{
+ return hw->phy.ops.read_i2c_byte(hw, byte_offset,
+ IXGBE_I2C_EEPROM_DEV_ADDR2,
+ sff8472_data);
+}
+
+/**
* ixgbe_write_i2c_eeprom_generic - Writes 8 bit EEPROM word over I2C interface
* @hw: pointer to hardware structure
* @byte_offset: EEPROM byte offset to write
@@ -1373,9 +1376,9 @@
break;
fail:
+ ixgbe_i2c_bus_clear(hw);
hw->mac.ops.release_swfw_sync(hw, swfw_mask);
msleep(100);
- ixgbe_i2c_bus_clear(hw);
retry++;
if (retry < max_retry)
hw_dbg(hw, "I2C byte read error - Retrying.\n");
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_phy.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -29,7 +29,9 @@
#define _IXGBE_PHY_H_
#include "ixgbe_type.h"
-#define IXGBE_I2C_EEPROM_DEV_ADDR 0xA0
+#define IXGBE_I2C_EEPROM_DEV_ADDR 0xA0
+#define IXGBE_I2C_EEPROM_DEV_ADDR2 0xA2
+#define IXGBE_I2C_EEPROM_BANK_LEN 0xFF
/* EEPROM byte offsets */
#define IXGBE_SFF_IDENTIFIER 0x0
@@ -41,6 +43,8 @@
#define IXGBE_SFF_10GBE_COMP_CODES 0x3
#define IXGBE_SFF_CABLE_TECHNOLOGY 0x8
#define IXGBE_SFF_CABLE_SPEC_COMP 0x3C
+#define IXGBE_SFF_SFF_8472_SWAP 0x5C
+#define IXGBE_SFF_SFF_8472_COMP 0x5E
/* Bitmasks */
#define IXGBE_SFF_DA_PASSIVE_CABLE 0x4
@@ -88,6 +92,14 @@
#define IXGBE_TN_LASI_STATUS_REG 0x9005
#define IXGBE_TN_LASI_STATUS_TEMP_ALARM 0x0008
+/* SFP+ SFF-8472 Compliance */
+#define IXGBE_SFF_SFF_8472_UNSUP 0x00
+#define IXGBE_SFF_SFF_8472_REV_9_3 0x01
+#define IXGBE_SFF_SFF_8472_REV_9_5 0x02
+#define IXGBE_SFF_SFF_8472_REV_10_2 0x03
+#define IXGBE_SFF_SFF_8472_REV_10_4 0x04
+#define IXGBE_SFF_SFF_8472_REV_11_0 0x05
+
s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw);
bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr);
enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id);
@@ -101,7 +113,6 @@
s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw);
s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw,
ixgbe_link_speed speed,
- bool autoneg,
bool autoneg_wait_to_complete);
s32 ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw,
ixgbe_link_speed *speed,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_procfs.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_ptp.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -26,7 +26,7 @@
*******************************************************************************/
#include "ixgbe.h"
-#ifdef CONFIG_IXGBE_PTP
+#ifdef HAVE_PTP_1588_CLOCK
#include <linux/export.h>
#include <linux/ptp_classify.h>
@@ -98,14 +98,7 @@
#define IXGBE_MAX_TIMEADJ_VALUE 0x7FFFFFFFFFFFFFFFULL
#define IXGBE_OVERFLOW_PERIOD (HZ * 30)
-
-#ifndef NSECS_PER_SEC
-#define NSECS_PER_SEC 1000000000ULL
-#endif
-
-static struct sock_filter ptp_filter[] = {
- PTP_FILTER
-};
+#define IXGBE_PTP_TX_TIMEOUT (HZ * 15)
/**
* ixgbe_ptp_setup_sdp
@@ -151,8 +144,8 @@
IXGBE_TSAUXC_SDP0_INT);
/* clock period (or pulse length) */
- clktiml = (u32)(NSECS_PER_SEC << shift);
- clktimh = (u32)((NSECS_PER_SEC << shift) >> 32);
+ clktiml = (u32)(NSEC_PER_SEC << shift);
+ clktimh = (u32)((NSEC_PER_SEC << shift) >> 32);
/*
* Account for the cyclecounter wrap-around value by
@@ -163,8 +156,8 @@
clock_edge |= (u64)IXGBE_READ_REG(hw, IXGBE_SYSTIMH) << 32;
ns = timecounter_cyc2time(&adapter->hw_tc, clock_edge);
- div_u64_rem(ns, NSECS_PER_SEC, &rem);
- clock_edge += ((NSECS_PER_SEC - (u64)rem) << shift);
+ div_u64_rem(ns, NSEC_PER_SEC, &rem);
+ clock_edge += ((NSEC_PER_SEC - (u64)rem) << shift);
/* specify the initial clock start time */
trgttiml = (u32)clock_edge;
@@ -177,15 +170,16 @@
IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp);
IXGBE_WRITE_REG(hw, IXGBE_TSAUXC, tsauxc);
- IXGBE_WRITE_FLUSH(hw);
} else {
IXGBE_WRITE_REG(hw, IXGBE_TSAUXC, 0x0);
}
+
+ IXGBE_WRITE_FLUSH(hw);
}
/**
* ixgbe_ptp_read - read raw cycle counter (to be used by time counter)
- * @cc: the cyclecounter structure
+ * @hw_cc: the cyclecounter structure
*
* this function reads the cyclecounter registers and is called by the
* cyclecounter structure used to construct a ns counter from the
@@ -388,6 +382,15 @@
struct ixgbe_hw *hw = &adapter->hw;
struct ptp_clock_event event;
+ event.type = PTP_CLOCK_PPS;
+
+ /* this check is necessary in case the interrupt was enabled via some
+ * alternative means (ex. debug_fs). Better to check here than
+ * everywhere that calls this function.
+ */
+ if (!adapter->ptp_clock)
+ return;
+
switch (hw->mac.type) {
case ixgbe_mac_X540:
ptp_clock_event(adapter->ptp_clock, &event);
@@ -397,149 +400,145 @@
}
}
-
/**
- * ixgbe_ptp_overflow_check - delayed work to detect SYSTIME overflow
- * @work: structure containing information about this work task
+ * ixgbe_ptp_overflow_check - watchdog task to detect SYSTIME overflow
+ * @adapter: private adapter struct
*
- * this work function is scheduled to continue reading the timecounter
+ * this watchdog task periodically reads the timecounter
* in order to prevent missing when the system time registers wrap
- * around. This needs to be run approximately twice a minute when no
- * PTP activity is occurring.
+ * around. This needs to be run approximately twice a minute.
*/
void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter)
{
- unsigned long elapsed_jiffies = adapter->last_overflow_check - jiffies;
+ bool timeout = time_is_before_jiffies(adapter->last_overflow_check +
+ IXGBE_OVERFLOW_PERIOD);
struct timespec ts;
- if ((adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED) &&
- (elapsed_jiffies >= IXGBE_OVERFLOW_PERIOD)) {
+ if (timeout) {
ixgbe_ptp_gettime(&adapter->ptp_caps, &ts);
adapter->last_overflow_check = jiffies;
}
}
/**
- * ixgbe_ptp_match - determine if this skb matches a ptp packet
- * @skb: pointer to the skb
- * @hwtstamp: pointer to the hwtstamp_config to check
- *
- * Determine whether the skb should have been timestamped, assuming the
- * hwtstamp was set via the hwtstamp ioctl. Returns non-zero when the packet
- * should have a timestamp waiting in the registers, and 0 otherwise.
- *
- * V1 packets have to check the version type to determine whether they are
- * correct. However, we can't directly access the data because it might be
- * fragmented in the SKB, in paged memory. In order to work around this, we
- * use skb_copy_bits which will properly copy the data whether it is in the
- * paged memory fragments or not. We have to copy the IP header as well as the
- * message type.
- */
-static int ixgbe_ptp_match(struct sk_buff *skb, int rx_filter)
-{
- struct iphdr iph;
- u8 msgtype;
- unsigned int type, offset;
-
- if (rx_filter == HWTSTAMP_FILTER_NONE)
- return 0;
-
- type = sk_run_filter(skb, ptp_filter);
-
- if (likely(rx_filter == HWTSTAMP_FILTER_PTP_V2_EVENT))
- return type & PTP_CLASS_V2;
+ * ixgbe_ptp_rx_hang - detect error case when Rx timestamp registers latched
+ * @adapter: private network adapter structure
+ *
+ * this watchdog task is scheduled to detect error case where hardware has
+ * dropped an Rx packet that was timestamped when the ring is full. The
+ * particular error is rare but leaves the device in a state unable to timestamp
+ * any future packets.
+ */
+void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter)
+{
+ struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_ring *rx_ring;
+ u32 tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL);
+ unsigned long rx_event;
+ int n;
- /* For the remaining cases actually check message type */
- switch (type) {
- case PTP_CLASS_V1_IPV4:
- skb_copy_bits(skb, OFF_IHL, &iph, sizeof(iph));
- offset = ETH_HLEN + (iph.ihl << 2) + UDP_HLEN + OFF_PTP_CONTROL;
- break;
- case PTP_CLASS_V1_IPV6:
- offset = OFF_PTP6 + OFF_PTP_CONTROL;
- break;
- default:
- /* other cases invalid or handled above */
- return 0;
+ /* if we don't have a valid timestamp in the registers, just update the
+ * timeout counter and exit
+ */
+ if (!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID)) {
+ adapter->last_rx_ptp_check = jiffies;
+ return;
}
- /* Make sure our buffer is long enough */
- if (skb->len < offset)
- return 0;
+ /* determine the most recent watchdog or rx_timestamp event */
+ rx_event = adapter->last_rx_ptp_check;
+ for (n = 0; n < adapter->num_rx_queues; n++) {
+ rx_ring = adapter->rx_ring[n];
+ if (time_after(rx_ring->last_rx_timestamp, rx_event))
+ rx_event = rx_ring->last_rx_timestamp;
+ }
- skb_copy_bits(skb, offset, &msgtype, sizeof(msgtype));
+ /* only need to read the high RXSTMP register to clear the lock */
+ if (time_is_before_jiffies(rx_event + 5*HZ)) {
+ IXGBE_READ_REG(hw, IXGBE_RXSTMPH);
+ adapter->last_rx_ptp_check = jiffies;
- switch (rx_filter) {
- case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
- return (msgtype == IXGBE_RXMTRL_V1_SYNC_MSG);
- break;
- case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
- return (msgtype == IXGBE_RXMTRL_V1_DELAY_REQ_MSG);
- break;
- default:
- return 0;
+ e_warn(drv, "clearing RX Timestamp hang");
}
}
/**
* ixgbe_ptp_tx_hwtstamp - utility function which checks for TX time stamp
- * @q_vector: structure containing interrupt and ring information
- * @skb: particular skb to send timestamp with
+ * @adapter: the private adapter struct
*
* if the timestamp is valid, we convert it into the timecounter ns
* value, then store that result into the shhwtstamps structure which
* is passed up the network stack
*/
-void ixgbe_ptp_tx_hwtstamp(struct ixgbe_q_vector *q_vector,
- struct sk_buff *skb)
+static void ixgbe_ptp_tx_hwtstamp(struct ixgbe_adapter *adapter)
{
- struct ixgbe_adapter *adapter;
- struct ixgbe_hw *hw;
+ struct ixgbe_hw *hw = &adapter->hw;
struct skb_shared_hwtstamps shhwtstamps;
u64 regval = 0, ns;
- u32 tsynctxctl;
unsigned long flags;
- /* we cannot process timestamps on a ring without a q_vector */
- if (!q_vector || !q_vector->adapter)
- return;
-
- adapter = q_vector->adapter;
- hw = &adapter->hw;
-
- tsynctxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCTXCTL);
regval |= (u64)IXGBE_READ_REG(hw, IXGBE_TXSTMPL);
regval |= (u64)IXGBE_READ_REG(hw, IXGBE_TXSTMPH) << 32;
- /*
- * if TX timestamp is not valid, exit after clearing the
- * timestamp registers
- */
- if (!(tsynctxctl & IXGBE_TSYNCTXCTL_VALID))
- return;
-
spin_lock_irqsave(&adapter->tmreg_lock, flags);
ns = timecounter_cyc2time(&adapter->hw_tc, regval);
spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
memset(&shhwtstamps, 0, sizeof(shhwtstamps));
shhwtstamps.hwtstamp = ns_to_ktime(ns);
- skb_tstamp_tx(skb, &shhwtstamps);
+ skb_tstamp_tx(adapter->ptp_tx_skb, &shhwtstamps);
+
+ dev_kfree_skb_any(adapter->ptp_tx_skb);
+ adapter->ptp_tx_skb = NULL;
+}
+
+/**
+ * ixgbe_ptp_tx_hwtstamp_work
+ * @work: pointer to the work struct
+ *
+ * This work item polls TSYNCTXCTL valid bit to determine when a Tx hardware
+ * timestamp has been taken for the current skb. It is necesary, because the
+ * descriptor's "done" bit does not correlate with the timestamp event.
+ */
+static void ixgbe_ptp_tx_hwtstamp_work(struct work_struct *work)
+{
+ struct ixgbe_adapter *adapter = container_of(work, struct ixgbe_adapter,
+ ptp_tx_work);
+ struct ixgbe_hw *hw = &adapter->hw;
+ bool timeout = time_is_before_jiffies(adapter->ptp_tx_start +
+ IXGBE_PTP_TX_TIMEOUT);
+ u32 tsynctxctl;
+
+ /* we have to have a valid skb */
+ if (!adapter->ptp_tx_skb)
+ return;
+
+ if (timeout) {
+ dev_kfree_skb_any(adapter->ptp_tx_skb);
+ adapter->ptp_tx_skb = NULL;
+ e_warn(drv, "clearing Tx Timestamp hang");
+ return;
+ }
+
+ tsynctxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCTXCTL);
+ if (tsynctxctl & IXGBE_TSYNCTXCTL_VALID)
+ ixgbe_ptp_tx_hwtstamp(adapter);
+ else
+ /* reschedule to keep checking if it's not available yet */
+ schedule_work(&adapter->ptp_tx_work);
}
/**
- * ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp
+ * __ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp
* @q_vector: structure containing interrupt and ring information
- * @rx_desc: the rx descriptor
* @skb: particular skb to send timestamp with
*
* if the timestamp is valid, we convert it into the timecounter ns
* value, then store that result into the shhwtstamps structure which
* is passed up the network stack
*/
-void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector,
- union ixgbe_adv_rx_desc *rx_desc,
- struct sk_buff *skb)
+void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector,
+ struct sk_buff *skb)
{
struct ixgbe_adapter *adapter;
struct ixgbe_hw *hw;
@@ -555,35 +554,17 @@
adapter = q_vector->adapter;
hw = &adapter->hw;
+ /*
+ * Read the tsyncrxctl register afterwards in order to prevent taking an
+ * I/O hit on every packet.
+ */
tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL);
-
- /* Check if we have a valid timestamp and make sure the skb should
- * have been timestamped */
- if (likely(!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID) ||
- !ixgbe_ptp_match(skb, adapter->rx_hwtstamp_filter)))
+ if (!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID))
return;
- /*
- * Always read the registers, in order to clear a possible fault
- * because of stagnant RX timestamp values for a packet that never
- * reached the queue.
- */
regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPL);
regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPH) << 32;
- /*
- * If the timestamp bit is set in the packet's descriptor, we know the
- * timestamp belongs to this packet. No other packet can be
- * timestamped until the registers for timestamping have been read.
- * Therefor only one packet with this bit can be in the queue at a
- * time, and the rx timestamp values that were in the registers belong
- * to this packet.
- *
- * If nothing went wrong, then it should have a skb_shared_tx that we
- * can turn into a skb_shared_hwtstamps.
- */
- if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS)))
- return;
spin_lock_irqsave(&adapter->tmreg_lock, flags);
ns = timecounter_cyc2time(&adapter->hw_tc, regval);
@@ -623,8 +604,7 @@
struct hwtstamp_config config;
u32 tsync_tx_ctl = IXGBE_TSYNCTXCTL_ENABLED;
u32 tsync_rx_ctl = IXGBE_TSYNCRXCTL_ENABLED;
- u32 tsync_rx_mtrl = 0;
- bool is_l4 = false;
+ u32 tsync_rx_mtrl = PTP_EV_PORT << 16;
bool is_l2 = false;
u32 regval;
@@ -647,16 +627,18 @@
switch (config.rx_filter) {
case HWTSTAMP_FILTER_NONE:
tsync_rx_ctl = 0;
+ tsync_rx_mtrl = 0;
+ adapter->flags &= ~IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
break;
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
- tsync_rx_mtrl = IXGBE_RXMTRL_V1_SYNC_MSG;
- is_l4 = true;
+ tsync_rx_mtrl |= IXGBE_RXMTRL_V1_SYNC_MSG;
+ adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
break;
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
- tsync_rx_mtrl = IXGBE_RXMTRL_V1_DELAY_REQ_MSG;
- is_l4 = true;
+ tsync_rx_mtrl |= IXGBE_RXMTRL_V1_DELAY_REQ_MSG;
+ adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
break;
case HWTSTAMP_FILTER_PTP_V2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
@@ -669,8 +651,8 @@
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_EVENT_V2;
is_l2 = true;
- is_l4 = true;
config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
+ adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
break;
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
case HWTSTAMP_FILTER_ALL:
@@ -681,55 +663,27 @@
* Delay_Req messages and hardware does not support
* timestamping all packets => return error
*/
+ adapter->flags &= ~IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
config.rx_filter = HWTSTAMP_FILTER_NONE;
return -ERANGE;
}
if (hw->mac.type == ixgbe_mac_82598EB) {
+ adapter->flags &= ~IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
if (tsync_rx_ctl | tsync_tx_ctl)
return -ERANGE;
return 0;
}
- /* Store filter value for later use */
- adapter->rx_hwtstamp_filter = config.rx_filter;
-
- /* define ethertype filter for timestamped packets */
+ /* define ethertype filter for timestamping L2 packets */
if (is_l2)
- IXGBE_WRITE_REG(hw, IXGBE_ETQF(3),
+ IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_1588),
(IXGBE_ETQF_FILTER_EN | /* enable filter */
IXGBE_ETQF_1588 | /* enable timestamping */
ETH_P_1588)); /* 1588 eth protocol type */
else
- IXGBE_WRITE_REG(hw, IXGBE_ETQF(3), 0);
-
-#define PTP_PORT 319
- /* L4 Queue Filter[3]: filter by destination port and protocol */
- if (is_l4) {
- u32 ftqf = (IXGBE_FTQF_PROTOCOL_UDP /* UDP */
- | IXGBE_FTQF_POOL_MASK_EN /* Pool not compared */
- | IXGBE_FTQF_QUEUE_ENABLE);
-
- ftqf |= ((IXGBE_FTQF_PROTOCOL_COMP_MASK /* protocol check */
- & IXGBE_FTQF_DEST_PORT_MASK /* dest check */
- & IXGBE_FTQF_SOURCE_PORT_MASK) /* source check */
- << IXGBE_FTQF_5TUPLE_MASK_SHIFT);
-
- IXGBE_WRITE_REG(hw, IXGBE_L34T_IMIR(3),
- (3 << IXGBE_IMIR_RX_QUEUE_SHIFT_82599 |
- IXGBE_IMIR_SIZE_BP_82599));
-
- /* enable port check */
- IXGBE_WRITE_REG(hw, IXGBE_SDPQF(3),
- (htons(PTP_PORT) |
- htons(PTP_PORT) << 16));
+ IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_1588), 0);
- IXGBE_WRITE_REG(hw, IXGBE_FTQF(3), ftqf);
-
- tsync_rx_mtrl |= PTP_PORT << 16;
- } else {
- IXGBE_WRITE_REG(hw, IXGBE_FTQF(3), 0);
- }
/* enable/disable TX */
regval = IXGBE_READ_REG(hw, IXGBE_TSYNCTXCTL);
@@ -869,9 +823,12 @@
spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
+ /* reset the overflow timer */
+ adapter->last_overflow_check = jiffies;
+
/*
- * now that the shift has been calculated and the systime
- * registers reset, enable pps signal
+ * Now that the shift has been calculated and the systime
+ * registers reset, (re-)enable the Clock out feature
*/
ixgbe_ptp_setup_sdp(adapter);
}
@@ -922,13 +879,11 @@
return;
}
- /* initialize the ptp filter */
- if (ptp_filter_init(ptp_filter, ARRAY_SIZE(ptp_filter)))
- e_dev_warn("ptp_filter_init failed\n");
-
spin_lock_init(&adapter->tmreg_lock);
+ INIT_WORK(&adapter->ptp_tx_work, ixgbe_ptp_tx_hwtstamp_work);
- adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps);
+ adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
+ &adapter->pdev->dev);
if (IS_ERR(adapter->ptp_clock)) {
adapter->ptp_clock = NULL;
e_dev_err("ptp_clock_register failed\n");
@@ -957,6 +912,12 @@
ixgbe_ptp_setup_sdp(adapter);
+ cancel_work_sync(&adapter->ptp_tx_work);
+ if (adapter->ptp_tx_skb) {
+ dev_kfree_skb_any(adapter->ptp_tx_skb);
+ adapter->ptp_tx_skb = NULL;
+ }
+
if (adapter->ptp_clock) {
ptp_clock_unregister(adapter->ptp_clock);
adapter->ptp_clock = NULL;
@@ -964,4 +925,4 @@
adapter->netdev->name);
}
}
-#endif /* CONFIG_IXGBE_PTP */
+#endif /* HAVE_PTP_1588_CLOCK */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_sriov.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -630,15 +630,7 @@
bool enable = ((event_mask & 0x10000000U) != 0);
if (enable) {
- random_ether_addr(vf_mac_addr);
- e_info(probe, "IOV: VF %d is enabled "
- "mac %02X:%02X:%02X:%02X:%02X:%02X\n",
- vfn,
- vf_mac_addr[0], vf_mac_addr[1], vf_mac_addr[2],
- vf_mac_addr[3], vf_mac_addr[4], vf_mac_addr[5]);
- /* Store away the VF "permananet" MAC address, it will ask
- * for it later.
- */
+ memset(vf_mac_addr, 0, ETH_ALEN);
memcpy(adapter->vfinfo[vfn].vf_mac_addresses, vf_mac_addr, 6);
}
@@ -663,7 +655,8 @@
ixgbe_vf_reset_event(adapter, vf);
/* set vf mac address */
- ixgbe_set_vf_mac(adapter, vf, vf_mac);
+ if (!is_zero_ether_addr(vf_mac))
+ ixgbe_set_vf_mac(adapter, vf, vf_mac);
vf_shift = vf % 32;
reg_offset = vf / 32;
@@ -712,8 +705,16 @@
}
/* reply to reset with ack and vf mac address */
- msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK;
- memcpy(addr, vf_mac, ETH_ALEN);
+ msgbuf[0] = IXGBE_VF_RESET;
+ if (!is_zero_ether_addr(vf_mac)) {
+ msgbuf[0] |= IXGBE_VT_MSGTYPE_ACK;
+ memcpy(addr, vf_mac, ETH_ALEN);
+ } else {
+ msgbuf[0] |= IXGBE_VT_MSGTYPE_NACK;
+ dev_warn(&adapter->pdev->dev,
+ "VF %d has no MAC address assigned, you may have to assign one manually\n",
+ vf);
+ }
/*
* Piggyback the multicast filter type so VF can compute the
@@ -738,14 +739,15 @@
if (adapter->vfinfo[vf].pf_set_mac &&
memcmp(adapter->vfinfo[vf].vf_mac_addresses, new_mac,
ETH_ALEN)) {
+ u8 *pm = adapter->vfinfo[vf].vf_mac_addresses;
e_warn(drv,
- "VF %d attempted to override administratively set MAC address\n"
- "Reload the VF driver to resume operations\n",
- vf);
+ "VF %d attempted to set a new MAC address but it already has an administratively set MAC address %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
+ vf, pm[0], pm[1], pm[2], pm[3], pm[4], pm[5]);
+ e_warn(drv, "Check the VF driver and if it is not using the correct MAC address you may need to reload the VF driver\n");
return -1;
}
- return !!(ixgbe_set_vf_mac(adapter, vf, new_mac) < 0);
+ return ixgbe_set_vf_mac(adapter, vf, new_mac) < 0;
}
static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter,
@@ -814,7 +816,7 @@
"VF %d has requested a MACVLAN filter but there is no space for it\n",
vf);
- return !!err < 0;
+ return err < 0;
}
static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_sriov.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_sysfs.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -38,989 +38,225 @@
#include <linux/device.h>
#include <linux/netdevice.h>
#include <linux/time.h>
-
-/*
- * This file provides a sysfs interface to export information from the
- * driver. The information presented is READ-ONLY.
- */
-
-static struct net_device_stats *sysfs_get_stats(struct net_device *netdev)
-{
-#ifndef HAVE_NETDEV_STATS_IN_NETDEV
- struct ixgbe_adapter *adapter;
+#ifdef IXGBE_HWMON
+#include <linux/hwmon.h>
#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 */
-}
-static struct net_device *ixgbe_get_netdev(struct kobject *kobj)
+#ifdef IXGBE_HWMON
+/* hwmon callback functions */
+static ssize_t ixgbe_hwmon_show_location(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
- 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 hwmon_attr *ixgbe_attr = container_of(attr, struct hwmon_attr,
+ dev_attr);
+ return sprintf(buf, "loc%u\n",
+ ixgbe_attr->sensor->location);
}
-static struct ixgbe_adapter *ixgbe_get_adapter(struct kobject *kobj)
+static ssize_t ixgbe_hwmon_show_temp(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
- struct ixgbe_adapter *adapter;
- struct net_device *netdev = ixgbe_get_netdev(kobj);
- if (netdev == NULL)
- return NULL;
- adapter = netdev_priv(netdev);
- return adapter;
-}
-
+ struct hwmon_attr *ixgbe_attr = container_of(attr, struct hwmon_attr,
+ dev_attr);
+ unsigned int value;
-static bool ixgbe_thermal_present(struct kobject *kobj)
-{
- s32 status;
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
+ /* reset the temp field */
+ ixgbe_attr->hw->mac.ops.get_thermal_sensor_data(ixgbe_attr->hw);
- if (adapter == NULL)
- return false;
+ value = ixgbe_attr->sensor->temp;
- status = ixgbe_init_thermal_sensor_thresh_generic(&(adapter->hw));
- if (status != 0)
- return false;
+ /* display millidegree */
+ value *= 1000;
- return true;
+ return sprintf(buf, "%u\n", value);
}
-/*
- * ixgbe_name_to_idx - Convert the directory name to the sensor offset.
- * @ c: pointer to the directory name string
- *
- * The directory name is in the form "sensor_n" where n is '0' -
- * 'IXGBE_MAX_SENSORS'. IXGBE_MAX_SENSORS will never be greater than
- * 9. This function takes advantage of that to keep it simple.
- */
-static int ixgbe_name_to_idx(const char *c)
+static ssize_t ixgbe_hwmon_show_cautionthresh(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
- /* find first digit */
- while (*c < '0' || *c > '9') {
- if (*c == '\n')
- return -1;
- c++;
- }
+ struct hwmon_attr *ixgbe_attr = container_of(attr, struct hwmon_attr,
+ dev_attr);
+ unsigned int value = ixgbe_attr->sensor->caution_thresh;
+
+ /* display millidegree */
+ value *= 1000;
- return ((int)(*c - '0'));
+ return sprintf(buf, "%u\n", value);
}
-static ssize_t ixgbe_fwbanner(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
+static ssize_t ixgbe_hwmon_show_maxopthresh(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
+ struct hwmon_attr *ixgbe_attr = container_of(attr, struct hwmon_attr,
+ dev_attr);
+ unsigned int value = ixgbe_attr->sensor->max_op_thresh;
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
+ /* display millidegree */
+ value *= 1000;
- return snprintf(buf, PAGE_SIZE, "%s\n", adapter->eeprom_id);
+ return sprintf(buf, "%u\n", value);
}
-static ssize_t ixgbe_porttype(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
- return snprintf(buf, PAGE_SIZE, "%d\n",
- test_bit(__IXGBE_DOWN, &adapter->state));
-}
-
-static ssize_t ixgbe_portspeed(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- int speed = 0;
+/**
+ * ixgbe_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 ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter,
+ unsigned int offset, int type) {
+ int rc;
+ unsigned int n_attr;
+ struct hwmon_attr *ixgbe_attr;
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
+ n_attr = adapter->ixgbe_hwmon_buff.n_hwmon;
+ ixgbe_attr = &adapter->ixgbe_hwmon_buff.hwmon_list[n_attr];
- switch (adapter->link_speed) {
- case IXGBE_LINK_SPEED_100_FULL:
- speed = 1;
+ switch (type) {
+ case IXGBE_HWMON_TYPE_LOC:
+ ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_location;
+ snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
+ "temp%u_label", offset);
break;
- case IXGBE_LINK_SPEED_1GB_FULL:
- speed = 10;
+ case IXGBE_HWMON_TYPE_TEMP:
+ ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_temp;
+ snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
+ "temp%u_input", offset);
break;
- case IXGBE_LINK_SPEED_10GB_FULL:
- speed = 100;
+ case IXGBE_HWMON_TYPE_CAUTION:
+ ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_cautionthresh;
+ snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
+ "temp%u_max", offset);
break;
+ case IXGBE_HWMON_TYPE_MAX:
+ ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_maxopthresh;
+ snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
+ "temp%u_crit", offset);
+ break;
+ default:
+ rc = -EPERM;
+ return rc;
}
- return snprintf(buf, PAGE_SIZE, "%d\n", speed);
-}
-static ssize_t ixgbe_wqlflag(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
+ /* These always the same regardless of type */
+ ixgbe_attr->sensor =
+ &adapter->hw.mac.thermal_sensor_data.sensor[offset];
+ ixgbe_attr->hw = &adapter->hw;
+ ixgbe_attr->dev_attr.store = NULL;
+ ixgbe_attr->dev_attr.attr.mode = S_IRUGO;
+ ixgbe_attr->dev_attr.attr.name = ixgbe_attr->name;
- return snprintf(buf, PAGE_SIZE, "%d\n", adapter->wol);
-}
+ rc = device_create_file(&adapter->pdev->dev,
+ &ixgbe_attr->dev_attr);
-static ssize_t ixgbe_xflowctl(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- struct ixgbe_hw *hw;
+ if (rc == 0)
+ ++adapter->ixgbe_hwmon_buff.n_hwmon;
- 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 ixgbe_rxdrops(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = ixgbe_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 ixgbe_rxerrors(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = ixgbe_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 ixgbe_rxupacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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", IXGBE_READ_REG(hw, IXGBE_TPR));
-}
-
-static ssize_t ixgbe_rxmpacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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", IXGBE_READ_REG(hw, IXGBE_MPRC));
-}
-
-static ssize_t ixgbe_rxbpacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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", IXGBE_READ_REG(hw, IXGBE_BPRC));
-}
-
-static ssize_t ixgbe_txupacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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", IXGBE_READ_REG(hw, IXGBE_TPT));
-}
-
-static ssize_t ixgbe_txmpacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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", IXGBE_READ_REG(hw, IXGBE_MPTC));
-}
-
-static ssize_t ixgbe_txbpacks(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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", IXGBE_READ_REG(hw, IXGBE_BPTC));
-}
-
-static ssize_t ixgbe_txerrors(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = ixgbe_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 ixgbe_txdrops(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = ixgbe_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 ixgbe_rxframes(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = ixgbe_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 ixgbe_rxbytes(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = ixgbe_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 ixgbe_txframes(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = ixgbe_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 ixgbe_txbytes(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device_stats *net_stats;
- struct net_device *netdev = ixgbe_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 ixgbe_linkstat(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- u32 link_speed;
- bool link_up = false;
- int bitmask = 0;
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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(__IXGBE_DOWN, &adapter->state))
- bitmask |= 1;
-
- if (hw->mac.ops.check_link)
- hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
- 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 ixgbe_funcid(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- struct ixgbe_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\n", hw->bus.func);
-}
-
-static ssize_t ixgbe_funcvers(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- return snprintf(buf, PAGE_SIZE, "%s\n", ixgbe_driver_version);
-}
-
-static ssize_t ixgbe_macburn(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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]);
+ return rc;
}
+#endif /* IXGBE_HWMON */
-static ssize_t ixgbe_macadmn(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
+static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter)
{
- struct ixgbe_hw *hw;
- struct ixgbe_adapter *adapter = ixgbe_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.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]);
-}
+#ifdef IXGBE_HWMON
+ int i;
-static ssize_t ixgbe_maclla1(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_hw *hw;
- u16 eeprom_buff[6];
- int first_word = 0x37;
- int word_count = 6;
- int rc;
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
+ return;
- hw = &adapter->hw;
- if (hw == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no hw data\n");
-
- rc = hw->eeprom.ops.read_buffer(hw, first_word, word_count,
- eeprom_buff);
- if (rc != 0)
- return snprintf(buf, PAGE_SIZE, "error: reading buffer\n");
-
- 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]);
+ for (i = 0; i < adapter->ixgbe_hwmon_buff.n_hwmon; i++) {
+ device_remove_file(&adapter->pdev->dev,
+ &adapter->ixgbe_hwmon_buff.hwmon_list[i].dev_attr);
}
- return snprintf(buf, PAGE_SIZE, "unexpected port %d\n", hw->bus.func);
-}
-
-static ssize_t ixgbe_mtusize(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- struct net_device *netdev = ixgbe_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 ixgbe_featflag(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- int bitmask = 0;
-#ifndef HAVE_NDO_SET_FEATURES
- struct ixgbe_ring *ring;
-#endif
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- struct net_device *netdev = ixgbe_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");
-#ifndef HAVE_NDO_SET_FEATURES
- /* ixgbe_get_rx_csum(netdev) doesn't compile so hard code */
- ring = adapter->rx_ring[0];
- bitmask = test_bit(__IXGBE_RX_CSUM_ENABLED, &ring->state);
- return snprintf(buf, PAGE_SIZE, "%d\n", bitmask);
-#else
- if (netdev->features & NETIF_F_RXCSUM)
- bitmask |= 1;
- return snprintf(buf, PAGE_SIZE, "%d\n", bitmask);
-#endif
-}
+ kfree(adapter->ixgbe_hwmon_buff.hwmon_list);
-static ssize_t ixgbe_lsominct(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- return snprintf(buf, PAGE_SIZE, "%d\n", 1);
+ if (adapter->ixgbe_hwmon_buff.device)
+ hwmon_device_unregister(adapter->ixgbe_hwmon_buff.device);
+#endif /* IXGBE_HWMON */
}
-static ssize_t ixgbe_prommode(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct net_device *netdev = ixgbe_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 ixgbe_txdscqsz(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
+/* called from ixgbe_main.c */
+void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter)
{
- struct ixgbe_adapter *adapter = ixgbe_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);
+ ixgbe_sysfs_del_adapter(adapter);
}
-static ssize_t ixgbe_rxdscqsz(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
+/* called from ixgbe_main.c */
+int ixgbe_sysfs_init(struct ixgbe_adapter *adapter)
{
- struct ixgbe_adapter *adapter = ixgbe_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);
-}
+ int rc = 0;
+#ifdef IXGBE_HWMON
+ struct hwmon_buff *ixgbe_hwmon = &adapter->ixgbe_hwmon_buff;
+ unsigned int i;
+ int n_attrs;
-static ssize_t ixgbe_rxqavg(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- int index;
- int diff = 0;
- u16 ntc;
- u16 ntu;
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
+#endif /* IXGBE_HWMON */
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);
-}
+ goto err;
-static ssize_t ixgbe_txqavg(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- int index;
- int diff = 0;
- u16 ntc;
- u16 ntu;
- struct ixgbe_adapter *adapter = ixgbe_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);
+#ifdef IXGBE_HWMON
+ /* If this method isn't defined we don't support thermals */
+ if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL) {
+ goto no_thermal;
}
- 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 ixgbe_iovotype(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- return snprintf(buf, PAGE_SIZE, "2\n");
-}
-
-static ssize_t ixgbe_funcnbr(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
- return snprintf(buf, PAGE_SIZE, "%d\n", adapter->num_vfs);
-}
-
-static ssize_t ixgbe_pciebnbr(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj);
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- return snprintf(buf, PAGE_SIZE, "%d\n", adapter->pdev->bus->number);
-}
-
-static s32 ixgbe_sysfs_get_thermal_data(struct kobject *kobj, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj->parent);
- s32 status;
-
- if (adapter == NULL) {
- snprintf(buf, PAGE_SIZE, "error: missing adapter\n");
- return 0;
+ /* Don't create thermal hwmon interface if no sensors present */
+ if (adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw))
+ goto no_thermal;
+
+ /*
+ * Allocation space for max attributs
+ * max num sensors * values (loc, temp, max, caution)
+ */
+ n_attrs = IXGBE_MAX_SENSORS * 4;
+ ixgbe_hwmon->hwmon_list = kcalloc(n_attrs, sizeof(struct hwmon_attr),
+ GFP_KERNEL);
+ if (!ixgbe_hwmon->hwmon_list) {
+ rc = -ENOMEM;
+ goto err;
}
- if (&adapter->hw == NULL) {
- snprintf(buf, PAGE_SIZE, "error: missing hw\n");
- return 0;
+ ixgbe_hwmon->device = hwmon_device_register(&adapter->pdev->dev);
+ if (IS_ERR(ixgbe_hwmon->device)) {
+ rc = PTR_ERR(ixgbe_hwmon->device);
+ goto err;
}
- status = ixgbe_get_thermal_sensor_data_generic(&adapter->hw);
-
- return status;
-}
-
-static ssize_t ixgbe_sysfs_location(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj->parent);
- int idx;
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- idx = ixgbe_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 ixgbe_sysfs_temp(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj->parent);
- int idx;
-
- s32 status = ixgbe_sysfs_get_thermal_data(kobj, buf);
-
- if (status != 0)
- return snprintf(buf, PAGE_SIZE, "error: status %d returned",
- status);
-
- idx = ixgbe_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 ixgbe_sysfs_maxopthresh(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj->parent);
- int idx;
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- idx = ixgbe_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 ixgbe_sysfs_cautionthresh(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
-{
- struct ixgbe_adapter *adapter = ixgbe_get_adapter(kobj->parent);
- int idx;
-
- if (adapter == NULL)
- return snprintf(buf, PAGE_SIZE, "error: no adapter\n");
-
- idx = ixgbe_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].caution_thresh);
-}
-
-/* Initialize the attributes */
-
-static struct kobj_attribute ixgbe_sysfs_location_attr =
- __ATTR(location, 0444, ixgbe_sysfs_location, NULL);
-static struct kobj_attribute ixgbe_sysfs_temp_attr =
- __ATTR(temp, 0444, ixgbe_sysfs_temp, NULL);
-static struct kobj_attribute ixgbe_sysfs_cautionthresh_attr =
- __ATTR(cautionthresh, 0444, ixgbe_sysfs_cautionthresh, NULL);
-static struct kobj_attribute ixgbe_sysfs_maxopthresh_attr =
- __ATTR(maxopthresh, 0444, ixgbe_sysfs_maxopthresh, NULL);
-
-static struct kobj_attribute ixgbe_sysfs_fwbanner_attr =
- __ATTR(fwbanner, 0444, ixgbe_fwbanner, NULL);
-static struct kobj_attribute ixgbe_sysfs_porttype_attr =
- __ATTR(porttype, 0444, ixgbe_porttype, NULL);
-static struct kobj_attribute ixgbe_sysfs_portspeed_attr =
- __ATTR(portspeed, 0444, ixgbe_portspeed, NULL);
-static struct kobj_attribute ixgbe_sysfs_wqlflag_attr =
- __ATTR(wqlflag, 0444, ixgbe_wqlflag, NULL);
-static struct kobj_attribute ixgbe_sysfs_xflowctl_attr =
- __ATTR(xflowctl, 0444, ixgbe_xflowctl, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxdrops_attr =
- __ATTR(rxdrops, 0444, ixgbe_rxdrops, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxerrors_attr =
- __ATTR(rxerrors, 0444, ixgbe_rxerrors, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxupacks_attr =
- __ATTR(rxupacks, 0444, ixgbe_rxupacks, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxmpacks_attr =
- __ATTR(rxmpacks, 0444, ixgbe_rxmpacks, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxbpacks_attr =
- __ATTR(rxbpacks, 0444, ixgbe_rxbpacks, NULL);
-static struct kobj_attribute ixgbe_sysfs_txupacks_attr =
- __ATTR(txupacks, 0444, ixgbe_txupacks, NULL);
-static struct kobj_attribute ixgbe_sysfs_txmpacks_attr =
- __ATTR(txmpacks, 0444, ixgbe_txmpacks, NULL);
-static struct kobj_attribute ixgbe_sysfs_txbpacks_attr =
- __ATTR(txbpacks, 0444, ixgbe_txbpacks, NULL);
-static struct kobj_attribute ixgbe_sysfs_txerrors_attr =
- __ATTR(txerrors, 0444, ixgbe_txerrors, NULL);
-static struct kobj_attribute ixgbe_sysfs_txdrops_attr =
- __ATTR(txdrops, 0444, ixgbe_txdrops, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxframes_attr =
- __ATTR(rxframes, 0444, ixgbe_rxframes, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxbytes_attr =
- __ATTR(rxbytes, 0444, ixgbe_rxbytes, NULL);
-static struct kobj_attribute ixgbe_sysfs_txframes_attr =
- __ATTR(txframes, 0444, ixgbe_txframes, NULL);
-static struct kobj_attribute ixgbe_sysfs_txbytes_attr =
- __ATTR(txbytes, 0444, ixgbe_txbytes, NULL);
-static struct kobj_attribute ixgbe_sysfs_linkstat_attr =
- __ATTR(linkstat, 0444, ixgbe_linkstat, NULL);
-static struct kobj_attribute ixgbe_sysfs_funcid_attr =
- __ATTR(funcid, 0444, ixgbe_funcid, NULL);
-static struct kobj_attribute ixgbe_sysfs_funvers_attr =
- __ATTR(funcvers, 0444, ixgbe_funcvers, NULL);
-static struct kobj_attribute ixgbe_sysfs_macburn_attr =
- __ATTR(macburn, 0444, ixgbe_macburn, NULL);
-static struct kobj_attribute ixgbe_sysfs_macadmn_attr =
- __ATTR(macadmn, 0444, ixgbe_macadmn, NULL);
-static struct kobj_attribute ixgbe_sysfs_maclla1_attr =
- __ATTR(maclla1, 0444, ixgbe_maclla1, NULL);
-static struct kobj_attribute ixgbe_sysfs_mtusize_attr =
- __ATTR(mtusize, 0444, ixgbe_mtusize, NULL);
-static struct kobj_attribute ixgbe_sysfs_featflag_attr =
- __ATTR(featflag, 0444, ixgbe_featflag, NULL);
-static struct kobj_attribute ixgbe_sysfs_lsominct_attr =
- __ATTR(lsominct, 0444, ixgbe_lsominct, NULL);
-static struct kobj_attribute ixgbe_sysfs_prommode_attr =
- __ATTR(prommode, 0444, ixgbe_prommode, NULL);
-static struct kobj_attribute ixgbe_sysfs_txdscqsz_attr =
- __ATTR(txdscqsz, 0444, ixgbe_txdscqsz, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxdscqsz_attr =
- __ATTR(rxdscqsz, 0444, ixgbe_rxdscqsz, NULL);
-static struct kobj_attribute ixgbe_sysfs_txqavg_attr =
- __ATTR(txqavg, 0444, ixgbe_txqavg, NULL);
-static struct kobj_attribute ixgbe_sysfs_rxqavg_attr =
- __ATTR(rxqavg, 0444, ixgbe_rxqavg, NULL);
-static struct kobj_attribute ixgbe_sysfs_iovotype_attr =
- __ATTR(iovotype, 0444, ixgbe_iovotype, NULL);
-static struct kobj_attribute ixgbe_sysfs_funcnbr_attr =
- __ATTR(funcnbr, 0444, ixgbe_funcnbr, NULL);
-static struct kobj_attribute ixgbe_sysfs_pciebnbr_attr =
- __ATTR(pciebnbr, 0444, ixgbe_pciebnbr, NULL);
-
-/* Add the attributes into an array, to be added to a group */
-
-static struct attribute *therm_attrs[] = {
- &ixgbe_sysfs_location_attr.attr,
- &ixgbe_sysfs_temp_attr.attr,
- &ixgbe_sysfs_cautionthresh_attr.attr,
- &ixgbe_sysfs_maxopthresh_attr.attr,
- NULL
-};
-
-static struct attribute *attrs[] = {
- &ixgbe_sysfs_fwbanner_attr.attr,
- &ixgbe_sysfs_porttype_attr.attr,
- &ixgbe_sysfs_portspeed_attr.attr,
- &ixgbe_sysfs_wqlflag_attr.attr,
- &ixgbe_sysfs_xflowctl_attr.attr,
- &ixgbe_sysfs_rxdrops_attr.attr,
- &ixgbe_sysfs_rxerrors_attr.attr,
- &ixgbe_sysfs_rxupacks_attr.attr,
- &ixgbe_sysfs_rxmpacks_attr.attr,
- &ixgbe_sysfs_rxbpacks_attr.attr,
- &ixgbe_sysfs_txdrops_attr.attr,
- &ixgbe_sysfs_txerrors_attr.attr,
- &ixgbe_sysfs_txupacks_attr.attr,
- &ixgbe_sysfs_txmpacks_attr.attr,
- &ixgbe_sysfs_txbpacks_attr.attr,
- &ixgbe_sysfs_rxframes_attr.attr,
- &ixgbe_sysfs_rxbytes_attr.attr,
- &ixgbe_sysfs_txframes_attr.attr,
- &ixgbe_sysfs_txbytes_attr.attr,
- &ixgbe_sysfs_linkstat_attr.attr,
- &ixgbe_sysfs_funcid_attr.attr,
- &ixgbe_sysfs_funvers_attr.attr,
- &ixgbe_sysfs_macburn_attr.attr,
- &ixgbe_sysfs_macadmn_attr.attr,
- &ixgbe_sysfs_maclla1_attr.attr,
- &ixgbe_sysfs_mtusize_attr.attr,
- &ixgbe_sysfs_featflag_attr.attr,
- &ixgbe_sysfs_lsominct_attr.attr,
- &ixgbe_sysfs_prommode_attr.attr,
- &ixgbe_sysfs_txdscqsz_attr.attr,
- &ixgbe_sysfs_rxdscqsz_attr.attr,
- &ixgbe_sysfs_txqavg_attr.attr,
- &ixgbe_sysfs_rxqavg_attr.attr,
- &ixgbe_sysfs_iovotype_attr.attr,
- &ixgbe_sysfs_funcnbr_attr.attr,
- &ixgbe_sysfs_pciebnbr_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,
-};
-
-static void ixgbe_del_adapter(struct ixgbe_adapter *adapter)
-{
- int i;
-
- if (adapter == NULL)
- return;
-
for (i = 0; i < IXGBE_MAX_SENSORS; i++) {
- if (adapter->therm_kobj[i] == NULL)
+ /*
+ * Only create hwmon sysfs entries for sensors that have
+ * meaningful data for.
+ */
+ if (adapter->hw.mac.thermal_sensor_data.sensor[i].location == 0)
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);
- }
-}
-
-/* called from ixgbe_main.c */
-void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter)
-{
- ixgbe_del_adapter(adapter);
-}
-
-/* called from ixgbe_main.c */
-int ixgbe_sysfs_init(struct ixgbe_adapter *adapter)
-{
- struct net_device *netdev;
- int rc = 0;
- int i;
- if (adapter == NULL)
- goto err;
- netdev = adapter->netdev;
- if (netdev == NULL)
- goto err;
-
- adapter->info_kobj = NULL;
- for (i = 0; i < IXGBE_MAX_SENSORS; i++)
- adapter->therm_kobj[i] = NULL;
-
- /* create info kobj and attribute listings in kobj */
- adapter->info_kobj = kobject_create_and_add("info",
- &(netdev->dev.kobj));
- if (adapter->info_kobj == NULL)
- goto err;
- if (sysfs_create_group(adapter->info_kobj, &attr_group))
- goto err;
-
- /* Don't create thermal subkobjs if no data present */
- if (ixgbe_thermal_present(adapter->info_kobj) == true) {
- for (i = 0; i < IXGBE_MAX_SENSORS; i++) {
-
- char buf[16];
-
- /*
- * 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 err;
- if (sysfs_create_group(adapter->therm_kobj[i],
- &therm_attr_group))
- goto err;
- }
+ /* Bail if any hwmon attr struct fails to initialize */
+ rc = ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_CAUTION);
+ rc |= ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_LOC);
+ rc |= ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_TEMP);
+ rc |= ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_MAX);
+ if (rc)
+ goto err;
}
+no_thermal:
+#endif /* IXGBE_HWMON */
goto exit;
err:
- ixgbe_del_adapter(adapter);
- rc = -1;
+ ixgbe_sysfs_del_adapter(adapter);
exit:
return rc;
}
-
#endif /* IXGBE_SYSFS */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_type.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -55,11 +55,11 @@
#define IXGBE_SUBDEV_ID_82599_RNDC 0x1F72
#define IXGBE_SUBDEV_ID_82599_560FLR 0x17D0
#define IXGBE_SUBDEV_ID_82599_ECNA_DP 0x0470
+#define IXGBE_SUBDEV_ID_82599_SP_560FLR 0x211B
#define IXGBE_DEV_ID_82599_BACKPLANE_FCOE 0x152A
#define IXGBE_DEV_ID_82599_SFP_FCOE 0x1529
#define IXGBE_DEV_ID_82599_SFP_EM 0x1507
#define IXGBE_DEV_ID_82599_SFP_SF2 0x154D
-#define IXGBE_DEV_ID_82599_SFP_SF_QP 0x154A
#define IXGBE_DEV_ID_82599EN_SFP 0x1557
#define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC
#define IXGBE_DEV_ID_82599_T3_LOM 0x151C
@@ -220,7 +220,6 @@
(((_i) < 64) ? (0x0100C + ((_i) * 0x40)) : \
(0x0D00C + (((_i) - 64) * 0x40))))
#define IXGBE_RDRXCTL 0x02F00
-#define IXGBE_RDRXCTL_RSC_PUSH 0x80
/* 8 of these 0x03C00 - 0x03C1C */
#define IXGBE_RXPBSIZE(_i) (0x03C00 + ((_i) * 4))
#define IXGBE_RXCTRL 0x03000
@@ -291,6 +290,7 @@
#define IXGBE_RETA(_i) (0x05C00 + ((_i) * 4)) /* 32 of these (0-31) */
#define IXGBE_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* 10 of these (0-9) */
+
/* Flow Director registers */
#define IXGBE_FDIRCTRL 0x0EE00
#define IXGBE_FDIRHKEY 0x0EE68
@@ -371,11 +371,16 @@
#define IXGBE_WUPL 0x05900
#define IXGBE_WUPM 0x05A00 /* wake up pkt memory 0x5A00-0x5A7C */
+
#define IXGBE_FHFT(_n) (0x09000 + (_n * 0x100)) /* Flex host filter table */
/* Ext Flexible Host Filter Table */
#define IXGBE_FHFT_EXT(_n) (0x09800 + (_n * 0x100))
+/* Four Flexible Filters are supported */
#define IXGBE_FLEXIBLE_FILTER_COUNT_MAX 4
+
+/* Six Flexible Filters are supported */
+#define IXGBE_FLEXIBLE_FILTER_COUNT_MAX_6 6
#define IXGBE_EXT_FLEXIBLE_FILTER_COUNT_MAX 2
/* Each Flexible Filter is at most 128 (0x80) bytes in length */
@@ -407,10 +412,11 @@
#define IXGBE_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */
#define IXGBE_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */
#define IXGBE_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */
-#define IXGBE_WUFC_FLX_FILTERS 0x000F0000 /* Mask for 4 flex filters */
+#define IXGBE_WUFC_FLX_FILTERS 0x000F0000 /* Mask for 4 flex filters */
/* Mask for Ext. flex filters */
#define IXGBE_WUFC_EXT_FLX_FILTERS 0x00300000
-#define IXGBE_WUFC_ALL_FILTERS 0x003F00FF /* Mask for all wakeup filters */
+#define IXGBE_WUFC_ALL_FILTERS 0x000F00FF /* Mask all 4 flex filters */
+#define IXGBE_WUFC_ALL_FILTERS_6 0x003F00FF /* Mask all 6 flex filters */
#define IXGBE_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */
/* Wake Up Status */
@@ -431,7 +437,6 @@
#define IXGBE_WUS_FLX5 IXGBE_WUFC_FLX5
#define IXGBE_WUS_FLX_FILTERS IXGBE_WUFC_FLX_FILTERS
-/* Wake Up Packet Length */
#define IXGBE_WUPL_LENGTH_MASK 0xFFFF
/* DCB registers */
@@ -573,6 +578,7 @@
(IXGBE_RTTBCNRC_RF_DEC_MASK << IXGBE_RTTBCNRC_RF_INT_SHIFT)
#define IXGBE_RTTBCNRM 0x04980
+
/* FCoE DMA Context Registers */
#define IXGBE_FCPTRL 0x02410 /* FC User Desc. PTR Low */
#define IXGBE_FCPTRH 0x02414 /* FC USer Desc. PTR High */
@@ -753,11 +759,14 @@
#define IXGBE_BMCIP_IPADDR_VALID 0x00000002
/* Management Bit Fields and Masks */
+#define IXGBE_MANC_RCV_TCO_EN 0x00020000 /* Rcv TCO packet enable */
#define IXGBE_MANC_EN_BMC2OS 0x10000000 /* Ena BMC2OS and OS2BMC traffic */
#define IXGBE_MANC_EN_BMC2OS_SHIFT 28
/* Firmware Semaphore Register */
#define IXGBE_FWSM_MODE_MASK 0xE
+#define IXGBE_FWSM_TS_ENABLED 0x1
+#define IXGBE_FWSM_FW_MODE_PT 0x4
/* ARC Subsystem registers */
#define IXGBE_HICR 0x15F00
@@ -1023,7 +1032,9 @@
#define IXGBE_RDRXCTL_RDMTS_1_2 0x00000000 /* Rx Desc Min THLD Size */
#define IXGBE_RDRXCTL_CRCSTRIP 0x00000002 /* CRC Strip */
#define IXGBE_RDRXCTL_MVMEN 0x00000020
+#define IXGBE_RDRXCTL_RSC_PUSH_DIS 0x00000020
#define IXGBE_RDRXCTL_DMAIDONE 0x00000008 /* DMA init cycle done */
+#define IXGBE_RDRXCTL_RSC_PUSH 0x00000080
#define IXGBE_RDRXCTL_AGGDIS 0x00010000 /* Aggregation disable */
#define IXGBE_RDRXCTL_RSCFRSTSIZE 0x003E0000 /* RSC First packet size */
#define IXGBE_RDRXCTL_RSCLLIDIS 0x00800000 /* Disable RSC compl on LLI*/
@@ -1052,6 +1063,7 @@
#define IXGBE_CTRL_RST_MASK (IXGBE_CTRL_LNK_RST | IXGBE_CTRL_RST)
/* FACTPS */
+#define IXGBE_FACTPS_MNGCG 0x20000000 /* Manageblility Clock Gated */
#define IXGBE_FACTPS_LFS 0x40000000 /* LAN Function Select */
/* MHADD Bit Masks */
@@ -1669,6 +1681,7 @@
#define IXGBE_AUTOC2_10G_KR (0x0 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
#define IXGBE_AUTOC2_10G_XFI (0x1 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
#define IXGBE_AUTOC2_10G_SFI (0x2 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
+#define IXGBE_AUTOC2_LINK_DISABLE_MASK 0x70000000
#define IXGBE_MACC_FLU 0x00000001
#define IXGBE_MACC_FSV_10G 0x00030000
@@ -1853,7 +1866,7 @@
#define IXGBE_ETH_LENGTH_OF_ADDRESS 6
#define IXGBE_EEPROM_PAGE_SIZE_MAX 128
-#define IXGBE_EEPROM_RD_BUFFER_MAX_COUNT 512 /* words rd in burst */
+#define IXGBE_EEPROM_RD_BUFFER_MAX_COUNT 256 /* words rd in burst */
#define IXGBE_EEPROM_WR_BUFFER_MAX_COUNT 256 /* words wr in burst */
#ifndef IXGBE_EEPROM_GRANT_ATTEMPTS
@@ -1921,6 +1934,17 @@
#define IXGBE_PCI_HEADER_TYPE_MULTIFUNC 0x80
#define IXGBE_PCI_DEVICE_CONTROL2_16ms 0x0005
+#define IXGBE_PCIDEVCTRL2_TIMEO_MASK 0xf
+#define IXGBE_PCIDEVCTRL2_16_32ms_def 0x0
+#define IXGBE_PCIDEVCTRL2_50_100us 0x1
+#define IXGBE_PCIDEVCTRL2_1_2ms 0x2
+#define IXGBE_PCIDEVCTRL2_16_32ms 0x5
+#define IXGBE_PCIDEVCTRL2_65_130ms 0x6
+#define IXGBE_PCIDEVCTRL2_260_520ms 0x9
+#define IXGBE_PCIDEVCTRL2_1_2s 0xa
+#define IXGBE_PCIDEVCTRL2_4_8s 0xd
+#define IXGBE_PCIDEVCTRL2_17_34s 0xe
+
/* Number of 100 microseconds we wait for PCI Express master disable */
#define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800
@@ -2407,6 +2431,14 @@
#define IXGBE_FDIR_DROP_QUEUE 127
#define IXGBE_STATUS_OVERHEATING_BIT 20 /* STATUS overtemp bit num */
+/* iTS sensor related defines*/
+#define IXGBE_TEMP_STATUS_ADDR_X540 0xC830
+#define IXGBE_TEMP_VALUE_ADDR_X540 0xC820
+#define IXGBE_TEMP_PROV_2_ADDR_X540 0xC421
+#define IXGBE_TEMP_PROV_4_ADDR_X540 0xC423
+#define IXGBE_TEMP_STATUS_PAGE_X540 0x1E
+#define IXGBE_TEMP_HIGH_FAILURE_BIT_X540 0xE
+#define IXGBE_TEMP_HIGH_WARNING_BIT_X540 0xC
/* Manageablility Host Interface defines */
#define IXGBE_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */
@@ -2600,7 +2632,6 @@
IXGBE_LINK_SPEED_1GB_FULL | \
IXGBE_LINK_SPEED_10GB_FULL)
-
/* Physical layer type */
typedef u32 ixgbe_physical_layer;
#define IXGBE_PHYSICAL_LAYER_UNKNOWN 0
@@ -3049,10 +3080,11 @@
void (*disable_tx_laser)(struct ixgbe_hw *);
void (*enable_tx_laser)(struct ixgbe_hw *);
void (*flap_tx_laser)(struct ixgbe_hw *);
- s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool);
+ s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool);
s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool);
s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *,
bool *);
+ bool (*mng_enabled) (struct ixgbe_hw *hw);
/* Packet Buffer manipulation */
void (*setup_rxpba)(struct ixgbe_hw *, int, u32, int);
@@ -3092,6 +3124,7 @@
s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);
s32 (*get_thermal_sensor_data)(struct ixgbe_hw *);
s32 (*init_thermal_sensor_thresh)(struct ixgbe_hw *hw);
+ void (*get_rtrup2tc)(struct ixgbe_hw *hw, u8 *map);
};
struct ixgbe_phy_operations {
@@ -3102,12 +3135,12 @@
s32 (*read_reg)(struct ixgbe_hw *, u32, u32, u16 *);
s32 (*write_reg)(struct ixgbe_hw *, u32, u32, u16);
s32 (*setup_link)(struct ixgbe_hw *);
- s32 (*setup_link_speed)(struct ixgbe_hw *, ixgbe_link_speed, bool,
- bool);
+ s32 (*setup_link_speed)(struct ixgbe_hw *, ixgbe_link_speed, bool);
s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *);
s32 (*get_firmware_version)(struct ixgbe_hw *, u16 *);
s32 (*read_i2c_byte)(struct ixgbe_hw *, u8, u8, u8 *);
s32 (*write_i2c_byte)(struct ixgbe_hw *, u8, u8, u8);
+ s32 (*read_i2c_sff8472)(struct ixgbe_hw *, u8 , u8 *);
s32 (*read_i2c_eeprom)(struct ixgbe_hw *, u8 , u8 *);
s32 (*write_i2c_eeprom)(struct ixgbe_hw *, u8, u8);
void (*i2c_bus_clear)(struct ixgbe_hw *);
@@ -3145,7 +3178,9 @@
u32 max_tx_queues;
u32 max_rx_queues;
u32 orig_autoc;
+ u32 cached_autoc;
u8 san_mac_rar_index;
+ bool get_link_status;
u32 orig_autoc2;
u16 max_msix_vectors;
bool arc_subsystem_valid;
@@ -3153,6 +3188,7 @@
bool autotry_restart;
u8 flags;
struct ixgbe_thermal_sensor_data thermal_sensor_data;
+ bool thermal_sensor_enabled;
};
struct ixgbe_phy_info {
@@ -3222,6 +3258,8 @@
int api_version;
bool force_full_reset;
bool allow_unsupported_sfp;
+ bool mng_fw_enabled;
+ bool wol_supported;
};
#define ixgbe_call_func(hw, func, params, error) \
@@ -3262,9 +3300,10 @@
#define IXGBE_ERR_INVALID_ARGUMENT -32
#define IXGBE_ERR_HOST_INTERFACE_COMMAND -33
#define IXGBE_ERR_OUT_OF_MEM -34
+#define IXGBE_ERR_FEATURE_NOT_SUPPORTED -36
+#define IXGBE_ERR_EEPROM_PROTECTED_REGION -37
#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF
#define UNREFERENCED_XPARAMETER
-
#endif /* _IXGBE_TYPE_H_ */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_x540.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -64,6 +64,7 @@
eeprom->ops.validate_checksum = &ixgbe_validate_eeprom_checksum_X540;
eeprom->ops.calc_checksum = &ixgbe_calc_eeprom_checksum_X540;
+
/* PHY */
phy->ops.init = &ixgbe_init_phy_ops_generic;
phy->ops.reset = NULL;
@@ -106,6 +107,9 @@
mac->ops.setup_rxpba = &ixgbe_set_rxpba_generic;
mac->ops.check_link = &ixgbe_check_mac_link_generic;
+ mac->ops.get_thermal_sensor_data = &ixgbe_get_thermal_sensor_data_X540;
+ mac->ops.init_thermal_sensor_thresh =
+ &ixgbe_init_thermal_sensor_thresh_X540;
mac->mcft_size = 128;
mac->vft_size = 128;
@@ -132,6 +136,8 @@
/* Manageability interface */
mac->ops.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic;
+ mac->ops.get_rtrup2tc = &ixgbe_dcb_get_rtrup2tc_generic;
+
return ret_val;
}
@@ -167,15 +173,13 @@
* ixgbe_setup_mac_link_X540 - Sets the auto advertised capabilities
* @hw: pointer to hardware structure
* @speed: new link speed
- * @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed
**/
s32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw,
- ixgbe_link_speed speed, bool autoneg,
+ ixgbe_link_speed speed,
bool autoneg_wait_to_complete)
{
- return hw->phy.ops.setup_link_speed(hw, speed, autoneg,
- autoneg_wait_to_complete);
+ return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait_to_complete);
}
/**
@@ -639,7 +643,7 @@
else
hw_dbg(hw, "Flash update time out\n");
- if (hw->revision_id == 0) {
+ if (hw->mac.type == ixgbe_mac_X540 && hw->revision_id == 0) {
flup = IXGBE_READ_REG(hw, IXGBE_EEC);
if (flup & IXGBE_EEC_SEC1VAL) {
@@ -928,4 +932,86 @@
return 0;
}
+/**
+ * ixgbe_get_thermal_sensor_data - Gathers thermal sensor data for X540
+ * @hw: pointer to hardware structure
+ *
+ * Returns the X540 thermal sensor data structure
+ **/
+s32 ixgbe_get_thermal_sensor_data_X540(struct ixgbe_hw *hw)
+{
+ s32 status = 0;
+ u16 phy_val = 0;
+ struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;
+
+ /* Only support thermal sensors on physical port 0 */
+ if (hw->mac.type != ixgbe_mac_X540 ||
+ IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1) {
+ status = IXGBE_NOT_IMPLEMENTED;
+ goto out;
+ }
+
+ /* Check if thermal sensor is not disabled in NVM */
+ if (!hw->mac.thermal_sensor_enabled) {
+ status = IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+ goto out;
+ }
+
+ /* Get the X540 internal thermal sensor reading */
+ status = hw->phy.ops.read_reg(hw, IXGBE_TEMP_VALUE_ADDR_X540,
+ IXGBE_TEMP_STATUS_PAGE_X540, &phy_val);
+
+ if (0 == status)
+ data->sensor[0].temp = (u8)(phy_val >> 8);
+
+out:
+ return status;
+}
+
+/**
+ * ixgbe_init_thermal_sensor_thresh_X540
+ * @hw: pointer to hardware structure
+ *
+ * Init the X540 threshold and location values into mac.thermal_sensor_data
+ **/
+s32 ixgbe_init_thermal_sensor_thresh_X540(struct ixgbe_hw *hw)
+{
+ s32 status = 0;
+ u16 fail_thresh = 0, warn_thresh = 0;
+ struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;
+
+ memset(data, 0, sizeof(struct ixgbe_thermal_sensor_data));
+
+ /* Only support thermal sensors on physical port 0 */
+ if (hw->mac.type != ixgbe_mac_X540 ||
+ IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1) {
+ status = IXGBE_NOT_IMPLEMENTED;
+ goto out;
+ }
+
+ if (!hw->mac.thermal_sensor_enabled) {
+ status = IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+ goto out;
+ }
+
+ status = hw->phy.ops.read_reg(hw, IXGBE_TEMP_PROV_2_ADDR_X540,
+ IXGBE_TEMP_STATUS_PAGE_X540, &fail_thresh);
+
+ if (0 != status)
+ goto out;
+
+ status = hw->phy.ops.read_reg(hw, IXGBE_TEMP_PROV_4_ADDR_X540,
+ IXGBE_TEMP_STATUS_PAGE_X540, &warn_thresh);
+
+ if (0 != status)
+ goto out;
+
+ data->sensor[0].location = 0x1;
+ data->sensor[0].caution_thresh = (u8)(fail_thresh >> 8);
+ data->sensor[0].max_op_thresh = (u8)(warn_thresh >> 8);
+
+out:
+ return status;
+}
+
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/ixgbe_x540.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -34,7 +34,7 @@
ixgbe_link_speed *speed, bool *autoneg);
enum ixgbe_media_type ixgbe_get_media_type_X540(struct ixgbe_hw *hw);
s32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw, ixgbe_link_speed speed,
- bool autoneg, bool link_up_wait_to_complete);
+ bool link_up_wait_to_complete);
s32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw);
s32 ixgbe_start_hw_X540(struct ixgbe_hw *hw);
u32 ixgbe_get_supported_physical_layer_X540(struct ixgbe_hw *hw);
@@ -55,4 +55,7 @@
s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index);
s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index);
+s32 ixgbe_get_thermal_sensor_data_X540(struct ixgbe_hw *hw);
+s32 ixgbe_init_thermal_sensor_thresh_X540(struct ixgbe_hw *hw);
#endif /* _IXGBE_X540_H_ */
+
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/kcompat.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -205,7 +205,7 @@
/* get the precision */
precision = -1;
if (*fmt == '.') {
- ++fmt;
+ ++fmt;
if (isdigit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == '*') {
@@ -601,6 +601,42 @@
return ret;
}
+#ifndef do_div
+#if BITS_PER_LONG == 32
+uint32_t __attribute__((weak)) _kc__div64_32(uint64_t *n, uint32_t base)
+{
+ uint64_t rem = *n;
+ uint64_t b = base;
+ uint64_t res, d = 1;
+ uint32_t high = rem >> 32;
+
+ /* Reduce the thing a bit first */
+ res = 0;
+ if (high >= base) {
+ high /= base;
+ res = (uint64_t) high << 32;
+ rem -= (uint64_t) (high*base) << 32;
+ }
+
+ while ((int64_t)b > 0 && b < rem) {
+ b = b+b;
+ d = d+d;
+ }
+
+ do {
+ if (rem >= b) {
+ rem -= b;
+ res += d;
+ }
+ b >>= 1;
+ d >>= 1;
+ } while (d);
+
+ *n = res;
+ return rem;
+}
+#endif /* BITS_PER_LONG == 32 */
+#endif /* do_div */
#endif /* 2.6.0 => 2.4.6 */
/*****************************************************************************/
@@ -656,13 +692,13 @@
int _kc_skb_pad(struct sk_buff *skb, int pad)
{
int ntail;
-
+
/* If the skbuff is non linear tailroom is always zero.. */
if(!skb_cloned(skb) && skb_tailroom(skb) >= pad) {
memset(skb->data+skb->len, 0, pad);
return 0;
}
-
+
ntail = skb->data_len + pad - (skb->end - skb->tail);
if (likely(skb_cloned(skb) || ntail > 0)) {
if (pskb_expand_head(skb, 0, ntail, GFP_ATOMIC));
@@ -681,7 +717,7 @@
free_skb:
kfree_skb(skb);
return -ENOMEM;
-}
+}
#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5,4)))
int _kc_pci_save_state(struct pci_dev *pdev)
@@ -889,6 +925,7 @@
}
}
}
+
#endif /* < 2.6.22 */
/*****************************************************************************/
@@ -1084,7 +1121,7 @@
for (i = txq; i < dev->num_tx_queues; i++) {
qdisc = netdev_get_tx_queue(dev, i)->qdisc;
if (qdisc) {
- spin_lock_bh(qdisc_lock(qdisc));
+ spin_lock_bh(qdisc_lock(qdisc));
qdisc_reset(qdisc);
spin_unlock_bh(qdisc_lock(qdisc));
}
@@ -1094,6 +1131,27 @@
#endif /* CONFIG_NETDEVICES_MULTIQUEUE */
#endif /* !(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,0)) */
#endif /* HAVE_TX_MQ */
+
+ssize_t _kc_simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
+ const void __user *from, size_t count)
+{
+ loff_t pos = *ppos;
+ size_t res;
+
+ if (pos < 0)
+ return -EINVAL;
+ if (pos >= available || !count)
+ return 0;
+ if (count > available - pos)
+ count = available - pos;
+ res = copy_from_user(to + pos, from, count);
+ if (res == count)
+ return -EFAULT;
+ count -= res;
+ *ppos = pos + count;
+ return count;
+}
+
#endif /* < 2.6.35 */
/*****************************************************************************/
@@ -1117,17 +1175,19 @@
}
#endif /* < 2.6.36 */
-/*****************************************************************************/
-#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) )
+/******************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) )
+#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(6,0)))
#ifdef HAVE_NETDEV_SELECT_QUEUE
#include <net/ip.h>
-static u32 _kc_simple_tx_hashrnd;
-static u32 _kc_simple_tx_hashrnd_initialized;
+#include <linux/pkt_sched.h>
u16 ___kc_skb_tx_hash(struct net_device *dev, const struct sk_buff *skb,
u16 num_tx_queues)
{
u32 hash;
+ u16 qoffset = 0;
+ u16 qcount = num_tx_queues;
if (skb_rx_queue_recorded(skb)) {
hash = skb_get_rx_queue(skb);
@@ -1136,9 +1196,19 @@
return hash;
}
- if (unlikely(!_kc_simple_tx_hashrnd_initialized)) {
- get_random_bytes(&_kc_simple_tx_hashrnd, 4);
- _kc_simple_tx_hashrnd_initialized = 1;
+ if (netdev_get_num_tc(dev)) {
+ struct adapter_struct *kc_adapter = netdev_priv(dev);
+
+ if (skb->priority == TC_PRIO_CONTROL) {
+ qoffset = kc_adapter->dcb_tc - 1;
+ } else {
+ qoffset = skb->vlan_tci;
+ qoffset &= IXGBE_TX_FLAGS_VLAN_PRIO_MASK;
+ qoffset >>= 13;
+ }
+
+ qcount = kc_adapter->ring_feature[RING_F_RSS].indices;
+ qoffset *= qcount;
}
if (skb->sk && skb->sk->sk_hash)
@@ -1150,16 +1220,12 @@
hash = skb->protocol;
#endif
- hash = jhash_1word(hash, _kc_simple_tx_hashrnd);
+ hash = jhash_1word(hash, _kc_hashrnd);
- return (u16) (((u64) hash * num_tx_queues) >> 32);
+ return (u16) (((u64) hash * qcount) >> 32) + qoffset;
}
#endif /* HAVE_NETDEV_SELECT_QUEUE */
-#endif /* < 2.6.38 */
-/******************************************************************************/
-#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) )
-#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(6,0)))
u8 _kc_netdev_get_num_tc(struct net_device *dev)
{
struct adapter_struct *kc_adapter = netdev_priv(dev);
@@ -1202,4 +1268,330 @@
skb->data_len += size;
skb->truesize += truesize;
}
+
+int _kc_simple_open(struct inode *inode, struct file *file)
+{
+ if (inode->i_private)
+ file->private_data = inode->i_private;
+
+ return 0;
+}
+
#endif /* < 3.4.0 */
+
+/******************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) )
+#if !(SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,3,0))
+static inline int __kc_pcie_cap_version(struct pci_dev *dev)
+{
+ int pos;
+ u16 reg16;
+
+ pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ if (!pos)
+ return 0;
+ pci_read_config_word(dev, pos + PCI_EXP_FLAGS, ®16);
+ return reg16 & PCI_EXP_FLAGS_VERS;
+}
+
+static inline bool __kc_pcie_cap_has_devctl(const struct pci_dev __always_unused *dev)
+{
+ return true;
+}
+
+static inline bool __kc_pcie_cap_has_lnkctl(struct pci_dev *dev)
+{
+ int type = pci_pcie_type(dev);
+
+ return __kc_pcie_cap_version(dev) > 1 ||
+ type == PCI_EXP_TYPE_ROOT_PORT ||
+ type == PCI_EXP_TYPE_ENDPOINT ||
+ type == PCI_EXP_TYPE_LEG_END;
+}
+
+static inline bool __kc_pcie_cap_has_sltctl(struct pci_dev *dev)
+{
+ int type = pci_pcie_type(dev);
+ int pos;
+ u16 pcie_flags_reg;
+
+ pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ if (!pos)
+ return 0;
+ pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &pcie_flags_reg);
+
+ return __kc_pcie_cap_version(dev) > 1 ||
+ type == PCI_EXP_TYPE_ROOT_PORT ||
+ (type == PCI_EXP_TYPE_DOWNSTREAM &&
+ pcie_flags_reg & PCI_EXP_FLAGS_SLOT);
+}
+
+static inline bool __kc_pcie_cap_has_rtctl(struct pci_dev *dev)
+{
+ int type = pci_pcie_type(dev);
+
+ return __kc_pcie_cap_version(dev) > 1 ||
+ type == PCI_EXP_TYPE_ROOT_PORT ||
+ type == PCI_EXP_TYPE_RC_EC;
+}
+
+static bool __kc_pcie_capability_reg_implemented(struct pci_dev *dev, int pos)
+{
+ if (!pci_is_pcie(dev))
+ return false;
+
+ switch (pos) {
+ case PCI_EXP_FLAGS_TYPE:
+ return true;
+ case PCI_EXP_DEVCAP:
+ case PCI_EXP_DEVCTL:
+ case PCI_EXP_DEVSTA:
+ return __kc_pcie_cap_has_devctl(dev);
+ case PCI_EXP_LNKCAP:
+ case PCI_EXP_LNKCTL:
+ case PCI_EXP_LNKSTA:
+ return __kc_pcie_cap_has_lnkctl(dev);
+ case PCI_EXP_SLTCAP:
+ case PCI_EXP_SLTCTL:
+ case PCI_EXP_SLTSTA:
+ return __kc_pcie_cap_has_sltctl(dev);
+ case PCI_EXP_RTCTL:
+ case PCI_EXP_RTCAP:
+ case PCI_EXP_RTSTA:
+ return __kc_pcie_cap_has_rtctl(dev);
+ case PCI_EXP_DEVCAP2:
+ case PCI_EXP_DEVCTL2:
+ case PCI_EXP_LNKCAP2:
+ case PCI_EXP_LNKCTL2:
+ case PCI_EXP_LNKSTA2:
+ return __kc_pcie_cap_version(dev) > 1;
+ default:
+ return false;
+ }
+}
+
+/*
+ * Note that these accessor functions are only for the "PCI Express
+ * Capability" (see PCIe spec r3.0, sec 7.8). They do not apply to the
+ * other "PCI Express Extended Capabilities" (AER, VC, ACS, MFVC, etc.)
+ */
+int __kc_pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val)
+{
+ int ret;
+
+ *val = 0;
+ if (pos & 1)
+ return -EINVAL;
+
+ if (__kc_pcie_capability_reg_implemented(dev, pos)) {
+ ret = pci_read_config_word(dev, pci_pcie_cap(dev) + pos, val);
+ /*
+ * Reset *val to 0 if pci_read_config_word() fails, it may
+ * have been written as 0xFFFF if hardware error happens
+ * during pci_read_config_word().
+ */
+ if (ret)
+ *val = 0;
+ return ret;
+ }
+
+ /*
+ * For Functions that do not implement the Slot Capabilities,
+ * Slot Status, and Slot Control registers, these spaces must
+ * be hardwired to 0b, with the exception of the Presence Detect
+ * State bit in the Slot Status register of Downstream Ports,
+ * which must be hardwired to 1b. (PCIe Base Spec 3.0, sec 7.8)
+ */
+ if (pci_is_pcie(dev) && pos == PCI_EXP_SLTSTA &&
+ pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) {
+ *val = PCI_EXP_SLTSTA_PDS;
+ }
+
+ return 0;
+}
+
+int __kc_pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val)
+{
+ if (pos & 1)
+ return -EINVAL;
+
+ if (!__kc_pcie_capability_reg_implemented(dev, pos))
+ return 0;
+
+ return pci_write_config_word(dev, pci_pcie_cap(dev) + pos, val);
+}
+
+int __kc_pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos,
+ u16 clear, u16 set)
+{
+ int ret;
+ u16 val;
+
+ ret = __kc_pcie_capability_read_word(dev, pos, &val);
+ if (!ret) {
+ val &= ~clear;
+ val |= set;
+ ret = __kc_pcie_capability_write_word(dev, pos, val);
+ }
+
+ return ret;
+}
+#endif /* !(SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,3,0)) */
+#endif /* < 3.7.0 */
+
+/******************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) )
+#ifdef CONFIG_XPS
+#if NR_CPUS < 64
+#define _KC_MAX_XPS_CPUS NR_CPUS
+#else
+#define _KC_MAX_XPS_CPUS 64
+#endif
+
+/*
+ * netdev_queue sysfs structures and functions.
+ */
+struct _kc_netdev_queue_attribute {
+ struct attribute attr;
+ ssize_t (*show)(struct netdev_queue *queue,
+ struct _kc_netdev_queue_attribute *attr, char *buf);
+ ssize_t (*store)(struct netdev_queue *queue,
+ struct _kc_netdev_queue_attribute *attr, const char *buf, size_t len);
+};
+
+#define to_kc_netdev_queue_attr(_attr) container_of(_attr, \
+ struct _kc_netdev_queue_attribute, attr)
+
+int __kc_netif_set_xps_queue(struct net_device *dev, struct cpumask *mask,
+ u16 index)
+{
+ struct netdev_queue *txq = netdev_get_tx_queue(dev, index);
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) )
+ /* Redhat requires some odd extended netdev structures */
+ struct netdev_tx_queue_extended *txq_ext =
+ netdev_extended(dev)->_tx_ext + index;
+ struct kobj_type *ktype = txq_ext->kobj.ktype;
+#else
+ struct kobj_type *ktype = txq->kobj.ktype;
+#endif
+ struct _kc_netdev_queue_attribute *xps_attr;
+ struct attribute *attr = NULL;
+ int i, len, err;
+#define _KC_XPS_BUFLEN (DIV_ROUND_UP(_KC_MAX_XPS_CPUS, 32) * 9)
+ char buf[_KC_XPS_BUFLEN];
+
+ if (!ktype)
+ return -ENOMEM;
+
+ /* attempt to locate the XPS attribute in the Tx queue */
+ for (i = 0; (attr = ktype->default_attrs[i]); i++) {
+ if (!strcmp("xps_cpus", attr->name))
+ break;
+ }
+
+ /* if we did not find it return an error */
+ if (!attr)
+ return -EINVAL;
+
+ /* copy the mask into a string */
+ len = bitmap_scnprintf(buf, _KC_XPS_BUFLEN,
+ cpumask_bits(mask), _KC_MAX_XPS_CPUS);
+ if (!len)
+ return -ENOMEM;
+
+ xps_attr = to_kc_netdev_queue_attr(attr);
+
+ /* Store the XPS value using the SYSFS store call */
+ err = xps_attr->store(txq, xps_attr, buf, len);
+
+ /* we only had an error on err < 0 */
+ return (err < 0) ? err : 0;
+}
+#endif /* CONFIG_XPS */
+#ifdef HAVE_NETDEV_SELECT_QUEUE
+static inline int kc_get_xps_queue(struct net_device *dev, struct sk_buff *skb)
+{
+#ifdef CONFIG_XPS
+ struct xps_dev_maps *dev_maps;
+ struct xps_map *map;
+ int queue_index = -1;
+
+ rcu_read_lock();
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) )
+ /* Redhat requires some odd extended netdev structures */
+ dev_maps = rcu_dereference(netdev_extended(dev)->xps_maps);
+#else
+ dev_maps = rcu_dereference(dev->xps_maps);
+#endif
+ if (dev_maps) {
+ map = rcu_dereference(
+ dev_maps->cpu_map[raw_smp_processor_id()]);
+ if (map) {
+ if (map->len == 1)
+ queue_index = map->queues[0];
+ else {
+ u32 hash;
+ if (skb->sk && skb->sk->sk_hash)
+ hash = skb->sk->sk_hash;
+ else
+ hash = (__force u16) skb->protocol ^
+ skb->rxhash;
+ hash = jhash_1word(hash, _kc_hashrnd);
+ queue_index = map->queues[
+ ((u64)hash * map->len) >> 32];
+ }
+ if (unlikely(queue_index >= dev->real_num_tx_queues))
+ queue_index = -1;
+ }
+ }
+ rcu_read_unlock();
+
+ return queue_index;
+#else
+ struct adapter_struct *kc_adapter = netdev_priv(dev);
+ int queue_index = -1;
+
+ if (kc_adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
+ queue_index = skb_rx_queue_recorded(skb) ?
+ skb_get_rx_queue(skb) :
+ smp_processor_id();
+ while (unlikely(queue_index >= dev->real_num_tx_queues))
+ queue_index -= dev->real_num_tx_queues;
+ return queue_index;
+ }
+
+ return -1;
+#endif
+}
+
+u16 __kc_netdev_pick_tx(struct net_device *dev, struct sk_buff *skb)
+{
+ struct sock *sk = skb->sk;
+ int queue_index = sk_tx_queue_get(sk);
+ int new_index;
+
+ if (queue_index >= 0 && queue_index < dev->real_num_tx_queues) {
+#ifdef CONFIG_XPS
+ if (!skb->ooo_okay)
+#endif
+ return queue_index;
+ }
+
+ new_index = kc_get_xps_queue(dev, skb);
+ if (new_index < 0)
+ new_index = skb_tx_hash(dev, skb);
+
+ if (queue_index != new_index && sk) {
+ struct dst_entry *dst =
+ rcu_dereference(sk->sk_dst_cache);
+
+ if (dst && skb_dst(skb) == dst)
+ sk_tx_queue_set(sk, queue_index);
+
+ }
+
+ return new_index;
+}
+
+#endif /* HAVE_NETDEV_SELECT_QUEUE */
+#endif /* 3.9.0 */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/kcompat.h
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
@@ -286,6 +286,24 @@
#define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0)
#endif
+#ifdef IS_ENABLED
+#undef IS_ENABLED
+#undef __ARG_PLACEHOLDER_1
+#undef config_enabled
+#undef _config_enabled
+#undef __config_enabled
+#undef ___config_enabled
+#endif
+
+#define __ARG_PLACEHOLDER_1 0,
+#define config_enabled(cfg) _config_enabled(cfg)
+#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
+#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
+#define ___config_enabled(__ignored, val, ...) val
+
+#define IS_ENABLED(option) \
+ (config_enabled(option) || config_enabled(option##_MODULE))
+
#ifndef NETIF_F_HW_VLAN_TX
struct _kc_vlan_ethhdr {
unsigned char h_dest[ETH_ALEN];
@@ -665,20 +683,21 @@
#ifndef SLE_VERSION
#define SLE_VERSION(a,b,c) KERNEL_VERSION(a,b,c)
#endif
-#ifndef SLE_VERSION_CODE
#ifdef CONFIG_SUSE_KERNEL
-/* SLES11 GA is 2.6.27 based */
#if ( LINUX_VERSION_CODE == KERNEL_VERSION(2,6,27) )
+/* SLES11 GA is 2.6.27 based */
#define SLE_VERSION_CODE SLE_VERSION(11,0,0)
#elif ( LINUX_VERSION_CODE == KERNEL_VERSION(2,6,32) )
/* SLES11 SP1 is 2.6.32 based */
#define SLE_VERSION_CODE SLE_VERSION(11,1,0)
-#else
-#define SLE_VERSION_CODE 0
-#endif
-#else /* CONFIG_SUSE_KERNEL */
-#define SLE_VERSION_CODE 0
+#elif ((LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,61)) && \
+ (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)))
+/* SLES11 SP3 is at least 3.0.61+ based */
+#define SLE_VERSION_CODE SLE_VERSION(11,3,0)
+#endif /* LINUX_VERSION_CODE == KERNEL_VERSION(x,y,z) */
#endif /* CONFIG_SUSE_KERNEL */
+#ifndef SLE_VERSION_CODE
+#define SLE_VERSION_CODE 0
#endif /* SLE_VERSION_CODE */
#ifdef __KLOCWORK__
@@ -990,6 +1009,13 @@
/* 2.4.22 => 2.4.17 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) )
#define pci_name(x) ((x)->slot_name)
+
+#ifndef SUPPORTED_10000baseT_Full
+#define SUPPORTED_10000baseT_Full (1 << 12)
+#endif
+#ifndef ADVERTISED_10000baseT_Full
+#define ADVERTISED_10000baseT_Full (1 << 12)
+#endif
#endif
/*****************************************************************************/
@@ -1049,6 +1075,11 @@
#endif /* 2.6.4 => 2.6.0 */
/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) )
+#define __user
+#endif /* < 2.4.27 */
+
+/*****************************************************************************/
/* 2.5.71 => 2.4.x */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71) )
#define sk_protocol protocol
@@ -1233,13 +1264,6 @@
/* 2.5.28 => 2.4.23 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) )
-static inline void _kc_synchronize_irq(void)
-{
- synchronize_irq();
-}
-#undef synchronize_irq
-#define synchronize_irq(X) _kc_synchronize_irq()
-
#include <linux/tqueue.h>
#define work_struct tq_struct
#undef INIT_WORK
@@ -1255,6 +1279,10 @@
/*****************************************************************************/
/* 2.6.0 => 2.5.28 */
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) )
+#ifndef read_barrier_depends
+#define read_barrier_depends() rmb()
+#endif
+
#undef get_cpu
#define get_cpu() smp_processor_id()
#undef put_cpu
@@ -1315,8 +1343,40 @@
extern size_t _kc_strlcpy(char *dest, const char *src, size_t size);
#endif /* strlcpy */
-#endif /* 2.6.0 => 2.5.28 */
+#ifndef do_div
+#if BITS_PER_LONG == 64
+# define do_div(n,base) ({ \
+ uint32_t __base = (base); \
+ uint32_t __rem; \
+ __rem = ((uint64_t)(n)) % __base; \
+ (n) = ((uint64_t)(n)) / __base; \
+ __rem; \
+ })
+#elif BITS_PER_LONG == 32
+extern uint32_t _kc__div64_32(uint64_t *dividend, uint32_t divisor);
+# define do_div(n,base) ({ \
+ uint32_t __base = (base); \
+ uint32_t __rem; \
+ if (likely(((n) >> 32) == 0)) { \
+ __rem = (uint32_t)(n) % __base; \
+ (n) = (uint32_t)(n) / __base; \
+ } else \
+ __rem = _kc__div64_32(&(n), __base); \
+ __rem; \
+ })
+#else /* BITS_PER_LONG == ?? */
+# error do_div() does not yet support the C64
+#endif /* BITS_PER_LONG */
+#endif /* do_div */
+#ifndef NSEC_PER_SEC
+#define NSEC_PER_SEC 1000000000L
+#endif
+
+#undef HAVE_I2C_SUPPORT
+#else /* 2.6.0 */
+
+#endif /* 2.6.0 => 2.5.28 */
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) )
#define dma_pool pci_pool
@@ -1403,6 +1463,16 @@
#ifndef PCI_EXP_DEVCTL_CERE
#define PCI_EXP_DEVCTL_CERE 0x0001
#endif
+#define PCI_EXP_FLAGS 2 /* Capabilities register */
+#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */
+#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */
+#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */
+#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */
+#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */
+#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
+#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
+#define PCI_EXP_DEVCAP 4 /* Device capabilities */
+#define PCI_EXP_DEVSTA 10 /* Device Status */
#define msleep(x) do { set_current_state(TASK_UNINTERRUPTIBLE); \
schedule_timeout((x * HZ)/1000 + 2); \
} while (0)
@@ -1593,6 +1663,15 @@
return (m * HZ + KC_USEC_PER_SEC - 1) / KC_USEC_PER_SEC;
#endif
}
+
+#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
+#define PCI_EXP_LNKSTA 18 /* Link Status */
+#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
+#define PCI_EXP_SLTCTL 24 /* Slot Control */
+#define PCI_EXP_SLTSTA 26 /* Slot Status */
+#define PCI_EXP_RTCTL 28 /* Root Control */
+#define PCI_EXP_RTCAP 30 /* Root Capabilities */
+#define PCI_EXP_RTSTA 32 /* Root Status */
#endif /* < 2.6.11 */
/*****************************************************************************/
@@ -1606,8 +1685,16 @@
/* Advertisement control register. */
#define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */
#define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymmetric pause */
+/* Link partner ability register. */
+#define LPA_PAUSE_CAP 0x0400 /* Can pause */
+#define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */
/* 1000BASE-T Control register */
#define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */
+#define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */
+/* 1000BASE-T Status register */
+#define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */
+#define LPA_1000REMRXOK 0x1000 /* Link partner remote receiver status */
+
#ifndef is_zero_ether_addr
#define is_zero_ether_addr _kc_is_zero_ether_addr
static inline int _kc_is_zero_ether_addr(const u8 *addr)
@@ -1821,6 +1908,10 @@
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) )
+#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5,4)))
+#define i_private u.generic_ip
+#endif /* >= RHEL 5.4 */
+
#ifndef DIV_ROUND_UP
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#endif
@@ -1988,6 +2079,10 @@
do { \
skb->tail = skb->data; \
} while (0)
+#define skb_set_tail_pointer(skb, offset) \
+ do { \
+ skb->tail = skb->data + offset; \
+ } while (0)
#define skb_copy_to_linear_data(skb, from, len) \
memcpy(skb->data, from, len)
#define skb_copy_to_linear_data_offset(skb, offset, from, len) \
@@ -2035,6 +2130,14 @@
const void *buf, size_t len, bool ascii);
#define print_hex_dump(lvl, s, t, r, g, b, l, a) \
_kc_print_hex_dump(lvl, s, t, r, g, b, l, a)
+#ifndef ADVERTISED_2500baseX_Full
+#define ADVERTISED_2500baseX_Full (1 << 15)
+#endif
+#ifndef SUPPORTED_2500baseX_Full
+#define SUPPORTED_2500baseX_Full (1 << 15)
+#endif
+
+
#else /* 2.6.22 */
#define ETH_TYPE_TRANS_SETS_DEV
#define HAVE_NETDEV_STATS_IN_NETDEV
@@ -2213,6 +2316,11 @@
#ifndef IXGBE_SYSFS
#define IXGBE_SYSFS
#endif /* IXGBE_SYSFS */
+#if IS_ENABLED(CONFIG_HWMON)
+#ifndef IXGBE_HWMON
+#define IXGBE_HWMON
+#endif /* IXGBE_HWMON */
+#endif /* CONFIG_HWMON */
#endif /* < 2.6.25 */
@@ -2370,9 +2478,13 @@
unlikely(__ret_warn_on); \
})
#endif /* WARN */
+#undef HAVE_IXGBE_DEBUG_FS
#else /* < 2.6.27 */
#define HAVE_TX_MQ
#define HAVE_NETDEV_SELECT_QUEUE
+#ifdef CONFIG_DEBUG_FS
+#define HAVE_IXGBE_DEBUG_FS
+#endif /* CONFIG_DEBUG_FS */
#endif /* < 2.6.27 */
/*****************************************************************************/
@@ -2392,6 +2504,10 @@
}
#define __skb_queue_head_init(_q) __kc_skb_queue_head_init(_q)
#endif
+
+#define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */
+#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
+
#endif /* < 2.6.28 */
/*****************************************************************************/
@@ -2408,6 +2524,9 @@
#ifndef pcie_aspm_enabled
#define pcie_aspm_enabled() (1)
#endif /* pcie_aspm_enabled */
+
+#define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */
+
#else /* < 2.6.29 */
#ifndef HAVE_NET_DEVICE_OPS
#define HAVE_NET_DEVICE_OPS
@@ -2435,7 +2554,20 @@
#define pr_cont(fmt, ...) \
printk(KERN_CONT fmt, ##__VA_ARGS__)
#endif /* pr_cont */
-#else
+static inline void _kc_synchronize_irq(unsigned int a)
+{
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) )
+ synchronize_irq();
+#else /* < 2.5.28 */
+ synchronize_irq(a);
+#endif /* < 2.5.28 */
+}
+#undef synchronize_irq
+#define synchronize_irq(a) _kc_synchronize_irq(a)
+
+#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
+
+#else /* < 2.6.30 */
#define HAVE_ASPM_QUIRKS
#endif /* < 2.6.30 */
@@ -2459,6 +2591,30 @@
#ifndef MDIO_PHY_ID_DEVAD
#define MDIO_PHY_ID_DEVAD 0x001f
#endif
+#ifndef skb_dst
+#define skb_dst(s) ((s)->dst)
+#endif
+
+#ifndef SUPPORTED_1000baseKX_Full
+#define SUPPORTED_1000baseKX_Full (1 << 17)
+#endif
+#ifndef SUPPORTED_10000baseKX4_Full
+#define SUPPORTED_10000baseKX4_Full (1 << 18)
+#endif
+#ifndef SUPPORTED_10000baseKR_Full
+#define SUPPORTED_10000baseKR_Full (1 << 19)
+#endif
+
+#ifndef ADVERTISED_1000baseKX_Full
+#define ADVERTISED_1000baseKX_Full (1 << 17)
+#endif
+#ifndef ADVERTISED_10000baseKX4_Full
+#define ADVERTISED_10000baseKX4_Full (1 << 18)
+#endif
+#ifndef ADVERTISED_10000baseKR_Full
+#define ADVERTISED_10000baseKR_Full (1 << 19)
+#endif
+
#else /* < 2.6.31 */
#ifndef HAVE_NETDEV_STORAGE_ADDRESS
#define HAVE_NETDEV_STORAGE_ADDRESS
@@ -2581,6 +2737,36 @@
#define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
#endif /* CONFIG_X86_64 && !CONFIG_NEED_DMA_MAP_STATE */
#endif /* RHEL_RELEASE_CODE */
+
+#if (!(RHEL_RELEASE_CODE && \
+ (((RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5,8)) && \
+ (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,0))) || \
+ ((RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1)) && \
+ (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0))))))
+static inline bool pci_is_pcie(struct pci_dev *dev)
+{
+ return !!pci_pcie_cap(dev);
+}
+#endif /* RHEL_RELEASE_CODE */
+
+#ifndef __always_unused
+#define __always_unused
+#endif
+
+#if (!(RHEL_RELEASE_CODE && \
+ (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,2))))
+#define sk_tx_queue_get(_sk) (-1)
+#define sk_tx_queue_set(_sk, _tx_queue) do {} while(0)
+#endif /* !(RHEL >= 6.2) */
+
+#if (RHEL_RELEASE_CODE && \
+ (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,4)) && \
+ (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)))
+#define HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT
+#define HAVE_ETHTOOL_SET_PHYS_ID
+#define HAVE_ETHTOOL_GET_TS_INFO
+#endif /* RHEL >= 6.4 && RHEL < 7.0 */
+
#else /* < 2.6.33 */
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
#ifndef HAVE_NETDEV_OPS_FCOE_GETWWN
@@ -2752,6 +2938,21 @@
#define dma_unmap_len pci_unmap_len
#define dma_unmap_len_set pci_unmap_len_set
#endif /* DEFINE_DMA_UNMAP_ADDR */
+
+#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,3))
+#ifdef IGB_HWMON
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#define sysfs_attr_init(attr) \
+ do { \
+ static struct lock_class_key __key; \
+ (attr)->key = &__key; \
+ } while (0)
+#else
+#define sysfs_attr_init(attr) do {} while (0)
+#endif /* CONFIG_DEBUG_LOCK_ALLOC */
+#endif /* IGB_HWMON */
+#endif /* RHEL_RELEASE_CODE */
+
#else /* < 2.6.34 */
#define HAVE_SYSTEM_SLEEP_PM_OPS
#ifndef HAVE_SET_RX_MODE
@@ -2762,6 +2963,11 @@
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) )
+
+ssize_t _kc_simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
+ const void __user *from, size_t count);
+#define simple_write_to_buffer _kc_simple_write_to_buffer
+
#ifndef numa_node_id
#define numa_node_id() 0
#endif
@@ -2784,6 +2990,9 @@
#ifndef ETH_FLAG_RXHASH
#define ETH_FLAG_RXHASH (1<<28)
#endif /* ETH_FLAG_RXHASH */
+#if (RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,0))
+#define HAVE_IRQ_AFFINITY_HINT
+#endif
#else /* < 2.6.35 */
#define HAVE_PM_QOS_REQUEST_LIST
#define HAVE_IRQ_AFFINITY_HINT
@@ -2844,6 +3053,13 @@
#define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000))
#else /* < 2.6.36 */
+
+#define msleep(x) do { if (x > 20) \
+ msleep(x); \
+ else \
+ usleep_range(1000 * x, 2000 * x); \
+ } while (0)
+
#define HAVE_PM_QOS_REQUEST_ACTIVE
#define HAVE_8021P_SUPPORT
#define HAVE_NDO_GET_STATS64
@@ -2954,9 +3170,9 @@
#define DCB_CAP_DCBX_STATIC 0x10
#endif
#endif /* CONFIG_DCB */
-extern u16 ___kc_skb_tx_hash(struct net_device *, const struct sk_buff *, u16);
-#define __skb_tx_hash(n, s, q) ___kc_skb_tx_hash((n), (s), (q))
-#else /* < 2.6.38 */
+#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,2))
+#define CONFIG_XPS
+#endif /* RHEL_RELEASE_VERSION(6,2) */
#endif /* < 2.6.38 */
/*****************************************************************************/
@@ -2968,6 +3184,8 @@
skb = tmp, tmp = skb->prev)
#endif
#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(6,0)))
+extern u16 ___kc_skb_tx_hash(struct net_device *, const struct sk_buff *, u16);
+#define __skb_tx_hash(n, s, q) ___kc_skb_tx_hash((n), (s), (q))
extern u8 _kc_netdev_get_num_tc(struct net_device *dev);
#define netdev_get_num_tc(dev) _kc_netdev_get_num_tc(dev)
extern int _kc_netdev_set_num_tc(struct net_device *dev, u8 num_tc);
@@ -3066,19 +3284,6 @@
#define HAVE_ETHTOOL_SET_PHYS_ID
#endif /* < 2.6.40 */
-/*****************************************************************************/
-#undef CONFIG_IXGBE_PTP
-#ifdef IXGBE_PTP
-#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) ) && (defined(CONFIG_PTP_1588_CLOCK) || defined(CONFIG_PTP_1588_CLOCK_MODULE))
-#define CONFIG_IXGBE_PTP
-#else
-#error Cannot enable PTP Hardware Clock due to insufficient kernel support
-#endif
-#endif /* IXGBE_PTP */
-
-/*****************************************************************************/
-
-/*****************************************************************************/
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) )
@@ -3088,6 +3293,11 @@
#define dcb_ieee_setapp(dev, app) dcb_setapp(dev, app)
#define dcb_ieee_delapp(dev, app) 0
#define dcb_ieee_getapp_mask(dev, app) (1 << app->priority)
+
+/* 1000BASE-T Control register */
+#define CTL1000_AS_MASTER 0x0800
+#define CTL1000_ENABLE_MASTER 0x1000
+
#else /* < 3.1.0 */
#ifndef HAVE_DCBNL_IEEE_DELAPP
#define HAVE_DCBNL_IEEE_DELAPP
@@ -3133,6 +3343,9 @@
#endif /* skb_frag_address */
#ifndef skb_frag_dma_map
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) )
+#include <linux/dma-mapping.h>
+#endif
#define skb_frag_dma_map(dev,frag,offset,size,dir) \
_kc_skb_frag_dma_map(dev,frag,offset,size,dir)
static inline dma_addr_t _kc_skb_frag_dma_map(struct device *dev,
@@ -3173,6 +3386,8 @@
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) )
typedef u32 netdev_features_t;
+#undef PCI_EXP_TYPE_RC_EC
+#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */
#else /* ! < 3.3.0 */
#define HAVE_INT_NDO_VLAN_RX_ADD_VID
#ifdef ETHTOOL_SRXNTUPLE
@@ -3191,13 +3406,35 @@
#define NUMTCS_RETURNS_U8
+int _kc_simple_open(struct inode *inode, struct file *file);
+#define simple_open _kc_simple_open
+
#ifndef skb_add_rx_frag
#define skb_add_rx_frag _kc_skb_add_rx_frag
extern void _kc_skb_add_rx_frag(struct sk_buff *, int, struct page *,
int, int, unsigned int);
#endif
-#endif /* < 3.4.0 */
+#ifdef NET_ADDR_RANDOM
+#define eth_hw_addr_random(N) do { \
+ random_ether_addr(N->dev_addr); \
+ N->addr_assign_type |= NET_ADDR_RANDOM; \
+ } while (0)
+#else /* NET_ADDR_RANDOM */
+#define eth_hw_addr_random(N) random_ether_addr(N->dev_addr)
+#endif /* NET_ADDR_RANDOM */
+#else /* < 3.4.0 */
+#include <linux/kconfig.h>
+#endif /* >= 3.4.0 */
+
+/*****************************************************************************/
+#if defined(E1000E_PTP) || defined(IGB_PTP) || defined(IXGBE_PTP)
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) ) && IS_ENABLED(CONFIG_PTP_1588_CLOCK)
+#define HAVE_PTP_1588_CLOCK
+#else
+#error Cannot enable PTP Hardware Clock support due to a pre-3.0 kernel version or CONFIG_PTP_1588_CLOCK not enabled in the kernel
+#endif /* > 3.0.0 && IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
+#endif /* E1000E_PTP || IGB_PTP || IXGBE_PTP */
/*****************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) )
@@ -3205,12 +3442,37 @@
#else
#define HAVE_FDB_OPS
#define HAVE_ETHTOOL_GET_TS_INFO
+#define HAVE_SKB_HEAD_FRAG
#endif /* < 3.5.0 */
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) )
+#define PCI_EXP_LNKCAP2 44 /* Link Capability 2 */
+
+#ifndef MDIO_EEE_100TX
+#define MDIO_EEE_100TX 0x0002 /* 100TX EEE cap */
+#endif
+#ifndef MDIO_EEE_1000T
+#define MDIO_EEE_1000T 0x0004 /* 1000T EEE cap */
+#endif
+#ifndef MDIO_EEE_10GT
+#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */
+#endif
+#ifndef MDIO_EEE_1000KX
+#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */
+#endif
+#ifndef MDIO_EEE_10GKX4
+#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */
+#endif
+#ifndef MDIO_EEE_10GKR
+#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */
+#endif
+#else /* < 3.6.0 */
+#include <linux/mdio.h>
+#endif /* < 3.6.0 */
+
/******************************************************************************/
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) )
-#ifdef ETHTOOL_GEEE
-#include <linux/mdio.h>
/**
* mmd_eee_cap_to_ethtool_sup_t
* @eee_cap: value of the MMD EEE Capability register
@@ -3265,6 +3527,118 @@
return adv;
}
-#endif /* ETHTOOL_GEEE */
-#endif /* < 3.7.0 */
+
+/**
+ * ethtool_adv_to_mmd_eee_adv_t
+ * @adv: the ethtool advertisement settings
+ *
+ * A small helper function that translates ethtool advertisement settings
+ * to EEE advertisements for the MMD EEE Advertisement (7.60) and
+ * MMD EEE Link Partner Ability (7.61) registers.
+ */
+static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
+{
+ u16 reg = 0;
+
+ if (adv & ADVERTISED_100baseT_Full)
+ reg |= MDIO_EEE_100TX;
+ if (adv & ADVERTISED_1000baseT_Full)
+ reg |= MDIO_EEE_1000T;
+ if (adv & ADVERTISED_10000baseT_Full)
+ reg |= MDIO_EEE_10GT;
+ if (adv & ADVERTISED_1000baseKX_Full)
+ reg |= MDIO_EEE_1000KX;
+ if (adv & ADVERTISED_10000baseKX4_Full)
+ reg |= MDIO_EEE_10GKX4;
+ if (adv & ADVERTISED_10000baseKR_Full)
+ reg |= MDIO_EEE_10GKR;
+
+ return reg;
+}
+
+#ifndef pci_pcie_type
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) )
+static inline u8 pci_pcie_type(struct pci_dev *pdev)
+{
+ int pos;
+ u16 reg16;
+
+ pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
+ if (!pos)
+ BUG();
+ pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16);
+ return (reg16 & PCI_EXP_FLAGS_TYPE) >> 4;
+}
+#else /* < 2.6.24 */
+#define pci_pcie_type(x) (x)->pcie_type
+#endif /* < 2.6.24 */
+#endif /* pci_pcie_type */
+
+#define ptp_clock_register(caps, args...) ptp_clock_register(caps)
+
+#if !(SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,3,0))
+int __kc_pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val);
+#define pcie_capability_read_word(d,p,v) __kc_pcie_capability_read_word(d,p,v)
+int __kc_pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val);
+#define pcie_capability_write_word(d,p,v) __kc_pcie_capability_write_word(d,p,v)
+int __kc_pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos,
+ u16 clear, u16 set);
+#define pcie_capability_clear_and_set_word(d,p,c,s) \
+ __kc_pcie_capability_clear_and_set_word(d,p,c,s)
+
+#define PCI_EXP_LNKSTA2 50 /* Link Status 2 */
+
+static inline int pcie_capability_clear_word(struct pci_dev *dev, int pos,
+ u16 clear)
+{
+ return __kc_pcie_capability_clear_and_set_word(dev, pos, clear, 0);
+}
+#endif /* !(SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(11,3,0)) */
+
+#else /* >= 3.7.0 */
+#define HAVE_CONST_STRUCT_PCI_ERROR_HANDLERS
+#endif /* >= 3.7.0 */
+
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) )
+#ifndef PCI_EXP_LNKCTL_ASPM_L0S
+#define PCI_EXP_LNKCTL_ASPM_L0S 0x01 /* L0s Enable */
+#endif
+#ifndef PCI_EXP_LNKCTL_ASPM_L1
+#define PCI_EXP_LNKCTL_ASPM_L1 0x02 /* L1 Enable */
+#endif
+#define HAVE_CONFIG_HOTPLUG
+#else /* >= 3.8.0 */
+#ifndef __devinit
+#define __devinit
+#endif
+
+#ifndef __devinitdata
+#define __devinitdata
+#endif
+
+#ifndef __devexit
+#define __devexit
+#endif
+
+#ifndef __devexit_p
+#define __devexit_p
+#endif
+#endif /* >= 3.8.0 */
+
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) )
+#ifdef CONFIG_XPS
+extern int __kc_netif_set_xps_queue(struct net_device *, struct cpumask *, u16);
+#define netif_set_xps_queue(_dev, _mask, _idx) __kc_netif_set_xps_queue((_dev), (_mask), (_idx))
+#else /* CONFIG_XPS */
+#define netif_set_xps_queue(_dev, _mask, _idx) do {} while (0)
+#endif /* CONFIG_XPS */
+
+#ifdef HAVE_NETDEV_SELECT_QUEUE
+#define _kc_hashrnd 0xd631614b /* not so random hash salt */
+extern u16 __kc_netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
+#define __netdev_pick_tx __kc_netdev_pick_tx
+#endif /* HAVE_NETDEV_SELECT_QUEUE */
+#endif /* < 3.9.0 */
#endif /* _KCOMPAT_H_ */
|
[-]
[+]
|
Changed |
ixgbe-3.14.5.tar.bz2/src/kcompat_ethtool.c
^
|
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 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,
|