author | Florian Pose |
Fri, 05 Oct 2018 10:24:11 +0200 | |
branch | stable-1.5 |
changeset 2724 | b4a109b9e2a8 |
parent 2723 | 37d89f56e9f1 |
permissions | -rw-r--r-- |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1 |
/* Intel(R) Gigabit Ethernet Linux driver |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2 |
* Copyright(c) 2007-2014 Intel Corporation. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4 |
* This program is free software; you can redistribute it and/or modify it |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5 |
* under the terms and conditions of the GNU General Public License, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6 |
* version 2, as published by the Free Software Foundation. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8 |
* This program is distributed in the hope it will be useful, but WITHOUT |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
11 |
* more details. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
12 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
13 |
* You should have received a copy of the GNU General Public License along with |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
14 |
* this program; if not, see <http://www.gnu.org/licenses/>. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
15 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
16 |
* The full GNU General Public License is included in this distribution in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
17 |
* the file called "COPYING". |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
18 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
19 |
* Contact Information: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
20 |
* e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
21 |
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
22 |
* |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
23 |
* vim: noexpandtab |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
24 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
25 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
26 |
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
27 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
28 |
#include <linux/module.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
29 |
#include <linux/types.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
30 |
#include <linux/init.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
31 |
#include <linux/bitops.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
32 |
#include <linux/vmalloc.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
33 |
#include <linux/pagemap.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
34 |
#include <linux/netdevice.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
35 |
#include <linux/ipv6.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
36 |
#include <linux/slab.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
37 |
#include <net/checksum.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
38 |
#include <net/ip6_checksum.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
39 |
#include <linux/net_tstamp.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
40 |
#include <linux/mii.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
41 |
#include <linux/ethtool.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
42 |
#include <linux/if.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
43 |
#include <linux/if_vlan.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
44 |
#include <linux/pci.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
45 |
#include <linux/pci-aspm.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
46 |
#include <linux/delay.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
47 |
#include <linux/interrupt.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
48 |
#include <linux/ip.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
49 |
#include <linux/tcp.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
50 |
#include <linux/sctp.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
51 |
#include <linux/if_ether.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
52 |
#include <linux/aer.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
53 |
#include <linux/prefetch.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
54 |
#include <linux/pm_runtime.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
55 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
56 |
#include <linux/dca.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
57 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
58 |
#include <linux/i2c.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
59 |
#include "igb-3.18-ethercat.h" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
60 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
61 |
#define MAJ 5 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
62 |
#define MIN 2 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
63 |
#define BUILD 15 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
64 |
#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
65 |
__stringify(BUILD) "-k-EtherCAT" |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
66 |
char igb_driver_name[] = "ec_igb"; |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
67 |
char igb_driver_version[] = DRV_VERSION; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
68 |
static const char igb_driver_string[] = |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
69 |
"Intel(R) Gigabit Ethernet Network Driver (EtherCAT-enabled)"; |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
70 |
static const char igb_copyright[] = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
71 |
"Copyright (c) 2007-2014 Intel Corporation."; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
72 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
73 |
static const struct e1000_info *igb_info_tbl[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
74 |
[board_82575] = &e1000_82575_info, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
75 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
76 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
77 |
static const struct pci_device_id igb_pci_tbl[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
78 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_BACKPLANE_1GBPS) }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
79 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_SGMII) }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
80 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_BACKPLANE_2_5GBPS) }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
81 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I211_COPPER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
82 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_COPPER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
83 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_FIBER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
84 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_SERDES), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
85 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_SGMII), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
86 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_COPPER_FLASHLESS), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
87 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I210_SERDES_FLASHLESS), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
88 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_COPPER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
89 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_FIBER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
90 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_SERDES), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
91 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_SGMII), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
92 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
93 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_FIBER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
94 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_QUAD_FIBER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
95 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SERDES), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
96 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SGMII), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
97 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER_DUAL), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
98 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_SGMII), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
99 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_SERDES), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
100 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_BACKPLANE), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
101 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_DH89XXCC_SFP), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
102 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
103 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
104 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS_SERDES), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
105 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
106 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
107 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES_QUAD), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
108 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER_ET2), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
109 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
110 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
111 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
112 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER), board_82575 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
113 |
/* required last entry */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
114 |
{0, } |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
115 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
116 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
117 |
// MODULE_DEVICE_TABLE(pci, igb_pci_tbl); |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
118 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
119 |
static int igb_setup_all_tx_resources(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
120 |
static int igb_setup_all_rx_resources(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
121 |
static void igb_free_all_tx_resources(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
122 |
static void igb_free_all_rx_resources(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
123 |
static void igb_setup_mrqc(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
124 |
static int igb_probe(struct pci_dev *, const struct pci_device_id *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
125 |
static void igb_remove(struct pci_dev *pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
126 |
static int igb_sw_init(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
127 |
static int igb_open(struct net_device *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
128 |
static int igb_close(struct net_device *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
129 |
static void igb_configure(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
130 |
static void igb_configure_tx(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
131 |
static void igb_configure_rx(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
132 |
static void igb_clean_all_tx_rings(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
133 |
static void igb_clean_all_rx_rings(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
134 |
static void igb_clean_tx_ring(struct igb_ring *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
135 |
static void igb_clean_rx_ring(struct igb_ring *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
136 |
static void igb_set_rx_mode(struct net_device *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
137 |
static void igb_update_phy_info(unsigned long); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
138 |
static void igb_watchdog(unsigned long); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
139 |
static void igb_watchdog_task(struct work_struct *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
140 |
static netdev_tx_t igb_xmit_frame(struct sk_buff *skb, struct net_device *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
141 |
static struct rtnl_link_stats64 *igb_get_stats64(struct net_device *dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
142 |
struct rtnl_link_stats64 *stats); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
143 |
static int igb_change_mtu(struct net_device *, int); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
144 |
static int igb_set_mac(struct net_device *, void *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
145 |
static void igb_set_uta(struct igb_adapter *adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
146 |
static irqreturn_t igb_intr(int irq, void *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
147 |
static irqreturn_t igb_intr_msi(int irq, void *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
148 |
static irqreturn_t igb_msix_other(int irq, void *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
149 |
static irqreturn_t igb_msix_ring(int irq, void *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
150 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
151 |
static void igb_update_dca(struct igb_q_vector *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
152 |
static void igb_setup_dca(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
153 |
#endif /* CONFIG_IGB_DCA */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
154 |
static int igb_poll(struct napi_struct *, int); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
155 |
static bool igb_clean_tx_irq(struct igb_q_vector *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
156 |
static bool igb_clean_rx_irq(struct igb_q_vector *, int); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
157 |
static int igb_ioctl(struct net_device *, struct ifreq *, int cmd); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
158 |
static void igb_tx_timeout(struct net_device *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
159 |
static void igb_reset_task(struct work_struct *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
160 |
static void igb_vlan_mode(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
161 |
netdev_features_t features); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
162 |
static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
163 |
static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
164 |
static void igb_restore_vlan(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
165 |
static void igb_rar_set_qsel(struct igb_adapter *, u8 *, u32 , u8); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
166 |
static void igb_ping_all_vfs(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
167 |
static void igb_msg_task(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
168 |
static void igb_vmm_control(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
169 |
static int igb_set_vf_mac(struct igb_adapter *, int, unsigned char *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
170 |
static void igb_restore_vf_multicasts(struct igb_adapter *adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
171 |
static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
172 |
static int igb_ndo_set_vf_vlan(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
173 |
int vf, u16 vlan, u8 qos); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
174 |
static int igb_ndo_set_vf_bw(struct net_device *, int, int, int); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
175 |
static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
176 |
bool setting); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
177 |
static int igb_ndo_get_vf_config(struct net_device *netdev, int vf, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
178 |
struct ifla_vf_info *ivi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
179 |
static void igb_check_vf_rate_limit(struct igb_adapter *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
180 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
181 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
182 |
static int igb_vf_configure(struct igb_adapter *adapter, int vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
183 |
static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
184 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
185 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
186 |
#ifdef CONFIG_PM |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
187 |
#ifdef CONFIG_PM_SLEEP |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
188 |
static int igb_suspend(struct device *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
189 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
190 |
static int igb_resume(struct device *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
191 |
#ifdef CONFIG_PM_RUNTIME |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
192 |
static int igb_runtime_suspend(struct device *dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
193 |
static int igb_runtime_resume(struct device *dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
194 |
static int igb_runtime_idle(struct device *dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
195 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
196 |
static const struct dev_pm_ops igb_pm_ops = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
197 |
SET_SYSTEM_SLEEP_PM_OPS(igb_suspend, igb_resume) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
198 |
SET_RUNTIME_PM_OPS(igb_runtime_suspend, igb_runtime_resume, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
199 |
igb_runtime_idle) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
200 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
201 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
202 |
static void igb_shutdown(struct pci_dev *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
203 |
static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
204 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
205 |
static int igb_notify_dca(struct notifier_block *, unsigned long, void *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
206 |
static struct notifier_block dca_notifier = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
207 |
.notifier_call = igb_notify_dca, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
208 |
.next = NULL, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
209 |
.priority = 0 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
210 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
211 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
212 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
213 |
/* for netdump / net console */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
214 |
static void igb_netpoll(struct net_device *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
215 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
216 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
217 |
static unsigned int max_vfs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
218 |
module_param(max_vfs, uint, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
219 |
MODULE_PARM_DESC(max_vfs, "Maximum number of virtual functions to allocate per physical function"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
220 |
#endif /* CONFIG_PCI_IOV */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
221 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
222 |
static pci_ers_result_t igb_io_error_detected(struct pci_dev *, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
223 |
pci_channel_state_t); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
224 |
static pci_ers_result_t igb_io_slot_reset(struct pci_dev *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
225 |
static void igb_io_resume(struct pci_dev *); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
226 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
227 |
static const struct pci_error_handlers igb_err_handler = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
228 |
.error_detected = igb_io_error_detected, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
229 |
.slot_reset = igb_io_slot_reset, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
230 |
.resume = igb_io_resume, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
231 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
232 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
233 |
static void igb_init_dmac(struct igb_adapter *adapter, u32 pba); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
234 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
235 |
static struct pci_driver igb_driver = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
236 |
.name = igb_driver_name, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
237 |
.id_table = igb_pci_tbl, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
238 |
.probe = igb_probe, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
239 |
.remove = igb_remove, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
240 |
#ifdef CONFIG_PM |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
241 |
.driver.pm = &igb_pm_ops, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
242 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
243 |
.shutdown = igb_shutdown, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
244 |
.sriov_configure = igb_pci_sriov_configure, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
245 |
.err_handler = &igb_err_handler |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
246 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
247 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
248 |
MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
249 |
MODULE_DESCRIPTION("Intel(R) Gigabit Ethernet Network Driver"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
250 |
MODULE_LICENSE("GPL"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
251 |
MODULE_VERSION(DRV_VERSION); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
252 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
253 |
#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
254 |
static int debug = -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
255 |
module_param(debug, int, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
256 |
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
257 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
258 |
struct igb_reg_info { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
259 |
u32 ofs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
260 |
char *name; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
261 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
262 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
263 |
static const struct igb_reg_info igb_reg_info_tbl[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
264 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
265 |
/* General Registers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
266 |
{E1000_CTRL, "CTRL"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
267 |
{E1000_STATUS, "STATUS"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
268 |
{E1000_CTRL_EXT, "CTRL_EXT"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
269 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
270 |
/* Interrupt Registers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
271 |
{E1000_ICR, "ICR"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
272 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
273 |
/* RX Registers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
274 |
{E1000_RCTL, "RCTL"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
275 |
{E1000_RDLEN(0), "RDLEN"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
276 |
{E1000_RDH(0), "RDH"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
277 |
{E1000_RDT(0), "RDT"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
278 |
{E1000_RXDCTL(0), "RXDCTL"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
279 |
{E1000_RDBAL(0), "RDBAL"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
280 |
{E1000_RDBAH(0), "RDBAH"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
281 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
282 |
/* TX Registers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
283 |
{E1000_TCTL, "TCTL"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
284 |
{E1000_TDBAL(0), "TDBAL"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
285 |
{E1000_TDBAH(0), "TDBAH"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
286 |
{E1000_TDLEN(0), "TDLEN"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
287 |
{E1000_TDH(0), "TDH"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
288 |
{E1000_TDT(0), "TDT"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
289 |
{E1000_TXDCTL(0), "TXDCTL"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
290 |
{E1000_TDFH, "TDFH"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
291 |
{E1000_TDFT, "TDFT"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
292 |
{E1000_TDFHS, "TDFHS"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
293 |
{E1000_TDFPC, "TDFPC"}, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
294 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
295 |
/* List Terminator */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
296 |
{} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
297 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
298 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
299 |
/* igb_regdump - register printout routine */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
300 |
static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
301 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
302 |
int n = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
303 |
char rname[16]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
304 |
u32 regs[8]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
305 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
306 |
switch (reginfo->ofs) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
307 |
case E1000_RDLEN(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
308 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
309 |
regs[n] = rd32(E1000_RDLEN(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
310 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
311 |
case E1000_RDH(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
312 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
313 |
regs[n] = rd32(E1000_RDH(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
314 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
315 |
case E1000_RDT(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
316 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
317 |
regs[n] = rd32(E1000_RDT(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
318 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
319 |
case E1000_RXDCTL(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
320 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
321 |
regs[n] = rd32(E1000_RXDCTL(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
322 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
323 |
case E1000_RDBAL(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
324 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
325 |
regs[n] = rd32(E1000_RDBAL(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
326 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
327 |
case E1000_RDBAH(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
328 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
329 |
regs[n] = rd32(E1000_RDBAH(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
330 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
331 |
case E1000_TDBAL(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
332 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
333 |
regs[n] = rd32(E1000_RDBAL(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
334 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
335 |
case E1000_TDBAH(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
336 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
337 |
regs[n] = rd32(E1000_TDBAH(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
338 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
339 |
case E1000_TDLEN(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
340 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
341 |
regs[n] = rd32(E1000_TDLEN(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
342 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
343 |
case E1000_TDH(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
344 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
345 |
regs[n] = rd32(E1000_TDH(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
346 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
347 |
case E1000_TDT(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
348 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
349 |
regs[n] = rd32(E1000_TDT(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
350 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
351 |
case E1000_TXDCTL(0): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
352 |
for (n = 0; n < 4; n++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
353 |
regs[n] = rd32(E1000_TXDCTL(n)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
354 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
355 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
356 |
pr_info("%-15s %08x\n", reginfo->name, rd32(reginfo->ofs)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
357 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
358 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
359 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
360 |
snprintf(rname, 16, "%s%s", reginfo->name, "[0-3]"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
361 |
pr_info("%-15s %08x %08x %08x %08x\n", rname, regs[0], regs[1], |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
362 |
regs[2], regs[3]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
363 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
364 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
365 |
/* igb_dump - Print registers, Tx-rings and Rx-rings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
366 |
static void igb_dump(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
367 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
368 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
369 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
370 |
struct igb_reg_info *reginfo; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
371 |
struct igb_ring *tx_ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
372 |
union e1000_adv_tx_desc *tx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
373 |
struct my_u0 { u64 a; u64 b; } *u0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
374 |
struct igb_ring *rx_ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
375 |
union e1000_adv_rx_desc *rx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
376 |
u32 staterr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
377 |
u16 i, n; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
378 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
379 |
if (!netif_msg_hw(adapter)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
380 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
381 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
382 |
/* Print netdevice Info */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
383 |
if (netdev) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
384 |
dev_info(&adapter->pdev->dev, "Net device Info\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
385 |
pr_info("Device Name state trans_start last_rx\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
386 |
pr_info("%-15s %016lX %016lX %016lX\n", netdev->name, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
387 |
netdev->state, netdev->trans_start, netdev->last_rx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
388 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
389 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
390 |
/* Print Registers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
391 |
dev_info(&adapter->pdev->dev, "Register Dump\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
392 |
pr_info(" Register Name Value\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
393 |
for (reginfo = (struct igb_reg_info *)igb_reg_info_tbl; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
394 |
reginfo->name; reginfo++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
395 |
igb_regdump(hw, reginfo); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
396 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
397 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
398 |
/* Print TX Ring Summary */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
399 |
if (!netdev || !netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
400 |
goto exit; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
401 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
402 |
dev_info(&adapter->pdev->dev, "TX Rings Summary\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
403 |
pr_info("Queue [NTU] [NTC] [bi(ntc)->dma ] leng ntw timestamp\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
404 |
for (n = 0; n < adapter->num_tx_queues; n++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
405 |
struct igb_tx_buffer *buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
406 |
tx_ring = adapter->tx_ring[n]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
407 |
buffer_info = &tx_ring->tx_buffer_info[tx_ring->next_to_clean]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
408 |
pr_info(" %5d %5X %5X %016llX %04X %p %016llX\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
409 |
n, tx_ring->next_to_use, tx_ring->next_to_clean, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
410 |
(u64)dma_unmap_addr(buffer_info, dma), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
411 |
dma_unmap_len(buffer_info, len), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
412 |
buffer_info->next_to_watch, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
413 |
(u64)buffer_info->time_stamp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
414 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
415 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
416 |
/* Print TX Rings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
417 |
if (!netif_msg_tx_done(adapter)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
418 |
goto rx_ring_summary; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
419 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
420 |
dev_info(&adapter->pdev->dev, "TX Rings Dump\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
421 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
422 |
/* Transmit Descriptor Formats |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
423 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
424 |
* Advanced Transmit Descriptor |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
425 |
* +--------------------------------------------------------------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
426 |
* 0 | Buffer Address [63:0] | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
427 |
* +--------------------------------------------------------------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
428 |
* 8 | PAYLEN | PORTS |CC|IDX | STA | DCMD |DTYP|MAC|RSV| DTALEN | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
429 |
* +--------------------------------------------------------------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
430 |
* 63 46 45 40 39 38 36 35 32 31 24 15 0 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
431 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
432 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
433 |
for (n = 0; n < adapter->num_tx_queues; n++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
434 |
tx_ring = adapter->tx_ring[n]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
435 |
pr_info("------------------------------------\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
436 |
pr_info("TX QUEUE INDEX = %d\n", tx_ring->queue_index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
437 |
pr_info("------------------------------------\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
438 |
pr_info("T [desc] [address 63:0 ] [PlPOCIStDDM Ln] [bi->dma ] leng ntw timestamp bi->skb\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
439 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
440 |
for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
441 |
const char *next_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
442 |
struct igb_tx_buffer *buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
443 |
tx_desc = IGB_TX_DESC(tx_ring, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
444 |
buffer_info = &tx_ring->tx_buffer_info[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
445 |
u0 = (struct my_u0 *)tx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
446 |
if (i == tx_ring->next_to_use && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
447 |
i == tx_ring->next_to_clean) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
448 |
next_desc = " NTC/U"; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
449 |
else if (i == tx_ring->next_to_use) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
450 |
next_desc = " NTU"; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
451 |
else if (i == tx_ring->next_to_clean) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
452 |
next_desc = " NTC"; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
453 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
454 |
next_desc = ""; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
455 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
456 |
pr_info("T [0x%03X] %016llX %016llX %016llX %04X %p %016llX %p%s\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
457 |
i, le64_to_cpu(u0->a), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
458 |
le64_to_cpu(u0->b), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
459 |
(u64)dma_unmap_addr(buffer_info, dma), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
460 |
dma_unmap_len(buffer_info, len), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
461 |
buffer_info->next_to_watch, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
462 |
(u64)buffer_info->time_stamp, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
463 |
buffer_info->skb, next_desc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
464 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
465 |
if (netif_msg_pktdata(adapter) && buffer_info->skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
466 |
print_hex_dump(KERN_INFO, "", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
467 |
DUMP_PREFIX_ADDRESS, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
468 |
16, 1, buffer_info->skb->data, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
469 |
dma_unmap_len(buffer_info, len), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
470 |
true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
471 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
472 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
473 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
474 |
/* Print RX Rings Summary */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
475 |
rx_ring_summary: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
476 |
dev_info(&adapter->pdev->dev, "RX Rings Summary\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
477 |
pr_info("Queue [NTU] [NTC]\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
478 |
for (n = 0; n < adapter->num_rx_queues; n++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
479 |
rx_ring = adapter->rx_ring[n]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
480 |
pr_info(" %5d %5X %5X\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
481 |
n, rx_ring->next_to_use, rx_ring->next_to_clean); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
482 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
483 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
484 |
/* Print RX Rings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
485 |
if (!netif_msg_rx_status(adapter)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
486 |
goto exit; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
487 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
488 |
dev_info(&adapter->pdev->dev, "RX Rings Dump\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
489 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
490 |
/* Advanced Receive Descriptor (Read) Format |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
491 |
* 63 1 0 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
492 |
* +-----------------------------------------------------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
493 |
* 0 | Packet Buffer Address [63:1] |A0/NSE| |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
494 |
* +----------------------------------------------+------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
495 |
* 8 | Header Buffer Address [63:1] | DD | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
496 |
* +-----------------------------------------------------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
497 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
498 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
499 |
* Advanced Receive Descriptor (Write-Back) Format |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
500 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
501 |
* 63 48 47 32 31 30 21 20 17 16 4 3 0 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
502 |
* +------------------------------------------------------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
503 |
* 0 | Packet IP |SPH| HDR_LEN | RSV|Packet| RSS | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
504 |
* | Checksum Ident | | | | Type | Type | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
505 |
* +------------------------------------------------------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
506 |
* 8 | VLAN Tag | Length | Extended Error | Extended Status | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
507 |
* +------------------------------------------------------+ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
508 |
* 63 48 47 32 31 20 19 0 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
509 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
510 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
511 |
for (n = 0; n < adapter->num_rx_queues; n++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
512 |
rx_ring = adapter->rx_ring[n]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
513 |
pr_info("------------------------------------\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
514 |
pr_info("RX QUEUE INDEX = %d\n", rx_ring->queue_index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
515 |
pr_info("------------------------------------\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
516 |
pr_info("R [desc] [ PktBuf A0] [ HeadBuf DD] [bi->dma ] [bi->skb] <-- Adv Rx Read format\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
517 |
pr_info("RWB[desc] [PcsmIpSHl PtRs] [vl er S cks ln] ---------------- [bi->skb] <-- Adv Rx Write-Back format\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
518 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
519 |
for (i = 0; i < rx_ring->count; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
520 |
const char *next_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
521 |
struct igb_rx_buffer *buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
522 |
buffer_info = &rx_ring->rx_buffer_info[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
523 |
rx_desc = IGB_RX_DESC(rx_ring, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
524 |
u0 = (struct my_u0 *)rx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
525 |
staterr = le32_to_cpu(rx_desc->wb.upper.status_error); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
526 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
527 |
if (i == rx_ring->next_to_use) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
528 |
next_desc = " NTU"; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
529 |
else if (i == rx_ring->next_to_clean) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
530 |
next_desc = " NTC"; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
531 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
532 |
next_desc = ""; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
533 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
534 |
if (staterr & E1000_RXD_STAT_DD) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
535 |
/* Descriptor Done */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
536 |
pr_info("%s[0x%03X] %016llX %016llX ---------------- %s\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
537 |
"RWB", i, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
538 |
le64_to_cpu(u0->a), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
539 |
le64_to_cpu(u0->b), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
540 |
next_desc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
541 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
542 |
pr_info("%s[0x%03X] %016llX %016llX %016llX %s\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
543 |
"R ", i, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
544 |
le64_to_cpu(u0->a), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
545 |
le64_to_cpu(u0->b), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
546 |
(u64)buffer_info->dma, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
547 |
next_desc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
548 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
549 |
if (netif_msg_pktdata(adapter) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
550 |
buffer_info->dma && buffer_info->page) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
551 |
print_hex_dump(KERN_INFO, "", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
552 |
DUMP_PREFIX_ADDRESS, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
553 |
16, 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
554 |
page_address(buffer_info->page) + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
555 |
buffer_info->page_offset, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
556 |
IGB_RX_BUFSZ, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
557 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
558 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
559 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
560 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
561 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
562 |
exit: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
563 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
564 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
565 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
566 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
567 |
* igb_get_i2c_data - Reads the I2C SDA data bit |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
568 |
* @hw: pointer to hardware structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
569 |
* @i2cctl: Current value of I2CCTL register |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
570 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
571 |
* Returns the I2C data bit value |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
572 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
573 |
static int igb_get_i2c_data(void *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
574 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
575 |
struct igb_adapter *adapter = (struct igb_adapter *)data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
576 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
577 |
s32 i2cctl = rd32(E1000_I2CPARAMS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
578 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
579 |
return !!(i2cctl & E1000_I2C_DATA_IN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
580 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
581 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
582 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
583 |
* igb_set_i2c_data - Sets the I2C data bit |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
584 |
* @data: pointer to hardware structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
585 |
* @state: I2C data value (0 or 1) to set |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
586 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
587 |
* Sets the I2C data bit |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
588 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
589 |
static void igb_set_i2c_data(void *data, int state) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
590 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
591 |
struct igb_adapter *adapter = (struct igb_adapter *)data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
592 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
593 |
s32 i2cctl = rd32(E1000_I2CPARAMS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
594 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
595 |
if (state) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
596 |
i2cctl |= E1000_I2C_DATA_OUT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
597 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
598 |
i2cctl &= ~E1000_I2C_DATA_OUT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
599 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
600 |
i2cctl &= ~E1000_I2C_DATA_OE_N; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
601 |
i2cctl |= E1000_I2C_CLK_OE_N; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
602 |
wr32(E1000_I2CPARAMS, i2cctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
603 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
604 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
605 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
606 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
607 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
608 |
* igb_set_i2c_clk - Sets the I2C SCL clock |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
609 |
* @data: pointer to hardware structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
610 |
* @state: state to set clock |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
611 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
612 |
* Sets the I2C clock line to state |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
613 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
614 |
static void igb_set_i2c_clk(void *data, int state) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
615 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
616 |
struct igb_adapter *adapter = (struct igb_adapter *)data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
617 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
618 |
s32 i2cctl = rd32(E1000_I2CPARAMS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
619 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
620 |
if (state) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
621 |
i2cctl |= E1000_I2C_CLK_OUT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
622 |
i2cctl &= ~E1000_I2C_CLK_OE_N; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
623 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
624 |
i2cctl &= ~E1000_I2C_CLK_OUT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
625 |
i2cctl &= ~E1000_I2C_CLK_OE_N; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
626 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
627 |
wr32(E1000_I2CPARAMS, i2cctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
628 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
629 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
630 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
631 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
632 |
* igb_get_i2c_clk - Gets the I2C SCL clock state |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
633 |
* @data: pointer to hardware structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
634 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
635 |
* Gets the I2C clock state |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
636 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
637 |
static int igb_get_i2c_clk(void *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
638 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
639 |
struct igb_adapter *adapter = (struct igb_adapter *)data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
640 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
641 |
s32 i2cctl = rd32(E1000_I2CPARAMS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
642 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
643 |
return !!(i2cctl & E1000_I2C_CLK_IN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
644 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
645 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
646 |
static const struct i2c_algo_bit_data igb_i2c_algo = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
647 |
.setsda = igb_set_i2c_data, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
648 |
.setscl = igb_set_i2c_clk, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
649 |
.getsda = igb_get_i2c_data, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
650 |
.getscl = igb_get_i2c_clk, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
651 |
.udelay = 5, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
652 |
.timeout = 20, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
653 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
654 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
655 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
656 |
* igb_get_hw_dev - return device |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
657 |
* @hw: pointer to hardware structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
658 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
659 |
* used by hardware layer to print debugging information |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
660 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
661 |
struct net_device *igb_get_hw_dev(struct e1000_hw *hw) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
662 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
663 |
struct igb_adapter *adapter = hw->back; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
664 |
return adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
665 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
666 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
667 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
668 |
* igb_init_module - Driver Registration Routine |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
669 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
670 |
* igb_init_module is the first routine called when the driver is |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
671 |
* loaded. All it does is register with the PCI subsystem. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
672 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
673 |
static int __init igb_init_module(void) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
674 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
675 |
int ret; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
676 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
677 |
pr_info("%s - version %s\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
678 |
igb_driver_string, igb_driver_version); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
679 |
pr_info("%s\n", igb_copyright); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
680 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
681 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
682 |
dca_register_notify(&dca_notifier); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
683 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
684 |
ret = pci_register_driver(&igb_driver); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
685 |
return ret; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
686 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
687 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
688 |
module_init(igb_init_module); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
689 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
690 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
691 |
* igb_exit_module - Driver Exit Cleanup Routine |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
692 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
693 |
* igb_exit_module is called just before the driver is removed |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
694 |
* from memory. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
695 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
696 |
static void __exit igb_exit_module(void) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
697 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
698 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
699 |
dca_unregister_notify(&dca_notifier); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
700 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
701 |
pci_unregister_driver(&igb_driver); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
702 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
703 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
704 |
module_exit(igb_exit_module); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
705 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
706 |
#define Q_IDX_82576(i) (((i & 0x1) << 3) + (i >> 1)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
707 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
708 |
* igb_cache_ring_register - Descriptor ring to register mapping |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
709 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
710 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
711 |
* Once we know the feature-set enabled for the device, we'll cache |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
712 |
* the register offset the descriptor ring is assigned to. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
713 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
714 |
static void igb_cache_ring_register(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
715 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
716 |
int i = 0, j = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
717 |
u32 rbase_offset = adapter->vfs_allocated_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
718 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
719 |
switch (adapter->hw.mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
720 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
721 |
/* The queues are allocated for virtualization such that VF 0 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
722 |
* is allocated queues 0 and 8, VF 1 queues 1 and 9, etc. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
723 |
* In order to avoid collision we start at the first free queue |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
724 |
* and continue consuming queues in the same sequence |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
725 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
726 |
if (adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
727 |
for (; i < adapter->rss_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
728 |
adapter->rx_ring[i]->reg_idx = rbase_offset + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
729 |
Q_IDX_82576(i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
730 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
731 |
/* Fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
732 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
733 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
734 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
735 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
736 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
737 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
738 |
/* Fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
739 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
740 |
for (; i < adapter->num_rx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
741 |
adapter->rx_ring[i]->reg_idx = rbase_offset + i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
742 |
for (; j < adapter->num_tx_queues; j++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
743 |
adapter->tx_ring[j]->reg_idx = rbase_offset + j; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
744 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
745 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
746 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
747 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
748 |
u32 igb_rd32(struct e1000_hw *hw, u32 reg) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
749 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
750 |
struct igb_adapter *igb = container_of(hw, struct igb_adapter, hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
751 |
u8 __iomem *hw_addr = ACCESS_ONCE(hw->hw_addr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
752 |
u32 value = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
753 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
754 |
if (E1000_REMOVED(hw_addr)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
755 |
return ~value; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
756 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
757 |
value = readl(&hw_addr[reg]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
758 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
759 |
/* reads should not return all F's */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
760 |
if (!(~value) && (!reg || !(~readl(hw_addr)))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
761 |
struct net_device *netdev = igb->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
762 |
hw->hw_addr = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
763 |
netif_device_detach(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
764 |
netdev_err(netdev, "PCIe link lost, device now detached\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
765 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
766 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
767 |
return value; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
768 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
769 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
770 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
771 |
* igb_write_ivar - configure ivar for given MSI-X vector |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
772 |
* @hw: pointer to the HW structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
773 |
* @msix_vector: vector number we are allocating to a given ring |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
774 |
* @index: row index of IVAR register to write within IVAR table |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
775 |
* @offset: column offset of in IVAR, should be multiple of 8 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
776 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
777 |
* This function is intended to handle the writing of the IVAR register |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
778 |
* for adapters 82576 and newer. The IVAR table consists of 2 columns, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
779 |
* each containing an cause allocation for an Rx and Tx ring, and a |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
780 |
* variable number of rows depending on the number of queues supported. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
781 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
782 |
static void igb_write_ivar(struct e1000_hw *hw, int msix_vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
783 |
int index, int offset) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
784 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
785 |
u32 ivar = array_rd32(E1000_IVAR0, index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
786 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
787 |
/* clear any bits that are currently set */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
788 |
ivar &= ~((u32)0xFF << offset); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
789 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
790 |
/* write vector and valid bit */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
791 |
ivar |= (msix_vector | E1000_IVAR_VALID) << offset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
792 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
793 |
array_wr32(E1000_IVAR0, index, ivar); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
794 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
795 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
796 |
#define IGB_N0_QUEUE -1 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
797 |
static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
798 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
799 |
struct igb_adapter *adapter = q_vector->adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
800 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
801 |
int rx_queue = IGB_N0_QUEUE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
802 |
int tx_queue = IGB_N0_QUEUE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
803 |
u32 msixbm = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
804 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
805 |
if (q_vector->rx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
806 |
rx_queue = q_vector->rx.ring->reg_idx; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
807 |
if (q_vector->tx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
808 |
tx_queue = q_vector->tx.ring->reg_idx; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
809 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
810 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
811 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
812 |
/* The 82575 assigns vectors using a bitmask, which matches the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
813 |
* bitmask for the EICR/EIMS/EIMC registers. To assign one |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
814 |
* or more queues to a vector, we write the appropriate bits |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
815 |
* into the MSIXBM register for that vector. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
816 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
817 |
if (rx_queue > IGB_N0_QUEUE) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
818 |
msixbm = E1000_EICR_RX_QUEUE0 << rx_queue; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
819 |
if (tx_queue > IGB_N0_QUEUE) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
820 |
msixbm |= E1000_EICR_TX_QUEUE0 << tx_queue; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
821 |
if (!(adapter->flags & IGB_FLAG_HAS_MSIX) && msix_vector == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
822 |
msixbm |= E1000_EIMS_OTHER; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
823 |
array_wr32(E1000_MSIXBM(0), msix_vector, msixbm); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
824 |
q_vector->eims_value = msixbm; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
825 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
826 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
827 |
/* 82576 uses a table that essentially consists of 2 columns |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
828 |
* with 8 rows. The ordering is column-major so we use the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
829 |
* lower 3 bits as the row index, and the 4th bit as the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
830 |
* column offset. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
831 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
832 |
if (rx_queue > IGB_N0_QUEUE) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
833 |
igb_write_ivar(hw, msix_vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
834 |
rx_queue & 0x7, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
835 |
(rx_queue & 0x8) << 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
836 |
if (tx_queue > IGB_N0_QUEUE) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
837 |
igb_write_ivar(hw, msix_vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
838 |
tx_queue & 0x7, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
839 |
((tx_queue & 0x8) << 1) + 8); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
840 |
q_vector->eims_value = 1 << msix_vector; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
841 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
842 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
843 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
844 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
845 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
846 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
847 |
/* On 82580 and newer adapters the scheme is similar to 82576 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
848 |
* however instead of ordering column-major we have things |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
849 |
* ordered row-major. So we traverse the table by using |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
850 |
* bit 0 as the column offset, and the remaining bits as the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
851 |
* row index. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
852 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
853 |
if (rx_queue > IGB_N0_QUEUE) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
854 |
igb_write_ivar(hw, msix_vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
855 |
rx_queue >> 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
856 |
(rx_queue & 0x1) << 4); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
857 |
if (tx_queue > IGB_N0_QUEUE) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
858 |
igb_write_ivar(hw, msix_vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
859 |
tx_queue >> 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
860 |
((tx_queue & 0x1) << 4) + 8); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
861 |
q_vector->eims_value = 1 << msix_vector; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
862 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
863 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
864 |
BUG(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
865 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
866 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
867 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
868 |
/* add q_vector eims value to global eims_enable_mask */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
869 |
adapter->eims_enable_mask |= q_vector->eims_value; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
870 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
871 |
/* configure q_vector to set itr on first interrupt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
872 |
q_vector->set_itr = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
873 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
874 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
875 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
876 |
* igb_configure_msix - Configure MSI-X hardware |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
877 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
878 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
879 |
* igb_configure_msix sets up the hardware to properly |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
880 |
* generate MSI-X interrupts. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
881 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
882 |
static void igb_configure_msix(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
883 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
884 |
u32 tmp; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
885 |
int i, vector = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
886 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
887 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
888 |
adapter->eims_enable_mask = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
889 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
890 |
/* set vector for other causes, i.e. link changes */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
891 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
892 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
893 |
tmp = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
894 |
/* enable MSI-X PBA support*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
895 |
tmp |= E1000_CTRL_EXT_PBA_CLR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
896 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
897 |
/* Auto-Mask interrupts upon ICR read. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
898 |
tmp |= E1000_CTRL_EXT_EIAME; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
899 |
tmp |= E1000_CTRL_EXT_IRCA; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
900 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
901 |
wr32(E1000_CTRL_EXT, tmp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
902 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
903 |
/* enable msix_other interrupt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
904 |
array_wr32(E1000_MSIXBM(0), vector++, E1000_EIMS_OTHER); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
905 |
adapter->eims_other = E1000_EIMS_OTHER; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
906 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
907 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
908 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
909 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
910 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
911 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
912 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
913 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
914 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
915 |
/* Turn on MSI-X capability first, or our settings |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
916 |
* won't stick. And it will take days to debug. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
917 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
918 |
wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
919 |
E1000_GPIE_PBA | E1000_GPIE_EIAME | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
920 |
E1000_GPIE_NSICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
921 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
922 |
/* enable msix_other interrupt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
923 |
adapter->eims_other = 1 << vector; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
924 |
tmp = (vector++ | E1000_IVAR_VALID) << 8; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
925 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
926 |
wr32(E1000_IVAR_MISC, tmp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
927 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
928 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
929 |
/* do nothing, since nothing else supports MSI-X */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
930 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
931 |
} /* switch (hw->mac.type) */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
932 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
933 |
adapter->eims_enable_mask |= adapter->eims_other; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
934 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
935 |
for (i = 0; i < adapter->num_q_vectors; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
936 |
igb_assign_vector(adapter->q_vector[i], vector++); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
937 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
938 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
939 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
940 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
941 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
942 |
* igb_request_msix - Initialize MSI-X interrupts |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
943 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
944 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
945 |
* igb_request_msix allocates MSI-X vectors and requests interrupts from the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
946 |
* kernel. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
947 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
948 |
static int igb_request_msix(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
949 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
950 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
951 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
952 |
int i, err = 0, vector = 0, free_vector = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
953 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
954 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
955 |
/* avoid requesting MSI-X. */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
956 |
return 0; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
957 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
958 |
|
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
959 |
err = request_irq(adapter->msix_entries[vector].vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
960 |
igb_msix_other, 0, netdev->name, adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
961 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
962 |
goto err_out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
963 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
964 |
for (i = 0; i < adapter->num_q_vectors; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
965 |
struct igb_q_vector *q_vector = adapter->q_vector[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
966 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
967 |
vector++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
968 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
969 |
q_vector->itr_register = hw->hw_addr + E1000_EITR(vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
970 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
971 |
if (q_vector->rx.ring && q_vector->tx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
972 |
sprintf(q_vector->name, "%s-TxRx-%u", netdev->name, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
973 |
q_vector->rx.ring->queue_index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
974 |
else if (q_vector->tx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
975 |
sprintf(q_vector->name, "%s-tx-%u", netdev->name, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
976 |
q_vector->tx.ring->queue_index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
977 |
else if (q_vector->rx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
978 |
sprintf(q_vector->name, "%s-rx-%u", netdev->name, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
979 |
q_vector->rx.ring->queue_index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
980 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
981 |
sprintf(q_vector->name, "%s-unused", netdev->name); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
982 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
983 |
err = request_irq(adapter->msix_entries[vector].vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
984 |
igb_msix_ring, 0, q_vector->name, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
985 |
q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
986 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
987 |
goto err_free; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
988 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
989 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
990 |
igb_configure_msix(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
991 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
992 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
993 |
err_free: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
994 |
/* free already assigned IRQs */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
995 |
free_irq(adapter->msix_entries[free_vector++].vector, adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
996 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
997 |
vector--; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
998 |
for (i = 0; i < vector; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
999 |
free_irq(adapter->msix_entries[free_vector++].vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1000 |
adapter->q_vector[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1001 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1002 |
err_out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1003 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1004 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1005 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1006 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1007 |
* igb_free_q_vector - Free memory allocated for specific interrupt vector |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1008 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1009 |
* @v_idx: Index of vector to be freed |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1010 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1011 |
* This function frees the memory allocated to the q_vector. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1012 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1013 |
static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1014 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1015 |
struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1016 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1017 |
adapter->q_vector[v_idx] = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1018 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1019 |
/* igb_get_stats64() might access the rings on this vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1020 |
* we must wait a grace period before freeing it. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1021 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1022 |
if (q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1023 |
kfree_rcu(q_vector, rcu); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1024 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1025 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1026 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1027 |
* igb_reset_q_vector - Reset config for interrupt vector |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1028 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1029 |
* @v_idx: Index of vector to be reset |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1030 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1031 |
* If NAPI is enabled it will delete any references to the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1032 |
* NAPI struct. This is preparation for igb_free_q_vector. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1033 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1034 |
static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1035 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1036 |
struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1037 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1038 |
/* Coming from igb_set_interrupt_capability, the vectors are not yet |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1039 |
* allocated. So, q_vector is NULL so we should stop here. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1040 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1041 |
if (!q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1042 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1043 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1044 |
if (q_vector->tx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1045 |
adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1046 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1047 |
if (q_vector->rx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1048 |
adapter->tx_ring[q_vector->rx.ring->queue_index] = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1049 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1050 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1051 |
netif_napi_del(&q_vector->napi); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1052 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1053 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1054 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1055 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1056 |
static void igb_reset_interrupt_capability(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1057 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1058 |
int v_idx = adapter->num_q_vectors; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1059 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1060 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1061 |
pci_disable_msix(adapter->pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1062 |
else if (adapter->flags & IGB_FLAG_HAS_MSI) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1063 |
pci_disable_msi(adapter->pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1064 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1065 |
while (v_idx--) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1066 |
igb_reset_q_vector(adapter, v_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1067 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1068 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1069 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1070 |
* igb_free_q_vectors - Free memory allocated for interrupt vectors |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1071 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1072 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1073 |
* This function frees the memory allocated to the q_vectors. In addition if |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1074 |
* NAPI is enabled it will delete any references to the NAPI struct prior |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1075 |
* to freeing the q_vector. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1076 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1077 |
static void igb_free_q_vectors(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1078 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1079 |
int v_idx = adapter->num_q_vectors; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1080 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1081 |
adapter->num_tx_queues = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1082 |
adapter->num_rx_queues = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1083 |
adapter->num_q_vectors = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1084 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1085 |
while (v_idx--) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1086 |
igb_reset_q_vector(adapter, v_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1087 |
igb_free_q_vector(adapter, v_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1088 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1089 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1090 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1091 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1092 |
* igb_clear_interrupt_scheme - reset the device to a state of no interrupts |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1093 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1094 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1095 |
* This function resets the device so that it has 0 Rx queues, Tx queues, and |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1096 |
* MSI-X interrupts allocated. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1097 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1098 |
static void igb_clear_interrupt_scheme(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1099 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1100 |
igb_free_q_vectors(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1101 |
igb_reset_interrupt_capability(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1102 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1103 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1104 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1105 |
* igb_set_interrupt_capability - set MSI or MSI-X if supported |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1106 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1107 |
* @msix: boolean value of MSIX capability |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1108 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1109 |
* Attempt to configure interrupts using the best available |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1110 |
* capabilities of the hardware and kernel. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1111 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1112 |
static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1113 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1114 |
int err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1115 |
int numvecs, i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1116 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1117 |
if (!msix) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1118 |
goto msi_only; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1119 |
adapter->flags |= IGB_FLAG_HAS_MSIX; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1120 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1121 |
/* Number of supported queues. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1122 |
adapter->num_rx_queues = adapter->rss_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1123 |
if (adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1124 |
adapter->num_tx_queues = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1125 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1126 |
adapter->num_tx_queues = adapter->rss_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1127 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1128 |
/* start with one vector for every Rx queue */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1129 |
numvecs = adapter->num_rx_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1130 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1131 |
/* if Tx handler is separate add 1 for every Tx queue */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1132 |
if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1133 |
numvecs += adapter->num_tx_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1134 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1135 |
/* store the number of vectors reserved for queues */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1136 |
adapter->num_q_vectors = numvecs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1137 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1138 |
/* add 1 vector for link status interrupts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1139 |
numvecs++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1140 |
for (i = 0; i < numvecs; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1141 |
adapter->msix_entries[i].entry = i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1142 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1143 |
err = pci_enable_msix_range(adapter->pdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1144 |
adapter->msix_entries, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1145 |
numvecs, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1146 |
numvecs); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1147 |
if (err > 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1148 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1149 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1150 |
igb_reset_interrupt_capability(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1151 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1152 |
/* If we can't do MSI-X, try MSI */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1153 |
msi_only: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1154 |
adapter->flags &= ~IGB_FLAG_HAS_MSIX; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1155 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1156 |
/* disable SR-IOV for non MSI-X configurations */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1157 |
if (adapter->vf_data) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1158 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1159 |
/* disable iov and allow time for transactions to clear */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1160 |
pci_disable_sriov(adapter->pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1161 |
msleep(500); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1162 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1163 |
kfree(adapter->vf_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1164 |
adapter->vf_data = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1165 |
wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1166 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1167 |
msleep(100); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1168 |
dev_info(&adapter->pdev->dev, "IOV Disabled\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1169 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1170 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1171 |
adapter->vfs_allocated_count = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1172 |
adapter->rss_queues = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1173 |
adapter->flags |= IGB_FLAG_QUEUE_PAIRS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1174 |
adapter->num_rx_queues = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1175 |
adapter->num_tx_queues = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1176 |
adapter->num_q_vectors = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1177 |
if (!pci_enable_msi(adapter->pdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1178 |
adapter->flags |= IGB_FLAG_HAS_MSI; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1179 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1180 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1181 |
static void igb_add_ring(struct igb_ring *ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1182 |
struct igb_ring_container *head) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1183 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1184 |
head->ring = ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1185 |
head->count++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1186 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1187 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1188 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1189 |
* igb_alloc_q_vector - Allocate memory for a single interrupt vector |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1190 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1191 |
* @v_count: q_vectors allocated on adapter, used for ring interleaving |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1192 |
* @v_idx: index of vector in adapter struct |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1193 |
* @txr_count: total number of Tx rings to allocate |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1194 |
* @txr_idx: index of first Tx ring to allocate |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1195 |
* @rxr_count: total number of Rx rings to allocate |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1196 |
* @rxr_idx: index of first Rx ring to allocate |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1197 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1198 |
* We allocate one q_vector. If allocation fails we return -ENOMEM. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1199 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1200 |
static int igb_alloc_q_vector(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1201 |
int v_count, int v_idx, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1202 |
int txr_count, int txr_idx, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1203 |
int rxr_count, int rxr_idx) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1204 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1205 |
struct igb_q_vector *q_vector; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1206 |
struct igb_ring *ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1207 |
int ring_count, size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1208 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1209 |
/* igb only supports 1 Tx and/or 1 Rx queue per vector */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1210 |
if (txr_count > 1 || rxr_count > 1) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1211 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1212 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1213 |
ring_count = txr_count + rxr_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1214 |
size = sizeof(struct igb_q_vector) + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1215 |
(sizeof(struct igb_ring) * ring_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1216 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1217 |
/* allocate q_vector and rings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1218 |
q_vector = adapter->q_vector[v_idx]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1219 |
if (!q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1220 |
q_vector = kzalloc(size, GFP_KERNEL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1221 |
if (!q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1222 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1223 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1224 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1225 |
/* initialize NAPI */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1226 |
netif_napi_add(adapter->netdev, &q_vector->napi, |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1227 |
igb_poll, 64); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1228 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1229 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1230 |
/* tie q_vector and adapter together */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1231 |
adapter->q_vector[v_idx] = q_vector; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1232 |
q_vector->adapter = adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1233 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1234 |
/* initialize work limits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1235 |
q_vector->tx.work_limit = adapter->tx_work_limit; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1236 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1237 |
/* initialize ITR configuration */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1238 |
q_vector->itr_register = adapter->hw.hw_addr + E1000_EITR(0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1239 |
q_vector->itr_val = IGB_START_ITR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1240 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1241 |
/* initialize pointer to rings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1242 |
ring = q_vector->ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1243 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1244 |
/* intialize ITR */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1245 |
if (rxr_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1246 |
/* rx or rx/tx vector */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1247 |
if (!adapter->rx_itr_setting || adapter->rx_itr_setting > 3) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1248 |
q_vector->itr_val = adapter->rx_itr_setting; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1249 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1250 |
/* tx only vector */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1251 |
if (!adapter->tx_itr_setting || adapter->tx_itr_setting > 3) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1252 |
q_vector->itr_val = adapter->tx_itr_setting; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1253 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1254 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1255 |
if (txr_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1256 |
/* assign generic ring traits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1257 |
ring->dev = &adapter->pdev->dev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1258 |
ring->netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1259 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1260 |
/* configure backlink on ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1261 |
ring->q_vector = q_vector; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1262 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1263 |
/* update q_vector Tx values */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1264 |
igb_add_ring(ring, &q_vector->tx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1265 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1266 |
/* For 82575, context index must be unique per ring. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1267 |
if (adapter->hw.mac.type == e1000_82575) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1268 |
set_bit(IGB_RING_FLAG_TX_CTX_IDX, &ring->flags); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1269 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1270 |
/* apply Tx specific ring traits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1271 |
ring->count = adapter->tx_ring_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1272 |
ring->queue_index = txr_idx; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1273 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1274 |
u64_stats_init(&ring->tx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1275 |
u64_stats_init(&ring->tx_syncp2); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1276 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1277 |
/* assign ring to adapter */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1278 |
adapter->tx_ring[txr_idx] = ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1279 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1280 |
/* push pointer to next ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1281 |
ring++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1282 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1283 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1284 |
if (rxr_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1285 |
/* assign generic ring traits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1286 |
ring->dev = &adapter->pdev->dev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1287 |
ring->netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1288 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1289 |
/* configure backlink on ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1290 |
ring->q_vector = q_vector; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1291 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1292 |
/* update q_vector Rx values */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1293 |
igb_add_ring(ring, &q_vector->rx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1294 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1295 |
/* set flag indicating ring supports SCTP checksum offload */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1296 |
if (adapter->hw.mac.type >= e1000_82576) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1297 |
set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1298 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1299 |
/* On i350, i354, i210, and i211, loopback VLAN packets |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1300 |
* have the tag byte-swapped. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1301 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1302 |
if (adapter->hw.mac.type >= e1000_i350) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1303 |
set_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1304 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1305 |
/* apply Rx specific ring traits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1306 |
ring->count = adapter->rx_ring_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1307 |
ring->queue_index = rxr_idx; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1308 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1309 |
u64_stats_init(&ring->rx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1310 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1311 |
/* assign ring to adapter */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1312 |
adapter->rx_ring[rxr_idx] = ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1313 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1314 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1315 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1316 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1317 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1318 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1319 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1320 |
* igb_alloc_q_vectors - Allocate memory for interrupt vectors |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1321 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1322 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1323 |
* We allocate one q_vector per queue interrupt. If allocation fails we |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1324 |
* return -ENOMEM. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1325 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1326 |
static int igb_alloc_q_vectors(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1327 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1328 |
int q_vectors = adapter->num_q_vectors; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1329 |
int rxr_remaining = adapter->num_rx_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1330 |
int txr_remaining = adapter->num_tx_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1331 |
int rxr_idx = 0, txr_idx = 0, v_idx = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1332 |
int err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1333 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1334 |
if (q_vectors >= (rxr_remaining + txr_remaining)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1335 |
for (; rxr_remaining; v_idx++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1336 |
err = igb_alloc_q_vector(adapter, q_vectors, v_idx, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1337 |
0, 0, 1, rxr_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1338 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1339 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1340 |
goto err_out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1341 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1342 |
/* update counts and index */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1343 |
rxr_remaining--; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1344 |
rxr_idx++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1345 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1346 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1347 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1348 |
for (; v_idx < q_vectors; v_idx++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1349 |
int rqpv = DIV_ROUND_UP(rxr_remaining, q_vectors - v_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1350 |
int tqpv = DIV_ROUND_UP(txr_remaining, q_vectors - v_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1351 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1352 |
err = igb_alloc_q_vector(adapter, q_vectors, v_idx, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1353 |
tqpv, txr_idx, rqpv, rxr_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1354 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1355 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1356 |
goto err_out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1357 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1358 |
/* update counts and index */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1359 |
rxr_remaining -= rqpv; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1360 |
txr_remaining -= tqpv; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1361 |
rxr_idx++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1362 |
txr_idx++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1363 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1364 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1365 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1366 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1367 |
err_out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1368 |
adapter->num_tx_queues = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1369 |
adapter->num_rx_queues = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1370 |
adapter->num_q_vectors = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1371 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1372 |
while (v_idx--) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1373 |
igb_free_q_vector(adapter, v_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1374 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1375 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1376 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1377 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1378 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1379 |
* igb_init_interrupt_scheme - initialize interrupts, allocate queues/vectors |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1380 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1381 |
* @msix: boolean value of MSIX capability |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1382 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1383 |
* This function initializes the interrupts and allocates all of the queues. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1384 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1385 |
static int igb_init_interrupt_scheme(struct igb_adapter *adapter, bool msix) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1386 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1387 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1388 |
int err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1389 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1390 |
igb_set_interrupt_capability(adapter, msix); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1391 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1392 |
err = igb_alloc_q_vectors(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1393 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1394 |
dev_err(&pdev->dev, "Unable to allocate memory for vectors\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1395 |
goto err_alloc_q_vectors; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1396 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1397 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1398 |
igb_cache_ring_register(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1399 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1400 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1401 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1402 |
err_alloc_q_vectors: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1403 |
igb_reset_interrupt_capability(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1404 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1405 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1406 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1407 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1408 |
* igb_request_irq - initialize interrupts |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1409 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1410 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1411 |
* Attempts to configure interrupts using the best available |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1412 |
* capabilities of the hardware and kernel. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1413 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1414 |
static int igb_request_irq(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1415 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1416 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1417 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1418 |
int err = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1419 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1420 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1421 |
err = igb_request_msix(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1422 |
if (!err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1423 |
goto request_done; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1424 |
/* fall back to MSI */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1425 |
igb_free_all_tx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1426 |
igb_free_all_rx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1427 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1428 |
igb_clear_interrupt_scheme(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1429 |
err = igb_init_interrupt_scheme(adapter, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1430 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1431 |
goto request_done; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1432 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1433 |
igb_setup_all_tx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1434 |
igb_setup_all_rx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1435 |
igb_configure(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1436 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1437 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1438 |
igb_assign_vector(adapter->q_vector[0], 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1439 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1440 |
if (!adapter->ecdev && adapter->flags & IGB_FLAG_HAS_MSI) { |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1441 |
err = request_irq(pdev->irq, igb_intr_msi, 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1442 |
netdev->name, adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1443 |
if (!err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1444 |
goto request_done; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1445 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1446 |
/* fall back to legacy interrupts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1447 |
igb_reset_interrupt_capability(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1448 |
adapter->flags &= ~IGB_FLAG_HAS_MSI; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1449 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1450 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1451 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1452 |
err = request_irq(pdev->irq, igb_intr, IRQF_SHARED, |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1453 |
netdev->name, adapter); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1454 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1455 |
if (err) |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1456 |
dev_err(&pdev->dev, "Error %d getting interrupt\n", |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1457 |
err); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1458 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1459 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1460 |
request_done: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1461 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1462 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1463 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1464 |
static void igb_free_irq(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1465 |
{ |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1466 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1467 |
/* no IRQ to free in EtherCAT operation */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1468 |
return; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1469 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1470 |
|
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1471 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1472 |
int vector = 0, i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1473 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1474 |
free_irq(adapter->msix_entries[vector++].vector, adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1475 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1476 |
for (i = 0; i < adapter->num_q_vectors; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1477 |
free_irq(adapter->msix_entries[vector++].vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1478 |
adapter->q_vector[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1479 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1480 |
free_irq(adapter->pdev->irq, adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1481 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1482 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1483 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1484 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1485 |
* igb_irq_disable - Mask off interrupt generation on the NIC |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1486 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1487 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1488 |
static void igb_irq_disable(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1489 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1490 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1491 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1492 |
/* we need to be careful when disabling interrupts. The VFs are also |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1493 |
* mapped into these registers and so clearing the bits can cause |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1494 |
* issues on the VF drivers so we only need to clear what we set |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1495 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1496 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1497 |
u32 regval = rd32(E1000_EIAM); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1498 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1499 |
wr32(E1000_EIAM, regval & ~adapter->eims_enable_mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1500 |
wr32(E1000_EIMC, adapter->eims_enable_mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1501 |
regval = rd32(E1000_EIAC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1502 |
wr32(E1000_EIAC, regval & ~adapter->eims_enable_mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1503 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1504 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1505 |
wr32(E1000_IAM, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1506 |
wr32(E1000_IMC, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1507 |
wrfl(); |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1508 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1509 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1510 |
/* skip synchonizing IRQs */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1511 |
return; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1512 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1513 |
|
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1514 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1515 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1516 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1517 |
for (i = 0; i < adapter->num_q_vectors; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1518 |
synchronize_irq(adapter->msix_entries[i].vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1519 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1520 |
synchronize_irq(adapter->pdev->irq); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1521 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1522 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1523 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1524 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1525 |
* igb_irq_enable - Enable default interrupt generation settings |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1526 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1527 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1528 |
static void igb_irq_enable(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1529 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1530 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1531 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1532 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1533 |
/* skip enabling interrupts */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1534 |
return; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1535 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1536 |
|
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1537 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1538 |
u32 ims = E1000_IMS_LSC | E1000_IMS_DOUTSYNC | E1000_IMS_DRSTA; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1539 |
u32 regval = rd32(E1000_EIAC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1540 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1541 |
wr32(E1000_EIAC, regval | adapter->eims_enable_mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1542 |
regval = rd32(E1000_EIAM); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1543 |
wr32(E1000_EIAM, regval | adapter->eims_enable_mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1544 |
wr32(E1000_EIMS, adapter->eims_enable_mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1545 |
if (adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1546 |
wr32(E1000_MBVFIMR, 0xFF); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1547 |
ims |= E1000_IMS_VMMB; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1548 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1549 |
wr32(E1000_IMS, ims); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1550 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1551 |
wr32(E1000_IMS, IMS_ENABLE_MASK | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1552 |
E1000_IMS_DRSTA); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1553 |
wr32(E1000_IAM, IMS_ENABLE_MASK | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1554 |
E1000_IMS_DRSTA); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1555 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1556 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1557 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1558 |
static void igb_update_mng_vlan(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1559 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1560 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1561 |
u16 vid = adapter->hw.mng_cookie.vlan_id; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1562 |
u16 old_vid = adapter->mng_vlan_id; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1563 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1564 |
if (hw->mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1565 |
/* add VID to filter table */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1566 |
igb_vfta_set(hw, vid, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1567 |
adapter->mng_vlan_id = vid; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1568 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1569 |
adapter->mng_vlan_id = IGB_MNG_VLAN_NONE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1570 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1571 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1572 |
if ((old_vid != (u16)IGB_MNG_VLAN_NONE) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1573 |
(vid != old_vid) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1574 |
!test_bit(old_vid, adapter->active_vlans)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1575 |
/* remove VID from filter table */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1576 |
igb_vfta_set(hw, old_vid, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1577 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1578 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1579 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1580 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1581 |
* igb_release_hw_control - release control of the h/w to f/w |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1582 |
* @adapter: address of board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1583 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1584 |
* igb_release_hw_control resets CTRL_EXT:DRV_LOAD bit. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1585 |
* For ASF and Pass Through versions of f/w this means that the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1586 |
* driver is no longer loaded. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1587 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1588 |
static void igb_release_hw_control(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1589 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1590 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1591 |
u32 ctrl_ext; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1592 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1593 |
/* Let firmware take over control of h/w */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1594 |
ctrl_ext = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1595 |
wr32(E1000_CTRL_EXT, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1596 |
ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1597 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1598 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1599 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1600 |
* igb_get_hw_control - get control of the h/w from f/w |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1601 |
* @adapter: address of board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1602 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1603 |
* igb_get_hw_control sets CTRL_EXT:DRV_LOAD bit. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1604 |
* For ASF and Pass Through versions of f/w this means that |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1605 |
* the driver is loaded. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1606 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1607 |
static void igb_get_hw_control(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1608 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1609 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1610 |
u32 ctrl_ext; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1611 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1612 |
/* Let firmware know the driver has taken over */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1613 |
ctrl_ext = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1614 |
wr32(E1000_CTRL_EXT, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1615 |
ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1616 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1617 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1618 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1619 |
* igb_configure - configure the hardware for RX and TX |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1620 |
* @adapter: private board structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1621 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1622 |
static void igb_configure(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1623 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1624 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1625 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1626 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1627 |
igb_get_hw_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1628 |
igb_set_rx_mode(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1629 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1630 |
igb_restore_vlan(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1631 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1632 |
igb_setup_tctl(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1633 |
igb_setup_mrqc(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1634 |
igb_setup_rctl(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1635 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1636 |
igb_configure_tx(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1637 |
igb_configure_rx(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1638 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1639 |
igb_rx_fifo_flush_82575(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1640 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1641 |
/* call igb_desc_unused which always leaves |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1642 |
* at least 1 descriptor unused to make sure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1643 |
* next_to_use != next_to_clean |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1644 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1645 |
for (i = 0; i < adapter->num_rx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1646 |
struct igb_ring *ring = adapter->rx_ring[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1647 |
igb_alloc_rx_buffers(ring, igb_desc_unused(ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1648 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1649 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1650 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1651 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1652 |
* igb_power_up_link - Power up the phy/serdes link |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1653 |
* @adapter: address of board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1654 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1655 |
void igb_power_up_link(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1656 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1657 |
igb_reset_phy(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1658 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1659 |
if (adapter->hw.phy.media_type == e1000_media_type_copper) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1660 |
igb_power_up_phy_copper(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1661 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1662 |
igb_power_up_serdes_link_82575(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1663 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1664 |
igb_setup_link(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1665 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1666 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1667 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1668 |
* igb_power_down_link - Power down the phy/serdes link |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1669 |
* @adapter: address of board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1670 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1671 |
static void igb_power_down_link(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1672 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1673 |
if (adapter->hw.phy.media_type == e1000_media_type_copper) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1674 |
igb_power_down_phy_copper_82575(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1675 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1676 |
igb_shutdown_serdes_link_82575(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1677 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1678 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1679 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1680 |
* Detect and switch function for Media Auto Sense |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1681 |
* @adapter: address of the board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1682 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1683 |
static void igb_check_swap_media(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1684 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1685 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1686 |
u32 ctrl_ext, connsw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1687 |
bool swap_now = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1688 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1689 |
ctrl_ext = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1690 |
connsw = rd32(E1000_CONNSW); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1691 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1692 |
/* need to live swap if current media is copper and we have fiber/serdes |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1693 |
* to go to. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1694 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1695 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1696 |
if ((hw->phy.media_type == e1000_media_type_copper) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1697 |
(!(connsw & E1000_CONNSW_AUTOSENSE_EN))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1698 |
swap_now = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1699 |
} else if (!(connsw & E1000_CONNSW_SERDESD)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1700 |
/* copper signal takes time to appear */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1701 |
if (adapter->copper_tries < 4) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1702 |
adapter->copper_tries++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1703 |
connsw |= E1000_CONNSW_AUTOSENSE_CONF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1704 |
wr32(E1000_CONNSW, connsw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1705 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1706 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1707 |
adapter->copper_tries = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1708 |
if ((connsw & E1000_CONNSW_PHYSD) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1709 |
(!(connsw & E1000_CONNSW_PHY_PDN))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1710 |
swap_now = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1711 |
connsw &= ~E1000_CONNSW_AUTOSENSE_CONF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1712 |
wr32(E1000_CONNSW, connsw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1713 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1714 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1715 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1716 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1717 |
if (!swap_now) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1718 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1719 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1720 |
switch (hw->phy.media_type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1721 |
case e1000_media_type_copper: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1722 |
netdev_info(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1723 |
"MAS: changing media to fiber/serdes\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1724 |
ctrl_ext |= |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1725 |
E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1726 |
adapter->flags |= IGB_FLAG_MEDIA_RESET; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1727 |
adapter->copper_tries = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1728 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1729 |
case e1000_media_type_internal_serdes: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1730 |
case e1000_media_type_fiber: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1731 |
netdev_info(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1732 |
"MAS: changing media to copper\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1733 |
ctrl_ext &= |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1734 |
~E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1735 |
adapter->flags |= IGB_FLAG_MEDIA_RESET; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1736 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1737 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1738 |
/* shouldn't get here during regular operation */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1739 |
netdev_err(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1740 |
"AMS: Invalid media type found, returning\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1741 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1742 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1743 |
wr32(E1000_CTRL_EXT, ctrl_ext); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1744 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1745 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1746 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1747 |
* igb_up - Open the interface and prepare it to handle traffic |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1748 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1749 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1750 |
int igb_up(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1751 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1752 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1753 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1754 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1755 |
/* hardware has been reset, we need to reload some things */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1756 |
igb_configure(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1757 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1758 |
clear_bit(__IGB_DOWN, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1759 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1760 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1761 |
for (i = 0; i < adapter->num_q_vectors; i++) |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1762 |
napi_enable(&(adapter->q_vector[i]->napi)); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1763 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1764 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1765 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1766 |
igb_configure_msix(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1767 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1768 |
igb_assign_vector(adapter->q_vector[0], 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1769 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1770 |
/* Clear any pending interrupts. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1771 |
rd32(E1000_ICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1772 |
igb_irq_enable(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1773 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1774 |
/* notify VFs that reset has been completed */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1775 |
if (adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1776 |
u32 reg_data = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1777 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1778 |
reg_data |= E1000_CTRL_EXT_PFRSTD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1779 |
wr32(E1000_CTRL_EXT, reg_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1780 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1781 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1782 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1783 |
netif_tx_start_all_queues(adapter->netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1784 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1785 |
/* start the watchdog. */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1786 |
hw->mac.get_link_status = 1; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1787 |
schedule_work(&adapter->watchdog_task); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1788 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1789 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1790 |
if ((adapter->flags & IGB_FLAG_EEE) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1791 |
(!hw->dev_spec._82575.eee_disable)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1792 |
adapter->eee_advert = MDIO_EEE_100TX | MDIO_EEE_1000T; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1793 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1794 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1795 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1796 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1797 |
void igb_down(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1798 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1799 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1800 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1801 |
u32 tctl, rctl; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1802 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1803 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1804 |
/* signal that we're down so the interrupt handler does not |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1805 |
* reschedule our watchdog timer |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1806 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1807 |
set_bit(__IGB_DOWN, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1808 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1809 |
/* disable receives in the hardware */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1810 |
rctl = rd32(E1000_RCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1811 |
wr32(E1000_RCTL, rctl & ~E1000_RCTL_EN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1812 |
/* flush and sleep below */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1813 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1814 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1815 |
netif_tx_stop_all_queues(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1816 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1817 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1818 |
/* disable transmits in the hardware */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1819 |
tctl = rd32(E1000_TCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1820 |
tctl &= ~E1000_TCTL_EN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1821 |
wr32(E1000_TCTL, tctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1822 |
/* flush both disables and wait for them to finish */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1823 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1824 |
usleep_range(10000, 11000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1825 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1826 |
igb_irq_disable(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1827 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1828 |
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1829 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1830 |
for (i = 0; i < adapter->num_q_vectors; i++) { |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1831 |
if (!adapter->ecdev && adapter->q_vector[i]) { |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1832 |
napi_synchronize(&adapter->q_vector[i]->napi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1833 |
napi_disable(&adapter->q_vector[i]->napi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1834 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1835 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1836 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1837 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1838 |
del_timer_sync(&adapter->watchdog_timer); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1839 |
del_timer_sync(&adapter->phy_info_timer); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1840 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1841 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1842 |
netif_carrier_off(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
1843 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1844 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1845 |
/* record the stats before reset*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1846 |
spin_lock(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1847 |
igb_update_stats(adapter, &adapter->stats64); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1848 |
spin_unlock(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1849 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1850 |
adapter->link_speed = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1851 |
adapter->link_duplex = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1852 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1853 |
if (!pci_channel_offline(adapter->pdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1854 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1855 |
igb_clean_all_tx_rings(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1856 |
igb_clean_all_rx_rings(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1857 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1858 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1859 |
/* since we reset the hardware DCA settings were cleared */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1860 |
igb_setup_dca(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1861 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1862 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1863 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1864 |
void igb_reinit_locked(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1865 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1866 |
WARN_ON(in_interrupt()); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1867 |
while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1868 |
usleep_range(1000, 2000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1869 |
igb_down(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1870 |
igb_up(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1871 |
clear_bit(__IGB_RESETTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1872 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1873 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1874 |
/** igb_enable_mas - Media Autosense re-enable after swap |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1875 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1876 |
* @adapter: adapter struct |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1877 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1878 |
static s32 igb_enable_mas(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1879 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1880 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1881 |
u32 connsw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1882 |
s32 ret_val = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1883 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1884 |
connsw = rd32(E1000_CONNSW); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1885 |
if (!(hw->phy.media_type == e1000_media_type_copper)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1886 |
return ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1887 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1888 |
/* configure for SerDes media detect */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1889 |
if (!(connsw & E1000_CONNSW_SERDESD)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1890 |
connsw |= E1000_CONNSW_ENRGSRC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1891 |
connsw |= E1000_CONNSW_AUTOSENSE_EN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1892 |
wr32(E1000_CONNSW, connsw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1893 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1894 |
} else if (connsw & E1000_CONNSW_SERDESD) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1895 |
/* already SerDes, no need to enable anything */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1896 |
return ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1897 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1898 |
netdev_info(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1899 |
"MAS: Unable to configure feature, disabling..\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1900 |
adapter->flags &= ~IGB_FLAG_MAS_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1901 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1902 |
return ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1903 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1904 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1905 |
void igb_reset(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1906 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1907 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1908 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1909 |
struct e1000_mac_info *mac = &hw->mac; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1910 |
struct e1000_fc_info *fc = &hw->fc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1911 |
u32 pba = 0, tx_space, min_tx_space, min_rx_space, hwm; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1912 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1913 |
/* Repartition Pba for greater than 9k mtu |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1914 |
* To take effect CTRL.RST is required. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1915 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1916 |
switch (mac->type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1917 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1918 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1919 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1920 |
pba = rd32(E1000_RXPBS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1921 |
pba = igb_rxpbs_adjust_82580(pba); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1922 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1923 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1924 |
pba = rd32(E1000_RXPBS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1925 |
pba &= E1000_RXPBS_SIZE_MASK_82576; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1926 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1927 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1928 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1929 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1930 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1931 |
pba = E1000_PBA_34K; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1932 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1933 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1934 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1935 |
if ((adapter->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1936 |
(mac->type < e1000_82576)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1937 |
/* adjust PBA for jumbo frames */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1938 |
wr32(E1000_PBA, pba); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1939 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1940 |
/* To maintain wire speed transmits, the Tx FIFO should be |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1941 |
* large enough to accommodate two full transmit packets, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1942 |
* rounded up to the next 1KB and expressed in KB. Likewise, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1943 |
* the Rx FIFO should be large enough to accommodate at least |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1944 |
* one full receive packet and is similarly rounded up and |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1945 |
* expressed in KB. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1946 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1947 |
pba = rd32(E1000_PBA); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1948 |
/* upper 16 bits has Tx packet buffer allocation size in KB */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1949 |
tx_space = pba >> 16; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1950 |
/* lower 16 bits has Rx packet buffer allocation size in KB */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1951 |
pba &= 0xffff; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1952 |
/* the Tx fifo also stores 16 bytes of information about the Tx |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1953 |
* but don't include ethernet FCS because hardware appends it |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1954 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1955 |
min_tx_space = (adapter->max_frame_size + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1956 |
sizeof(union e1000_adv_tx_desc) - |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1957 |
ETH_FCS_LEN) * 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1958 |
min_tx_space = ALIGN(min_tx_space, 1024); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1959 |
min_tx_space >>= 10; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1960 |
/* software strips receive CRC, so leave room for it */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1961 |
min_rx_space = adapter->max_frame_size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1962 |
min_rx_space = ALIGN(min_rx_space, 1024); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1963 |
min_rx_space >>= 10; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1964 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1965 |
/* If current Tx allocation is less than the min Tx FIFO size, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1966 |
* and the min Tx FIFO size is less than the current Rx FIFO |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1967 |
* allocation, take space away from current Rx allocation |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1968 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1969 |
if (tx_space < min_tx_space && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1970 |
((min_tx_space - tx_space) < pba)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1971 |
pba = pba - (min_tx_space - tx_space); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1972 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1973 |
/* if short on Rx space, Rx wins and must trump Tx |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1974 |
* adjustment |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1975 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1976 |
if (pba < min_rx_space) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1977 |
pba = min_rx_space; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1978 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1979 |
wr32(E1000_PBA, pba); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1980 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1981 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1982 |
/* flow control settings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1983 |
/* The high water mark must be low enough to fit one full frame |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1984 |
* (or the size used for early receive) above it in the Rx FIFO. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1985 |
* Set it to the lower of: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1986 |
* - 90% of the Rx FIFO size, or |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1987 |
* - the full Rx FIFO size minus one full frame |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1988 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1989 |
hwm = min(((pba << 10) * 9 / 10), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1990 |
((pba << 10) - 2 * adapter->max_frame_size)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1991 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1992 |
fc->high_water = hwm & 0xFFFFFFF0; /* 16-byte granularity */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1993 |
fc->low_water = fc->high_water - 16; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1994 |
fc->pause_time = 0xFFFF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1995 |
fc->send_xon = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1996 |
fc->current_mode = fc->requested_mode; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1997 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1998 |
/* disable receive for all VFs and wait one second */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1999 |
if (adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2000 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2001 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2002 |
for (i = 0 ; i < adapter->vfs_allocated_count; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2003 |
adapter->vf_data[i].flags &= IGB_VF_FLAG_PF_SET_MAC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2004 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2005 |
/* ping all the active vfs to let them know we are going down */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2006 |
igb_ping_all_vfs(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2007 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2008 |
/* disable transmits and receives */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2009 |
wr32(E1000_VFRE, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2010 |
wr32(E1000_VFTE, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2011 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2012 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2013 |
/* Allow time for pending master requests to run */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2014 |
hw->mac.ops.reset_hw(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2015 |
wr32(E1000_WUC, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2016 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2017 |
if (adapter->flags & IGB_FLAG_MEDIA_RESET) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2018 |
/* need to resetup here after media swap */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2019 |
adapter->ei.get_invariants(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2020 |
adapter->flags &= ~IGB_FLAG_MEDIA_RESET; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2021 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2022 |
if (adapter->flags & IGB_FLAG_MAS_ENABLE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2023 |
if (igb_enable_mas(adapter)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2024 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2025 |
"Error enabling Media Auto Sense\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2026 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2027 |
if (hw->mac.ops.init_hw(hw)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2028 |
dev_err(&pdev->dev, "Hardware Error\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2029 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2030 |
/* Flow control settings reset on hardware reset, so guarantee flow |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2031 |
* control is off when forcing speed. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2032 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2033 |
if (!hw->mac.autoneg) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2034 |
igb_force_mac_fc(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2035 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2036 |
igb_init_dmac(adapter, pba); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2037 |
#ifdef CONFIG_IGB_HWMON |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2038 |
/* Re-initialize the thermal sensor on i350 devices. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2039 |
if (!test_bit(__IGB_DOWN, &adapter->state)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2040 |
if (mac->type == e1000_i350 && hw->bus.func == 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2041 |
/* If present, re-initialize the external thermal sensor |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2042 |
* interface. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2043 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2044 |
if (adapter->ets) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2045 |
mac->ops.init_thermal_sensor_thresh(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2046 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2047 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2048 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2049 |
/* Re-establish EEE setting */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2050 |
if (hw->phy.media_type == e1000_media_type_copper) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2051 |
switch (mac->type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2052 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2053 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2054 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2055 |
igb_set_eee_i350(hw, true, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2056 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2057 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2058 |
igb_set_eee_i354(hw, true, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2059 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2060 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2061 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2062 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2063 |
} |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2064 |
if (!adapter->ecdev && !netif_running(adapter->netdev)) |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2065 |
igb_power_down_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2066 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2067 |
igb_update_mng_vlan(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2068 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2069 |
/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2070 |
wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2071 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2072 |
/* Re-enable PTP, where applicable. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2073 |
igb_ptp_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2074 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2075 |
igb_get_phy_info(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2076 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2077 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2078 |
static netdev_features_t igb_fix_features(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2079 |
netdev_features_t features) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2080 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2081 |
/* Since there is no support for separate Rx/Tx vlan accel |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2082 |
* enable/disable make sure Tx flag is always in same state as Rx. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2083 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2084 |
if (features & NETIF_F_HW_VLAN_CTAG_RX) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2085 |
features |= NETIF_F_HW_VLAN_CTAG_TX; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2086 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2087 |
features &= ~NETIF_F_HW_VLAN_CTAG_TX; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2088 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2089 |
return features; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2090 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2091 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2092 |
static int igb_set_features(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2093 |
netdev_features_t features) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2094 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2095 |
netdev_features_t changed = netdev->features ^ features; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2096 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2097 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2098 |
if (changed & NETIF_F_HW_VLAN_CTAG_RX) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2099 |
igb_vlan_mode(netdev, features); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2100 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2101 |
if (!(changed & NETIF_F_RXALL)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2102 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2103 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2104 |
netdev->features = features; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2105 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2106 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2107 |
igb_reinit_locked(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2108 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2109 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2110 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2111 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2112 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2113 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2114 |
static const struct net_device_ops igb_netdev_ops = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2115 |
.ndo_open = igb_open, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2116 |
.ndo_stop = igb_close, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2117 |
.ndo_start_xmit = igb_xmit_frame, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2118 |
.ndo_get_stats64 = igb_get_stats64, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2119 |
.ndo_set_rx_mode = igb_set_rx_mode, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2120 |
.ndo_set_mac_address = igb_set_mac, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2121 |
.ndo_change_mtu = igb_change_mtu, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2122 |
.ndo_do_ioctl = igb_ioctl, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2123 |
.ndo_tx_timeout = igb_tx_timeout, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2124 |
.ndo_validate_addr = eth_validate_addr, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2125 |
.ndo_vlan_rx_add_vid = igb_vlan_rx_add_vid, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2126 |
.ndo_vlan_rx_kill_vid = igb_vlan_rx_kill_vid, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2127 |
.ndo_set_vf_mac = igb_ndo_set_vf_mac, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2128 |
.ndo_set_vf_vlan = igb_ndo_set_vf_vlan, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2129 |
.ndo_set_vf_rate = igb_ndo_set_vf_bw, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2130 |
.ndo_set_vf_spoofchk = igb_ndo_set_vf_spoofchk, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2131 |
.ndo_get_vf_config = igb_ndo_get_vf_config, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2132 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2133 |
.ndo_poll_controller = igb_netpoll, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2134 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2135 |
.ndo_fix_features = igb_fix_features, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2136 |
.ndo_set_features = igb_set_features, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2137 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2138 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2139 |
/** |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2140 |
* ec_poll - EtherCAT poll routine |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2141 |
* @netdev: net device structure |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2142 |
* |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2143 |
* This function can never fail. |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2144 |
* |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2145 |
**/ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2146 |
void ec_poll(struct net_device *netdev) |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2147 |
{ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2148 |
struct igb_adapter *adapter = netdev_priv(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2149 |
int i; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2150 |
int budget = 64; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2151 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2152 |
if (jiffies - adapter->ec_watchdog_jiffies >= 2 * HZ) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2153 |
struct e1000_hw *hw = &adapter->hw; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2154 |
bool link; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2155 |
hw->mac.get_link_status = true; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2156 |
link = igb_has_link(adapter); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2157 |
ecdev_set_link(adapter->ecdev, link); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2158 |
adapter->ec_watchdog_jiffies = jiffies; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2159 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2160 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2161 |
for (i = 0; i < adapter->num_q_vectors; i++) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2162 |
struct igb_q_vector *q_vector = adapter->q_vector[i]; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2163 |
if (q_vector->tx.ring) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2164 |
igb_clean_tx_irq(q_vector); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2165 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2166 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2167 |
if (q_vector->rx.ring) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2168 |
igb_clean_rx_irq(q_vector, budget); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2169 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2170 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2171 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2172 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2173 |
/** |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2174 |
* igb_set_fw_version - Configure version string for ethtool |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2175 |
* @adapter: adapter struct |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2176 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2177 |
void igb_set_fw_version(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2178 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2179 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2180 |
struct e1000_fw_version fw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2181 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2182 |
igb_get_fw_version(hw, &fw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2183 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2184 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2185 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2186 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2187 |
if (!(igb_get_flash_presence_i210(hw))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2188 |
snprintf(adapter->fw_version, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2189 |
sizeof(adapter->fw_version), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2190 |
"%2d.%2d-%d", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2191 |
fw.invm_major, fw.invm_minor, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2192 |
fw.invm_img_type); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2193 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2194 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2195 |
/* fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2196 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2197 |
/* if option is rom valid, display its version too */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2198 |
if (fw.or_valid) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2199 |
snprintf(adapter->fw_version, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2200 |
sizeof(adapter->fw_version), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2201 |
"%d.%d, 0x%08x, %d.%d.%d", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2202 |
fw.eep_major, fw.eep_minor, fw.etrack_id, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2203 |
fw.or_major, fw.or_build, fw.or_patch); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2204 |
/* no option rom */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2205 |
} else if (fw.etrack_id != 0X0000) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2206 |
snprintf(adapter->fw_version, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2207 |
sizeof(adapter->fw_version), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2208 |
"%d.%d, 0x%08x", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2209 |
fw.eep_major, fw.eep_minor, fw.etrack_id); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2210 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2211 |
snprintf(adapter->fw_version, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2212 |
sizeof(adapter->fw_version), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2213 |
"%d.%d.%d", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2214 |
fw.eep_major, fw.eep_minor, fw.eep_build); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2215 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2216 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2217 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2218 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2219 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2220 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2221 |
* igb_init_mas - init Media Autosense feature if enabled in the NVM |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2222 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2223 |
* @adapter: adapter struct |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2224 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2225 |
static void igb_init_mas(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2226 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2227 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2228 |
u16 eeprom_data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2229 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2230 |
hw->nvm.ops.read(hw, NVM_COMPAT, 1, &eeprom_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2231 |
switch (hw->bus.func) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2232 |
case E1000_FUNC_0: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2233 |
if (eeprom_data & IGB_MAS_ENABLE_0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2234 |
adapter->flags |= IGB_FLAG_MAS_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2235 |
netdev_info(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2236 |
"MAS: Enabling Media Autosense for port %d\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2237 |
hw->bus.func); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2238 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2239 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2240 |
case E1000_FUNC_1: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2241 |
if (eeprom_data & IGB_MAS_ENABLE_1) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2242 |
adapter->flags |= IGB_FLAG_MAS_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2243 |
netdev_info(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2244 |
"MAS: Enabling Media Autosense for port %d\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2245 |
hw->bus.func); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2246 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2247 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2248 |
case E1000_FUNC_2: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2249 |
if (eeprom_data & IGB_MAS_ENABLE_2) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2250 |
adapter->flags |= IGB_FLAG_MAS_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2251 |
netdev_info(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2252 |
"MAS: Enabling Media Autosense for port %d\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2253 |
hw->bus.func); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2254 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2255 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2256 |
case E1000_FUNC_3: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2257 |
if (eeprom_data & IGB_MAS_ENABLE_3) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2258 |
adapter->flags |= IGB_FLAG_MAS_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2259 |
netdev_info(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2260 |
"MAS: Enabling Media Autosense for port %d\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2261 |
hw->bus.func); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2262 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2263 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2264 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2265 |
/* Shouldn't get here */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2266 |
netdev_err(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2267 |
"MAS: Invalid port configuration, returning\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2268 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2269 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2270 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2271 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2272 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2273 |
* igb_init_i2c - Init I2C interface |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2274 |
* @adapter: pointer to adapter structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2275 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2276 |
static s32 igb_init_i2c(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2277 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2278 |
s32 status = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2279 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2280 |
/* I2C interface supported on i350 devices */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2281 |
if (adapter->hw.mac.type != e1000_i350) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2282 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2283 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2284 |
/* Initialize the i2c bus which is controlled by the registers. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2285 |
* This bus will use the i2c_algo_bit structue that implements |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2286 |
* the protocol through toggling of the 4 bits in the register. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2287 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2288 |
adapter->i2c_adap.owner = THIS_MODULE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2289 |
adapter->i2c_algo = igb_i2c_algo; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2290 |
adapter->i2c_algo.data = adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2291 |
adapter->i2c_adap.algo_data = &adapter->i2c_algo; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2292 |
adapter->i2c_adap.dev.parent = &adapter->pdev->dev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2293 |
strlcpy(adapter->i2c_adap.name, "igb BB", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2294 |
sizeof(adapter->i2c_adap.name)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2295 |
status = i2c_bit_add_bus(&adapter->i2c_adap); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2296 |
return status; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2297 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2298 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2299 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2300 |
* igb_probe - Device Initialization Routine |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2301 |
* @pdev: PCI device information struct |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2302 |
* @ent: entry in igb_pci_tbl |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2303 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2304 |
* Returns 0 on success, negative on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2305 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2306 |
* igb_probe initializes an adapter identified by a pci_dev structure. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2307 |
* The OS initialization, configuring of the adapter private structure, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2308 |
* and a hardware reset occur. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2309 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2310 |
static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2311 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2312 |
struct net_device *netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2313 |
struct igb_adapter *adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2314 |
struct e1000_hw *hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2315 |
u16 eeprom_data = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2316 |
s32 ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2317 |
static int global_quad_port_a; /* global quad port a indication */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2318 |
const struct e1000_info *ei = igb_info_tbl[ent->driver_data]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2319 |
int err, pci_using_dac; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2320 |
u8 part_str[E1000_PBANUM_LENGTH]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2321 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2322 |
/* Catch broken hardware that put the wrong VF device ID in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2323 |
* the PCIe SR-IOV capability. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2324 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2325 |
if (pdev->is_virtfn) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2326 |
WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2327 |
pci_name(pdev), pdev->vendor, pdev->device); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2328 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2329 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2330 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2331 |
err = pci_enable_device_mem(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2332 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2333 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2334 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2335 |
pci_using_dac = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2336 |
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2337 |
if (!err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2338 |
pci_using_dac = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2339 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2340 |
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2341 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2342 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2343 |
"No usable DMA configuration, aborting\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2344 |
goto err_dma; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2345 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2346 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2347 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2348 |
err = pci_request_selected_regions(pdev, pci_select_bars(pdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2349 |
IORESOURCE_MEM), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2350 |
igb_driver_name); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2351 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2352 |
goto err_pci_reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2353 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2354 |
pci_enable_pcie_error_reporting(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2355 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2356 |
pci_set_master(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2357 |
pci_save_state(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2358 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2359 |
err = -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2360 |
netdev = alloc_etherdev_mq(sizeof(struct igb_adapter), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2361 |
IGB_MAX_TX_QUEUES); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2362 |
if (!netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2363 |
goto err_alloc_etherdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2364 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2365 |
SET_NETDEV_DEV(netdev, &pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2366 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2367 |
pci_set_drvdata(pdev, netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2368 |
adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2369 |
adapter->netdev = netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2370 |
adapter->pdev = pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2371 |
hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2372 |
hw->back = adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2373 |
adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2374 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2375 |
err = -EIO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2376 |
hw->hw_addr = pci_iomap(pdev, 0, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2377 |
if (!hw->hw_addr) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2378 |
goto err_ioremap; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2379 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2380 |
netdev->netdev_ops = &igb_netdev_ops; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2381 |
igb_set_ethtool_ops(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2382 |
netdev->watchdog_timeo = 5 * HZ; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2383 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2384 |
strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2385 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2386 |
netdev->mem_start = pci_resource_start(pdev, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2387 |
netdev->mem_end = pci_resource_end(pdev, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2388 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2389 |
/* PCI config space info */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2390 |
hw->vendor_id = pdev->vendor; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2391 |
hw->device_id = pdev->device; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2392 |
hw->revision_id = pdev->revision; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2393 |
hw->subsystem_vendor_id = pdev->subsystem_vendor; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2394 |
hw->subsystem_device_id = pdev->subsystem_device; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2395 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2396 |
/* Copy the default MAC, PHY and NVM function pointers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2397 |
memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2398 |
memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2399 |
memcpy(&hw->nvm.ops, ei->nvm_ops, sizeof(hw->nvm.ops)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2400 |
/* Initialize skew-specific constants */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2401 |
err = ei->get_invariants(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2402 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2403 |
goto err_sw_init; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2404 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2405 |
/* setup the private structure */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2406 |
err = igb_sw_init(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2407 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2408 |
goto err_sw_init; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2409 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2410 |
igb_get_bus_info_pcie(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2411 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2412 |
hw->phy.autoneg_wait_to_complete = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2413 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2414 |
/* Copper options */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2415 |
if (hw->phy.media_type == e1000_media_type_copper) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2416 |
hw->phy.mdix = AUTO_ALL_MODES; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2417 |
hw->phy.disable_polarity_correction = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2418 |
hw->phy.ms_type = e1000_ms_hw_default; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2419 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2420 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2421 |
if (igb_check_reset_block(hw)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2422 |
dev_info(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2423 |
"PHY reset is blocked due to SOL/IDER session.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2424 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2425 |
/* features is initialized to 0 in allocation, it might have bits |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2426 |
* set by igb_sw_init so we should use an or instead of an |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2427 |
* assignment. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2428 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2429 |
netdev->features |= NETIF_F_SG | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2430 |
NETIF_F_IP_CSUM | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2431 |
NETIF_F_IPV6_CSUM | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2432 |
NETIF_F_TSO | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2433 |
NETIF_F_TSO6 | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2434 |
NETIF_F_RXHASH | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2435 |
NETIF_F_RXCSUM | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2436 |
NETIF_F_HW_VLAN_CTAG_RX | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2437 |
NETIF_F_HW_VLAN_CTAG_TX; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2438 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2439 |
/* copy netdev features into list of user selectable features */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2440 |
netdev->hw_features |= netdev->features; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2441 |
netdev->hw_features |= NETIF_F_RXALL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2442 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2443 |
/* set this bit last since it cannot be part of hw_features */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2444 |
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2445 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2446 |
netdev->vlan_features |= NETIF_F_TSO | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2447 |
NETIF_F_TSO6 | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2448 |
NETIF_F_IP_CSUM | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2449 |
NETIF_F_IPV6_CSUM | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2450 |
NETIF_F_SG; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2451 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2452 |
netdev->priv_flags |= IFF_SUPP_NOFCS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2453 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2454 |
if (pci_using_dac) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2455 |
netdev->features |= NETIF_F_HIGHDMA; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2456 |
netdev->vlan_features |= NETIF_F_HIGHDMA; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2457 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2458 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2459 |
if (hw->mac.type >= e1000_82576) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2460 |
netdev->hw_features |= NETIF_F_SCTP_CSUM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2461 |
netdev->features |= NETIF_F_SCTP_CSUM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2462 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2463 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2464 |
netdev->priv_flags |= IFF_UNICAST_FLT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2465 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2466 |
adapter->en_mng_pt = igb_enable_mng_pass_thru(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2467 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2468 |
/* before reading the NVM, reset the controller to put the device in a |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2469 |
* known good starting state |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2470 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2471 |
hw->mac.ops.reset_hw(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2472 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2473 |
/* make sure the NVM is good , i211/i210 parts can have special NVM |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2474 |
* that doesn't contain a checksum |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2475 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2476 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2477 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2478 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2479 |
if (igb_get_flash_presence_i210(hw)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2480 |
if (hw->nvm.ops.validate(hw) < 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2481 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2482 |
"The NVM Checksum Is Not Valid\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2483 |
err = -EIO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2484 |
goto err_eeprom; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2485 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2486 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2487 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2488 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2489 |
if (hw->nvm.ops.validate(hw) < 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2490 |
dev_err(&pdev->dev, "The NVM Checksum Is Not Valid\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2491 |
err = -EIO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2492 |
goto err_eeprom; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2493 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2494 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2495 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2496 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2497 |
/* copy the MAC address out of the NVM */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2498 |
if (hw->mac.ops.read_mac_addr(hw)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2499 |
dev_err(&pdev->dev, "NVM Read Error\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2500 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2501 |
memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2502 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2503 |
if (!is_valid_ether_addr(netdev->dev_addr)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2504 |
dev_err(&pdev->dev, "Invalid MAC Address\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2505 |
err = -EIO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2506 |
goto err_eeprom; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2507 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2508 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2509 |
/* get firmware version for ethtool -i */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2510 |
igb_set_fw_version(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2511 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2512 |
/* configure RXPBSIZE and TXPBSIZE */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2513 |
if (hw->mac.type == e1000_i210) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2514 |
wr32(E1000_RXPBS, I210_RXPBSIZE_DEFAULT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2515 |
wr32(E1000_TXPBS, I210_TXPBSIZE_DEFAULT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2516 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2517 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2518 |
setup_timer(&adapter->watchdog_timer, igb_watchdog, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2519 |
(unsigned long) adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2520 |
setup_timer(&adapter->phy_info_timer, igb_update_phy_info, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2521 |
(unsigned long) adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2522 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2523 |
INIT_WORK(&adapter->reset_task, igb_reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2524 |
INIT_WORK(&adapter->watchdog_task, igb_watchdog_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2525 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2526 |
/* Initialize link properties that are user-changeable */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2527 |
adapter->fc_autoneg = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2528 |
hw->mac.autoneg = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2529 |
hw->phy.autoneg_advertised = 0x2f; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2530 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2531 |
hw->fc.requested_mode = e1000_fc_default; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2532 |
hw->fc.current_mode = e1000_fc_default; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2533 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2534 |
igb_validate_mdi_setting(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2535 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2536 |
/* By default, support wake on port A */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2537 |
if (hw->bus.func == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2538 |
adapter->flags |= IGB_FLAG_WOL_SUPPORTED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2539 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2540 |
/* Check the NVM for wake support on non-port A ports */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2541 |
if (hw->mac.type >= e1000_82580) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2542 |
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2543 |
NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2544 |
&eeprom_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2545 |
else if (hw->bus.func == 1) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2546 |
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2547 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2548 |
if (eeprom_data & IGB_EEPROM_APME) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2549 |
adapter->flags |= IGB_FLAG_WOL_SUPPORTED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2550 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2551 |
/* now that we have the eeprom settings, apply the special cases where |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2552 |
* the eeprom may be wrong or the board simply won't support wake on |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2553 |
* lan on a particular port |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2554 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2555 |
switch (pdev->device) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2556 |
case E1000_DEV_ID_82575GB_QUAD_COPPER: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2557 |
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2558 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2559 |
case E1000_DEV_ID_82575EB_FIBER_SERDES: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2560 |
case E1000_DEV_ID_82576_FIBER: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2561 |
case E1000_DEV_ID_82576_SERDES: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2562 |
/* Wake events only supported on port A for dual fiber |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2563 |
* regardless of eeprom setting |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2564 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2565 |
if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2566 |
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2567 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2568 |
case E1000_DEV_ID_82576_QUAD_COPPER: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2569 |
case E1000_DEV_ID_82576_QUAD_COPPER_ET2: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2570 |
/* if quad port adapter, disable WoL on all but port A */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2571 |
if (global_quad_port_a != 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2572 |
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2573 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2574 |
adapter->flags |= IGB_FLAG_QUAD_PORT_A; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2575 |
/* Reset for multiple quad port adapters */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2576 |
if (++global_quad_port_a == 4) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2577 |
global_quad_port_a = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2578 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2579 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2580 |
/* If the device can't wake, don't set software support */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2581 |
if (!device_can_wakeup(&adapter->pdev->dev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2582 |
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2583 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2584 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2585 |
/* initialize the wol settings based on the eeprom settings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2586 |
if (adapter->flags & IGB_FLAG_WOL_SUPPORTED) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2587 |
adapter->wol |= E1000_WUFC_MAG; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2588 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2589 |
/* Some vendors want WoL disabled by default, but still supported */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2590 |
if ((hw->mac.type == e1000_i350) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2591 |
(pdev->subsystem_vendor == PCI_VENDOR_ID_HP)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2592 |
adapter->flags |= IGB_FLAG_WOL_SUPPORTED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2593 |
adapter->wol = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2594 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2595 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2596 |
device_set_wakeup_enable(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2597 |
adapter->flags & IGB_FLAG_WOL_SUPPORTED); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2598 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2599 |
/* reset the hardware with the new settings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2600 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2601 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2602 |
/* Init the I2C interface */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2603 |
err = igb_init_i2c(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2604 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2605 |
dev_err(&pdev->dev, "failed to init i2c interface\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2606 |
goto err_eeprom; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2607 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2608 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2609 |
/* let the f/w know that the h/w is now under the control of the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2610 |
* driver. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2611 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2612 |
igb_get_hw_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2613 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2614 |
adapter->ecdev = ecdev_offer(netdev, ec_poll, THIS_MODULE); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2615 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2616 |
err = ecdev_open(adapter->ecdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2617 |
if (err) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2618 |
ecdev_withdraw(adapter->ecdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2619 |
goto err_register; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2620 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2621 |
adapter->ec_watchdog_jiffies = jiffies; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2622 |
} else { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2623 |
strcpy(netdev->name, "eth%d"); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2624 |
err = register_netdev(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2625 |
if (err) |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2626 |
goto err_register; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2627 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2628 |
/* carrier off reporting is important to ethtool even BEFORE open */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2629 |
netif_carrier_off(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2630 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2631 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2632 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2633 |
if (dca_add_requester(&pdev->dev) == 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2634 |
adapter->flags |= IGB_FLAG_DCA_ENABLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2635 |
dev_info(&pdev->dev, "DCA enabled\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2636 |
igb_setup_dca(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2637 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2638 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2639 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2640 |
#ifdef CONFIG_IGB_HWMON |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2641 |
/* Initialize the thermal sensor on i350 devices. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2642 |
if (hw->mac.type == e1000_i350 && hw->bus.func == 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2643 |
u16 ets_word; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2644 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2645 |
/* Read the NVM to determine if this i350 device supports an |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2646 |
* external thermal sensor. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2647 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2648 |
hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_word); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2649 |
if (ets_word != 0x0000 && ets_word != 0xFFFF) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2650 |
adapter->ets = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2651 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2652 |
adapter->ets = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2653 |
if (igb_sysfs_init(adapter)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2654 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2655 |
"failed to allocate sysfs resources\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2656 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2657 |
adapter->ets = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2658 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2659 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2660 |
/* Check if Media Autosense is enabled */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2661 |
adapter->ei = *ei; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2662 |
if (hw->dev_spec._82575.mas_capable) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2663 |
igb_init_mas(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2664 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2665 |
/* do hw tstamp init after resetting */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2666 |
igb_ptp_init(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2667 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2668 |
dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2669 |
/* print bus type/speed/width info, not applicable to i354 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2670 |
if (hw->mac.type != e1000_i354) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2671 |
dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2672 |
netdev->name, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2673 |
((hw->bus.speed == e1000_bus_speed_2500) ? "2.5Gb/s" : |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2674 |
(hw->bus.speed == e1000_bus_speed_5000) ? "5.0Gb/s" : |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2675 |
"unknown"), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2676 |
((hw->bus.width == e1000_bus_width_pcie_x4) ? |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2677 |
"Width x4" : |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2678 |
(hw->bus.width == e1000_bus_width_pcie_x2) ? |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2679 |
"Width x2" : |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2680 |
(hw->bus.width == e1000_bus_width_pcie_x1) ? |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2681 |
"Width x1" : "unknown"), netdev->dev_addr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2682 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2683 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2684 |
if ((hw->mac.type >= e1000_i210 || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2685 |
igb_get_flash_presence_i210(hw))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2686 |
ret_val = igb_read_part_string(hw, part_str, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2687 |
E1000_PBANUM_LENGTH); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2688 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2689 |
ret_val = -E1000_ERR_INVM_VALUE_NOT_FOUND; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2690 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2691 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2692 |
if (ret_val) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2693 |
strcpy(part_str, "Unknown"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2694 |
dev_info(&pdev->dev, "%s: PBA No: %s\n", netdev->name, part_str); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2695 |
dev_info(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2696 |
"Using %s interrupts. %d rx queue(s), %d tx queue(s)\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2697 |
(adapter->flags & IGB_FLAG_HAS_MSIX) ? "MSI-X" : |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2698 |
(adapter->flags & IGB_FLAG_HAS_MSI) ? "MSI" : "legacy", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2699 |
adapter->num_rx_queues, adapter->num_tx_queues); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2700 |
if (hw->phy.media_type == e1000_media_type_copper) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2701 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2702 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2703 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2704 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2705 |
/* Enable EEE for internal copper PHY devices */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2706 |
err = igb_set_eee_i350(hw, true, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2707 |
if ((!err) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2708 |
(!hw->dev_spec._82575.eee_disable)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2709 |
adapter->eee_advert = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2710 |
MDIO_EEE_100TX | MDIO_EEE_1000T; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2711 |
adapter->flags |= IGB_FLAG_EEE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2712 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2713 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2714 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2715 |
if ((rd32(E1000_CTRL_EXT) & |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2716 |
E1000_CTRL_EXT_LINK_MODE_SGMII)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2717 |
err = igb_set_eee_i354(hw, true, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2718 |
if ((!err) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2719 |
(!hw->dev_spec._82575.eee_disable)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2720 |
adapter->eee_advert = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2721 |
MDIO_EEE_100TX | MDIO_EEE_1000T; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2722 |
adapter->flags |= IGB_FLAG_EEE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2723 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2724 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2725 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2726 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2727 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2728 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2729 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2730 |
pm_runtime_put_noidle(&pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2731 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2732 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2733 |
err_register: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2734 |
igb_release_hw_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2735 |
memset(&adapter->i2c_adap, 0, sizeof(adapter->i2c_adap)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2736 |
err_eeprom: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2737 |
if (!igb_check_reset_block(hw)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2738 |
igb_reset_phy(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2739 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2740 |
if (hw->flash_address) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2741 |
iounmap(hw->flash_address); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2742 |
err_sw_init: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2743 |
igb_clear_interrupt_scheme(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2744 |
pci_iounmap(pdev, hw->hw_addr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2745 |
err_ioremap: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2746 |
free_netdev(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2747 |
err_alloc_etherdev: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2748 |
pci_release_selected_regions(pdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2749 |
pci_select_bars(pdev, IORESOURCE_MEM)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2750 |
err_pci_reg: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2751 |
err_dma: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2752 |
pci_disable_device(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2753 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2754 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2755 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2756 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2757 |
static int igb_disable_sriov(struct pci_dev *pdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2758 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2759 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2760 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2761 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2762 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2763 |
/* reclaim resources allocated to VFs */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2764 |
if (adapter->vf_data) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2765 |
/* disable iov and allow time for transactions to clear */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2766 |
if (pci_vfs_assigned(pdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2767 |
dev_warn(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2768 |
"Cannot deallocate SR-IOV virtual functions while they are assigned - VFs will not be deallocated\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2769 |
return -EPERM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2770 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2771 |
pci_disable_sriov(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2772 |
msleep(500); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2773 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2774 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2775 |
kfree(adapter->vf_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2776 |
adapter->vf_data = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2777 |
adapter->vfs_allocated_count = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2778 |
wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2779 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2780 |
msleep(100); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2781 |
dev_info(&pdev->dev, "IOV Disabled\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2782 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2783 |
/* Re-enable DMA Coalescing flag since IOV is turned off */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2784 |
adapter->flags |= IGB_FLAG_DMAC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2785 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2786 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2787 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2788 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2789 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2790 |
static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2791 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2792 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2793 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2794 |
int old_vfs = pci_num_vf(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2795 |
int err = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2796 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2797 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2798 |
if (!(adapter->flags & IGB_FLAG_HAS_MSIX) || num_vfs > 7) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2799 |
err = -EPERM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2800 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2801 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2802 |
if (!num_vfs) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2803 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2804 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2805 |
if (old_vfs) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2806 |
dev_info(&pdev->dev, "%d pre-allocated VFs found - override max_vfs setting of %d\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2807 |
old_vfs, max_vfs); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2808 |
adapter->vfs_allocated_count = old_vfs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2809 |
} else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2810 |
adapter->vfs_allocated_count = num_vfs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2811 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2812 |
adapter->vf_data = kcalloc(adapter->vfs_allocated_count, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2813 |
sizeof(struct vf_data_storage), GFP_KERNEL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2814 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2815 |
/* if allocation failed then we do not support SR-IOV */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2816 |
if (!adapter->vf_data) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2817 |
adapter->vfs_allocated_count = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2818 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2819 |
"Unable to allocate memory for VF Data Storage\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2820 |
err = -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2821 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2822 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2823 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2824 |
/* only call pci_enable_sriov() if no VFs are allocated already */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2825 |
if (!old_vfs) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2826 |
err = pci_enable_sriov(pdev, adapter->vfs_allocated_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2827 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2828 |
goto err_out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2829 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2830 |
dev_info(&pdev->dev, "%d VFs allocated\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2831 |
adapter->vfs_allocated_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2832 |
for (i = 0; i < adapter->vfs_allocated_count; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2833 |
igb_vf_configure(adapter, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2834 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2835 |
/* DMA Coalescing is not supported in IOV mode. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2836 |
adapter->flags &= ~IGB_FLAG_DMAC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2837 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2838 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2839 |
err_out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2840 |
kfree(adapter->vf_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2841 |
adapter->vf_data = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2842 |
adapter->vfs_allocated_count = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2843 |
out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2844 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2845 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2846 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2847 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2848 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2849 |
* igb_remove_i2c - Cleanup I2C interface |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2850 |
* @adapter: pointer to adapter structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2851 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2852 |
static void igb_remove_i2c(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2853 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2854 |
/* free the adapter bus structure */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2855 |
i2c_del_adapter(&adapter->i2c_adap); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2856 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2857 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2858 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2859 |
* igb_remove - Device Removal Routine |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2860 |
* @pdev: PCI device information struct |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2861 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2862 |
* igb_remove is called by the PCI subsystem to alert the driver |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2863 |
* that it should release a PCI device. The could be caused by a |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2864 |
* Hot-Plug event, or because the driver is going to be removed from |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2865 |
* memory. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2866 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2867 |
static void igb_remove(struct pci_dev *pdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2868 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2869 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2870 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2871 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2872 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2873 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2874 |
ecdev_close(adapter->ecdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2875 |
ecdev_withdraw(adapter->ecdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2876 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2877 |
|
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2878 |
pm_runtime_get_noresume(&pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2879 |
#ifdef CONFIG_IGB_HWMON |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2880 |
igb_sysfs_exit(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2881 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2882 |
igb_remove_i2c(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2883 |
igb_ptp_stop(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2884 |
/* The watchdog timer may be rescheduled, so explicitly |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2885 |
* disable watchdog from being rescheduled. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2886 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2887 |
set_bit(__IGB_DOWN, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2888 |
del_timer_sync(&adapter->watchdog_timer); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2889 |
del_timer_sync(&adapter->phy_info_timer); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2890 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2891 |
cancel_work_sync(&adapter->reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2892 |
cancel_work_sync(&adapter->watchdog_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2893 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2894 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2895 |
if (adapter->flags & IGB_FLAG_DCA_ENABLED) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2896 |
dev_info(&pdev->dev, "DCA disabled\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2897 |
dca_remove_requester(&pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2898 |
adapter->flags &= ~IGB_FLAG_DCA_ENABLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2899 |
wr32(E1000_DCA_CTRL, E1000_DCA_CTRL_DCA_MODE_DISABLE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2900 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2901 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2902 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2903 |
/* Release control of h/w to f/w. If f/w is AMT enabled, this |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2904 |
* would have already happened in close and is redundant. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2905 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2906 |
igb_release_hw_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2907 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2908 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2909 |
unregister_netdev(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
2910 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2911 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2912 |
igb_clear_interrupt_scheme(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2913 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2914 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2915 |
igb_disable_sriov(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2916 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2917 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2918 |
pci_iounmap(pdev, hw->hw_addr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2919 |
if (hw->flash_address) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2920 |
iounmap(hw->flash_address); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2921 |
pci_release_selected_regions(pdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2922 |
pci_select_bars(pdev, IORESOURCE_MEM)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2923 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2924 |
kfree(adapter->shadow_vfta); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2925 |
free_netdev(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2926 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2927 |
pci_disable_pcie_error_reporting(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2928 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2929 |
pci_disable_device(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2930 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2931 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2932 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2933 |
* igb_probe_vfs - Initialize vf data storage and add VFs to pci config space |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2934 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2935 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2936 |
* This function initializes the vf specific data storage and then attempts to |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2937 |
* allocate the VFs. The reason for ordering it this way is because it is much |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2938 |
* mor expensive time wise to disable SR-IOV than it is to allocate and free |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2939 |
* the memory for the VFs. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2940 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2941 |
static void igb_probe_vfs(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2942 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2943 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2944 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2945 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2946 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2947 |
/* Virtualization features not supported on i210 family. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2948 |
if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2949 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2950 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2951 |
pci_sriov_set_totalvfs(pdev, 7); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2952 |
igb_pci_enable_sriov(pdev, max_vfs); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2953 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2954 |
#endif /* CONFIG_PCI_IOV */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2955 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2956 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2957 |
static void igb_init_queue_configuration(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2958 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2959 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2960 |
u32 max_rss_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2961 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2962 |
/* Determine the maximum number of RSS queues supported. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2963 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2964 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2965 |
max_rss_queues = IGB_MAX_RX_QUEUES_I211; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2966 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2967 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2968 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2969 |
max_rss_queues = IGB_MAX_RX_QUEUES_82575; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2970 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2971 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2972 |
/* I350 cannot do RSS and SR-IOV at the same time */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2973 |
if (!!adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2974 |
max_rss_queues = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2975 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2976 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2977 |
/* fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2978 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2979 |
if (!!adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2980 |
max_rss_queues = 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2981 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2982 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2983 |
/* fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2984 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2985 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2986 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2987 |
max_rss_queues = IGB_MAX_RX_QUEUES; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2988 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2989 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2990 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2991 |
adapter->rss_queues = min_t(u32, max_rss_queues, num_online_cpus()); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2992 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2993 |
/* Determine if we need to pair queues. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2994 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2995 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2996 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2997 |
/* Device supports enough interrupts without queue pairing. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2998 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2999 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3000 |
/* If VFs are going to be allocated with RSS queues then we |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3001 |
* should pair the queues in order to conserve interrupts due |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3002 |
* to limited supply. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3003 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3004 |
if ((adapter->rss_queues > 1) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3005 |
(adapter->vfs_allocated_count > 6)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3006 |
adapter->flags |= IGB_FLAG_QUEUE_PAIRS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3007 |
/* fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3008 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3009 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3010 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3011 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3012 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3013 |
/* If rss_queues > half of max_rss_queues, pair the queues in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3014 |
* order to conserve interrupts due to limited supply. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3015 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3016 |
if (adapter->rss_queues > (max_rss_queues / 2)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3017 |
adapter->flags |= IGB_FLAG_QUEUE_PAIRS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3018 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3019 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3020 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3021 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3022 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3023 |
* igb_sw_init - Initialize general software structures (struct igb_adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3024 |
* @adapter: board private structure to initialize |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3025 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3026 |
* igb_sw_init initializes the Adapter private data structure. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3027 |
* Fields are initialized based on PCI device information and |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3028 |
* OS network device settings (MTU size). |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3029 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3030 |
static int igb_sw_init(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3031 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3032 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3033 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3034 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3035 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3036 |
pci_read_config_word(pdev, PCI_COMMAND, &hw->bus.pci_cmd_word); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3037 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3038 |
/* set default ring sizes */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3039 |
adapter->tx_ring_count = IGB_DEFAULT_TXD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3040 |
adapter->rx_ring_count = IGB_DEFAULT_RXD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3041 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3042 |
/* set default ITR values */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3043 |
adapter->rx_itr_setting = IGB_DEFAULT_ITR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3044 |
adapter->tx_itr_setting = IGB_DEFAULT_ITR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3045 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3046 |
/* set default work limits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3047 |
adapter->tx_work_limit = IGB_DEFAULT_TX_WORK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3048 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3049 |
adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3050 |
VLAN_HLEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3051 |
adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3052 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3053 |
spin_lock_init(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3054 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3055 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3056 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3057 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3058 |
if (max_vfs > 7) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3059 |
dev_warn(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3060 |
"Maximum of 7 VFs per PF, using max\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3061 |
max_vfs = adapter->vfs_allocated_count = 7; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3062 |
} else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3063 |
adapter->vfs_allocated_count = max_vfs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3064 |
if (adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3065 |
dev_warn(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3066 |
"Enabling SR-IOV VFs using the module parameter is deprecated - please use the pci sysfs interface.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3067 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3068 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3069 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3070 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3071 |
#endif /* CONFIG_PCI_IOV */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3072 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3073 |
igb_init_queue_configuration(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3074 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3075 |
/* Setup and initialize a copy of the hw vlan table array */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3076 |
adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3077 |
GFP_ATOMIC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3078 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3079 |
/* This call may decrease the number of queues */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3080 |
if (igb_init_interrupt_scheme(adapter, true)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3081 |
dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3082 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3083 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3084 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3085 |
igb_probe_vfs(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3086 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3087 |
/* Explicitly disable IRQ since the NIC can be in any state. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3088 |
igb_irq_disable(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3089 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3090 |
if (hw->mac.type >= e1000_i350) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3091 |
adapter->flags &= ~IGB_FLAG_DMAC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3092 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3093 |
set_bit(__IGB_DOWN, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3094 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3095 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3096 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3097 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3098 |
* igb_open - Called when a network interface is made active |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3099 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3100 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3101 |
* Returns 0 on success, negative value on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3102 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3103 |
* The open entry point is called when a network interface is made |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3104 |
* active by the system (IFF_UP). At this point all resources needed |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3105 |
* for transmit and receive operations are allocated, the interrupt |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3106 |
* handler is registered with the OS, the watchdog timer is started, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3107 |
* and the stack is notified that the interface is ready. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3108 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3109 |
static int __igb_open(struct net_device *netdev, bool resuming) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3110 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3111 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3112 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3113 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3114 |
int err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3115 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3116 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3117 |
/* disallow open during test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3118 |
if (test_bit(__IGB_TESTING, &adapter->state)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3119 |
WARN_ON(resuming); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3120 |
return -EBUSY; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3121 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3122 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3123 |
if (!resuming) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3124 |
pm_runtime_get_sync(&pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3125 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3126 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3127 |
ecdev_set_link(adapter->ecdev, 0); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3128 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3129 |
else { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3130 |
netif_carrier_off(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3131 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3132 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3133 |
/* allocate transmit descriptors */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3134 |
err = igb_setup_all_tx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3135 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3136 |
goto err_setup_tx; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3137 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3138 |
/* allocate receive descriptors */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3139 |
err = igb_setup_all_rx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3140 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3141 |
goto err_setup_rx; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3142 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3143 |
igb_power_up_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3144 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3145 |
/* before we allocate an interrupt, we must be ready to handle it. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3146 |
* Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3147 |
* as soon as we call pci_request_irq, so we have to setup our |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3148 |
* clean_rx handler before we do so. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3149 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3150 |
igb_configure(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3151 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3152 |
err = igb_request_irq(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3153 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3154 |
goto err_req_irq; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3155 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3156 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3157 |
/* Notify the stack of the actual queue counts. */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3158 |
err = netif_set_real_num_tx_queues(adapter->netdev, |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3159 |
adapter->num_tx_queues); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3160 |
if (err) |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3161 |
goto err_set_queues; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3162 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3163 |
err = netif_set_real_num_rx_queues(adapter->netdev, |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3164 |
adapter->num_rx_queues); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3165 |
if (err) |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3166 |
goto err_set_queues; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3167 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3168 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3169 |
/* From here on the code is the same as igb_up() */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3170 |
clear_bit(__IGB_DOWN, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3171 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3172 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3173 |
for (i = 0; i < adapter->num_q_vectors; i++) |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3174 |
napi_enable(&(adapter->q_vector[i]->napi)); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3175 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3176 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3177 |
/* Clear any pending interrupts. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3178 |
rd32(E1000_ICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3179 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3180 |
igb_irq_enable(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3181 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3182 |
/* notify VFs that reset has been completed */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3183 |
if (adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3184 |
u32 reg_data = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3185 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3186 |
reg_data |= E1000_CTRL_EXT_PFRSTD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3187 |
wr32(E1000_CTRL_EXT, reg_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3188 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3189 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3190 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3191 |
netif_tx_start_all_queues(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3192 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3193 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3194 |
if (!resuming) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3195 |
pm_runtime_put(&pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3196 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3197 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3198 |
/* start the watchdog. */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3199 |
hw->mac.get_link_status = 1; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3200 |
schedule_work(&adapter->watchdog_task); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3201 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3202 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3203 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3204 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3205 |
err_set_queues: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3206 |
igb_free_irq(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3207 |
err_req_irq: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3208 |
igb_release_hw_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3209 |
igb_power_down_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3210 |
igb_free_all_rx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3211 |
err_setup_rx: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3212 |
igb_free_all_tx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3213 |
err_setup_tx: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3214 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3215 |
if (!resuming) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3216 |
pm_runtime_put(&pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3217 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3218 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3219 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3220 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3221 |
static int igb_open(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3222 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3223 |
return __igb_open(netdev, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3224 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3225 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3226 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3227 |
* igb_close - Disables a network interface |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3228 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3229 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3230 |
* Returns 0, this is not allowed to fail |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3231 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3232 |
* The close entry point is called when an interface is de-activated |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3233 |
* by the OS. The hardware is still under the driver's control, but |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3234 |
* needs to be disabled. A global MAC reset is issued to stop the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3235 |
* hardware, and all transmit and receive resources are freed. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3236 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3237 |
static int __igb_close(struct net_device *netdev, bool suspending) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3238 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3239 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3240 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3241 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3242 |
WARN_ON(test_bit(__IGB_RESETTING, &adapter->state)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3243 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3244 |
if (!suspending) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3245 |
pm_runtime_get_sync(&pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3246 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3247 |
igb_down(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3248 |
igb_free_irq(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3249 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3250 |
igb_free_all_tx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3251 |
igb_free_all_rx_resources(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3252 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3253 |
if (!suspending) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3254 |
pm_runtime_put_sync(&pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3255 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3256 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3257 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3258 |
static int igb_close(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3259 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3260 |
return __igb_close(netdev, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3261 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3262 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3263 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3264 |
* igb_setup_tx_resources - allocate Tx resources (Descriptors) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3265 |
* @tx_ring: tx descriptor ring (for a specific queue) to setup |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3266 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3267 |
* Return 0 on success, negative on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3268 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3269 |
int igb_setup_tx_resources(struct igb_ring *tx_ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3270 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3271 |
struct device *dev = tx_ring->dev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3272 |
int size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3273 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3274 |
size = sizeof(struct igb_tx_buffer) * tx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3275 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3276 |
tx_ring->tx_buffer_info = vzalloc(size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3277 |
if (!tx_ring->tx_buffer_info) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3278 |
goto err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3279 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3280 |
/* round up to nearest 4K */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3281 |
tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3282 |
tx_ring->size = ALIGN(tx_ring->size, 4096); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3283 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3284 |
tx_ring->desc = dma_alloc_coherent(dev, tx_ring->size, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3285 |
&tx_ring->dma, GFP_KERNEL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3286 |
if (!tx_ring->desc) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3287 |
goto err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3288 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3289 |
tx_ring->next_to_use = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3290 |
tx_ring->next_to_clean = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3291 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3292 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3293 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3294 |
err: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3295 |
vfree(tx_ring->tx_buffer_info); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3296 |
tx_ring->tx_buffer_info = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3297 |
dev_err(dev, "Unable to allocate memory for the Tx descriptor ring\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3298 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3299 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3300 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3301 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3302 |
* igb_setup_all_tx_resources - wrapper to allocate Tx resources |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3303 |
* (Descriptors) for all queues |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3304 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3305 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3306 |
* Return 0 on success, negative on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3307 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3308 |
static int igb_setup_all_tx_resources(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3309 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3310 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3311 |
int i, err = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3312 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3313 |
for (i = 0; i < adapter->num_tx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3314 |
err = igb_setup_tx_resources(adapter->tx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3315 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3316 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3317 |
"Allocation for Tx Queue %u failed\n", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3318 |
for (i--; i >= 0; i--) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3319 |
igb_free_tx_resources(adapter->tx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3320 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3321 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3322 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3323 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3324 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3325 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3326 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3327 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3328 |
* igb_setup_tctl - configure the transmit control registers |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3329 |
* @adapter: Board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3330 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3331 |
void igb_setup_tctl(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3332 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3333 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3334 |
u32 tctl; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3335 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3336 |
/* disable queue 0 which is enabled by default on 82575 and 82576 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3337 |
wr32(E1000_TXDCTL(0), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3338 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3339 |
/* Program the Transmit Control Register */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3340 |
tctl = rd32(E1000_TCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3341 |
tctl &= ~E1000_TCTL_CT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3342 |
tctl |= E1000_TCTL_PSP | E1000_TCTL_RTLC | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3343 |
(E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3344 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3345 |
igb_config_collision_dist(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3346 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3347 |
/* Enable transmits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3348 |
tctl |= E1000_TCTL_EN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3349 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3350 |
wr32(E1000_TCTL, tctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3351 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3352 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3353 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3354 |
* igb_configure_tx_ring - Configure transmit ring after Reset |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3355 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3356 |
* @ring: tx ring to configure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3357 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3358 |
* Configure a transmit ring after a reset. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3359 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3360 |
void igb_configure_tx_ring(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3361 |
struct igb_ring *ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3362 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3363 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3364 |
u32 txdctl = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3365 |
u64 tdba = ring->dma; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3366 |
int reg_idx = ring->reg_idx; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3367 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3368 |
/* disable the queue */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3369 |
wr32(E1000_TXDCTL(reg_idx), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3370 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3371 |
mdelay(10); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3372 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3373 |
wr32(E1000_TDLEN(reg_idx), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3374 |
ring->count * sizeof(union e1000_adv_tx_desc)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3375 |
wr32(E1000_TDBAL(reg_idx), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3376 |
tdba & 0x00000000ffffffffULL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3377 |
wr32(E1000_TDBAH(reg_idx), tdba >> 32); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3378 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3379 |
ring->tail = hw->hw_addr + E1000_TDT(reg_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3380 |
wr32(E1000_TDH(reg_idx), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3381 |
writel(0, ring->tail); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3382 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3383 |
txdctl |= IGB_TX_PTHRESH; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3384 |
txdctl |= IGB_TX_HTHRESH << 8; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3385 |
txdctl |= IGB_TX_WTHRESH << 16; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3386 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3387 |
txdctl |= E1000_TXDCTL_QUEUE_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3388 |
wr32(E1000_TXDCTL(reg_idx), txdctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3389 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3390 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3391 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3392 |
* igb_configure_tx - Configure transmit Unit after Reset |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3393 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3394 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3395 |
* Configure the Tx unit of the MAC after a reset. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3396 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3397 |
static void igb_configure_tx(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3398 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3399 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3400 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3401 |
for (i = 0; i < adapter->num_tx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3402 |
igb_configure_tx_ring(adapter, adapter->tx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3403 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3404 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3405 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3406 |
* igb_setup_rx_resources - allocate Rx resources (Descriptors) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3407 |
* @rx_ring: Rx descriptor ring (for a specific queue) to setup |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3408 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3409 |
* Returns 0 on success, negative on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3410 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3411 |
int igb_setup_rx_resources(struct igb_ring *rx_ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3412 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3413 |
struct device *dev = rx_ring->dev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3414 |
int size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3415 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3416 |
size = sizeof(struct igb_rx_buffer) * rx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3417 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3418 |
rx_ring->rx_buffer_info = vzalloc(size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3419 |
if (!rx_ring->rx_buffer_info) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3420 |
goto err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3421 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3422 |
/* Round up to nearest 4K */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3423 |
rx_ring->size = rx_ring->count * sizeof(union e1000_adv_rx_desc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3424 |
rx_ring->size = ALIGN(rx_ring->size, 4096); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3425 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3426 |
rx_ring->desc = dma_alloc_coherent(dev, rx_ring->size, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3427 |
&rx_ring->dma, GFP_KERNEL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3428 |
if (!rx_ring->desc) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3429 |
goto err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3430 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3431 |
rx_ring->next_to_alloc = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3432 |
rx_ring->next_to_clean = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3433 |
rx_ring->next_to_use = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3434 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3435 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3436 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3437 |
err: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3438 |
vfree(rx_ring->rx_buffer_info); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3439 |
rx_ring->rx_buffer_info = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3440 |
dev_err(dev, "Unable to allocate memory for the Rx descriptor ring\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3441 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3442 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3443 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3444 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3445 |
* igb_setup_all_rx_resources - wrapper to allocate Rx resources |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3446 |
* (Descriptors) for all queues |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3447 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3448 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3449 |
* Return 0 on success, negative on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3450 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3451 |
static int igb_setup_all_rx_resources(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3452 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3453 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3454 |
int i, err = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3455 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3456 |
for (i = 0; i < adapter->num_rx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3457 |
err = igb_setup_rx_resources(adapter->rx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3458 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3459 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3460 |
"Allocation for Rx Queue %u failed\n", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3461 |
for (i--; i >= 0; i--) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3462 |
igb_free_rx_resources(adapter->rx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3463 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3464 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3465 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3466 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3467 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3468 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3469 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3470 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3471 |
* igb_setup_mrqc - configure the multiple receive queue control registers |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3472 |
* @adapter: Board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3473 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3474 |
static void igb_setup_mrqc(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3475 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3476 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3477 |
u32 mrqc, rxcsum; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3478 |
u32 j, num_rx_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3479 |
static const u32 rsskey[10] = { 0xDA565A6D, 0xC20E5B25, 0x3D256741, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3480 |
0xB08FA343, 0xCB2BCAD0, 0xB4307BAE, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3481 |
0xA32DCB77, 0x0CF23080, 0x3BB7426A, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3482 |
0xFA01ACBE }; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3483 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3484 |
/* Fill out hash function seeds */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3485 |
for (j = 0; j < 10; j++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3486 |
wr32(E1000_RSSRK(j), rsskey[j]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3487 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3488 |
num_rx_queues = adapter->rss_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3489 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3490 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3491 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3492 |
/* 82576 supports 2 RSS queues for SR-IOV */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3493 |
if (adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3494 |
num_rx_queues = 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3495 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3496 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3497 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3498 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3499 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3500 |
if (adapter->rss_indir_tbl_init != num_rx_queues) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3501 |
for (j = 0; j < IGB_RETA_SIZE; j++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3502 |
adapter->rss_indir_tbl[j] = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3503 |
(j * num_rx_queues) / IGB_RETA_SIZE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3504 |
adapter->rss_indir_tbl_init = num_rx_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3505 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3506 |
igb_write_rss_indir_tbl(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3507 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3508 |
/* Disable raw packet checksumming so that RSS hash is placed in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3509 |
* descriptor on writeback. No need to enable TCP/UDP/IP checksum |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3510 |
* offloads as they are enabled by default |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3511 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3512 |
rxcsum = rd32(E1000_RXCSUM); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3513 |
rxcsum |= E1000_RXCSUM_PCSD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3514 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3515 |
if (adapter->hw.mac.type >= e1000_82576) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3516 |
/* Enable Receive Checksum Offload for SCTP */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3517 |
rxcsum |= E1000_RXCSUM_CRCOFL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3518 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3519 |
/* Don't need to set TUOFL or IPOFL, they default to 1 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3520 |
wr32(E1000_RXCSUM, rxcsum); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3521 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3522 |
/* Generate RSS hash based on packet types, TCP/UDP |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3523 |
* port numbers and/or IPv4/v6 src and dst addresses |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3524 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3525 |
mrqc = E1000_MRQC_RSS_FIELD_IPV4 | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3526 |
E1000_MRQC_RSS_FIELD_IPV4_TCP | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3527 |
E1000_MRQC_RSS_FIELD_IPV6 | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3528 |
E1000_MRQC_RSS_FIELD_IPV6_TCP | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3529 |
E1000_MRQC_RSS_FIELD_IPV6_TCP_EX; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3530 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3531 |
if (adapter->flags & IGB_FLAG_RSS_FIELD_IPV4_UDP) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3532 |
mrqc |= E1000_MRQC_RSS_FIELD_IPV4_UDP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3533 |
if (adapter->flags & IGB_FLAG_RSS_FIELD_IPV6_UDP) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3534 |
mrqc |= E1000_MRQC_RSS_FIELD_IPV6_UDP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3535 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3536 |
/* If VMDq is enabled then we set the appropriate mode for that, else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3537 |
* we default to RSS so that an RSS hash is calculated per packet even |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3538 |
* if we are only using one queue |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3539 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3540 |
if (adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3541 |
if (hw->mac.type > e1000_82575) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3542 |
/* Set the default pool for the PF's first queue */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3543 |
u32 vtctl = rd32(E1000_VT_CTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3544 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3545 |
vtctl &= ~(E1000_VT_CTL_DEFAULT_POOL_MASK | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3546 |
E1000_VT_CTL_DISABLE_DEF_POOL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3547 |
vtctl |= adapter->vfs_allocated_count << |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3548 |
E1000_VT_CTL_DEFAULT_POOL_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3549 |
wr32(E1000_VT_CTL, vtctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3550 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3551 |
if (adapter->rss_queues > 1) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3552 |
mrqc |= E1000_MRQC_ENABLE_VMDQ_RSS_2Q; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3553 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3554 |
mrqc |= E1000_MRQC_ENABLE_VMDQ; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3555 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3556 |
if (hw->mac.type != e1000_i211) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3557 |
mrqc |= E1000_MRQC_ENABLE_RSS_4Q; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3558 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3559 |
igb_vmm_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3560 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3561 |
wr32(E1000_MRQC, mrqc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3562 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3563 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3564 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3565 |
* igb_setup_rctl - configure the receive control registers |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3566 |
* @adapter: Board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3567 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3568 |
void igb_setup_rctl(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3569 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3570 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3571 |
u32 rctl; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3572 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3573 |
rctl = rd32(E1000_RCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3574 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3575 |
rctl &= ~(3 << E1000_RCTL_MO_SHIFT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3576 |
rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3577 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3578 |
rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_RDMTS_HALF | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3579 |
(hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3580 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3581 |
/* enable stripping of CRC. It's unlikely this will break BMC |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3582 |
* redirection as it did with e1000. Newer features require |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3583 |
* that the HW strips the CRC. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3584 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3585 |
rctl |= E1000_RCTL_SECRC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3586 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3587 |
/* disable store bad packets and clear size bits. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3588 |
rctl &= ~(E1000_RCTL_SBP | E1000_RCTL_SZ_256); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3589 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3590 |
/* enable LPE to prevent packets larger than max_frame_size */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3591 |
rctl |= E1000_RCTL_LPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3592 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3593 |
/* disable queue 0 to prevent tail write w/o re-config */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3594 |
wr32(E1000_RXDCTL(0), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3595 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3596 |
/* Attention!!! For SR-IOV PF driver operations you must enable |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3597 |
* queue drop for all VF and PF queues to prevent head of line blocking |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3598 |
* if an un-trusted VF does not provide descriptors to hardware. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3599 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3600 |
if (adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3601 |
/* set all queue drop enable bits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3602 |
wr32(E1000_QDE, ALL_QUEUES); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3603 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3604 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3605 |
/* This is useful for sniffing bad packets. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3606 |
if (adapter->netdev->features & NETIF_F_RXALL) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3607 |
/* UPE and MPE will be handled by normal PROMISC logic |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3608 |
* in e1000e_set_rx_mode |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3609 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3610 |
rctl |= (E1000_RCTL_SBP | /* Receive bad packets */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3611 |
E1000_RCTL_BAM | /* RX All Bcast Pkts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3612 |
E1000_RCTL_PMCF); /* RX All MAC Ctrl Pkts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3613 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3614 |
rctl &= ~(E1000_RCTL_VFE | /* Disable VLAN filter */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3615 |
E1000_RCTL_DPF | /* Allow filtered pause */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3616 |
E1000_RCTL_CFIEN); /* Dis VLAN CFIEN Filter */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3617 |
/* Do not mess with E1000_CTRL_VME, it affects transmit as well, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3618 |
* and that breaks VLANs. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3619 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3620 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3621 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3622 |
wr32(E1000_RCTL, rctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3623 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3624 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3625 |
static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3626 |
int vfn) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3627 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3628 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3629 |
u32 vmolr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3630 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3631 |
/* if it isn't the PF check to see if VFs are enabled and |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3632 |
* increase the size to support vlan tags |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3633 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3634 |
if (vfn < adapter->vfs_allocated_count && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3635 |
adapter->vf_data[vfn].vlans_enabled) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3636 |
size += VLAN_TAG_SIZE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3637 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3638 |
vmolr = rd32(E1000_VMOLR(vfn)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3639 |
vmolr &= ~E1000_VMOLR_RLPML_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3640 |
vmolr |= size | E1000_VMOLR_LPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3641 |
wr32(E1000_VMOLR(vfn), vmolr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3642 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3643 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3644 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3645 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3646 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3647 |
* igb_rlpml_set - set maximum receive packet size |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3648 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3649 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3650 |
* Configure maximum receivable packet size. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3651 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3652 |
static void igb_rlpml_set(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3653 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3654 |
u32 max_frame_size = adapter->max_frame_size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3655 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3656 |
u16 pf_id = adapter->vfs_allocated_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3657 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3658 |
if (pf_id) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3659 |
igb_set_vf_rlpml(adapter, max_frame_size, pf_id); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3660 |
/* If we're in VMDQ or SR-IOV mode, then set global RLPML |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3661 |
* to our max jumbo frame size, in case we need to enable |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3662 |
* jumbo frames on one of the rings later. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3663 |
* This will not pass over-length frames into the default |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3664 |
* queue because it's gated by the VMOLR.RLPML. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3665 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3666 |
max_frame_size = MAX_JUMBO_FRAME_SIZE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3667 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3668 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3669 |
wr32(E1000_RLPML, max_frame_size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3670 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3671 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3672 |
static inline void igb_set_vmolr(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3673 |
int vfn, bool aupe) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3674 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3675 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3676 |
u32 vmolr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3677 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3678 |
/* This register exists only on 82576 and newer so if we are older then |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3679 |
* we should exit and do nothing |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3680 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3681 |
if (hw->mac.type < e1000_82576) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3682 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3683 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3684 |
vmolr = rd32(E1000_VMOLR(vfn)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3685 |
vmolr |= E1000_VMOLR_STRVLAN; /* Strip vlan tags */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3686 |
if (hw->mac.type == e1000_i350) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3687 |
u32 dvmolr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3688 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3689 |
dvmolr = rd32(E1000_DVMOLR(vfn)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3690 |
dvmolr |= E1000_DVMOLR_STRVLAN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3691 |
wr32(E1000_DVMOLR(vfn), dvmolr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3692 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3693 |
if (aupe) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3694 |
vmolr |= E1000_VMOLR_AUPE; /* Accept untagged packets */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3695 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3696 |
vmolr &= ~(E1000_VMOLR_AUPE); /* Tagged packets ONLY */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3697 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3698 |
/* clear all bits that might not be set */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3699 |
vmolr &= ~(E1000_VMOLR_BAM | E1000_VMOLR_RSSE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3700 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3701 |
if (adapter->rss_queues > 1 && vfn == adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3702 |
vmolr |= E1000_VMOLR_RSSE; /* enable RSS */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3703 |
/* for VMDq only allow the VFs and pool 0 to accept broadcast and |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3704 |
* multicast packets |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3705 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3706 |
if (vfn <= adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3707 |
vmolr |= E1000_VMOLR_BAM; /* Accept broadcast */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3708 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3709 |
wr32(E1000_VMOLR(vfn), vmolr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3710 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3711 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3712 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3713 |
* igb_configure_rx_ring - Configure a receive ring after Reset |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3714 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3715 |
* @ring: receive ring to be configured |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3716 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3717 |
* Configure the Rx unit of the MAC after a reset. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3718 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3719 |
void igb_configure_rx_ring(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3720 |
struct igb_ring *ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3721 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3722 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3723 |
u64 rdba = ring->dma; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3724 |
int reg_idx = ring->reg_idx; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3725 |
u32 srrctl = 0, rxdctl = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3726 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3727 |
/* disable the queue */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3728 |
wr32(E1000_RXDCTL(reg_idx), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3729 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3730 |
/* Set DMA base address registers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3731 |
wr32(E1000_RDBAL(reg_idx), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3732 |
rdba & 0x00000000ffffffffULL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3733 |
wr32(E1000_RDBAH(reg_idx), rdba >> 32); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3734 |
wr32(E1000_RDLEN(reg_idx), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3735 |
ring->count * sizeof(union e1000_adv_rx_desc)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3736 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3737 |
/* initialize head and tail */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3738 |
ring->tail = hw->hw_addr + E1000_RDT(reg_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3739 |
wr32(E1000_RDH(reg_idx), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3740 |
writel(0, ring->tail); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3741 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3742 |
/* set descriptor configuration */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3743 |
srrctl = IGB_RX_HDR_LEN << E1000_SRRCTL_BSIZEHDRSIZE_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3744 |
srrctl |= IGB_RX_BUFSZ >> E1000_SRRCTL_BSIZEPKT_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3745 |
srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3746 |
if (hw->mac.type >= e1000_82580) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3747 |
srrctl |= E1000_SRRCTL_TIMESTAMP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3748 |
/* Only set Drop Enable if we are supporting multiple queues */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3749 |
if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3750 |
srrctl |= E1000_SRRCTL_DROP_EN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3751 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3752 |
wr32(E1000_SRRCTL(reg_idx), srrctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3753 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3754 |
/* set filtering for VMDQ pools */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3755 |
igb_set_vmolr(adapter, reg_idx & 0x7, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3756 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3757 |
rxdctl |= IGB_RX_PTHRESH; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3758 |
rxdctl |= IGB_RX_HTHRESH << 8; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3759 |
rxdctl |= IGB_RX_WTHRESH << 16; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3760 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3761 |
/* enable receive descriptor fetching */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3762 |
rxdctl |= E1000_RXDCTL_QUEUE_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3763 |
wr32(E1000_RXDCTL(reg_idx), rxdctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3764 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3765 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3766 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3767 |
* igb_configure_rx - Configure receive Unit after Reset |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3768 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3769 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3770 |
* Configure the Rx unit of the MAC after a reset. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3771 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3772 |
static void igb_configure_rx(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3773 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3774 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3775 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3776 |
/* set UTA to appropriate mode */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3777 |
igb_set_uta(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3778 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3779 |
/* set the correct pool for the PF default MAC address in entry 0 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3780 |
igb_rar_set_qsel(adapter, adapter->hw.mac.addr, 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3781 |
adapter->vfs_allocated_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3782 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3783 |
/* Setup the HW Rx Head and Tail Descriptor Pointers and |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3784 |
* the Base and Length of the Rx Descriptor Ring |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3785 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3786 |
for (i = 0; i < adapter->num_rx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3787 |
igb_configure_rx_ring(adapter, adapter->rx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3788 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3789 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3790 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3791 |
* igb_free_tx_resources - Free Tx Resources per Queue |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3792 |
* @tx_ring: Tx descriptor ring for a specific queue |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3793 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3794 |
* Free all transmit software resources |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3795 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3796 |
void igb_free_tx_resources(struct igb_ring *tx_ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3797 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3798 |
igb_clean_tx_ring(tx_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3799 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3800 |
vfree(tx_ring->tx_buffer_info); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3801 |
tx_ring->tx_buffer_info = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3802 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3803 |
/* if not set, then don't free */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3804 |
if (!tx_ring->desc) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3805 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3806 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3807 |
dma_free_coherent(tx_ring->dev, tx_ring->size, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3808 |
tx_ring->desc, tx_ring->dma); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3809 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3810 |
tx_ring->desc = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3811 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3812 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3813 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3814 |
* igb_free_all_tx_resources - Free Tx Resources for All Queues |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3815 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3816 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3817 |
* Free all transmit software resources |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3818 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3819 |
static void igb_free_all_tx_resources(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3820 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3821 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3822 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3823 |
for (i = 0; i < adapter->num_tx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3824 |
if (adapter->tx_ring[i]) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3825 |
igb_free_tx_resources(adapter->tx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3826 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3827 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3828 |
void igb_unmap_and_free_tx_resource(struct igb_ring *ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3829 |
struct igb_tx_buffer *tx_buffer) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3830 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3831 |
if (tx_buffer->skb) { |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3832 |
struct igb_adapter *adapter = netdev_priv(ring->netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3833 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3834 |
/* skb is reused in EtherCAT TX operation */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3835 |
dev_kfree_skb_any(tx_buffer->skb); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
3836 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3837 |
if (dma_unmap_len(tx_buffer, len)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3838 |
dma_unmap_single(ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3839 |
dma_unmap_addr(tx_buffer, dma), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3840 |
dma_unmap_len(tx_buffer, len), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3841 |
DMA_TO_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3842 |
} else if (dma_unmap_len(tx_buffer, len)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3843 |
dma_unmap_page(ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3844 |
dma_unmap_addr(tx_buffer, dma), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3845 |
dma_unmap_len(tx_buffer, len), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3846 |
DMA_TO_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3847 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3848 |
tx_buffer->next_to_watch = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3849 |
tx_buffer->skb = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3850 |
dma_unmap_len_set(tx_buffer, len, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3851 |
/* buffer_info must be completely set up in the transmit path */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3852 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3853 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3854 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3855 |
* igb_clean_tx_ring - Free Tx Buffers |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3856 |
* @tx_ring: ring to be cleaned |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3857 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3858 |
static void igb_clean_tx_ring(struct igb_ring *tx_ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3859 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3860 |
struct igb_tx_buffer *buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3861 |
unsigned long size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3862 |
u16 i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3863 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3864 |
if (!tx_ring->tx_buffer_info) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3865 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3866 |
/* Free all the Tx ring sk_buffs */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3867 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3868 |
for (i = 0; i < tx_ring->count; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3869 |
buffer_info = &tx_ring->tx_buffer_info[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3870 |
igb_unmap_and_free_tx_resource(tx_ring, buffer_info); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3871 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3872 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3873 |
netdev_tx_reset_queue(txring_txq(tx_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3874 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3875 |
size = sizeof(struct igb_tx_buffer) * tx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3876 |
memset(tx_ring->tx_buffer_info, 0, size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3877 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3878 |
/* Zero out the descriptor ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3879 |
memset(tx_ring->desc, 0, tx_ring->size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3880 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3881 |
tx_ring->next_to_use = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3882 |
tx_ring->next_to_clean = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3883 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3884 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3885 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3886 |
* igb_clean_all_tx_rings - Free Tx Buffers for all queues |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3887 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3888 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3889 |
static void igb_clean_all_tx_rings(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3890 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3891 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3892 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3893 |
for (i = 0; i < adapter->num_tx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3894 |
if (adapter->tx_ring[i]) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3895 |
igb_clean_tx_ring(adapter->tx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3896 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3897 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3898 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3899 |
* igb_free_rx_resources - Free Rx Resources |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3900 |
* @rx_ring: ring to clean the resources from |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3901 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3902 |
* Free all receive software resources |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3903 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3904 |
void igb_free_rx_resources(struct igb_ring *rx_ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3905 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3906 |
igb_clean_rx_ring(rx_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3907 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3908 |
vfree(rx_ring->rx_buffer_info); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3909 |
rx_ring->rx_buffer_info = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3910 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3911 |
/* if not set, then don't free */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3912 |
if (!rx_ring->desc) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3913 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3914 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3915 |
dma_free_coherent(rx_ring->dev, rx_ring->size, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3916 |
rx_ring->desc, rx_ring->dma); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3917 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3918 |
rx_ring->desc = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3919 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3920 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3921 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3922 |
* igb_free_all_rx_resources - Free Rx Resources for All Queues |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3923 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3924 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3925 |
* Free all receive software resources |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3926 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3927 |
static void igb_free_all_rx_resources(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3928 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3929 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3930 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3931 |
for (i = 0; i < adapter->num_rx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3932 |
if (adapter->rx_ring[i]) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3933 |
igb_free_rx_resources(adapter->rx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3934 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3935 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3936 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3937 |
* igb_clean_rx_ring - Free Rx Buffers per Queue |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3938 |
* @rx_ring: ring to free buffers from |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3939 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3940 |
static void igb_clean_rx_ring(struct igb_ring *rx_ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3941 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3942 |
unsigned long size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3943 |
u16 i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3944 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3945 |
if (rx_ring->skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3946 |
dev_kfree_skb(rx_ring->skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3947 |
rx_ring->skb = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3948 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3949 |
if (!rx_ring->rx_buffer_info) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3950 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3951 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3952 |
/* Free all the Rx ring sk_buffs */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3953 |
for (i = 0; i < rx_ring->count; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3954 |
struct igb_rx_buffer *buffer_info = &rx_ring->rx_buffer_info[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3955 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3956 |
if (!buffer_info->page) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3957 |
continue; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3958 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3959 |
dma_unmap_page(rx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3960 |
buffer_info->dma, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3961 |
PAGE_SIZE, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3962 |
DMA_FROM_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3963 |
__free_page(buffer_info->page); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3964 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3965 |
buffer_info->page = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3966 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3967 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3968 |
size = sizeof(struct igb_rx_buffer) * rx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3969 |
memset(rx_ring->rx_buffer_info, 0, size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3970 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3971 |
/* Zero out the descriptor ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3972 |
memset(rx_ring->desc, 0, rx_ring->size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3973 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3974 |
rx_ring->next_to_alloc = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3975 |
rx_ring->next_to_clean = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3976 |
rx_ring->next_to_use = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3977 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3978 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3979 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3980 |
* igb_clean_all_rx_rings - Free Rx Buffers for all queues |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3981 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3982 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3983 |
static void igb_clean_all_rx_rings(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3984 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3985 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3986 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3987 |
for (i = 0; i < adapter->num_rx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3988 |
if (adapter->rx_ring[i]) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3989 |
igb_clean_rx_ring(adapter->rx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3990 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3991 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3992 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3993 |
* igb_set_mac - Change the Ethernet Address of the NIC |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3994 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3995 |
* @p: pointer to an address structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3996 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3997 |
* Returns 0 on success, negative on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3998 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3999 |
static int igb_set_mac(struct net_device *netdev, void *p) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4000 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4001 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4002 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4003 |
struct sockaddr *addr = p; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4004 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4005 |
if (!is_valid_ether_addr(addr->sa_data)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4006 |
return -EADDRNOTAVAIL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4007 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4008 |
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4009 |
memcpy(hw->mac.addr, addr->sa_data, netdev->addr_len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4010 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4011 |
/* set the correct pool for the new PF MAC address in entry 0 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4012 |
igb_rar_set_qsel(adapter, hw->mac.addr, 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4013 |
adapter->vfs_allocated_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4014 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4015 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4016 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4017 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4018 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4019 |
* igb_write_mc_addr_list - write multicast addresses to MTA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4020 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4021 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4022 |
* Writes multicast address list to the MTA hash table. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4023 |
* Returns: -ENOMEM on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4024 |
* 0 on no addresses written |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4025 |
* X on writing X addresses to MTA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4026 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4027 |
static int igb_write_mc_addr_list(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4028 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4029 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4030 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4031 |
struct netdev_hw_addr *ha; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4032 |
u8 *mta_list; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4033 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4034 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4035 |
if (netdev_mc_empty(netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4036 |
/* nothing to program, so clear mc list */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4037 |
igb_update_mc_addr_list(hw, NULL, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4038 |
igb_restore_vf_multicasts(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4039 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4040 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4041 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4042 |
mta_list = kzalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4043 |
if (!mta_list) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4044 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4045 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4046 |
/* The shared function expects a packed array of only addresses. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4047 |
i = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4048 |
netdev_for_each_mc_addr(ha, netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4049 |
memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4050 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4051 |
igb_update_mc_addr_list(hw, mta_list, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4052 |
kfree(mta_list); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4053 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4054 |
return netdev_mc_count(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4055 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4056 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4057 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4058 |
* igb_write_uc_addr_list - write unicast addresses to RAR table |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4059 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4060 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4061 |
* Writes unicast address list to the RAR table. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4062 |
* Returns: -ENOMEM on failure/insufficient address space |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4063 |
* 0 on no addresses written |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4064 |
* X on writing X addresses to the RAR table |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4065 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4066 |
static int igb_write_uc_addr_list(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4067 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4068 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4069 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4070 |
unsigned int vfn = adapter->vfs_allocated_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4071 |
unsigned int rar_entries = hw->mac.rar_entry_count - (vfn + 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4072 |
int count = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4073 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4074 |
/* return ENOMEM indicating insufficient memory for addresses */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4075 |
if (netdev_uc_count(netdev) > rar_entries) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4076 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4077 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4078 |
if (!netdev_uc_empty(netdev) && rar_entries) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4079 |
struct netdev_hw_addr *ha; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4080 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4081 |
netdev_for_each_uc_addr(ha, netdev) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4082 |
if (!rar_entries) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4083 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4084 |
igb_rar_set_qsel(adapter, ha->addr, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4085 |
rar_entries--, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4086 |
vfn); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4087 |
count++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4088 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4089 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4090 |
/* write the addresses in reverse order to avoid write combining */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4091 |
for (; rar_entries > 0 ; rar_entries--) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4092 |
wr32(E1000_RAH(rar_entries), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4093 |
wr32(E1000_RAL(rar_entries), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4094 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4095 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4096 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4097 |
return count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4098 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4099 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4100 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4101 |
* igb_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4102 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4103 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4104 |
* The set_rx_mode entry point is called whenever the unicast or multicast |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4105 |
* address lists or the network interface flags are updated. This routine is |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4106 |
* responsible for configuring the hardware for proper unicast, multicast, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4107 |
* promiscuous mode, and all-multi behavior. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4108 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4109 |
static void igb_set_rx_mode(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4110 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4111 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4112 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4113 |
unsigned int vfn = adapter->vfs_allocated_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4114 |
u32 rctl, vmolr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4115 |
int count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4116 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4117 |
/* Check for Promiscuous and All Multicast modes */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4118 |
rctl = rd32(E1000_RCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4119 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4120 |
/* clear the effected bits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4121 |
rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE | E1000_RCTL_VFE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4122 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4123 |
if (netdev->flags & IFF_PROMISC) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4124 |
/* retain VLAN HW filtering if in VT mode */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4125 |
if (adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4126 |
rctl |= E1000_RCTL_VFE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4127 |
rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4128 |
vmolr |= (E1000_VMOLR_ROPE | E1000_VMOLR_MPME); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4129 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4130 |
if (netdev->flags & IFF_ALLMULTI) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4131 |
rctl |= E1000_RCTL_MPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4132 |
vmolr |= E1000_VMOLR_MPME; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4133 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4134 |
/* Write addresses to the MTA, if the attempt fails |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4135 |
* then we should just turn on promiscuous mode so |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4136 |
* that we can at least receive multicast traffic |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4137 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4138 |
count = igb_write_mc_addr_list(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4139 |
if (count < 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4140 |
rctl |= E1000_RCTL_MPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4141 |
vmolr |= E1000_VMOLR_MPME; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4142 |
} else if (count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4143 |
vmolr |= E1000_VMOLR_ROMPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4144 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4145 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4146 |
/* Write addresses to available RAR registers, if there is not |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4147 |
* sufficient space to store all the addresses then enable |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4148 |
* unicast promiscuous mode |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4149 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4150 |
count = igb_write_uc_addr_list(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4151 |
if (count < 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4152 |
rctl |= E1000_RCTL_UPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4153 |
vmolr |= E1000_VMOLR_ROPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4154 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4155 |
rctl |= E1000_RCTL_VFE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4156 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4157 |
wr32(E1000_RCTL, rctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4158 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4159 |
/* In order to support SR-IOV and eventually VMDq it is necessary to set |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4160 |
* the VMOLR to enable the appropriate modes. Without this workaround |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4161 |
* we will have issues with VLAN tag stripping not being done for frames |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4162 |
* that are only arriving because we are the default pool |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4163 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4164 |
if ((hw->mac.type < e1000_82576) || (hw->mac.type > e1000_i350)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4165 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4166 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4167 |
vmolr |= rd32(E1000_VMOLR(vfn)) & |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4168 |
~(E1000_VMOLR_ROPE | E1000_VMOLR_MPME | E1000_VMOLR_ROMPE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4169 |
wr32(E1000_VMOLR(vfn), vmolr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4170 |
igb_restore_vf_multicasts(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4171 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4172 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4173 |
static void igb_check_wvbr(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4174 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4175 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4176 |
u32 wvbr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4177 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4178 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4179 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4180 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4181 |
wvbr = rd32(E1000_WVBR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4182 |
if (!wvbr) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4183 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4184 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4185 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4186 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4187 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4188 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4189 |
adapter->wvbr |= wvbr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4190 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4191 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4192 |
#define IGB_STAGGERED_QUEUE_OFFSET 8 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4193 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4194 |
static void igb_spoof_check(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4195 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4196 |
int j; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4197 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4198 |
if (!adapter->wvbr) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4199 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4200 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4201 |
for (j = 0; j < adapter->vfs_allocated_count; j++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4202 |
if (adapter->wvbr & (1 << j) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4203 |
adapter->wvbr & (1 << (j + IGB_STAGGERED_QUEUE_OFFSET))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4204 |
dev_warn(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4205 |
"Spoof event(s) detected on VF %d\n", j); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4206 |
adapter->wvbr &= |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4207 |
~((1 << j) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4208 |
(1 << (j + IGB_STAGGERED_QUEUE_OFFSET))); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4209 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4210 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4211 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4212 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4213 |
/* Need to wait a few seconds after link up to get diagnostic information from |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4214 |
* the phy |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4215 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4216 |
static void igb_update_phy_info(unsigned long data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4217 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4218 |
struct igb_adapter *adapter = (struct igb_adapter *) data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4219 |
igb_get_phy_info(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4220 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4221 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4222 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4223 |
* igb_has_link - check shared code for link and determine up/down |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4224 |
* @adapter: pointer to driver private info |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4225 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4226 |
bool igb_has_link(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4227 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4228 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4229 |
bool link_active = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4230 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4231 |
/* get_link_status is set on LSC (link status) interrupt or |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4232 |
* rx sequence error interrupt. get_link_status will stay |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4233 |
* false until the e1000_check_for_link establishes link |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4234 |
* for copper adapters ONLY |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4235 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4236 |
switch (hw->phy.media_type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4237 |
case e1000_media_type_copper: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4238 |
if (!hw->mac.get_link_status) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4239 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4240 |
case e1000_media_type_internal_serdes: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4241 |
hw->mac.ops.check_for_link(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4242 |
link_active = !hw->mac.get_link_status; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4243 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4244 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4245 |
case e1000_media_type_unknown: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4246 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4247 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4248 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4249 |
if (((hw->mac.type == e1000_i210) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4250 |
(hw->mac.type == e1000_i211)) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4251 |
(hw->phy.id == I210_I_PHY_ID)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4252 |
if (!netif_carrier_ok(adapter->netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4253 |
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4254 |
} else if (!(adapter->flags & IGB_FLAG_NEED_LINK_UPDATE)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4255 |
adapter->flags |= IGB_FLAG_NEED_LINK_UPDATE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4256 |
adapter->link_check_timeout = jiffies; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4257 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4258 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4259 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4260 |
return link_active; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4261 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4262 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4263 |
static bool igb_thermal_sensor_event(struct e1000_hw *hw, u32 event) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4264 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4265 |
bool ret = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4266 |
u32 ctrl_ext, thstat; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4267 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4268 |
/* check for thermal sensor event on i350 copper only */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4269 |
if (hw->mac.type == e1000_i350) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4270 |
thstat = rd32(E1000_THSTAT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4271 |
ctrl_ext = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4272 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4273 |
if ((hw->phy.media_type == e1000_media_type_copper) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4274 |
!(ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4275 |
ret = !!(thstat & event); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4276 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4277 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4278 |
return ret; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4279 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4280 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4281 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4282 |
* igb_check_lvmmc - check for malformed packets received |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4283 |
* and indicated in LVMMC register |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4284 |
* @adapter: pointer to adapter |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4285 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4286 |
static void igb_check_lvmmc(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4287 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4288 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4289 |
u32 lvmmc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4290 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4291 |
lvmmc = rd32(E1000_LVMMC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4292 |
if (lvmmc) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4293 |
if (unlikely(net_ratelimit())) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4294 |
netdev_warn(adapter->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4295 |
"malformed Tx packet detected and dropped, LVMMC:0x%08x\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4296 |
lvmmc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4297 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4298 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4299 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4300 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4301 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4302 |
* igb_watchdog - Timer Call-back |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4303 |
* @data: pointer to adapter cast into an unsigned long |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4304 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4305 |
static void igb_watchdog(unsigned long data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4306 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4307 |
struct igb_adapter *adapter = (struct igb_adapter *)data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4308 |
/* Do the rest outside of interrupt context */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4309 |
schedule_work(&adapter->watchdog_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4310 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4311 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4312 |
static void igb_watchdog_task(struct work_struct *work) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4313 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4314 |
struct igb_adapter *adapter = container_of(work, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4315 |
struct igb_adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4316 |
watchdog_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4317 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4318 |
struct e1000_phy_info *phy = &hw->phy; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4319 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4320 |
u32 link; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4321 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4322 |
u32 connsw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4323 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4324 |
link = igb_has_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4325 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4326 |
if (adapter->flags & IGB_FLAG_NEED_LINK_UPDATE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4327 |
if (time_after(jiffies, (adapter->link_check_timeout + HZ))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4328 |
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4329 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4330 |
link = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4331 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4332 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4333 |
/* Force link down if we have fiber to swap to */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4334 |
if (adapter->flags & IGB_FLAG_MAS_ENABLE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4335 |
if (hw->phy.media_type == e1000_media_type_copper) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4336 |
connsw = rd32(E1000_CONNSW); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4337 |
if (!(connsw & E1000_CONNSW_AUTOSENSE_EN)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4338 |
link = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4339 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4340 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4341 |
if (link) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4342 |
/* Perform a reset if the media type changed. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4343 |
if (hw->dev_spec._82575.media_changed) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4344 |
hw->dev_spec._82575.media_changed = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4345 |
adapter->flags |= IGB_FLAG_MEDIA_RESET; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4346 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4347 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4348 |
/* Cancel scheduled suspend requests. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4349 |
pm_runtime_resume(netdev->dev.parent); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4350 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4351 |
if (!netif_carrier_ok(netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4352 |
u32 ctrl; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4353 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4354 |
hw->mac.ops.get_speed_and_duplex(hw, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4355 |
&adapter->link_speed, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4356 |
&adapter->link_duplex); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4357 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4358 |
ctrl = rd32(E1000_CTRL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4359 |
/* Links status message must follow this format */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4360 |
netdev_info(netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4361 |
"igb: %s NIC Link is Up %d Mbps %s Duplex, Flow Control: %s\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4362 |
netdev->name, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4363 |
adapter->link_speed, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4364 |
adapter->link_duplex == FULL_DUPLEX ? |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4365 |
"Full" : "Half", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4366 |
(ctrl & E1000_CTRL_TFCE) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4367 |
(ctrl & E1000_CTRL_RFCE) ? "RX/TX" : |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4368 |
(ctrl & E1000_CTRL_RFCE) ? "RX" : |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4369 |
(ctrl & E1000_CTRL_TFCE) ? "TX" : "None"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4370 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4371 |
/* disable EEE if enabled */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4372 |
if ((adapter->flags & IGB_FLAG_EEE) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4373 |
(adapter->link_duplex == HALF_DUPLEX)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4374 |
dev_info(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4375 |
"EEE Disabled: unsupported at half duplex. Re-enable using ethtool when at full duplex.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4376 |
adapter->hw.dev_spec._82575.eee_disable = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4377 |
adapter->flags &= ~IGB_FLAG_EEE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4378 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4379 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4380 |
/* check if SmartSpeed worked */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4381 |
igb_check_downshift(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4382 |
if (phy->speed_downgraded) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4383 |
netdev_warn(netdev, "Link Speed was downgraded by SmartSpeed\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4384 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4385 |
/* check for thermal sensor event */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4386 |
if (igb_thermal_sensor_event(hw, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4387 |
E1000_THSTAT_LINK_THROTTLE)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4388 |
netdev_info(netdev, "The network adapter link speed was downshifted because it overheated\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4389 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4390 |
/* adjust timeout factor according to speed/duplex */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4391 |
adapter->tx_timeout_factor = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4392 |
switch (adapter->link_speed) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4393 |
case SPEED_10: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4394 |
adapter->tx_timeout_factor = 14; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4395 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4396 |
case SPEED_100: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4397 |
/* maybe add some timeout factor ? */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4398 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4399 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4400 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4401 |
netif_carrier_on(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4402 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4403 |
igb_ping_all_vfs(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4404 |
igb_check_vf_rate_limit(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4405 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4406 |
/* link state has changed, schedule phy info update */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4407 |
if (!test_bit(__IGB_DOWN, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4408 |
mod_timer(&adapter->phy_info_timer, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4409 |
round_jiffies(jiffies + 2 * HZ)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4410 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4411 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4412 |
if (netif_carrier_ok(netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4413 |
adapter->link_speed = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4414 |
adapter->link_duplex = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4415 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4416 |
/* check for thermal sensor event */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4417 |
if (igb_thermal_sensor_event(hw, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4418 |
E1000_THSTAT_PWR_DOWN)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4419 |
netdev_err(netdev, "The network adapter was stopped because it overheated\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4420 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4421 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4422 |
/* Links status message must follow this format */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4423 |
netdev_info(netdev, "igb: %s NIC Link is Down\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4424 |
netdev->name); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4425 |
netif_carrier_off(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4426 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4427 |
igb_ping_all_vfs(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4428 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4429 |
/* link state has changed, schedule phy info update */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4430 |
if (!test_bit(__IGB_DOWN, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4431 |
mod_timer(&adapter->phy_info_timer, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4432 |
round_jiffies(jiffies + 2 * HZ)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4433 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4434 |
/* link is down, time to check for alternate media */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4435 |
if (adapter->flags & IGB_FLAG_MAS_ENABLE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4436 |
igb_check_swap_media(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4437 |
if (adapter->flags & IGB_FLAG_MEDIA_RESET) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4438 |
schedule_work(&adapter->reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4439 |
/* return immediately */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4440 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4441 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4442 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4443 |
pm_schedule_suspend(netdev->dev.parent, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4444 |
MSEC_PER_SEC * 5); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4445 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4446 |
/* also check for alternate media here */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4447 |
} else if (!netif_carrier_ok(netdev) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4448 |
(adapter->flags & IGB_FLAG_MAS_ENABLE)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4449 |
igb_check_swap_media(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4450 |
if (adapter->flags & IGB_FLAG_MEDIA_RESET) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4451 |
schedule_work(&adapter->reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4452 |
/* return immediately */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4453 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4454 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4455 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4456 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4457 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4458 |
spin_lock(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4459 |
igb_update_stats(adapter, &adapter->stats64); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4460 |
spin_unlock(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4461 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4462 |
for (i = 0; i < adapter->num_tx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4463 |
struct igb_ring *tx_ring = adapter->tx_ring[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4464 |
if (!netif_carrier_ok(netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4465 |
/* We've lost link, so the controller stops DMA, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4466 |
* but we've got queued Tx work that's never going |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4467 |
* to get done, so reset controller to flush Tx. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4468 |
* (Do the reset outside of interrupt context). |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4469 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4470 |
if (igb_desc_unused(tx_ring) + 1 < tx_ring->count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4471 |
adapter->tx_timeout_count++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4472 |
schedule_work(&adapter->reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4473 |
/* return immediately since reset is imminent */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4474 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4475 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4476 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4477 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4478 |
/* Force detection of hung controller every watchdog period */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4479 |
set_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4480 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4481 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4482 |
/* Cause software interrupt to ensure Rx ring is cleaned */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4483 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4484 |
u32 eics = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4485 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4486 |
for (i = 0; i < adapter->num_q_vectors; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4487 |
eics |= adapter->q_vector[i]->eims_value; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4488 |
wr32(E1000_EICS, eics); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4489 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4490 |
wr32(E1000_ICS, E1000_ICS_RXDMT0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4491 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4492 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4493 |
igb_spoof_check(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4494 |
igb_ptp_rx_hang(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4495 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4496 |
/* Check LVMMC register on i350/i354 only */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4497 |
if ((adapter->hw.mac.type == e1000_i350) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4498 |
(adapter->hw.mac.type == e1000_i354)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4499 |
igb_check_lvmmc(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4500 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4501 |
/* Reset the timer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4502 |
if (!test_bit(__IGB_DOWN, &adapter->state)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4503 |
if (adapter->flags & IGB_FLAG_NEED_LINK_UPDATE) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4504 |
mod_timer(&adapter->watchdog_timer, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4505 |
round_jiffies(jiffies + HZ)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4506 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4507 |
mod_timer(&adapter->watchdog_timer, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4508 |
round_jiffies(jiffies + 2 * HZ)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4509 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4510 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4511 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4512 |
enum latency_range { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4513 |
lowest_latency = 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4514 |
low_latency = 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4515 |
bulk_latency = 2, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4516 |
latency_invalid = 255 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4517 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4518 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4519 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4520 |
* igb_update_ring_itr - update the dynamic ITR value based on packet size |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4521 |
* @q_vector: pointer to q_vector |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4522 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4523 |
* Stores a new ITR value based on strictly on packet size. This |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4524 |
* algorithm is less sophisticated than that used in igb_update_itr, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4525 |
* due to the difficulty of synchronizing statistics across multiple |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4526 |
* receive rings. The divisors and thresholds used by this function |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4527 |
* were determined based on theoretical maximum wire speed and testing |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4528 |
* data, in order to minimize response time while increasing bulk |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4529 |
* throughput. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4530 |
* This functionality is controlled by ethtool's coalescing settings. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4531 |
* NOTE: This function is called only when operating in a multiqueue |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4532 |
* receive environment. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4533 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4534 |
static void igb_update_ring_itr(struct igb_q_vector *q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4535 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4536 |
int new_val = q_vector->itr_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4537 |
int avg_wire_size = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4538 |
struct igb_adapter *adapter = q_vector->adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4539 |
unsigned int packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4540 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4541 |
/* For non-gigabit speeds, just fix the interrupt rate at 4000 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4542 |
* ints/sec - ITR timer value of 120 ticks. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4543 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4544 |
if (adapter->link_speed != SPEED_1000) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4545 |
new_val = IGB_4K_ITR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4546 |
goto set_itr_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4547 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4548 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4549 |
packets = q_vector->rx.total_packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4550 |
if (packets) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4551 |
avg_wire_size = q_vector->rx.total_bytes / packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4552 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4553 |
packets = q_vector->tx.total_packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4554 |
if (packets) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4555 |
avg_wire_size = max_t(u32, avg_wire_size, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4556 |
q_vector->tx.total_bytes / packets); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4557 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4558 |
/* if avg_wire_size isn't set no work was done */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4559 |
if (!avg_wire_size) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4560 |
goto clear_counts; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4561 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4562 |
/* Add 24 bytes to size to account for CRC, preamble, and gap */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4563 |
avg_wire_size += 24; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4564 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4565 |
/* Don't starve jumbo frames */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4566 |
avg_wire_size = min(avg_wire_size, 3000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4567 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4568 |
/* Give a little boost to mid-size frames */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4569 |
if ((avg_wire_size > 300) && (avg_wire_size < 1200)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4570 |
new_val = avg_wire_size / 3; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4571 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4572 |
new_val = avg_wire_size / 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4573 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4574 |
/* conservative mode (itr 3) eliminates the lowest_latency setting */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4575 |
if (new_val < IGB_20K_ITR && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4576 |
((q_vector->rx.ring && adapter->rx_itr_setting == 3) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4577 |
(!q_vector->rx.ring && adapter->tx_itr_setting == 3))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4578 |
new_val = IGB_20K_ITR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4579 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4580 |
set_itr_val: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4581 |
if (new_val != q_vector->itr_val) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4582 |
q_vector->itr_val = new_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4583 |
q_vector->set_itr = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4584 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4585 |
clear_counts: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4586 |
q_vector->rx.total_bytes = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4587 |
q_vector->rx.total_packets = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4588 |
q_vector->tx.total_bytes = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4589 |
q_vector->tx.total_packets = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4590 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4591 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4592 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4593 |
* igb_update_itr - update the dynamic ITR value based on statistics |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4594 |
* @q_vector: pointer to q_vector |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4595 |
* @ring_container: ring info to update the itr for |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4596 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4597 |
* Stores a new ITR value based on packets and byte |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4598 |
* counts during the last interrupt. The advantage of per interrupt |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4599 |
* computation is faster updates and more accurate ITR for the current |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4600 |
* traffic pattern. Constants in this function were computed |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4601 |
* based on theoretical maximum wire speed and thresholds were set based |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4602 |
* on testing data as well as attempting to minimize response time |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4603 |
* while increasing bulk throughput. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4604 |
* This functionality is controlled by ethtool's coalescing settings. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4605 |
* NOTE: These calculations are only valid when operating in a single- |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4606 |
* queue environment. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4607 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4608 |
static void igb_update_itr(struct igb_q_vector *q_vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4609 |
struct igb_ring_container *ring_container) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4610 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4611 |
unsigned int packets = ring_container->total_packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4612 |
unsigned int bytes = ring_container->total_bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4613 |
u8 itrval = ring_container->itr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4614 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4615 |
/* no packets, exit with status unchanged */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4616 |
if (packets == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4617 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4618 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4619 |
switch (itrval) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4620 |
case lowest_latency: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4621 |
/* handle TSO and jumbo frames */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4622 |
if (bytes/packets > 8000) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4623 |
itrval = bulk_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4624 |
else if ((packets < 5) && (bytes > 512)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4625 |
itrval = low_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4626 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4627 |
case low_latency: /* 50 usec aka 20000 ints/s */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4628 |
if (bytes > 10000) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4629 |
/* this if handles the TSO accounting */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4630 |
if (bytes/packets > 8000) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4631 |
itrval = bulk_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4632 |
else if ((packets < 10) || ((bytes/packets) > 1200)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4633 |
itrval = bulk_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4634 |
else if ((packets > 35)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4635 |
itrval = lowest_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4636 |
} else if (bytes/packets > 2000) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4637 |
itrval = bulk_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4638 |
} else if (packets <= 2 && bytes < 512) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4639 |
itrval = lowest_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4640 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4641 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4642 |
case bulk_latency: /* 250 usec aka 4000 ints/s */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4643 |
if (bytes > 25000) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4644 |
if (packets > 35) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4645 |
itrval = low_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4646 |
} else if (bytes < 1500) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4647 |
itrval = low_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4648 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4649 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4650 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4651 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4652 |
/* clear work counters since we have the values we need */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4653 |
ring_container->total_bytes = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4654 |
ring_container->total_packets = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4655 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4656 |
/* write updated itr to ring container */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4657 |
ring_container->itr = itrval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4658 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4659 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4660 |
static void igb_set_itr(struct igb_q_vector *q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4661 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4662 |
struct igb_adapter *adapter = q_vector->adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4663 |
u32 new_itr = q_vector->itr_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4664 |
u8 current_itr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4665 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4666 |
/* for non-gigabit speeds, just fix the interrupt rate at 4000 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4667 |
if (adapter->link_speed != SPEED_1000) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4668 |
current_itr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4669 |
new_itr = IGB_4K_ITR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4670 |
goto set_itr_now; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4671 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4672 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4673 |
igb_update_itr(q_vector, &q_vector->tx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4674 |
igb_update_itr(q_vector, &q_vector->rx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4675 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4676 |
current_itr = max(q_vector->rx.itr, q_vector->tx.itr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4677 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4678 |
/* conservative mode (itr 3) eliminates the lowest_latency setting */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4679 |
if (current_itr == lowest_latency && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4680 |
((q_vector->rx.ring && adapter->rx_itr_setting == 3) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4681 |
(!q_vector->rx.ring && adapter->tx_itr_setting == 3))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4682 |
current_itr = low_latency; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4683 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4684 |
switch (current_itr) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4685 |
/* counts and packets in update_itr are dependent on these numbers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4686 |
case lowest_latency: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4687 |
new_itr = IGB_70K_ITR; /* 70,000 ints/sec */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4688 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4689 |
case low_latency: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4690 |
new_itr = IGB_20K_ITR; /* 20,000 ints/sec */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4691 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4692 |
case bulk_latency: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4693 |
new_itr = IGB_4K_ITR; /* 4,000 ints/sec */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4694 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4695 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4696 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4697 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4698 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4699 |
set_itr_now: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4700 |
if (new_itr != q_vector->itr_val) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4701 |
/* this attempts to bias the interrupt rate towards Bulk |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4702 |
* by adding intermediate steps when interrupt rate is |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4703 |
* increasing |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4704 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4705 |
new_itr = new_itr > q_vector->itr_val ? |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4706 |
max((new_itr * q_vector->itr_val) / |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4707 |
(new_itr + (q_vector->itr_val >> 2)), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4708 |
new_itr) : new_itr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4709 |
/* Don't write the value here; it resets the adapter's |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4710 |
* internal timer, and causes us to delay far longer than |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4711 |
* we should between interrupts. Instead, we write the ITR |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4712 |
* value at the beginning of the next interrupt so the timing |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4713 |
* ends up being correct. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4714 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4715 |
q_vector->itr_val = new_itr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4716 |
q_vector->set_itr = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4717 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4718 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4719 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4720 |
static void igb_tx_ctxtdesc(struct igb_ring *tx_ring, u32 vlan_macip_lens, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4721 |
u32 type_tucmd, u32 mss_l4len_idx) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4722 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4723 |
struct e1000_adv_tx_context_desc *context_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4724 |
u16 i = tx_ring->next_to_use; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4725 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4726 |
context_desc = IGB_TX_CTXTDESC(tx_ring, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4727 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4728 |
i++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4729 |
tx_ring->next_to_use = (i < tx_ring->count) ? i : 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4730 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4731 |
/* set bits to identify this as an advanced context descriptor */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4732 |
type_tucmd |= E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4733 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4734 |
/* For 82575, context index must be unique per ring. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4735 |
if (test_bit(IGB_RING_FLAG_TX_CTX_IDX, &tx_ring->flags)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4736 |
mss_l4len_idx |= tx_ring->reg_idx << 4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4737 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4738 |
context_desc->vlan_macip_lens = cpu_to_le32(vlan_macip_lens); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4739 |
context_desc->seqnum_seed = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4740 |
context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4741 |
context_desc->mss_l4len_idx = cpu_to_le32(mss_l4len_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4742 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4743 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4744 |
static int igb_tso(struct igb_ring *tx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4745 |
struct igb_tx_buffer *first, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4746 |
u8 *hdr_len) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4747 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4748 |
struct sk_buff *skb = first->skb; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4749 |
u32 vlan_macip_lens, type_tucmd; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4750 |
u32 mss_l4len_idx, l4len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4751 |
int err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4752 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4753 |
if (skb->ip_summed != CHECKSUM_PARTIAL) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4754 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4755 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4756 |
if (!skb_is_gso(skb)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4757 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4758 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4759 |
err = skb_cow_head(skb, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4760 |
if (err < 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4761 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4762 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4763 |
/* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4764 |
type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4765 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4766 |
if (first->protocol == htons(ETH_P_IP)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4767 |
struct iphdr *iph = ip_hdr(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4768 |
iph->tot_len = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4769 |
iph->check = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4770 |
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4771 |
iph->daddr, 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4772 |
IPPROTO_TCP, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4773 |
0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4774 |
type_tucmd |= E1000_ADVTXD_TUCMD_IPV4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4775 |
first->tx_flags |= IGB_TX_FLAGS_TSO | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4776 |
IGB_TX_FLAGS_CSUM | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4777 |
IGB_TX_FLAGS_IPV4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4778 |
} else if (skb_is_gso_v6(skb)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4779 |
ipv6_hdr(skb)->payload_len = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4780 |
tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4781 |
&ipv6_hdr(skb)->daddr, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4782 |
0, IPPROTO_TCP, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4783 |
first->tx_flags |= IGB_TX_FLAGS_TSO | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4784 |
IGB_TX_FLAGS_CSUM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4785 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4786 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4787 |
/* compute header lengths */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4788 |
l4len = tcp_hdrlen(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4789 |
*hdr_len = skb_transport_offset(skb) + l4len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4790 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4791 |
/* update gso size and bytecount with header size */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4792 |
first->gso_segs = skb_shinfo(skb)->gso_segs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4793 |
first->bytecount += (first->gso_segs - 1) * *hdr_len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4794 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4795 |
/* MSS L4LEN IDX */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4796 |
mss_l4len_idx = l4len << E1000_ADVTXD_L4LEN_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4797 |
mss_l4len_idx |= skb_shinfo(skb)->gso_size << E1000_ADVTXD_MSS_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4798 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4799 |
/* VLAN MACLEN IPLEN */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4800 |
vlan_macip_lens = skb_network_header_len(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4801 |
vlan_macip_lens |= skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4802 |
vlan_macip_lens |= first->tx_flags & IGB_TX_FLAGS_VLAN_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4803 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4804 |
igb_tx_ctxtdesc(tx_ring, vlan_macip_lens, type_tucmd, mss_l4len_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4805 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4806 |
return 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4807 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4808 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4809 |
static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4810 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4811 |
struct sk_buff *skb = first->skb; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4812 |
u32 vlan_macip_lens = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4813 |
u32 mss_l4len_idx = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4814 |
u32 type_tucmd = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4815 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4816 |
if (skb->ip_summed != CHECKSUM_PARTIAL) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4817 |
if (!(first->tx_flags & IGB_TX_FLAGS_VLAN)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4818 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4819 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4820 |
u8 l4_hdr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4821 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4822 |
switch (first->protocol) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4823 |
case htons(ETH_P_IP): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4824 |
vlan_macip_lens |= skb_network_header_len(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4825 |
type_tucmd |= E1000_ADVTXD_TUCMD_IPV4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4826 |
l4_hdr = ip_hdr(skb)->protocol; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4827 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4828 |
case htons(ETH_P_IPV6): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4829 |
vlan_macip_lens |= skb_network_header_len(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4830 |
l4_hdr = ipv6_hdr(skb)->nexthdr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4831 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4832 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4833 |
if (unlikely(net_ratelimit())) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4834 |
dev_warn(tx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4835 |
"partial checksum but proto=%x!\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4836 |
first->protocol); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4837 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4838 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4839 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4840 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4841 |
switch (l4_hdr) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4842 |
case IPPROTO_TCP: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4843 |
type_tucmd |= E1000_ADVTXD_TUCMD_L4T_TCP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4844 |
mss_l4len_idx = tcp_hdrlen(skb) << |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4845 |
E1000_ADVTXD_L4LEN_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4846 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4847 |
case IPPROTO_SCTP: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4848 |
type_tucmd |= E1000_ADVTXD_TUCMD_L4T_SCTP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4849 |
mss_l4len_idx = sizeof(struct sctphdr) << |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4850 |
E1000_ADVTXD_L4LEN_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4851 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4852 |
case IPPROTO_UDP: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4853 |
mss_l4len_idx = sizeof(struct udphdr) << |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4854 |
E1000_ADVTXD_L4LEN_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4855 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4856 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4857 |
if (unlikely(net_ratelimit())) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4858 |
dev_warn(tx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4859 |
"partial checksum but l4 proto=%x!\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4860 |
l4_hdr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4861 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4862 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4863 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4864 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4865 |
/* update TX checksum flag */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4866 |
first->tx_flags |= IGB_TX_FLAGS_CSUM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4867 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4868 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4869 |
vlan_macip_lens |= skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4870 |
vlan_macip_lens |= first->tx_flags & IGB_TX_FLAGS_VLAN_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4871 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4872 |
igb_tx_ctxtdesc(tx_ring, vlan_macip_lens, type_tucmd, mss_l4len_idx); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4873 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4874 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4875 |
#define IGB_SET_FLAG(_input, _flag, _result) \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4876 |
((_flag <= _result) ? \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4877 |
((u32)(_input & _flag) * (_result / _flag)) : \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4878 |
((u32)(_input & _flag) / (_flag / _result))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4879 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4880 |
static u32 igb_tx_cmd_type(struct sk_buff *skb, u32 tx_flags) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4881 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4882 |
/* set type for advanced descriptor with frame checksum insertion */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4883 |
u32 cmd_type = E1000_ADVTXD_DTYP_DATA | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4884 |
E1000_ADVTXD_DCMD_DEXT | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4885 |
E1000_ADVTXD_DCMD_IFCS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4886 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4887 |
/* set HW vlan bit if vlan is present */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4888 |
cmd_type |= IGB_SET_FLAG(tx_flags, IGB_TX_FLAGS_VLAN, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4889 |
(E1000_ADVTXD_DCMD_VLE)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4890 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4891 |
/* set segmentation bits for TSO */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4892 |
cmd_type |= IGB_SET_FLAG(tx_flags, IGB_TX_FLAGS_TSO, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4893 |
(E1000_ADVTXD_DCMD_TSE)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4894 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4895 |
/* set timestamp bit if present */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4896 |
cmd_type |= IGB_SET_FLAG(tx_flags, IGB_TX_FLAGS_TSTAMP, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4897 |
(E1000_ADVTXD_MAC_TSTAMP)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4898 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4899 |
/* insert frame checksum */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4900 |
cmd_type ^= IGB_SET_FLAG(skb->no_fcs, 1, E1000_ADVTXD_DCMD_IFCS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4901 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4902 |
return cmd_type; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4903 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4904 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4905 |
static void igb_tx_olinfo_status(struct igb_ring *tx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4906 |
union e1000_adv_tx_desc *tx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4907 |
u32 tx_flags, unsigned int paylen) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4908 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4909 |
u32 olinfo_status = paylen << E1000_ADVTXD_PAYLEN_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4910 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4911 |
/* 82575 requires a unique index per ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4912 |
if (test_bit(IGB_RING_FLAG_TX_CTX_IDX, &tx_ring->flags)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4913 |
olinfo_status |= tx_ring->reg_idx << 4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4914 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4915 |
/* insert L4 checksum */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4916 |
olinfo_status |= IGB_SET_FLAG(tx_flags, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4917 |
IGB_TX_FLAGS_CSUM, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4918 |
(E1000_TXD_POPTS_TXSM << 8)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4919 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4920 |
/* insert IPv4 checksum */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4921 |
olinfo_status |= IGB_SET_FLAG(tx_flags, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4922 |
IGB_TX_FLAGS_IPV4, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4923 |
(E1000_TXD_POPTS_IXSM << 8)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4924 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4925 |
tx_desc->read.olinfo_status = cpu_to_le32(olinfo_status); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4926 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4927 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4928 |
static int __igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4929 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4930 |
struct net_device *netdev = tx_ring->netdev; |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
4931 |
struct igb_adapter *adapter = netdev_priv(netdev); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
4932 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
4933 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
4934 |
netif_stop_subqueue(netdev, tx_ring->queue_index); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
4935 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4936 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4937 |
/* Herbert's original patch had: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4938 |
* smp_mb__after_netif_stop_queue(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4939 |
* but since that doesn't exist yet, just open code it. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4940 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4941 |
smp_mb(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4942 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4943 |
/* We need to check again in a case another CPU has just |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4944 |
* made room available. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4945 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4946 |
if (igb_desc_unused(tx_ring) < size) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4947 |
return -EBUSY; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4948 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4949 |
/* A reprieve! */ |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
4950 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
4951 |
netif_wake_subqueue(netdev, tx_ring->queue_index); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
4952 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4953 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4954 |
u64_stats_update_begin(&tx_ring->tx_syncp2); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4955 |
tx_ring->tx_stats.restart_queue2++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4956 |
u64_stats_update_end(&tx_ring->tx_syncp2); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4957 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4958 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4959 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4960 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4961 |
static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4962 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4963 |
if (igb_desc_unused(tx_ring) >= size) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4964 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4965 |
return __igb_maybe_stop_tx(tx_ring, size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4966 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4967 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4968 |
static void igb_tx_map(struct igb_ring *tx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4969 |
struct igb_tx_buffer *first, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4970 |
const u8 hdr_len) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4971 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4972 |
struct sk_buff *skb = first->skb; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4973 |
struct igb_tx_buffer *tx_buffer; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4974 |
union e1000_adv_tx_desc *tx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4975 |
struct skb_frag_struct *frag; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4976 |
dma_addr_t dma; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4977 |
unsigned int data_len, size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4978 |
u32 tx_flags = first->tx_flags; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4979 |
u32 cmd_type = igb_tx_cmd_type(skb, tx_flags); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4980 |
u16 i = tx_ring->next_to_use; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4981 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4982 |
tx_desc = IGB_TX_DESC(tx_ring, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4983 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4984 |
igb_tx_olinfo_status(tx_ring, tx_desc, tx_flags, skb->len - hdr_len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4985 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4986 |
size = skb_headlen(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4987 |
data_len = skb->data_len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4988 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4989 |
dma = dma_map_single(tx_ring->dev, skb->data, size, DMA_TO_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4990 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4991 |
tx_buffer = first; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4992 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4993 |
for (frag = &skb_shinfo(skb)->frags[0];; frag++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4994 |
if (dma_mapping_error(tx_ring->dev, dma)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4995 |
goto dma_error; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4996 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4997 |
/* record length, and DMA address */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4998 |
dma_unmap_len_set(tx_buffer, len, size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4999 |
dma_unmap_addr_set(tx_buffer, dma, dma); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5000 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5001 |
tx_desc->read.buffer_addr = cpu_to_le64(dma); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5002 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5003 |
while (unlikely(size > IGB_MAX_DATA_PER_TXD)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5004 |
tx_desc->read.cmd_type_len = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5005 |
cpu_to_le32(cmd_type ^ IGB_MAX_DATA_PER_TXD); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5006 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5007 |
i++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5008 |
tx_desc++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5009 |
if (i == tx_ring->count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5010 |
tx_desc = IGB_TX_DESC(tx_ring, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5011 |
i = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5012 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5013 |
tx_desc->read.olinfo_status = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5014 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5015 |
dma += IGB_MAX_DATA_PER_TXD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5016 |
size -= IGB_MAX_DATA_PER_TXD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5017 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5018 |
tx_desc->read.buffer_addr = cpu_to_le64(dma); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5019 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5020 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5021 |
if (likely(!data_len)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5022 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5023 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5024 |
tx_desc->read.cmd_type_len = cpu_to_le32(cmd_type ^ size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5025 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5026 |
i++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5027 |
tx_desc++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5028 |
if (i == tx_ring->count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5029 |
tx_desc = IGB_TX_DESC(tx_ring, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5030 |
i = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5031 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5032 |
tx_desc->read.olinfo_status = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5033 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5034 |
size = skb_frag_size(frag); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5035 |
data_len -= size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5036 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5037 |
dma = skb_frag_dma_map(tx_ring->dev, frag, 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5038 |
size, DMA_TO_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5039 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5040 |
tx_buffer = &tx_ring->tx_buffer_info[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5041 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5042 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5043 |
/* write last descriptor with RS and EOP bits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5044 |
cmd_type |= size | IGB_TXD_DCMD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5045 |
tx_desc->read.cmd_type_len = cpu_to_le32(cmd_type); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5046 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5047 |
netdev_tx_sent_queue(txring_txq(tx_ring), first->bytecount); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5048 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5049 |
/* set the timestamp */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5050 |
first->time_stamp = jiffies; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5051 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5052 |
/* Force memory writes to complete before letting h/w know there |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5053 |
* are new descriptors to fetch. (Only applicable for weak-ordered |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5054 |
* memory model archs, such as IA-64). |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5055 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5056 |
* We also need this memory barrier to make certain all of the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5057 |
* status bits have been updated before next_to_watch is written. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5058 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5059 |
wmb(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5060 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5061 |
/* set next_to_watch value indicating a packet is present */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5062 |
first->next_to_watch = tx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5063 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5064 |
i++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5065 |
if (i == tx_ring->count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5066 |
i = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5067 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5068 |
tx_ring->next_to_use = i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5069 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5070 |
/* Make sure there is space in the ring for the next send. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5071 |
igb_maybe_stop_tx(tx_ring, DESC_NEEDED); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5072 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5073 |
if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5074 |
writel(i, tx_ring->tail); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5075 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5076 |
/* we need this if more than one processor can write to our tail |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5077 |
* at a time, it synchronizes IO on IA64/Altix systems |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5078 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5079 |
mmiowb(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5080 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5081 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5082 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5083 |
dma_error: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5084 |
dev_err(tx_ring->dev, "TX DMA map failed\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5085 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5086 |
/* clear dma mappings for failed tx_buffer_info map */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5087 |
for (;;) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5088 |
tx_buffer = &tx_ring->tx_buffer_info[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5089 |
igb_unmap_and_free_tx_resource(tx_ring, tx_buffer); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5090 |
if (tx_buffer == first) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5091 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5092 |
if (i == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5093 |
i = tx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5094 |
i--; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5095 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5096 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5097 |
tx_ring->next_to_use = i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5098 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5099 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5100 |
netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5101 |
struct igb_ring *tx_ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5102 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5103 |
struct igb_tx_buffer *first; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5104 |
int tso; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5105 |
u32 tx_flags = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5106 |
u16 count = TXD_USE_COUNT(skb_headlen(skb)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5107 |
__be16 protocol = vlan_get_protocol(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5108 |
u8 hdr_len = 0; |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5109 |
struct igb_adapter *adapter = netdev_priv(tx_ring->netdev); |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5110 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5111 |
/* need: 1 descriptor per page * PAGE_SIZE/IGB_MAX_DATA_PER_TXD, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5112 |
* + 1 desc for skb_headlen/IGB_MAX_DATA_PER_TXD, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5113 |
* + 2 desc gap to keep tail from touching head, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5114 |
* + 1 desc for context descriptor, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5115 |
* otherwise try next time |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5116 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5117 |
if (NETDEV_FRAG_PAGE_MAX_SIZE > IGB_MAX_DATA_PER_TXD) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5118 |
unsigned short f; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5119 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5120 |
for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5121 |
count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5122 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5123 |
count += skb_shinfo(skb)->nr_frags; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5124 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5125 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5126 |
if (igb_maybe_stop_tx(tx_ring, count + 3)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5127 |
/* this is a hard error */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5128 |
return NETDEV_TX_BUSY; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5129 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5130 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5131 |
/* record the location of the first descriptor for this packet */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5132 |
first = &tx_ring->tx_buffer_info[tx_ring->next_to_use]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5133 |
first->skb = skb; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5134 |
first->bytecount = skb->len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5135 |
first->gso_segs = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5136 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5137 |
if (unlikely(!adapter->ecdev && |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5138 |
(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))) { |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5139 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5140 |
if (!test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5141 |
&adapter->state)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5142 |
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5143 |
tx_flags |= IGB_TX_FLAGS_TSTAMP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5144 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5145 |
adapter->ptp_tx_skb = skb_get(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5146 |
adapter->ptp_tx_start = jiffies; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5147 |
if (adapter->hw.mac.type == e1000_82576) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5148 |
schedule_work(&adapter->ptp_tx_work); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5149 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5150 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5151 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5152 |
skb_tx_timestamp(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5153 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5154 |
if (vlan_tx_tag_present(skb)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5155 |
tx_flags |= IGB_TX_FLAGS_VLAN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5156 |
tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5157 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5158 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5159 |
/* record initial flags and protocol */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5160 |
first->tx_flags = tx_flags; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5161 |
first->protocol = protocol; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5162 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5163 |
tso = igb_tso(tx_ring, first, &hdr_len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5164 |
if (tso < 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5165 |
goto out_drop; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5166 |
else if (!tso) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5167 |
igb_tx_csum(tx_ring, first); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5168 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5169 |
igb_tx_map(tx_ring, first, hdr_len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5170 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5171 |
return NETDEV_TX_OK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5172 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5173 |
out_drop: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5174 |
igb_unmap_and_free_tx_resource(tx_ring, first); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5175 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5176 |
return NETDEV_TX_OK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5177 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5178 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5179 |
static inline struct igb_ring *igb_tx_queue_mapping(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5180 |
struct sk_buff *skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5181 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5182 |
unsigned int r_idx = skb->queue_mapping; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5183 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5184 |
if (r_idx >= adapter->num_tx_queues) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5185 |
r_idx = r_idx % adapter->num_tx_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5186 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5187 |
return adapter->tx_ring[r_idx]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5188 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5189 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5190 |
static netdev_tx_t igb_xmit_frame(struct sk_buff *skb, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5191 |
struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5192 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5193 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5194 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5195 |
if (test_bit(__IGB_DOWN, &adapter->state)) { |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5196 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5197 |
dev_kfree_skb_any(skb); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5198 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5199 |
return NETDEV_TX_OK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5200 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5201 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5202 |
if (skb->len <= 0) { |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5203 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5204 |
dev_kfree_skb_any(skb); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
5205 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5206 |
return NETDEV_TX_OK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5207 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5208 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5209 |
/* The minimum packet size with TCTL.PSP set is 17 so pad the skb |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5210 |
* in order to meet this minimum size requirement. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5211 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5212 |
if (unlikely(skb->len < 17)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5213 |
if (skb_pad(skb, 17 - skb->len)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5214 |
return NETDEV_TX_OK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5215 |
skb->len = 17; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5216 |
skb_set_tail_pointer(skb, 17); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5217 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5218 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5219 |
return igb_xmit_frame_ring(skb, igb_tx_queue_mapping(adapter, skb)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5220 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5221 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5222 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5223 |
* igb_tx_timeout - Respond to a Tx Hang |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5224 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5225 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5226 |
static void igb_tx_timeout(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5227 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5228 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5229 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5230 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5231 |
/* Do the reset outside of interrupt context */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5232 |
adapter->tx_timeout_count++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5233 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5234 |
if (hw->mac.type >= e1000_82580) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5235 |
hw->dev_spec._82575.global_device_reset = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5236 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5237 |
schedule_work(&adapter->reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5238 |
wr32(E1000_EICS, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5239 |
(adapter->eims_enable_mask & ~adapter->eims_other)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5240 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5241 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5242 |
static void igb_reset_task(struct work_struct *work) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5243 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5244 |
struct igb_adapter *adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5245 |
adapter = container_of(work, struct igb_adapter, reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5246 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5247 |
igb_dump(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5248 |
netdev_err(adapter->netdev, "Reset adapter\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5249 |
igb_reinit_locked(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5250 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5251 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5252 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5253 |
* igb_get_stats64 - Get System Network Statistics |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5254 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5255 |
* @stats: rtnl_link_stats64 pointer |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5256 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5257 |
static struct rtnl_link_stats64 *igb_get_stats64(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5258 |
struct rtnl_link_stats64 *stats) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5259 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5260 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5261 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5262 |
spin_lock(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5263 |
igb_update_stats(adapter, &adapter->stats64); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5264 |
memcpy(stats, &adapter->stats64, sizeof(*stats)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5265 |
spin_unlock(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5266 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5267 |
return stats; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5268 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5269 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5270 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5271 |
* igb_change_mtu - Change the Maximum Transfer Unit |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5272 |
* @netdev: network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5273 |
* @new_mtu: new value for maximum frame size |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5274 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5275 |
* Returns 0 on success, negative on failure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5276 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5277 |
static int igb_change_mtu(struct net_device *netdev, int new_mtu) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5278 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5279 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5280 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5281 |
int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5282 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5283 |
if ((new_mtu < 68) || (max_frame > MAX_JUMBO_FRAME_SIZE)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5284 |
dev_err(&pdev->dev, "Invalid MTU setting\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5285 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5286 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5287 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5288 |
#define MAX_STD_JUMBO_FRAME_SIZE 9238 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5289 |
if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5290 |
dev_err(&pdev->dev, "MTU > 9216 not supported.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5291 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5292 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5293 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5294 |
/* adjust max frame to be at least the size of a standard frame */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5295 |
if (max_frame < (ETH_FRAME_LEN + ETH_FCS_LEN)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5296 |
max_frame = ETH_FRAME_LEN + ETH_FCS_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5297 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5298 |
while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5299 |
usleep_range(1000, 2000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5300 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5301 |
/* igb_down has a dependency on max_frame_size */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5302 |
adapter->max_frame_size = max_frame; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5303 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5304 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5305 |
igb_down(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5306 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5307 |
dev_info(&pdev->dev, "changing MTU from %d to %d\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5308 |
netdev->mtu, new_mtu); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5309 |
netdev->mtu = new_mtu; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5310 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5311 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5312 |
igb_up(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5313 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5314 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5315 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5316 |
clear_bit(__IGB_RESETTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5317 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5318 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5319 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5320 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5321 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5322 |
* igb_update_stats - Update the board statistics counters |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5323 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5324 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5325 |
void igb_update_stats(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5326 |
struct rtnl_link_stats64 *net_stats) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5327 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5328 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5329 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5330 |
u32 reg, mpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5331 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5332 |
u64 bytes, packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5333 |
unsigned int start; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5334 |
u64 _bytes, _packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5335 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5336 |
/* Prevent stats update while adapter is being reset, or if the pci |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5337 |
* connection is down. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5338 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5339 |
if (adapter->link_speed == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5340 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5341 |
if (pci_channel_offline(pdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5342 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5343 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5344 |
bytes = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5345 |
packets = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5346 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5347 |
rcu_read_lock(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5348 |
for (i = 0; i < adapter->num_rx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5349 |
struct igb_ring *ring = adapter->rx_ring[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5350 |
u32 rqdpc = rd32(E1000_RQDPC(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5351 |
if (hw->mac.type >= e1000_i210) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5352 |
wr32(E1000_RQDPC(i), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5353 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5354 |
if (rqdpc) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5355 |
ring->rx_stats.drops += rqdpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5356 |
net_stats->rx_fifo_errors += rqdpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5357 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5358 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5359 |
do { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5360 |
start = u64_stats_fetch_begin_irq(&ring->rx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5361 |
_bytes = ring->rx_stats.bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5362 |
_packets = ring->rx_stats.packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5363 |
} while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5364 |
bytes += _bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5365 |
packets += _packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5366 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5367 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5368 |
net_stats->rx_bytes = bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5369 |
net_stats->rx_packets = packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5370 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5371 |
bytes = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5372 |
packets = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5373 |
for (i = 0; i < adapter->num_tx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5374 |
struct igb_ring *ring = adapter->tx_ring[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5375 |
do { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5376 |
start = u64_stats_fetch_begin_irq(&ring->tx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5377 |
_bytes = ring->tx_stats.bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5378 |
_packets = ring->tx_stats.packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5379 |
} while (u64_stats_fetch_retry_irq(&ring->tx_syncp, start)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5380 |
bytes += _bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5381 |
packets += _packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5382 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5383 |
net_stats->tx_bytes = bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5384 |
net_stats->tx_packets = packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5385 |
rcu_read_unlock(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5386 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5387 |
/* read stats registers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5388 |
adapter->stats.crcerrs += rd32(E1000_CRCERRS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5389 |
adapter->stats.gprc += rd32(E1000_GPRC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5390 |
adapter->stats.gorc += rd32(E1000_GORCL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5391 |
rd32(E1000_GORCH); /* clear GORCL */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5392 |
adapter->stats.bprc += rd32(E1000_BPRC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5393 |
adapter->stats.mprc += rd32(E1000_MPRC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5394 |
adapter->stats.roc += rd32(E1000_ROC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5395 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5396 |
adapter->stats.prc64 += rd32(E1000_PRC64); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5397 |
adapter->stats.prc127 += rd32(E1000_PRC127); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5398 |
adapter->stats.prc255 += rd32(E1000_PRC255); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5399 |
adapter->stats.prc511 += rd32(E1000_PRC511); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5400 |
adapter->stats.prc1023 += rd32(E1000_PRC1023); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5401 |
adapter->stats.prc1522 += rd32(E1000_PRC1522); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5402 |
adapter->stats.symerrs += rd32(E1000_SYMERRS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5403 |
adapter->stats.sec += rd32(E1000_SEC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5404 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5405 |
mpc = rd32(E1000_MPC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5406 |
adapter->stats.mpc += mpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5407 |
net_stats->rx_fifo_errors += mpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5408 |
adapter->stats.scc += rd32(E1000_SCC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5409 |
adapter->stats.ecol += rd32(E1000_ECOL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5410 |
adapter->stats.mcc += rd32(E1000_MCC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5411 |
adapter->stats.latecol += rd32(E1000_LATECOL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5412 |
adapter->stats.dc += rd32(E1000_DC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5413 |
adapter->stats.rlec += rd32(E1000_RLEC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5414 |
adapter->stats.xonrxc += rd32(E1000_XONRXC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5415 |
adapter->stats.xontxc += rd32(E1000_XONTXC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5416 |
adapter->stats.xoffrxc += rd32(E1000_XOFFRXC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5417 |
adapter->stats.xofftxc += rd32(E1000_XOFFTXC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5418 |
adapter->stats.fcruc += rd32(E1000_FCRUC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5419 |
adapter->stats.gptc += rd32(E1000_GPTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5420 |
adapter->stats.gotc += rd32(E1000_GOTCL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5421 |
rd32(E1000_GOTCH); /* clear GOTCL */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5422 |
adapter->stats.rnbc += rd32(E1000_RNBC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5423 |
adapter->stats.ruc += rd32(E1000_RUC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5424 |
adapter->stats.rfc += rd32(E1000_RFC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5425 |
adapter->stats.rjc += rd32(E1000_RJC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5426 |
adapter->stats.tor += rd32(E1000_TORH); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5427 |
adapter->stats.tot += rd32(E1000_TOTH); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5428 |
adapter->stats.tpr += rd32(E1000_TPR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5429 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5430 |
adapter->stats.ptc64 += rd32(E1000_PTC64); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5431 |
adapter->stats.ptc127 += rd32(E1000_PTC127); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5432 |
adapter->stats.ptc255 += rd32(E1000_PTC255); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5433 |
adapter->stats.ptc511 += rd32(E1000_PTC511); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5434 |
adapter->stats.ptc1023 += rd32(E1000_PTC1023); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5435 |
adapter->stats.ptc1522 += rd32(E1000_PTC1522); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5436 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5437 |
adapter->stats.mptc += rd32(E1000_MPTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5438 |
adapter->stats.bptc += rd32(E1000_BPTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5439 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5440 |
adapter->stats.tpt += rd32(E1000_TPT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5441 |
adapter->stats.colc += rd32(E1000_COLC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5442 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5443 |
adapter->stats.algnerrc += rd32(E1000_ALGNERRC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5444 |
/* read internal phy specific stats */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5445 |
reg = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5446 |
if (!(reg & E1000_CTRL_EXT_LINK_MODE_MASK)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5447 |
adapter->stats.rxerrc += rd32(E1000_RXERRC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5448 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5449 |
/* this stat has invalid values on i210/i211 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5450 |
if ((hw->mac.type != e1000_i210) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5451 |
(hw->mac.type != e1000_i211)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5452 |
adapter->stats.tncrs += rd32(E1000_TNCRS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5453 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5454 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5455 |
adapter->stats.tsctc += rd32(E1000_TSCTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5456 |
adapter->stats.tsctfc += rd32(E1000_TSCTFC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5457 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5458 |
adapter->stats.iac += rd32(E1000_IAC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5459 |
adapter->stats.icrxoc += rd32(E1000_ICRXOC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5460 |
adapter->stats.icrxptc += rd32(E1000_ICRXPTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5461 |
adapter->stats.icrxatc += rd32(E1000_ICRXATC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5462 |
adapter->stats.ictxptc += rd32(E1000_ICTXPTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5463 |
adapter->stats.ictxatc += rd32(E1000_ICTXATC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5464 |
adapter->stats.ictxqec += rd32(E1000_ICTXQEC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5465 |
adapter->stats.ictxqmtc += rd32(E1000_ICTXQMTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5466 |
adapter->stats.icrxdmtc += rd32(E1000_ICRXDMTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5467 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5468 |
/* Fill out the OS statistics structure */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5469 |
net_stats->multicast = adapter->stats.mprc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5470 |
net_stats->collisions = adapter->stats.colc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5471 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5472 |
/* Rx Errors */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5473 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5474 |
/* RLEC on some newer hardware can be incorrect so build |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5475 |
* our own version based on RUC and ROC |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5476 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5477 |
net_stats->rx_errors = adapter->stats.rxerrc + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5478 |
adapter->stats.crcerrs + adapter->stats.algnerrc + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5479 |
adapter->stats.ruc + adapter->stats.roc + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5480 |
adapter->stats.cexterr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5481 |
net_stats->rx_length_errors = adapter->stats.ruc + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5482 |
adapter->stats.roc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5483 |
net_stats->rx_crc_errors = adapter->stats.crcerrs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5484 |
net_stats->rx_frame_errors = adapter->stats.algnerrc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5485 |
net_stats->rx_missed_errors = adapter->stats.mpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5486 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5487 |
/* Tx Errors */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5488 |
net_stats->tx_errors = adapter->stats.ecol + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5489 |
adapter->stats.latecol; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5490 |
net_stats->tx_aborted_errors = adapter->stats.ecol; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5491 |
net_stats->tx_window_errors = adapter->stats.latecol; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5492 |
net_stats->tx_carrier_errors = adapter->stats.tncrs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5493 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5494 |
/* Tx Dropped needs to be maintained elsewhere */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5495 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5496 |
/* Management Stats */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5497 |
adapter->stats.mgptc += rd32(E1000_MGTPTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5498 |
adapter->stats.mgprc += rd32(E1000_MGTPRC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5499 |
adapter->stats.mgpdc += rd32(E1000_MGTPDC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5500 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5501 |
/* OS2BMC Stats */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5502 |
reg = rd32(E1000_MANC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5503 |
if (reg & E1000_MANC_EN_BMC2OS) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5504 |
adapter->stats.o2bgptc += rd32(E1000_O2BGPTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5505 |
adapter->stats.o2bspc += rd32(E1000_O2BSPC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5506 |
adapter->stats.b2ospc += rd32(E1000_B2OSPC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5507 |
adapter->stats.b2ogprc += rd32(E1000_B2OGPRC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5508 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5509 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5510 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5511 |
static irqreturn_t igb_msix_other(int irq, void *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5512 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5513 |
struct igb_adapter *adapter = data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5514 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5515 |
u32 icr = rd32(E1000_ICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5516 |
/* reading ICR causes bit 31 of EICR to be cleared */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5517 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5518 |
if (icr & E1000_ICR_DRSTA) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5519 |
schedule_work(&adapter->reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5520 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5521 |
if (icr & E1000_ICR_DOUTSYNC) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5522 |
/* HW is reporting DMA is out of sync */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5523 |
adapter->stats.doosync++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5524 |
/* The DMA Out of Sync is also indication of a spoof event |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5525 |
* in IOV mode. Check the Wrong VM Behavior register to |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5526 |
* see if it is really a spoof event. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5527 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5528 |
igb_check_wvbr(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5529 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5530 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5531 |
/* Check for a mailbox event */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5532 |
if (icr & E1000_ICR_VMMB) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5533 |
igb_msg_task(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5534 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5535 |
if (icr & E1000_ICR_LSC) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5536 |
hw->mac.get_link_status = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5537 |
/* guard against interrupt when we're going down */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5538 |
if (!test_bit(__IGB_DOWN, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5539 |
mod_timer(&adapter->watchdog_timer, jiffies + 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5540 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5541 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5542 |
if (icr & E1000_ICR_TS) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5543 |
u32 tsicr = rd32(E1000_TSICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5544 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5545 |
if (tsicr & E1000_TSICR_TXTS) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5546 |
/* acknowledge the interrupt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5547 |
wr32(E1000_TSICR, E1000_TSICR_TXTS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5548 |
/* retrieve hardware timestamp */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5549 |
schedule_work(&adapter->ptp_tx_work); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5550 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5551 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5552 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5553 |
wr32(E1000_EIMS, adapter->eims_other); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5554 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5555 |
return IRQ_HANDLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5556 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5557 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5558 |
static void igb_write_itr(struct igb_q_vector *q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5559 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5560 |
struct igb_adapter *adapter = q_vector->adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5561 |
u32 itr_val = q_vector->itr_val & 0x7FFC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5562 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5563 |
if (!q_vector->set_itr) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5564 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5565 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5566 |
if (!itr_val) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5567 |
itr_val = 0x4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5568 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5569 |
if (adapter->hw.mac.type == e1000_82575) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5570 |
itr_val |= itr_val << 16; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5571 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5572 |
itr_val |= E1000_EITR_CNT_IGNR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5573 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5574 |
writel(itr_val, q_vector->itr_register); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5575 |
q_vector->set_itr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5576 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5577 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5578 |
static irqreturn_t igb_msix_ring(int irq, void *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5579 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5580 |
struct igb_q_vector *q_vector = data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5581 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5582 |
/* Write the ITR value calculated from the previous interrupt. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5583 |
igb_write_itr(q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5584 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5585 |
napi_schedule(&q_vector->napi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5586 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5587 |
return IRQ_HANDLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5588 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5589 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5590 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5591 |
static void igb_update_tx_dca(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5592 |
struct igb_ring *tx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5593 |
int cpu) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5594 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5595 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5596 |
u32 txctrl = dca3_get_tag(tx_ring->dev, cpu); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5597 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5598 |
if (hw->mac.type != e1000_82575) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5599 |
txctrl <<= E1000_DCA_TXCTRL_CPUID_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5600 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5601 |
/* We can enable relaxed ordering for reads, but not writes when |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5602 |
* DCA is enabled. This is due to a known issue in some chipsets |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5603 |
* which will cause the DCA tag to be cleared. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5604 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5605 |
txctrl |= E1000_DCA_TXCTRL_DESC_RRO_EN | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5606 |
E1000_DCA_TXCTRL_DATA_RRO_EN | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5607 |
E1000_DCA_TXCTRL_DESC_DCA_EN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5608 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5609 |
wr32(E1000_DCA_TXCTRL(tx_ring->reg_idx), txctrl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5610 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5611 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5612 |
static void igb_update_rx_dca(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5613 |
struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5614 |
int cpu) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5615 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5616 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5617 |
u32 rxctrl = dca3_get_tag(&adapter->pdev->dev, cpu); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5618 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5619 |
if (hw->mac.type != e1000_82575) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5620 |
rxctrl <<= E1000_DCA_RXCTRL_CPUID_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5621 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5622 |
/* We can enable relaxed ordering for reads, but not writes when |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5623 |
* DCA is enabled. This is due to a known issue in some chipsets |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5624 |
* which will cause the DCA tag to be cleared. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5625 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5626 |
rxctrl |= E1000_DCA_RXCTRL_DESC_RRO_EN | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5627 |
E1000_DCA_RXCTRL_DESC_DCA_EN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5628 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5629 |
wr32(E1000_DCA_RXCTRL(rx_ring->reg_idx), rxctrl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5630 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5631 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5632 |
static void igb_update_dca(struct igb_q_vector *q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5633 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5634 |
struct igb_adapter *adapter = q_vector->adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5635 |
int cpu = get_cpu(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5636 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5637 |
if (q_vector->cpu == cpu) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5638 |
goto out_no_update; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5639 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5640 |
if (q_vector->tx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5641 |
igb_update_tx_dca(adapter, q_vector->tx.ring, cpu); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5642 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5643 |
if (q_vector->rx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5644 |
igb_update_rx_dca(adapter, q_vector->rx.ring, cpu); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5645 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5646 |
q_vector->cpu = cpu; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5647 |
out_no_update: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5648 |
put_cpu(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5649 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5650 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5651 |
static void igb_setup_dca(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5652 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5653 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5654 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5655 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5656 |
if (!(adapter->flags & IGB_FLAG_DCA_ENABLED)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5657 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5658 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5659 |
/* Always use CB2 mode, difference is masked in the CB driver. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5660 |
wr32(E1000_DCA_CTRL, E1000_DCA_CTRL_DCA_MODE_CB2); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5661 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5662 |
for (i = 0; i < adapter->num_q_vectors; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5663 |
adapter->q_vector[i]->cpu = -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5664 |
igb_update_dca(adapter->q_vector[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5665 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5666 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5667 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5668 |
static int __igb_notify_dca(struct device *dev, void *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5669 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5670 |
struct net_device *netdev = dev_get_drvdata(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5671 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5672 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5673 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5674 |
unsigned long event = *(unsigned long *)data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5675 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5676 |
switch (event) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5677 |
case DCA_PROVIDER_ADD: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5678 |
/* if already enabled, don't do it again */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5679 |
if (adapter->flags & IGB_FLAG_DCA_ENABLED) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5680 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5681 |
if (dca_add_requester(dev) == 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5682 |
adapter->flags |= IGB_FLAG_DCA_ENABLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5683 |
dev_info(&pdev->dev, "DCA enabled\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5684 |
igb_setup_dca(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5685 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5686 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5687 |
/* Fall Through since DCA is disabled. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5688 |
case DCA_PROVIDER_REMOVE: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5689 |
if (adapter->flags & IGB_FLAG_DCA_ENABLED) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5690 |
/* without this a class_device is left |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5691 |
* hanging around in the sysfs model |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5692 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5693 |
dca_remove_requester(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5694 |
dev_info(&pdev->dev, "DCA disabled\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5695 |
adapter->flags &= ~IGB_FLAG_DCA_ENABLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5696 |
wr32(E1000_DCA_CTRL, E1000_DCA_CTRL_DCA_MODE_DISABLE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5697 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5698 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5699 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5700 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5701 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5702 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5703 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5704 |
static int igb_notify_dca(struct notifier_block *nb, unsigned long event, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5705 |
void *p) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5706 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5707 |
int ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5708 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5709 |
ret_val = driver_for_each_device(&igb_driver.driver, NULL, &event, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5710 |
__igb_notify_dca); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5711 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5712 |
return ret_val ? NOTIFY_BAD : NOTIFY_DONE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5713 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5714 |
#endif /* CONFIG_IGB_DCA */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5715 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5716 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5717 |
static int igb_vf_configure(struct igb_adapter *adapter, int vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5718 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5719 |
unsigned char mac_addr[ETH_ALEN]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5720 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5721 |
eth_zero_addr(mac_addr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5722 |
igb_set_vf_mac(adapter, vf, mac_addr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5723 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5724 |
/* By default spoof check is enabled for all VFs */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5725 |
adapter->vf_data[vf].spoofchk_enabled = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5726 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5727 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5728 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5729 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5730 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5731 |
static void igb_ping_all_vfs(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5732 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5733 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5734 |
u32 ping; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5735 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5736 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5737 |
for (i = 0 ; i < adapter->vfs_allocated_count; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5738 |
ping = E1000_PF_CONTROL_MSG; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5739 |
if (adapter->vf_data[i].flags & IGB_VF_FLAG_CTS) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5740 |
ping |= E1000_VT_MSGTYPE_CTS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5741 |
igb_write_mbx(hw, &ping, 1, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5742 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5743 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5744 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5745 |
static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5746 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5747 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5748 |
u32 vmolr = rd32(E1000_VMOLR(vf)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5749 |
struct vf_data_storage *vf_data = &adapter->vf_data[vf]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5750 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5751 |
vf_data->flags &= ~(IGB_VF_FLAG_UNI_PROMISC | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5752 |
IGB_VF_FLAG_MULTI_PROMISC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5753 |
vmolr &= ~(E1000_VMOLR_ROPE | E1000_VMOLR_ROMPE | E1000_VMOLR_MPME); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5754 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5755 |
if (*msgbuf & E1000_VF_SET_PROMISC_MULTICAST) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5756 |
vmolr |= E1000_VMOLR_MPME; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5757 |
vf_data->flags |= IGB_VF_FLAG_MULTI_PROMISC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5758 |
*msgbuf &= ~E1000_VF_SET_PROMISC_MULTICAST; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5759 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5760 |
/* if we have hashes and we are clearing a multicast promisc |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5761 |
* flag we need to write the hashes to the MTA as this step |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5762 |
* was previously skipped |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5763 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5764 |
if (vf_data->num_vf_mc_hashes > 30) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5765 |
vmolr |= E1000_VMOLR_MPME; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5766 |
} else if (vf_data->num_vf_mc_hashes) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5767 |
int j; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5768 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5769 |
vmolr |= E1000_VMOLR_ROMPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5770 |
for (j = 0; j < vf_data->num_vf_mc_hashes; j++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5771 |
igb_mta_set(hw, vf_data->vf_mc_hashes[j]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5772 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5773 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5774 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5775 |
wr32(E1000_VMOLR(vf), vmolr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5776 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5777 |
/* there are flags left unprocessed, likely not supported */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5778 |
if (*msgbuf & E1000_VT_MSGINFO_MASK) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5779 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5780 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5781 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5782 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5783 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5784 |
static int igb_set_vf_multicasts(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5785 |
u32 *msgbuf, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5786 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5787 |
int n = (msgbuf[0] & E1000_VT_MSGINFO_MASK) >> E1000_VT_MSGINFO_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5788 |
u16 *hash_list = (u16 *)&msgbuf[1]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5789 |
struct vf_data_storage *vf_data = &adapter->vf_data[vf]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5790 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5791 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5792 |
/* salt away the number of multicast addresses assigned |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5793 |
* to this VF for later use to restore when the PF multi cast |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5794 |
* list changes |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5795 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5796 |
vf_data->num_vf_mc_hashes = n; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5797 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5798 |
/* only up to 30 hash values supported */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5799 |
if (n > 30) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5800 |
n = 30; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5801 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5802 |
/* store the hashes for later use */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5803 |
for (i = 0; i < n; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5804 |
vf_data->vf_mc_hashes[i] = hash_list[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5805 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5806 |
/* Flush and reset the mta with the new values */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5807 |
igb_set_rx_mode(adapter->netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5808 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5809 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5810 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5811 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5812 |
static void igb_restore_vf_multicasts(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5813 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5814 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5815 |
struct vf_data_storage *vf_data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5816 |
int i, j; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5817 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5818 |
for (i = 0; i < adapter->vfs_allocated_count; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5819 |
u32 vmolr = rd32(E1000_VMOLR(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5820 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5821 |
vmolr &= ~(E1000_VMOLR_ROMPE | E1000_VMOLR_MPME); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5822 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5823 |
vf_data = &adapter->vf_data[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5824 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5825 |
if ((vf_data->num_vf_mc_hashes > 30) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5826 |
(vf_data->flags & IGB_VF_FLAG_MULTI_PROMISC)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5827 |
vmolr |= E1000_VMOLR_MPME; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5828 |
} else if (vf_data->num_vf_mc_hashes) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5829 |
vmolr |= E1000_VMOLR_ROMPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5830 |
for (j = 0; j < vf_data->num_vf_mc_hashes; j++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5831 |
igb_mta_set(hw, vf_data->vf_mc_hashes[j]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5832 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5833 |
wr32(E1000_VMOLR(i), vmolr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5834 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5835 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5836 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5837 |
static void igb_clear_vf_vfta(struct igb_adapter *adapter, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5838 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5839 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5840 |
u32 pool_mask, reg, vid; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5841 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5842 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5843 |
pool_mask = 1 << (E1000_VLVF_POOLSEL_SHIFT + vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5844 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5845 |
/* Find the vlan filter for this id */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5846 |
for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5847 |
reg = rd32(E1000_VLVF(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5848 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5849 |
/* remove the vf from the pool */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5850 |
reg &= ~pool_mask; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5851 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5852 |
/* if pool is empty then remove entry from vfta */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5853 |
if (!(reg & E1000_VLVF_POOLSEL_MASK) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5854 |
(reg & E1000_VLVF_VLANID_ENABLE)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5855 |
reg = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5856 |
vid = reg & E1000_VLVF_VLANID_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5857 |
igb_vfta_set(hw, vid, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5858 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5859 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5860 |
wr32(E1000_VLVF(i), reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5861 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5862 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5863 |
adapter->vf_data[vf].vlans_enabled = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5864 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5865 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5866 |
static s32 igb_vlvf_set(struct igb_adapter *adapter, u32 vid, bool add, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5867 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5868 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5869 |
u32 reg, i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5870 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5871 |
/* The vlvf table only exists on 82576 hardware and newer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5872 |
if (hw->mac.type < e1000_82576) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5873 |
return -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5874 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5875 |
/* we only need to do this if VMDq is enabled */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5876 |
if (!adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5877 |
return -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5878 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5879 |
/* Find the vlan filter for this id */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5880 |
for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5881 |
reg = rd32(E1000_VLVF(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5882 |
if ((reg & E1000_VLVF_VLANID_ENABLE) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5883 |
vid == (reg & E1000_VLVF_VLANID_MASK)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5884 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5885 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5886 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5887 |
if (add) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5888 |
if (i == E1000_VLVF_ARRAY_SIZE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5889 |
/* Did not find a matching VLAN ID entry that was |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5890 |
* enabled. Search for a free filter entry, i.e. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5891 |
* one without the enable bit set |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5892 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5893 |
for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5894 |
reg = rd32(E1000_VLVF(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5895 |
if (!(reg & E1000_VLVF_VLANID_ENABLE)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5896 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5897 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5898 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5899 |
if (i < E1000_VLVF_ARRAY_SIZE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5900 |
/* Found an enabled/available entry */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5901 |
reg |= 1 << (E1000_VLVF_POOLSEL_SHIFT + vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5902 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5903 |
/* if !enabled we need to set this up in vfta */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5904 |
if (!(reg & E1000_VLVF_VLANID_ENABLE)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5905 |
/* add VID to filter table */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5906 |
igb_vfta_set(hw, vid, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5907 |
reg |= E1000_VLVF_VLANID_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5908 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5909 |
reg &= ~E1000_VLVF_VLANID_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5910 |
reg |= vid; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5911 |
wr32(E1000_VLVF(i), reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5912 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5913 |
/* do not modify RLPML for PF devices */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5914 |
if (vf >= adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5915 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5916 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5917 |
if (!adapter->vf_data[vf].vlans_enabled) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5918 |
u32 size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5919 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5920 |
reg = rd32(E1000_VMOLR(vf)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5921 |
size = reg & E1000_VMOLR_RLPML_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5922 |
size += 4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5923 |
reg &= ~E1000_VMOLR_RLPML_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5924 |
reg |= size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5925 |
wr32(E1000_VMOLR(vf), reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5926 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5927 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5928 |
adapter->vf_data[vf].vlans_enabled++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5929 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5930 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5931 |
if (i < E1000_VLVF_ARRAY_SIZE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5932 |
/* remove vf from the pool */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5933 |
reg &= ~(1 << (E1000_VLVF_POOLSEL_SHIFT + vf)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5934 |
/* if pool is empty then remove entry from vfta */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5935 |
if (!(reg & E1000_VLVF_POOLSEL_MASK)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5936 |
reg = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5937 |
igb_vfta_set(hw, vid, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5938 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5939 |
wr32(E1000_VLVF(i), reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5940 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5941 |
/* do not modify RLPML for PF devices */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5942 |
if (vf >= adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5943 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5944 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5945 |
adapter->vf_data[vf].vlans_enabled--; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5946 |
if (!adapter->vf_data[vf].vlans_enabled) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5947 |
u32 size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5948 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5949 |
reg = rd32(E1000_VMOLR(vf)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5950 |
size = reg & E1000_VMOLR_RLPML_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5951 |
size -= 4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5952 |
reg &= ~E1000_VMOLR_RLPML_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5953 |
reg |= size; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5954 |
wr32(E1000_VMOLR(vf), reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5955 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5956 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5957 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5958 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5959 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5960 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5961 |
static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5962 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5963 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5964 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5965 |
if (vid) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5966 |
wr32(E1000_VMVIR(vf), (vid | E1000_VMVIR_VLANA_DEFAULT)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5967 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5968 |
wr32(E1000_VMVIR(vf), 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5969 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5970 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5971 |
static int igb_ndo_set_vf_vlan(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5972 |
int vf, u16 vlan, u8 qos) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5973 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5974 |
int err = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5975 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5976 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5977 |
if ((vf >= adapter->vfs_allocated_count) || (vlan > 4095) || (qos > 7)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5978 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5979 |
if (vlan || qos) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5980 |
err = igb_vlvf_set(adapter, vlan, !!vlan, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5981 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5982 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5983 |
igb_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5984 |
igb_set_vmolr(adapter, vf, !vlan); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5985 |
adapter->vf_data[vf].pf_vlan = vlan; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5986 |
adapter->vf_data[vf].pf_qos = qos; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5987 |
dev_info(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5988 |
"Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5989 |
if (test_bit(__IGB_DOWN, &adapter->state)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5990 |
dev_warn(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5991 |
"The VF VLAN has been set, but the PF device is not up.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5992 |
dev_warn(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5993 |
"Bring the PF device up before attempting to use the VF device.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5994 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5995 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5996 |
igb_vlvf_set(adapter, adapter->vf_data[vf].pf_vlan, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5997 |
false, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5998 |
igb_set_vmvir(adapter, vlan, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5999 |
igb_set_vmolr(adapter, vf, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6000 |
adapter->vf_data[vf].pf_vlan = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6001 |
adapter->vf_data[vf].pf_qos = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6002 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6003 |
out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6004 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6005 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6006 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6007 |
static int igb_find_vlvf_entry(struct igb_adapter *adapter, int vid) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6008 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6009 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6010 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6011 |
u32 reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6012 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6013 |
/* Find the vlan filter for this id */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6014 |
for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6015 |
reg = rd32(E1000_VLVF(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6016 |
if ((reg & E1000_VLVF_VLANID_ENABLE) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6017 |
vid == (reg & E1000_VLVF_VLANID_MASK)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6018 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6019 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6020 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6021 |
if (i >= E1000_VLVF_ARRAY_SIZE) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6022 |
i = -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6023 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6024 |
return i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6025 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6026 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6027 |
static int igb_set_vf_vlan(struct igb_adapter *adapter, u32 *msgbuf, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6028 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6029 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6030 |
int add = (msgbuf[0] & E1000_VT_MSGINFO_MASK) >> E1000_VT_MSGINFO_SHIFT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6031 |
int vid = (msgbuf[1] & E1000_VLVF_VLANID_MASK); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6032 |
int err = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6033 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6034 |
/* If in promiscuous mode we need to make sure the PF also has |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6035 |
* the VLAN filter set. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6036 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6037 |
if (add && (adapter->netdev->flags & IFF_PROMISC)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6038 |
err = igb_vlvf_set(adapter, vid, add, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6039 |
adapter->vfs_allocated_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6040 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6041 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6042 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6043 |
err = igb_vlvf_set(adapter, vid, add, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6044 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6045 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6046 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6047 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6048 |
/* Go through all the checks to see if the VLAN filter should |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6049 |
* be wiped completely. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6050 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6051 |
if (!add && (adapter->netdev->flags & IFF_PROMISC)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6052 |
u32 vlvf, bits; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6053 |
int regndx = igb_find_vlvf_entry(adapter, vid); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6054 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6055 |
if (regndx < 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6056 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6057 |
/* See if any other pools are set for this VLAN filter |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6058 |
* entry other than the PF. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6059 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6060 |
vlvf = bits = rd32(E1000_VLVF(regndx)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6061 |
bits &= 1 << (E1000_VLVF_POOLSEL_SHIFT + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6062 |
adapter->vfs_allocated_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6063 |
/* If the filter was removed then ensure PF pool bit |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6064 |
* is cleared if the PF only added itself to the pool |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6065 |
* because the PF is in promiscuous mode. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6066 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6067 |
if ((vlvf & VLAN_VID_MASK) == vid && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6068 |
!test_bit(vid, adapter->active_vlans) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6069 |
!bits) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6070 |
igb_vlvf_set(adapter, vid, add, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6071 |
adapter->vfs_allocated_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6072 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6073 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6074 |
out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6075 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6076 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6077 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6078 |
static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6079 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6080 |
/* clear flags - except flag that indicates PF has set the MAC */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6081 |
adapter->vf_data[vf].flags &= IGB_VF_FLAG_PF_SET_MAC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6082 |
adapter->vf_data[vf].last_nack = jiffies; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6083 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6084 |
/* reset offloads to defaults */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6085 |
igb_set_vmolr(adapter, vf, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6086 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6087 |
/* reset vlans for device */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6088 |
igb_clear_vf_vfta(adapter, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6089 |
if (adapter->vf_data[vf].pf_vlan) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6090 |
igb_ndo_set_vf_vlan(adapter->netdev, vf, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6091 |
adapter->vf_data[vf].pf_vlan, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6092 |
adapter->vf_data[vf].pf_qos); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6093 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6094 |
igb_clear_vf_vfta(adapter, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6095 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6096 |
/* reset multicast table array for vf */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6097 |
adapter->vf_data[vf].num_vf_mc_hashes = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6098 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6099 |
/* Flush and reset the mta with the new values */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6100 |
igb_set_rx_mode(adapter->netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6101 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6102 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6103 |
static void igb_vf_reset_event(struct igb_adapter *adapter, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6104 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6105 |
unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6106 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6107 |
/* clear mac address as we were hotplug removed/added */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6108 |
if (!(adapter->vf_data[vf].flags & IGB_VF_FLAG_PF_SET_MAC)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6109 |
eth_zero_addr(vf_mac); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6110 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6111 |
/* process remaining reset events */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6112 |
igb_vf_reset(adapter, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6113 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6114 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6115 |
static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6116 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6117 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6118 |
unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6119 |
int rar_entry = hw->mac.rar_entry_count - (vf + 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6120 |
u32 reg, msgbuf[3]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6121 |
u8 *addr = (u8 *)(&msgbuf[1]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6122 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6123 |
/* process all the same items cleared in a function level reset */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6124 |
igb_vf_reset(adapter, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6125 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6126 |
/* set vf mac address */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6127 |
igb_rar_set_qsel(adapter, vf_mac, rar_entry, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6128 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6129 |
/* enable transmit and receive for vf */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6130 |
reg = rd32(E1000_VFTE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6131 |
wr32(E1000_VFTE, reg | (1 << vf)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6132 |
reg = rd32(E1000_VFRE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6133 |
wr32(E1000_VFRE, reg | (1 << vf)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6134 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6135 |
adapter->vf_data[vf].flags |= IGB_VF_FLAG_CTS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6136 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6137 |
/* reply to reset with ack and vf mac address */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6138 |
msgbuf[0] = E1000_VF_RESET | E1000_VT_MSGTYPE_ACK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6139 |
memcpy(addr, vf_mac, ETH_ALEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6140 |
igb_write_mbx(hw, msgbuf, 3, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6141 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6142 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6143 |
static int igb_set_vf_mac_addr(struct igb_adapter *adapter, u32 *msg, int vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6144 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6145 |
/* The VF MAC Address is stored in a packed array of bytes |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6146 |
* starting at the second 32 bit word of the msg array |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6147 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6148 |
unsigned char *addr = (char *)&msg[1]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6149 |
int err = -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6150 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6151 |
if (is_valid_ether_addr(addr)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6152 |
err = igb_set_vf_mac(adapter, vf, addr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6153 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6154 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6155 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6156 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6157 |
static void igb_rcv_ack_from_vf(struct igb_adapter *adapter, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6158 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6159 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6160 |
struct vf_data_storage *vf_data = &adapter->vf_data[vf]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6161 |
u32 msg = E1000_VT_MSGTYPE_NACK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6162 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6163 |
/* if device isn't clear to send it shouldn't be reading either */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6164 |
if (!(vf_data->flags & IGB_VF_FLAG_CTS) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6165 |
time_after(jiffies, vf_data->last_nack + (2 * HZ))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6166 |
igb_write_mbx(hw, &msg, 1, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6167 |
vf_data->last_nack = jiffies; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6168 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6169 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6170 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6171 |
static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6172 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6173 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6174 |
u32 msgbuf[E1000_VFMAILBOX_SIZE]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6175 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6176 |
struct vf_data_storage *vf_data = &adapter->vf_data[vf]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6177 |
s32 retval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6178 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6179 |
retval = igb_read_mbx(hw, msgbuf, E1000_VFMAILBOX_SIZE, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6180 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6181 |
if (retval) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6182 |
/* if receive failed revoke VF CTS stats and restart init */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6183 |
dev_err(&pdev->dev, "Error receiving message from VF\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6184 |
vf_data->flags &= ~IGB_VF_FLAG_CTS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6185 |
if (!time_after(jiffies, vf_data->last_nack + (2 * HZ))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6186 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6187 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6188 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6189 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6190 |
/* this is a message we already processed, do nothing */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6191 |
if (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6192 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6193 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6194 |
/* until the vf completes a reset it should not be |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6195 |
* allowed to start any configuration. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6196 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6197 |
if (msgbuf[0] == E1000_VF_RESET) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6198 |
igb_vf_reset_msg(adapter, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6199 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6200 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6201 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6202 |
if (!(vf_data->flags & IGB_VF_FLAG_CTS)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6203 |
if (!time_after(jiffies, vf_data->last_nack + (2 * HZ))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6204 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6205 |
retval = -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6206 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6207 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6208 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6209 |
switch ((msgbuf[0] & 0xFFFF)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6210 |
case E1000_VF_SET_MAC_ADDR: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6211 |
retval = -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6212 |
if (!(vf_data->flags & IGB_VF_FLAG_PF_SET_MAC)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6213 |
retval = igb_set_vf_mac_addr(adapter, msgbuf, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6214 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6215 |
dev_warn(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6216 |
"VF %d attempted to override administratively set MAC address\nReload the VF driver to resume operations\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6217 |
vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6218 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6219 |
case E1000_VF_SET_PROMISC: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6220 |
retval = igb_set_vf_promisc(adapter, msgbuf, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6221 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6222 |
case E1000_VF_SET_MULTICAST: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6223 |
retval = igb_set_vf_multicasts(adapter, msgbuf, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6224 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6225 |
case E1000_VF_SET_LPE: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6226 |
retval = igb_set_vf_rlpml(adapter, msgbuf[1], vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6227 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6228 |
case E1000_VF_SET_VLAN: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6229 |
retval = -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6230 |
if (vf_data->pf_vlan) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6231 |
dev_warn(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6232 |
"VF %d attempted to override administratively set VLAN tag\nReload the VF driver to resume operations\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6233 |
vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6234 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6235 |
retval = igb_set_vf_vlan(adapter, msgbuf, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6236 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6237 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6238 |
dev_err(&pdev->dev, "Unhandled Msg %08x\n", msgbuf[0]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6239 |
retval = -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6240 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6241 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6242 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6243 |
msgbuf[0] |= E1000_VT_MSGTYPE_CTS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6244 |
out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6245 |
/* notify the VF of the results of what it sent us */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6246 |
if (retval) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6247 |
msgbuf[0] |= E1000_VT_MSGTYPE_NACK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6248 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6249 |
msgbuf[0] |= E1000_VT_MSGTYPE_ACK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6250 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6251 |
igb_write_mbx(hw, msgbuf, 1, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6252 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6253 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6254 |
static void igb_msg_task(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6255 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6256 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6257 |
u32 vf; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6258 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6259 |
for (vf = 0; vf < adapter->vfs_allocated_count; vf++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6260 |
/* process any reset requests */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6261 |
if (!igb_check_for_rst(hw, vf)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6262 |
igb_vf_reset_event(adapter, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6263 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6264 |
/* process any messages pending */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6265 |
if (!igb_check_for_msg(hw, vf)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6266 |
igb_rcv_msg_from_vf(adapter, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6267 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6268 |
/* process any acks */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6269 |
if (!igb_check_for_ack(hw, vf)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6270 |
igb_rcv_ack_from_vf(adapter, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6271 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6272 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6273 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6274 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6275 |
* igb_set_uta - Set unicast filter table address |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6276 |
* @adapter: board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6277 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6278 |
* The unicast table address is a register array of 32-bit registers. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6279 |
* The table is meant to be used in a way similar to how the MTA is used |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6280 |
* however due to certain limitations in the hardware it is necessary to |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6281 |
* set all the hash bits to 1 and use the VMOLR ROPE bit as a promiscuous |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6282 |
* enable bit to allow vlan tag stripping when promiscuous mode is enabled |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6283 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6284 |
static void igb_set_uta(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6285 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6286 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6287 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6288 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6289 |
/* The UTA table only exists on 82576 hardware and newer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6290 |
if (hw->mac.type < e1000_82576) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6291 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6292 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6293 |
/* we only need to do this if VMDq is enabled */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6294 |
if (!adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6295 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6296 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6297 |
for (i = 0; i < hw->mac.uta_reg_count; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6298 |
array_wr32(E1000_UTA, i, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6299 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6300 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6301 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6302 |
* igb_intr_msi - Interrupt Handler |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6303 |
* @irq: interrupt number |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6304 |
* @data: pointer to a network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6305 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6306 |
static irqreturn_t igb_intr_msi(int irq, void *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6307 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6308 |
struct igb_adapter *adapter = data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6309 |
struct igb_q_vector *q_vector = adapter->q_vector[0]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6310 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6311 |
/* read ICR disables interrupts using IAM */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6312 |
u32 icr = rd32(E1000_ICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6313 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6314 |
igb_write_itr(q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6315 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6316 |
if (icr & E1000_ICR_DRSTA) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6317 |
schedule_work(&adapter->reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6318 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6319 |
if (icr & E1000_ICR_DOUTSYNC) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6320 |
/* HW is reporting DMA is out of sync */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6321 |
adapter->stats.doosync++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6322 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6323 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6324 |
if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6325 |
hw->mac.get_link_status = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6326 |
if (!test_bit(__IGB_DOWN, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6327 |
mod_timer(&adapter->watchdog_timer, jiffies + 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6328 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6329 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6330 |
if (icr & E1000_ICR_TS) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6331 |
u32 tsicr = rd32(E1000_TSICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6332 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6333 |
if (tsicr & E1000_TSICR_TXTS) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6334 |
/* acknowledge the interrupt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6335 |
wr32(E1000_TSICR, E1000_TSICR_TXTS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6336 |
/* retrieve hardware timestamp */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6337 |
schedule_work(&adapter->ptp_tx_work); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6338 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6339 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6340 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6341 |
napi_schedule(&q_vector->napi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6342 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6343 |
return IRQ_HANDLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6344 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6345 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6346 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6347 |
* igb_intr - Legacy Interrupt Handler |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6348 |
* @irq: interrupt number |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6349 |
* @data: pointer to a network interface device structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6350 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6351 |
static irqreturn_t igb_intr(int irq, void *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6352 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6353 |
struct igb_adapter *adapter = data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6354 |
struct igb_q_vector *q_vector = adapter->q_vector[0]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6355 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6356 |
/* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6357 |
* need for the IMC write |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6358 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6359 |
u32 icr = rd32(E1000_ICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6360 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6361 |
/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6362 |
* not set, then the adapter didn't send an interrupt |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6363 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6364 |
if (!(icr & E1000_ICR_INT_ASSERTED)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6365 |
return IRQ_NONE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6366 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6367 |
igb_write_itr(q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6368 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6369 |
if (icr & E1000_ICR_DRSTA) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6370 |
schedule_work(&adapter->reset_task); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6371 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6372 |
if (icr & E1000_ICR_DOUTSYNC) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6373 |
/* HW is reporting DMA is out of sync */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6374 |
adapter->stats.doosync++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6375 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6376 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6377 |
if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6378 |
hw->mac.get_link_status = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6379 |
/* guard against interrupt when we're going down */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6380 |
if (!test_bit(__IGB_DOWN, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6381 |
mod_timer(&adapter->watchdog_timer, jiffies + 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6382 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6383 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6384 |
if (icr & E1000_ICR_TS) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6385 |
u32 tsicr = rd32(E1000_TSICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6386 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6387 |
if (tsicr & E1000_TSICR_TXTS) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6388 |
/* acknowledge the interrupt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6389 |
wr32(E1000_TSICR, E1000_TSICR_TXTS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6390 |
/* retrieve hardware timestamp */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6391 |
schedule_work(&adapter->ptp_tx_work); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6392 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6393 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6394 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6395 |
napi_schedule(&q_vector->napi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6396 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6397 |
return IRQ_HANDLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6398 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6399 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6400 |
static void igb_ring_irq_enable(struct igb_q_vector *q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6401 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6402 |
struct igb_adapter *adapter = q_vector->adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6403 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6404 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6405 |
if ((q_vector->rx.ring && (adapter->rx_itr_setting & 3)) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6406 |
(!q_vector->rx.ring && (adapter->tx_itr_setting & 3))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6407 |
if ((adapter->num_q_vectors == 1) && !adapter->vf_data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6408 |
igb_set_itr(q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6409 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6410 |
igb_update_ring_itr(q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6411 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6412 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6413 |
if (!test_bit(__IGB_DOWN, &adapter->state)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6414 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6415 |
wr32(E1000_EIMS, q_vector->eims_value); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6416 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6417 |
igb_irq_enable(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6418 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6419 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6420 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6421 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6422 |
* igb_poll - NAPI Rx polling callback |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6423 |
* @napi: napi polling structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6424 |
* @budget: count of how many packets we should handle |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6425 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6426 |
static int igb_poll(struct napi_struct *napi, int budget) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6427 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6428 |
struct igb_q_vector *q_vector = container_of(napi, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6429 |
struct igb_q_vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6430 |
napi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6431 |
bool clean_complete = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6432 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6433 |
#ifdef CONFIG_IGB_DCA |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6434 |
if (q_vector->adapter->flags & IGB_FLAG_DCA_ENABLED) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6435 |
igb_update_dca(q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6436 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6437 |
if (q_vector->tx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6438 |
clean_complete = igb_clean_tx_irq(q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6439 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6440 |
if (q_vector->rx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6441 |
clean_complete &= igb_clean_rx_irq(q_vector, budget); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6442 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6443 |
/* If all work not completed, return budget and keep polling */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6444 |
if (!clean_complete) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6445 |
return budget; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6446 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6447 |
/* If not enough Rx work done, exit the polling mode */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6448 |
napi_complete(napi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6449 |
igb_ring_irq_enable(q_vector); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6450 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6451 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6452 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6453 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6454 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6455 |
* igb_clean_tx_irq - Reclaim resources after transmit completes |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6456 |
* @q_vector: pointer to q_vector containing needed info |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6457 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6458 |
* returns true if ring is completely cleaned |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6459 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6460 |
static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6461 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6462 |
struct igb_adapter *adapter = q_vector->adapter; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6463 |
struct igb_ring *tx_ring = q_vector->tx.ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6464 |
struct igb_tx_buffer *tx_buffer; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6465 |
union e1000_adv_tx_desc *tx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6466 |
unsigned int total_bytes = 0, total_packets = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6467 |
unsigned int budget = q_vector->tx.work_limit; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6468 |
unsigned int i = tx_ring->next_to_clean; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6469 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6470 |
if (test_bit(__IGB_DOWN, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6471 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6472 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6473 |
tx_buffer = &tx_ring->tx_buffer_info[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6474 |
tx_desc = IGB_TX_DESC(tx_ring, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6475 |
i -= tx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6476 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6477 |
do { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6478 |
union e1000_adv_tx_desc *eop_desc = tx_buffer->next_to_watch; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6479 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6480 |
/* if next_to_watch is not set then there is no work pending */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6481 |
if (!eop_desc) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6482 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6483 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6484 |
/* prevent any other reads prior to eop_desc */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6485 |
read_barrier_depends(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6486 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6487 |
/* if DD is not set pending work has not been completed */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6488 |
if (!(eop_desc->wb.status & cpu_to_le32(E1000_TXD_STAT_DD))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6489 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6490 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6491 |
/* clear next_to_watch to prevent false hangs */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6492 |
tx_buffer->next_to_watch = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6493 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6494 |
/* update the statistics for this packet */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6495 |
total_bytes += tx_buffer->bytecount; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6496 |
total_packets += tx_buffer->gso_segs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6497 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6498 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6499 |
/* free the skb */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6500 |
dev_consume_skb_any(tx_buffer->skb); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6501 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6502 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6503 |
/* unmap skb header data */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6504 |
dma_unmap_single(tx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6505 |
dma_unmap_addr(tx_buffer, dma), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6506 |
dma_unmap_len(tx_buffer, len), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6507 |
DMA_TO_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6508 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6509 |
/* clear tx_buffer data */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6510 |
tx_buffer->skb = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6511 |
dma_unmap_len_set(tx_buffer, len, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6512 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6513 |
/* clear last DMA location and unmap remaining buffers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6514 |
while (tx_desc != eop_desc) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6515 |
tx_buffer++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6516 |
tx_desc++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6517 |
i++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6518 |
if (unlikely(!i)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6519 |
i -= tx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6520 |
tx_buffer = tx_ring->tx_buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6521 |
tx_desc = IGB_TX_DESC(tx_ring, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6522 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6523 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6524 |
/* unmap any remaining paged data */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6525 |
if (dma_unmap_len(tx_buffer, len)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6526 |
dma_unmap_page(tx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6527 |
dma_unmap_addr(tx_buffer, dma), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6528 |
dma_unmap_len(tx_buffer, len), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6529 |
DMA_TO_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6530 |
dma_unmap_len_set(tx_buffer, len, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6531 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6532 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6533 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6534 |
/* move us one more past the eop_desc for start of next pkt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6535 |
tx_buffer++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6536 |
tx_desc++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6537 |
i++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6538 |
if (unlikely(!i)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6539 |
i -= tx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6540 |
tx_buffer = tx_ring->tx_buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6541 |
tx_desc = IGB_TX_DESC(tx_ring, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6542 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6543 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6544 |
/* issue prefetch for next Tx descriptor */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6545 |
prefetch(tx_desc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6546 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6547 |
/* update budget accounting */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6548 |
budget--; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6549 |
} while (likely(budget)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6550 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6551 |
if (!adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6552 |
netdev_tx_completed_queue(txring_txq(tx_ring), |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6553 |
total_packets, total_bytes); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6554 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6555 |
i += tx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6556 |
tx_ring->next_to_clean = i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6557 |
u64_stats_update_begin(&tx_ring->tx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6558 |
tx_ring->tx_stats.bytes += total_bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6559 |
tx_ring->tx_stats.packets += total_packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6560 |
u64_stats_update_end(&tx_ring->tx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6561 |
q_vector->tx.total_bytes += total_bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6562 |
q_vector->tx.total_packets += total_packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6563 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6564 |
if (!adapter->ecdev && |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6565 |
test_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags)) { |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6566 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6567 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6568 |
/* Detect a transmit hang in hardware, this serializes the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6569 |
* check with the clearing of time_stamp and movement of i |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6570 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6571 |
clear_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6572 |
if (tx_buffer->next_to_watch && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6573 |
time_after(jiffies, tx_buffer->time_stamp + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6574 |
(adapter->tx_timeout_factor * HZ)) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6575 |
!(rd32(E1000_STATUS) & E1000_STATUS_TXOFF)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6576 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6577 |
/* detected Tx unit hang */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6578 |
dev_err(tx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6579 |
"Detected Tx Unit Hang\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6580 |
" Tx Queue <%d>\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6581 |
" TDH <%x>\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6582 |
" TDT <%x>\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6583 |
" next_to_use <%x>\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6584 |
" next_to_clean <%x>\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6585 |
"buffer_info[next_to_clean]\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6586 |
" time_stamp <%lx>\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6587 |
" next_to_watch <%p>\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6588 |
" jiffies <%lx>\n" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6589 |
" desc.status <%x>\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6590 |
tx_ring->queue_index, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6591 |
rd32(E1000_TDH(tx_ring->reg_idx)), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6592 |
readl(tx_ring->tail), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6593 |
tx_ring->next_to_use, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6594 |
tx_ring->next_to_clean, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6595 |
tx_buffer->time_stamp, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6596 |
tx_buffer->next_to_watch, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6597 |
jiffies, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6598 |
tx_buffer->next_to_watch->wb.status); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6599 |
netif_stop_subqueue(tx_ring->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6600 |
tx_ring->queue_index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6601 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6602 |
/* we are about to reset, no point in enabling stuff */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6603 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6604 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6605 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6606 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6607 |
#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2) |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6608 |
if (unlikely(!adapter->ecdev && total_packets && |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6609 |
netif_carrier_ok(tx_ring->netdev) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6610 |
igb_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6611 |
/* Make sure that anybody stopping the queue after this |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6612 |
* sees the new next_to_clean. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6613 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6614 |
smp_mb(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6615 |
if (__netif_subqueue_stopped(tx_ring->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6616 |
tx_ring->queue_index) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6617 |
!(test_bit(__IGB_DOWN, &adapter->state))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6618 |
netif_wake_subqueue(tx_ring->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6619 |
tx_ring->queue_index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6620 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6621 |
u64_stats_update_begin(&tx_ring->tx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6622 |
tx_ring->tx_stats.restart_queue++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6623 |
u64_stats_update_end(&tx_ring->tx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6624 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6625 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6626 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6627 |
return !!budget; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6628 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6629 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6630 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6631 |
* igb_reuse_rx_page - page flip buffer and store it back on the ring |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6632 |
* @rx_ring: rx descriptor ring to store buffers on |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6633 |
* @old_buff: donor buffer to have page reused |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6634 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6635 |
* Synchronizes page for reuse by the adapter |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6636 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6637 |
static void igb_reuse_rx_page(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6638 |
struct igb_rx_buffer *old_buff) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6639 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6640 |
struct igb_rx_buffer *new_buff; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6641 |
u16 nta = rx_ring->next_to_alloc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6642 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6643 |
new_buff = &rx_ring->rx_buffer_info[nta]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6644 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6645 |
/* update, and store next to alloc */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6646 |
nta++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6647 |
rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6648 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6649 |
/* transfer page from old buffer to new buffer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6650 |
*new_buff = *old_buff; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6651 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6652 |
/* sync the buffer for use by the device */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6653 |
dma_sync_single_range_for_device(rx_ring->dev, old_buff->dma, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6654 |
old_buff->page_offset, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6655 |
IGB_RX_BUFSZ, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6656 |
DMA_FROM_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6657 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6658 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6659 |
static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6660 |
struct page *page, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6661 |
unsigned int truesize) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6662 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6663 |
/* avoid re-using remote pages */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6664 |
if (unlikely(page_to_nid(page) != numa_node_id())) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6665 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6666 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6667 |
if (unlikely(page->pfmemalloc)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6668 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6669 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6670 |
#if (PAGE_SIZE < 8192) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6671 |
/* if we are only owner of page we can reuse it */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6672 |
if (unlikely(page_count(page) != 1)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6673 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6674 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6675 |
/* flip page offset to other buffer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6676 |
rx_buffer->page_offset ^= IGB_RX_BUFSZ; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6677 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6678 |
/* Even if we own the page, we are not allowed to use atomic_set() |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6679 |
* This would break get_page_unless_zero() users. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6680 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6681 |
atomic_inc(&page->_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6682 |
#else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6683 |
/* move offset up to the next cache line */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6684 |
rx_buffer->page_offset += truesize; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6685 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6686 |
if (rx_buffer->page_offset > (PAGE_SIZE - IGB_RX_BUFSZ)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6687 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6688 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6689 |
/* bump ref count on page before it is given to the stack */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6690 |
get_page(page); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6691 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6692 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6693 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6694 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6695 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6696 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6697 |
* igb_add_rx_frag - Add contents of Rx buffer to sk_buff |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6698 |
* @rx_ring: rx descriptor ring to transact packets on |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6699 |
* @rx_buffer: buffer containing page to add |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6700 |
* @rx_desc: descriptor containing length of buffer written by hardware |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6701 |
* @skb: sk_buff to place the data into |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6702 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6703 |
* This function will add the data contained in rx_buffer->page to the skb. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6704 |
* This is done either through a direct copy if the data in the buffer is |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6705 |
* less than the skb header size, otherwise it will just attach the page as |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6706 |
* a frag to the skb. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6707 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6708 |
* The function will then update the page offset if necessary and return |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6709 |
* true if the buffer can be reused by the adapter. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6710 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6711 |
static bool igb_add_rx_frag(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6712 |
struct igb_rx_buffer *rx_buffer, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6713 |
union e1000_adv_rx_desc *rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6714 |
struct sk_buff *skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6715 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6716 |
struct page *page = rx_buffer->page; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6717 |
unsigned int size = le16_to_cpu(rx_desc->wb.upper.length); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6718 |
#if (PAGE_SIZE < 8192) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6719 |
unsigned int truesize = IGB_RX_BUFSZ; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6720 |
#else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6721 |
unsigned int truesize = ALIGN(size, L1_CACHE_BYTES); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6722 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6723 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6724 |
if ((size <= IGB_RX_HDR_LEN) && !skb_is_nonlinear(skb)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6725 |
unsigned char *va = page_address(page) + rx_buffer->page_offset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6726 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6727 |
if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6728 |
igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6729 |
va += IGB_TS_HDR_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6730 |
size -= IGB_TS_HDR_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6731 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6732 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6733 |
memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6734 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6735 |
/* we can reuse buffer as-is, just make sure it is local */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6736 |
if (likely((page_to_nid(page) == numa_node_id()) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6737 |
!page->pfmemalloc)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6738 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6739 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6740 |
/* this page cannot be reused so discard it */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6741 |
put_page(page); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6742 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6743 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6744 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6745 |
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6746 |
rx_buffer->page_offset, size, truesize); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6747 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6748 |
return igb_can_reuse_rx_page(rx_buffer, page, truesize); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6749 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6750 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6751 |
static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6752 |
union e1000_adv_rx_desc *rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6753 |
struct sk_buff *skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6754 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6755 |
struct igb_rx_buffer *rx_buffer; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6756 |
struct page *page; |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6757 |
struct igb_adapter *adapter = netdev_priv(rx_ring->netdev); |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6758 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6759 |
rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6760 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6761 |
page = rx_buffer->page; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6762 |
prefetchw(page); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6763 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6764 |
if (!adapter->ecdev && likely(!skb)) { |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6765 |
void *page_addr = page_address(page) + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6766 |
rx_buffer->page_offset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6767 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6768 |
/* prefetch first cache line of first page */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6769 |
prefetch(page_addr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6770 |
#if L1_CACHE_BYTES < 128 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6771 |
prefetch(page_addr + L1_CACHE_BYTES); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6772 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6773 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6774 |
/* allocate a skb to store the frags */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6775 |
skb = netdev_alloc_skb_ip_align(rx_ring->netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6776 |
IGB_RX_HDR_LEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6777 |
if (unlikely(!skb)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6778 |
rx_ring->rx_stats.alloc_failed++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6779 |
return NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6780 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6781 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6782 |
/* we will be copying header into skb->data in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6783 |
* pskb_may_pull so it is in our interest to prefetch |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6784 |
* it now to avoid a possible cache miss |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6785 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6786 |
prefetchw(skb->data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6787 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6788 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6789 |
/* we are reusing so sync this buffer for CPU use */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6790 |
dma_sync_single_range_for_cpu(rx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6791 |
rx_buffer->dma, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6792 |
rx_buffer->page_offset, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6793 |
IGB_RX_BUFSZ, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6794 |
DMA_FROM_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6795 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6796 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6797 |
unsigned char *va = |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6798 |
page_address(rx_buffer->page) + rx_buffer->page_offset; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6799 |
unsigned int size = le16_to_cpu(rx_desc->wb.upper.length); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6800 |
ecdev_receive(adapter->ecdev, va, size); |
2723
37d89f56e9f1
Do not call watchdog function while frames are received.
Florian Pose <fp@igh.de>
parents:
2686
diff
changeset
|
6801 |
adapter->ec_watchdog_jiffies = jiffies; |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6802 |
igb_reuse_rx_page(rx_ring, rx_buffer); |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6803 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6804 |
else { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6805 |
/* pull page into skb */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6806 |
if (igb_add_rx_frag(rx_ring, rx_buffer, rx_desc, skb)) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6807 |
/* hand second half of page back to the ring */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6808 |
igb_reuse_rx_page(rx_ring, rx_buffer); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6809 |
} else { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6810 |
/* we are not reusing the buffer so unmap it */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6811 |
dma_unmap_page(rx_ring->dev, rx_buffer->dma, |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6812 |
PAGE_SIZE, DMA_FROM_DEVICE); |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6813 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6814 |
|
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6815 |
/* clear contents of rx_buffer */ |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6816 |
rx_buffer->page = NULL; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
6817 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6818 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6819 |
return skb; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6820 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6821 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6822 |
static inline void igb_rx_checksum(struct igb_ring *ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6823 |
union e1000_adv_rx_desc *rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6824 |
struct sk_buff *skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6825 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6826 |
skb_checksum_none_assert(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6827 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6828 |
/* Ignore Checksum bit is set */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6829 |
if (igb_test_staterr(rx_desc, E1000_RXD_STAT_IXSM)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6830 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6831 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6832 |
/* Rx checksum disabled via ethtool */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6833 |
if (!(ring->netdev->features & NETIF_F_RXCSUM)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6834 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6835 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6836 |
/* TCP/UDP checksum error bit is set */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6837 |
if (igb_test_staterr(rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6838 |
E1000_RXDEXT_STATERR_TCPE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6839 |
E1000_RXDEXT_STATERR_IPE)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6840 |
/* work around errata with sctp packets where the TCPE aka |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6841 |
* L4E bit is set incorrectly on 64 byte (60 byte w/o crc) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6842 |
* packets, (aka let the stack check the crc32c) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6843 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6844 |
if (!((skb->len == 60) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6845 |
test_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6846 |
u64_stats_update_begin(&ring->rx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6847 |
ring->rx_stats.csum_err++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6848 |
u64_stats_update_end(&ring->rx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6849 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6850 |
/* let the stack verify checksum errors */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6851 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6852 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6853 |
/* It must be a TCP or UDP packet with a valid checksum */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6854 |
if (igb_test_staterr(rx_desc, E1000_RXD_STAT_TCPCS | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6855 |
E1000_RXD_STAT_UDPCS)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6856 |
skb->ip_summed = CHECKSUM_UNNECESSARY; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6857 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6858 |
dev_dbg(ring->dev, "cksum success: bits %08X\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6859 |
le32_to_cpu(rx_desc->wb.upper.status_error)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6860 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6861 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6862 |
static inline void igb_rx_hash(struct igb_ring *ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6863 |
union e1000_adv_rx_desc *rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6864 |
struct sk_buff *skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6865 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6866 |
if (ring->netdev->features & NETIF_F_RXHASH) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6867 |
skb_set_hash(skb, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6868 |
le32_to_cpu(rx_desc->wb.lower.hi_dword.rss), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6869 |
PKT_HASH_TYPE_L3); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6870 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6871 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6872 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6873 |
* igb_is_non_eop - process handling of non-EOP buffers |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6874 |
* @rx_ring: Rx ring being processed |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6875 |
* @rx_desc: Rx descriptor for current buffer |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6876 |
* @skb: current socket buffer containing buffer in progress |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6877 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6878 |
* This function updates next to clean. If the buffer is an EOP buffer |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6879 |
* this function exits returning false, otherwise it will place the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6880 |
* sk_buff in the next buffer to be chained and return true indicating |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6881 |
* that this is in fact a non-EOP buffer. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6882 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6883 |
static bool igb_is_non_eop(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6884 |
union e1000_adv_rx_desc *rx_desc) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6885 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6886 |
u32 ntc = rx_ring->next_to_clean + 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6887 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6888 |
/* fetch, update, and store next to clean */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6889 |
ntc = (ntc < rx_ring->count) ? ntc : 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6890 |
rx_ring->next_to_clean = ntc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6891 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6892 |
prefetch(IGB_RX_DESC(rx_ring, ntc)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6893 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6894 |
if (likely(igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6895 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6896 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6897 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6898 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6899 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6900 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6901 |
* igb_pull_tail - igb specific version of skb_pull_tail |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6902 |
* @rx_ring: rx descriptor ring packet is being transacted on |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6903 |
* @rx_desc: pointer to the EOP Rx descriptor |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6904 |
* @skb: pointer to current skb being adjusted |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6905 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6906 |
* This function is an igb specific version of __pskb_pull_tail. The |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6907 |
* main difference between this version and the original function is that |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6908 |
* this function can make several assumptions about the state of things |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6909 |
* that allow for significant optimizations versus the standard function. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6910 |
* As a result we can do things like drop a frag and maintain an accurate |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6911 |
* truesize for the skb. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6912 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6913 |
static void igb_pull_tail(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6914 |
union e1000_adv_rx_desc *rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6915 |
struct sk_buff *skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6916 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6917 |
struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6918 |
unsigned char *va; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6919 |
unsigned int pull_len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6920 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6921 |
/* it is valid to use page_address instead of kmap since we are |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6922 |
* working with pages allocated out of the lomem pool per |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6923 |
* alloc_page(GFP_ATOMIC) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6924 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6925 |
va = skb_frag_address(frag); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6926 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6927 |
if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6928 |
/* retrieve timestamp from buffer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6929 |
igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6930 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6931 |
/* update pointers to remove timestamp header */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6932 |
skb_frag_size_sub(frag, IGB_TS_HDR_LEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6933 |
frag->page_offset += IGB_TS_HDR_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6934 |
skb->data_len -= IGB_TS_HDR_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6935 |
skb->len -= IGB_TS_HDR_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6936 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6937 |
/* move va to start of packet data */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6938 |
va += IGB_TS_HDR_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6939 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6940 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6941 |
/* we need the header to contain the greater of either ETH_HLEN or |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6942 |
* 60 bytes if the skb->len is less than 60 for skb_pad. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6943 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6944 |
pull_len = eth_get_headlen(va, IGB_RX_HDR_LEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6945 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6946 |
/* align pull length to size of long to optimize memcpy performance */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6947 |
skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long))); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6948 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6949 |
/* update all of the pointers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6950 |
skb_frag_size_sub(frag, pull_len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6951 |
frag->page_offset += pull_len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6952 |
skb->data_len -= pull_len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6953 |
skb->tail += pull_len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6954 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6955 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6956 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6957 |
* igb_cleanup_headers - Correct corrupted or empty headers |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6958 |
* @rx_ring: rx descriptor ring packet is being transacted on |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6959 |
* @rx_desc: pointer to the EOP Rx descriptor |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6960 |
* @skb: pointer to current skb being fixed |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6961 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6962 |
* Address the case where we are pulling data in on pages only |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6963 |
* and as such no data is present in the skb header. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6964 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6965 |
* In addition if skb is not at least 60 bytes we need to pad it so that |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6966 |
* it is large enough to qualify as a valid Ethernet frame. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6967 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6968 |
* Returns true if an error was encountered and skb was freed. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6969 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6970 |
static bool igb_cleanup_headers(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6971 |
union e1000_adv_rx_desc *rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6972 |
struct sk_buff *skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6973 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6974 |
if (unlikely((igb_test_staterr(rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6975 |
E1000_RXDEXT_ERR_FRAME_ERR_MASK)))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6976 |
struct net_device *netdev = rx_ring->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6977 |
if (!(netdev->features & NETIF_F_RXALL)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6978 |
dev_kfree_skb_any(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6979 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6980 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6981 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6982 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6983 |
/* place header in linear portion of buffer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6984 |
if (skb_is_nonlinear(skb)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6985 |
igb_pull_tail(rx_ring, rx_desc, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6986 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6987 |
/* if skb_pad returns an error the skb was freed */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6988 |
if (unlikely(skb->len < 60)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6989 |
int pad_len = 60 - skb->len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6990 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6991 |
if (skb_pad(skb, pad_len)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6992 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6993 |
__skb_put(skb, pad_len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6994 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6995 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6996 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6997 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6998 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6999 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7000 |
* igb_process_skb_fields - Populate skb header fields from Rx descriptor |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7001 |
* @rx_ring: rx descriptor ring packet is being transacted on |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7002 |
* @rx_desc: pointer to the EOP Rx descriptor |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7003 |
* @skb: pointer to current skb being populated |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7004 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7005 |
* This function checks the ring, descriptor, and packet information in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7006 |
* order to populate the hash, checksum, VLAN, timestamp, protocol, and |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7007 |
* other fields within the skb. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7008 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7009 |
static void igb_process_skb_fields(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7010 |
union e1000_adv_rx_desc *rx_desc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7011 |
struct sk_buff *skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7012 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7013 |
struct net_device *dev = rx_ring->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7014 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7015 |
igb_rx_hash(rx_ring, rx_desc, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7016 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7017 |
igb_rx_checksum(rx_ring, rx_desc, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7018 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7019 |
if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TS) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7020 |
!igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7021 |
igb_ptp_rx_rgtstamp(rx_ring->q_vector, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7022 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7023 |
if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7024 |
igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7025 |
u16 vid; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7026 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7027 |
if (igb_test_staterr(rx_desc, E1000_RXDEXT_STATERR_LB) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7028 |
test_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &rx_ring->flags)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7029 |
vid = be16_to_cpu(rx_desc->wb.upper.vlan); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7030 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7031 |
vid = le16_to_cpu(rx_desc->wb.upper.vlan); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7032 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7033 |
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7034 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7035 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7036 |
skb_record_rx_queue(skb, rx_ring->queue_index); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7037 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7038 |
skb->protocol = eth_type_trans(skb, rx_ring->netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7039 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7040 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7041 |
static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7042 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7043 |
struct igb_ring *rx_ring = q_vector->rx.ring; |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
7044 |
struct igb_adapter *adapter = netdev_priv(rx_ring->netdev); |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7045 |
struct sk_buff *skb = rx_ring->skb; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7046 |
unsigned int total_bytes = 0, total_packets = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7047 |
u16 cleaned_count = igb_desc_unused(rx_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7048 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7049 |
while (likely(total_packets < budget)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7050 |
union e1000_adv_rx_desc *rx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7051 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7052 |
/* return some buffers to hardware, one at a time is too slow */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7053 |
if (cleaned_count >= IGB_RX_BUFFER_WRITE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7054 |
igb_alloc_rx_buffers(rx_ring, cleaned_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7055 |
cleaned_count = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7056 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7057 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7058 |
rx_desc = IGB_RX_DESC(rx_ring, rx_ring->next_to_clean); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7059 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7060 |
if (!igb_test_staterr(rx_desc, E1000_RXD_STAT_DD)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7061 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7062 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7063 |
/* This memory barrier is needed to keep us from reading |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7064 |
* any other fields out of the rx_desc until we know the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7065 |
* RXD_STAT_DD bit is set |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7066 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7067 |
rmb(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7068 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7069 |
/* retrieve a buffer from the ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7070 |
skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7071 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7072 |
/* exit if we failed to retrieve a buffer */ |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
7073 |
if (!adapter->ecdev && !skb) { |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7074 |
break; |
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
7075 |
} |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7076 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7077 |
cleaned_count++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7078 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7079 |
/* fetch next buffer in frame if non-eop */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7080 |
if (igb_is_non_eop(rx_ring, rx_desc)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7081 |
continue; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7082 |
|
2686
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
7083 |
if (adapter->ecdev) { |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
7084 |
total_packets++; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
7085 |
continue; |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
7086 |
} |
91cb9cf20f6c
EtherCAT functionality of igb driver.
Florian Pose <fp@igh.de>
parents:
2685
diff
changeset
|
7087 |
|
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7088 |
/* verify the packet layout is correct */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7089 |
if (igb_cleanup_headers(rx_ring, rx_desc, skb)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7090 |
skb = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7091 |
continue; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7092 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7093 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7094 |
/* probably a little skewed due to removing CRC */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7095 |
total_bytes += skb->len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7096 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7097 |
/* populate checksum, timestamp, VLAN, and protocol */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7098 |
igb_process_skb_fields(rx_ring, rx_desc, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7099 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7100 |
napi_gro_receive(&q_vector->napi, skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7101 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7102 |
/* reset skb pointer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7103 |
skb = NULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7104 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7105 |
/* update budget accounting */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7106 |
total_packets++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7107 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7108 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7109 |
/* place incomplete frames back on ring for completion */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7110 |
rx_ring->skb = skb; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7111 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7112 |
u64_stats_update_begin(&rx_ring->rx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7113 |
rx_ring->rx_stats.packets += total_packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7114 |
rx_ring->rx_stats.bytes += total_bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7115 |
u64_stats_update_end(&rx_ring->rx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7116 |
q_vector->rx.total_packets += total_packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7117 |
q_vector->rx.total_bytes += total_bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7118 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7119 |
if (cleaned_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7120 |
igb_alloc_rx_buffers(rx_ring, cleaned_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7121 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7122 |
return total_packets < budget; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7123 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7124 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7125 |
static bool igb_alloc_mapped_page(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7126 |
struct igb_rx_buffer *bi) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7127 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7128 |
struct page *page = bi->page; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7129 |
dma_addr_t dma; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7130 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7131 |
/* since we are recycling buffers we should seldom need to alloc */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7132 |
if (likely(page)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7133 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7134 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7135 |
/* alloc new page for storage */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7136 |
page = __skb_alloc_page(GFP_ATOMIC | __GFP_COLD, NULL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7137 |
if (unlikely(!page)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7138 |
rx_ring->rx_stats.alloc_failed++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7139 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7140 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7141 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7142 |
/* map page for use */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7143 |
dma = dma_map_page(rx_ring->dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7144 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7145 |
/* if mapping failed free memory back to system since |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7146 |
* there isn't much point in holding memory we can't use |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7147 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7148 |
if (dma_mapping_error(rx_ring->dev, dma)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7149 |
__free_page(page); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7150 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7151 |
rx_ring->rx_stats.alloc_failed++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7152 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7153 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7154 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7155 |
bi->dma = dma; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7156 |
bi->page = page; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7157 |
bi->page_offset = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7158 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7159 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7160 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7161 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7162 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7163 |
* igb_alloc_rx_buffers - Replace used receive buffers; packet split |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7164 |
* @adapter: address of board private structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7165 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7166 |
void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7167 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7168 |
union e1000_adv_rx_desc *rx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7169 |
struct igb_rx_buffer *bi; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7170 |
u16 i = rx_ring->next_to_use; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7171 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7172 |
/* nothing to do */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7173 |
if (!cleaned_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7174 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7175 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7176 |
rx_desc = IGB_RX_DESC(rx_ring, i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7177 |
bi = &rx_ring->rx_buffer_info[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7178 |
i -= rx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7179 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7180 |
do { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7181 |
if (!igb_alloc_mapped_page(rx_ring, bi)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7182 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7183 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7184 |
/* Refresh the desc even if buffer_addrs didn't change |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7185 |
* because each write-back erases this info. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7186 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7187 |
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + bi->page_offset); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7188 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7189 |
rx_desc++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7190 |
bi++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7191 |
i++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7192 |
if (unlikely(!i)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7193 |
rx_desc = IGB_RX_DESC(rx_ring, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7194 |
bi = rx_ring->rx_buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7195 |
i -= rx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7196 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7197 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7198 |
/* clear the hdr_addr for the next_to_use descriptor */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7199 |
rx_desc->read.hdr_addr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7200 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7201 |
cleaned_count--; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7202 |
} while (cleaned_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7203 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7204 |
i += rx_ring->count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7205 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7206 |
if (rx_ring->next_to_use != i) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7207 |
/* record the next descriptor to use */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7208 |
rx_ring->next_to_use = i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7209 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7210 |
/* update next to alloc since we have filled the ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7211 |
rx_ring->next_to_alloc = i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7212 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7213 |
/* Force memory writes to complete before letting h/w |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7214 |
* know there are new descriptors to fetch. (Only |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7215 |
* applicable for weak-ordered memory model archs, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7216 |
* such as IA-64). |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7217 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7218 |
wmb(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7219 |
writel(i, rx_ring->tail); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7220 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7221 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7222 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7223 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7224 |
* igb_mii_ioctl - |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7225 |
* @netdev: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7226 |
* @ifreq: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7227 |
* @cmd: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7228 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7229 |
static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7230 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7231 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7232 |
struct mii_ioctl_data *data = if_mii(ifr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7233 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7234 |
if (adapter->hw.phy.media_type != e1000_media_type_copper) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7235 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7236 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7237 |
switch (cmd) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7238 |
case SIOCGMIIPHY: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7239 |
data->phy_id = adapter->hw.phy.addr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7240 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7241 |
case SIOCGMIIREG: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7242 |
if (igb_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7243 |
&data->val_out)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7244 |
return -EIO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7245 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7246 |
case SIOCSMIIREG: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7247 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7248 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7249 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7250 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7251 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7252 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7253 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7254 |
* igb_ioctl - |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7255 |
* @netdev: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7256 |
* @ifreq: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7257 |
* @cmd: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7258 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7259 |
static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7260 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7261 |
switch (cmd) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7262 |
case SIOCGMIIPHY: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7263 |
case SIOCGMIIREG: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7264 |
case SIOCSMIIREG: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7265 |
return igb_mii_ioctl(netdev, ifr, cmd); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7266 |
case SIOCGHWTSTAMP: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7267 |
return igb_ptp_get_ts_config(netdev, ifr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7268 |
case SIOCSHWTSTAMP: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7269 |
return igb_ptp_set_ts_config(netdev, ifr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7270 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7271 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7272 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7273 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7274 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7275 |
void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7276 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7277 |
struct igb_adapter *adapter = hw->back; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7278 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7279 |
pci_read_config_word(adapter->pdev, reg, value); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7280 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7281 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7282 |
void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7283 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7284 |
struct igb_adapter *adapter = hw->back; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7285 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7286 |
pci_write_config_word(adapter->pdev, reg, *value); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7287 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7288 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7289 |
s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7290 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7291 |
struct igb_adapter *adapter = hw->back; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7292 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7293 |
if (pcie_capability_read_word(adapter->pdev, reg, value)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7294 |
return -E1000_ERR_CONFIG; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7295 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7296 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7297 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7298 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7299 |
s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7300 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7301 |
struct igb_adapter *adapter = hw->back; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7302 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7303 |
if (pcie_capability_write_word(adapter->pdev, reg, *value)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7304 |
return -E1000_ERR_CONFIG; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7305 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7306 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7307 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7308 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7309 |
static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7310 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7311 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7312 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7313 |
u32 ctrl, rctl; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7314 |
bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7315 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7316 |
if (enable) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7317 |
/* enable VLAN tag insert/strip */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7318 |
ctrl = rd32(E1000_CTRL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7319 |
ctrl |= E1000_CTRL_VME; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7320 |
wr32(E1000_CTRL, ctrl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7321 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7322 |
/* Disable CFI check */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7323 |
rctl = rd32(E1000_RCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7324 |
rctl &= ~E1000_RCTL_CFIEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7325 |
wr32(E1000_RCTL, rctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7326 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7327 |
/* disable VLAN tag insert/strip */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7328 |
ctrl = rd32(E1000_CTRL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7329 |
ctrl &= ~E1000_CTRL_VME; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7330 |
wr32(E1000_CTRL, ctrl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7331 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7332 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7333 |
igb_rlpml_set(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7334 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7335 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7336 |
static int igb_vlan_rx_add_vid(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7337 |
__be16 proto, u16 vid) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7338 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7339 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7340 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7341 |
int pf_id = adapter->vfs_allocated_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7342 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7343 |
/* attempt to add filter to vlvf array */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7344 |
igb_vlvf_set(adapter, vid, true, pf_id); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7345 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7346 |
/* add the filter since PF can receive vlans w/o entry in vlvf */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7347 |
igb_vfta_set(hw, vid, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7348 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7349 |
set_bit(vid, adapter->active_vlans); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7350 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7351 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7352 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7353 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7354 |
static int igb_vlan_rx_kill_vid(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7355 |
__be16 proto, u16 vid) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7356 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7357 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7358 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7359 |
int pf_id = adapter->vfs_allocated_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7360 |
s32 err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7361 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7362 |
/* remove vlan from VLVF table array */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7363 |
err = igb_vlvf_set(adapter, vid, false, pf_id); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7364 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7365 |
/* if vid was not present in VLVF just remove it from table */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7366 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7367 |
igb_vfta_set(hw, vid, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7368 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7369 |
clear_bit(vid, adapter->active_vlans); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7370 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7371 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7372 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7373 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7374 |
static void igb_restore_vlan(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7375 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7376 |
u16 vid; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7377 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7378 |
igb_vlan_mode(adapter->netdev, adapter->netdev->features); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7379 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7380 |
for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7381 |
igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7382 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7383 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7384 |
int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7385 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7386 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7387 |
struct e1000_mac_info *mac = &adapter->hw.mac; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7388 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7389 |
mac->autoneg = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7390 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7391 |
/* Make sure dplx is at most 1 bit and lsb of speed is not set |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7392 |
* for the switch() below to work |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7393 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7394 |
if ((spd & 1) || (dplx & ~1)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7395 |
goto err_inval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7396 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7397 |
/* Fiber NIC's only allow 1000 gbps Full duplex |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7398 |
* and 100Mbps Full duplex for 100baseFx sfp |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7399 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7400 |
if (adapter->hw.phy.media_type == e1000_media_type_internal_serdes) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7401 |
switch (spd + dplx) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7402 |
case SPEED_10 + DUPLEX_HALF: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7403 |
case SPEED_10 + DUPLEX_FULL: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7404 |
case SPEED_100 + DUPLEX_HALF: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7405 |
goto err_inval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7406 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7407 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7408 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7409 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7410 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7411 |
switch (spd + dplx) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7412 |
case SPEED_10 + DUPLEX_HALF: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7413 |
mac->forced_speed_duplex = ADVERTISE_10_HALF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7414 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7415 |
case SPEED_10 + DUPLEX_FULL: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7416 |
mac->forced_speed_duplex = ADVERTISE_10_FULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7417 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7418 |
case SPEED_100 + DUPLEX_HALF: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7419 |
mac->forced_speed_duplex = ADVERTISE_100_HALF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7420 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7421 |
case SPEED_100 + DUPLEX_FULL: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7422 |
mac->forced_speed_duplex = ADVERTISE_100_FULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7423 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7424 |
case SPEED_1000 + DUPLEX_FULL: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7425 |
mac->autoneg = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7426 |
adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7427 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7428 |
case SPEED_1000 + DUPLEX_HALF: /* not supported */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7429 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7430 |
goto err_inval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7431 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7432 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7433 |
/* clear MDI, MDI(-X) override is only allowed when autoneg enabled */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7434 |
adapter->hw.phy.mdix = AUTO_ALL_MODES; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7435 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7436 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7437 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7438 |
err_inval: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7439 |
dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7440 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7441 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7442 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7443 |
static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7444 |
bool runtime) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7445 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7446 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7447 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7448 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7449 |
u32 ctrl, rctl, status; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7450 |
u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7451 |
#ifdef CONFIG_PM |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7452 |
int retval = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7453 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7454 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7455 |
netif_device_detach(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7456 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7457 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7458 |
__igb_close(netdev, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7459 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7460 |
igb_clear_interrupt_scheme(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7461 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7462 |
#ifdef CONFIG_PM |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7463 |
retval = pci_save_state(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7464 |
if (retval) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7465 |
return retval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7466 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7467 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7468 |
status = rd32(E1000_STATUS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7469 |
if (status & E1000_STATUS_LU) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7470 |
wufc &= ~E1000_WUFC_LNKC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7471 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7472 |
if (wufc) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7473 |
igb_setup_rctl(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7474 |
igb_set_rx_mode(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7475 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7476 |
/* turn on all-multi mode if wake on multicast is enabled */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7477 |
if (wufc & E1000_WUFC_MC) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7478 |
rctl = rd32(E1000_RCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7479 |
rctl |= E1000_RCTL_MPE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7480 |
wr32(E1000_RCTL, rctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7481 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7482 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7483 |
ctrl = rd32(E1000_CTRL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7484 |
/* advertise wake from D3Cold */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7485 |
#define E1000_CTRL_ADVD3WUC 0x00100000 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7486 |
/* phy power management enable */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7487 |
#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7488 |
ctrl |= E1000_CTRL_ADVD3WUC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7489 |
wr32(E1000_CTRL, ctrl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7490 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7491 |
/* Allow time for pending master requests to run */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7492 |
igb_disable_pcie_master(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7493 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7494 |
wr32(E1000_WUC, E1000_WUC_PME_EN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7495 |
wr32(E1000_WUFC, wufc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7496 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7497 |
wr32(E1000_WUC, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7498 |
wr32(E1000_WUFC, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7499 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7500 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7501 |
*enable_wake = wufc || adapter->en_mng_pt; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7502 |
if (!*enable_wake) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7503 |
igb_power_down_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7504 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7505 |
igb_power_up_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7506 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7507 |
/* Release control of h/w to f/w. If f/w is AMT enabled, this |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7508 |
* would have already happened in close and is redundant. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7509 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7510 |
igb_release_hw_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7511 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7512 |
pci_disable_device(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7513 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7514 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7515 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7516 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7517 |
#ifdef CONFIG_PM |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7518 |
#ifdef CONFIG_PM_SLEEP |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7519 |
static int igb_suspend(struct device *dev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7520 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7521 |
int retval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7522 |
bool wake; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7523 |
struct pci_dev *pdev = to_pci_dev(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7524 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7525 |
retval = __igb_shutdown(pdev, &wake, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7526 |
if (retval) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7527 |
return retval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7528 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7529 |
if (wake) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7530 |
pci_prepare_to_sleep(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7531 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7532 |
pci_wake_from_d3(pdev, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7533 |
pci_set_power_state(pdev, PCI_D3hot); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7534 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7535 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7536 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7537 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7538 |
#endif /* CONFIG_PM_SLEEP */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7539 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7540 |
static int igb_resume(struct device *dev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7541 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7542 |
struct pci_dev *pdev = to_pci_dev(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7543 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7544 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7545 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7546 |
u32 err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7547 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7548 |
pci_set_power_state(pdev, PCI_D0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7549 |
pci_restore_state(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7550 |
pci_save_state(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7551 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7552 |
if (!pci_device_is_present(pdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7553 |
return -ENODEV; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7554 |
err = pci_enable_device_mem(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7555 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7556 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7557 |
"igb: Cannot enable PCI device from suspend\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7558 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7559 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7560 |
pci_set_master(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7561 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7562 |
pci_enable_wake(pdev, PCI_D3hot, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7563 |
pci_enable_wake(pdev, PCI_D3cold, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7564 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7565 |
if (igb_init_interrupt_scheme(adapter, true)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7566 |
dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7567 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7568 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7569 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7570 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7571 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7572 |
/* let the f/w know that the h/w is now under the control of the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7573 |
* driver. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7574 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7575 |
igb_get_hw_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7576 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7577 |
wr32(E1000_WUS, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7578 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7579 |
if (netdev->flags & IFF_UP) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7580 |
rtnl_lock(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7581 |
err = __igb_open(netdev, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7582 |
rtnl_unlock(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7583 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7584 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7585 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7586 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7587 |
netif_device_attach(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7588 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7589 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7590 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7591 |
#ifdef CONFIG_PM_RUNTIME |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7592 |
static int igb_runtime_idle(struct device *dev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7593 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7594 |
struct pci_dev *pdev = to_pci_dev(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7595 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7596 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7597 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7598 |
if (!igb_has_link(adapter)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7599 |
pm_schedule_suspend(dev, MSEC_PER_SEC * 5); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7600 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7601 |
return -EBUSY; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7602 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7603 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7604 |
static int igb_runtime_suspend(struct device *dev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7605 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7606 |
struct pci_dev *pdev = to_pci_dev(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7607 |
int retval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7608 |
bool wake; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7609 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7610 |
retval = __igb_shutdown(pdev, &wake, 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7611 |
if (retval) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7612 |
return retval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7613 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7614 |
if (wake) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7615 |
pci_prepare_to_sleep(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7616 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7617 |
pci_wake_from_d3(pdev, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7618 |
pci_set_power_state(pdev, PCI_D3hot); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7619 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7620 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7621 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7622 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7623 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7624 |
static int igb_runtime_resume(struct device *dev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7625 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7626 |
return igb_resume(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7627 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7628 |
#endif /* CONFIG_PM_RUNTIME */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7629 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7630 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7631 |
static void igb_shutdown(struct pci_dev *pdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7632 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7633 |
bool wake; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7634 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7635 |
__igb_shutdown(pdev, &wake, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7636 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7637 |
if (system_state == SYSTEM_POWER_OFF) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7638 |
pci_wake_from_d3(pdev, wake); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7639 |
pci_set_power_state(pdev, PCI_D3hot); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7640 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7641 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7642 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7643 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7644 |
static int igb_sriov_reinit(struct pci_dev *dev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7645 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7646 |
struct net_device *netdev = pci_get_drvdata(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7647 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7648 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7649 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7650 |
rtnl_lock(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7651 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7652 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7653 |
igb_close(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7654 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7655 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7656 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7657 |
igb_clear_interrupt_scheme(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7658 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7659 |
igb_init_queue_configuration(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7660 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7661 |
if (igb_init_interrupt_scheme(adapter, true)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7662 |
dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7663 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7664 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7665 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7666 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7667 |
igb_open(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7668 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7669 |
rtnl_unlock(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7670 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7671 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7672 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7673 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7674 |
static int igb_pci_disable_sriov(struct pci_dev *dev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7675 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7676 |
int err = igb_disable_sriov(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7677 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7678 |
if (!err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7679 |
err = igb_sriov_reinit(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7680 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7681 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7682 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7683 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7684 |
static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7685 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7686 |
int err = igb_enable_sriov(dev, num_vfs); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7687 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7688 |
if (err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7689 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7690 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7691 |
err = igb_sriov_reinit(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7692 |
if (!err) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7693 |
return num_vfs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7694 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7695 |
out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7696 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7697 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7698 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7699 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7700 |
static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7701 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7702 |
#ifdef CONFIG_PCI_IOV |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7703 |
if (num_vfs == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7704 |
return igb_pci_disable_sriov(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7705 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7706 |
return igb_pci_enable_sriov(dev, num_vfs); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7707 |
#endif |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7708 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7709 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7710 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7711 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7712 |
/* Polling 'interrupt' - used by things like netconsole to send skbs |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7713 |
* without having to re-enable interrupts. It's not called while |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7714 |
* the interrupt routine is executing. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7715 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7716 |
static void igb_netpoll(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7717 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7718 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7719 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7720 |
struct igb_q_vector *q_vector; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7721 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7722 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7723 |
for (i = 0; i < adapter->num_q_vectors; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7724 |
q_vector = adapter->q_vector[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7725 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7726 |
wr32(E1000_EIMC, q_vector->eims_value); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7727 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7728 |
igb_irq_disable(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7729 |
napi_schedule(&q_vector->napi); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7730 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7731 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7732 |
#endif /* CONFIG_NET_POLL_CONTROLLER */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7733 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7734 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7735 |
* igb_io_error_detected - called when PCI error is detected |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7736 |
* @pdev: Pointer to PCI device |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7737 |
* @state: The current pci connection state |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7738 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7739 |
* This function is called after a PCI bus error affecting |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7740 |
* this device has been detected. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7741 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7742 |
static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7743 |
pci_channel_state_t state) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7744 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7745 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7746 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7747 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7748 |
netif_device_detach(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7749 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7750 |
if (state == pci_channel_io_perm_failure) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7751 |
return PCI_ERS_RESULT_DISCONNECT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7752 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7753 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7754 |
igb_down(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7755 |
pci_disable_device(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7756 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7757 |
/* Request a slot slot reset. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7758 |
return PCI_ERS_RESULT_NEED_RESET; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7759 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7760 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7761 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7762 |
* igb_io_slot_reset - called after the pci bus has been reset. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7763 |
* @pdev: Pointer to PCI device |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7764 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7765 |
* Restart the card from scratch, as if from a cold-boot. Implementation |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7766 |
* resembles the first-half of the igb_resume routine. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7767 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7768 |
static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7769 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7770 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7771 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7772 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7773 |
pci_ers_result_t result; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7774 |
int err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7775 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7776 |
if (pci_enable_device_mem(pdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7777 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7778 |
"Cannot re-enable PCI device after reset.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7779 |
result = PCI_ERS_RESULT_DISCONNECT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7780 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7781 |
pci_set_master(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7782 |
pci_restore_state(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7783 |
pci_save_state(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7784 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7785 |
pci_enable_wake(pdev, PCI_D3hot, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7786 |
pci_enable_wake(pdev, PCI_D3cold, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7787 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7788 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7789 |
wr32(E1000_WUS, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7790 |
result = PCI_ERS_RESULT_RECOVERED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7791 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7792 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7793 |
err = pci_cleanup_aer_uncorrect_error_status(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7794 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7795 |
dev_err(&pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7796 |
"pci_cleanup_aer_uncorrect_error_status failed 0x%0x\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7797 |
err); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7798 |
/* non-fatal, continue */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7799 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7800 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7801 |
return result; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7802 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7803 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7804 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7805 |
* igb_io_resume - called when traffic can start flowing again. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7806 |
* @pdev: Pointer to PCI device |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7807 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7808 |
* This callback is called when the error recovery driver tells us that |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7809 |
* its OK to resume normal operation. Implementation resembles the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7810 |
* second-half of the igb_resume routine. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7811 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7812 |
static void igb_io_resume(struct pci_dev *pdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7813 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7814 |
struct net_device *netdev = pci_get_drvdata(pdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7815 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7816 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7817 |
if (netif_running(netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7818 |
if (igb_up(adapter)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7819 |
dev_err(&pdev->dev, "igb_up failed after reset\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7820 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7821 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7822 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7823 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7824 |
netif_device_attach(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7825 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7826 |
/* let the f/w know that the h/w is now under the control of the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7827 |
* driver. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7828 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7829 |
igb_get_hw_control(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7830 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7831 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7832 |
static void igb_rar_set_qsel(struct igb_adapter *adapter, u8 *addr, u32 index, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7833 |
u8 qsel) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7834 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7835 |
u32 rar_low, rar_high; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7836 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7837 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7838 |
/* HW expects these in little endian so we reverse the byte order |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7839 |
* from network order (big endian) to little endian |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7840 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7841 |
rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7842 |
((u32) addr[2] << 16) | ((u32) addr[3] << 24)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7843 |
rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7844 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7845 |
/* Indicate to hardware the Address is Valid. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7846 |
rar_high |= E1000_RAH_AV; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7847 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7848 |
if (hw->mac.type == e1000_82575) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7849 |
rar_high |= E1000_RAH_POOL_1 * qsel; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7850 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7851 |
rar_high |= E1000_RAH_POOL_1 << qsel; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7852 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7853 |
wr32(E1000_RAL(index), rar_low); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7854 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7855 |
wr32(E1000_RAH(index), rar_high); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7856 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7857 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7858 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7859 |
static int igb_set_vf_mac(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7860 |
int vf, unsigned char *mac_addr) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7861 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7862 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7863 |
/* VF MAC addresses start at end of receive addresses and moves |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7864 |
* towards the first, as a result a collision should not be possible |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7865 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7866 |
int rar_entry = hw->mac.rar_entry_count - (vf + 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7867 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7868 |
memcpy(adapter->vf_data[vf].vf_mac_addresses, mac_addr, ETH_ALEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7869 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7870 |
igb_rar_set_qsel(adapter, mac_addr, rar_entry, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7871 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7872 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7873 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7874 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7875 |
static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7876 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7877 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7878 |
if (!is_valid_ether_addr(mac) || (vf >= adapter->vfs_allocated_count)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7879 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7880 |
adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7881 |
dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7882 |
dev_info(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7883 |
"Reload the VF driver to make this change effective."); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7884 |
if (test_bit(__IGB_DOWN, &adapter->state)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7885 |
dev_warn(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7886 |
"The VF MAC address has been set, but the PF device is not up.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7887 |
dev_warn(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7888 |
"Bring the PF device up before attempting to use the VF device.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7889 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7890 |
return igb_set_vf_mac(adapter, vf, mac); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7891 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7892 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7893 |
static int igb_link_mbps(int internal_link_speed) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7894 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7895 |
switch (internal_link_speed) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7896 |
case SPEED_100: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7897 |
return 100; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7898 |
case SPEED_1000: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7899 |
return 1000; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7900 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7901 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7902 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7903 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7904 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7905 |
static void igb_set_vf_rate_limit(struct e1000_hw *hw, int vf, int tx_rate, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7906 |
int link_speed) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7907 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7908 |
int rf_dec, rf_int; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7909 |
u32 bcnrc_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7910 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7911 |
if (tx_rate != 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7912 |
/* Calculate the rate factor values to set */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7913 |
rf_int = link_speed / tx_rate; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7914 |
rf_dec = (link_speed - (rf_int * tx_rate)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7915 |
rf_dec = (rf_dec * (1 << E1000_RTTBCNRC_RF_INT_SHIFT)) / |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7916 |
tx_rate; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7917 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7918 |
bcnrc_val = E1000_RTTBCNRC_RS_ENA; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7919 |
bcnrc_val |= ((rf_int << E1000_RTTBCNRC_RF_INT_SHIFT) & |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7920 |
E1000_RTTBCNRC_RF_INT_MASK); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7921 |
bcnrc_val |= (rf_dec & E1000_RTTBCNRC_RF_DEC_MASK); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7922 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7923 |
bcnrc_val = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7924 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7925 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7926 |
wr32(E1000_RTTDQSEL, vf); /* vf X uses queue X */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7927 |
/* Set global transmit compensation time to the MMW_SIZE in RTTBCNRM |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7928 |
* register. MMW_SIZE=0x014 if 9728-byte jumbo is supported. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7929 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7930 |
wr32(E1000_RTTBCNRM, 0x14); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7931 |
wr32(E1000_RTTBCNRC, bcnrc_val); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7932 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7933 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7934 |
static void igb_check_vf_rate_limit(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7935 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7936 |
int actual_link_speed, i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7937 |
bool reset_rate = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7938 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7939 |
/* VF TX rate limit was not set or not supported */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7940 |
if ((adapter->vf_rate_link_speed == 0) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7941 |
(adapter->hw.mac.type != e1000_82576)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7942 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7943 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7944 |
actual_link_speed = igb_link_mbps(adapter->link_speed); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7945 |
if (actual_link_speed != adapter->vf_rate_link_speed) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7946 |
reset_rate = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7947 |
adapter->vf_rate_link_speed = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7948 |
dev_info(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7949 |
"Link speed has been changed. VF Transmit rate is disabled\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7950 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7951 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7952 |
for (i = 0; i < adapter->vfs_allocated_count; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7953 |
if (reset_rate) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7954 |
adapter->vf_data[i].tx_rate = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7955 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7956 |
igb_set_vf_rate_limit(&adapter->hw, i, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7957 |
adapter->vf_data[i].tx_rate, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7958 |
actual_link_speed); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7959 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7960 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7961 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7962 |
static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7963 |
int min_tx_rate, int max_tx_rate) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7964 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7965 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7966 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7967 |
int actual_link_speed; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7968 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7969 |
if (hw->mac.type != e1000_82576) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7970 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7971 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7972 |
if (min_tx_rate) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7973 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7974 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7975 |
actual_link_speed = igb_link_mbps(adapter->link_speed); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7976 |
if ((vf >= adapter->vfs_allocated_count) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7977 |
(!(rd32(E1000_STATUS) & E1000_STATUS_LU)) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7978 |
(max_tx_rate < 0) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7979 |
(max_tx_rate > actual_link_speed)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7980 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7981 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7982 |
adapter->vf_rate_link_speed = actual_link_speed; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7983 |
adapter->vf_data[vf].tx_rate = (u16)max_tx_rate; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7984 |
igb_set_vf_rate_limit(hw, vf, max_tx_rate, actual_link_speed); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7985 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7986 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7987 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7988 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7989 |
static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7990 |
bool setting) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7991 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7992 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7993 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7994 |
u32 reg_val, reg_offset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7995 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7996 |
if (!adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7997 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7998 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7999 |
if (vf >= adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8000 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8001 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8002 |
reg_offset = (hw->mac.type == e1000_82576) ? E1000_DTXSWC : E1000_TXSWC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8003 |
reg_val = rd32(reg_offset); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8004 |
if (setting) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8005 |
reg_val |= ((1 << vf) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8006 |
(1 << (vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT))); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8007 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8008 |
reg_val &= ~((1 << vf) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8009 |
(1 << (vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT))); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8010 |
wr32(reg_offset, reg_val); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8011 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8012 |
adapter->vf_data[vf].spoofchk_enabled = setting; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8013 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8014 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8015 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8016 |
static int igb_ndo_get_vf_config(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8017 |
int vf, struct ifla_vf_info *ivi) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8018 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8019 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8020 |
if (vf >= adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8021 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8022 |
ivi->vf = vf; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8023 |
memcpy(&ivi->mac, adapter->vf_data[vf].vf_mac_addresses, ETH_ALEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8024 |
ivi->max_tx_rate = adapter->vf_data[vf].tx_rate; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8025 |
ivi->min_tx_rate = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8026 |
ivi->vlan = adapter->vf_data[vf].pf_vlan; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8027 |
ivi->qos = adapter->vf_data[vf].pf_qos; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8028 |
ivi->spoofchk = adapter->vf_data[vf].spoofchk_enabled; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8029 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8030 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8031 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8032 |
static void igb_vmm_control(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8033 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8034 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8035 |
u32 reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8036 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8037 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8038 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8039 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8040 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8041 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8042 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8043 |
/* replication is not supported for 82575 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8044 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8045 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8046 |
/* notify HW that the MAC is adding vlan tags */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8047 |
reg = rd32(E1000_DTXCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8048 |
reg |= E1000_DTXCTL_VLAN_ADDED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8049 |
wr32(E1000_DTXCTL, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8050 |
/* Fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8051 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8052 |
/* enable replication vlan tag stripping */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8053 |
reg = rd32(E1000_RPLOLR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8054 |
reg |= E1000_RPLOLR_STRVLAN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8055 |
wr32(E1000_RPLOLR, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8056 |
/* Fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8057 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8058 |
/* none of the above registers are supported by i350 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8059 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8060 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8061 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8062 |
if (adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8063 |
igb_vmdq_set_loopback_pf(hw, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8064 |
igb_vmdq_set_replication_pf(hw, true); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8065 |
igb_vmdq_set_anti_spoofing_pf(hw, true, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8066 |
adapter->vfs_allocated_count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8067 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8068 |
igb_vmdq_set_loopback_pf(hw, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8069 |
igb_vmdq_set_replication_pf(hw, false); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8070 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8071 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8072 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8073 |
static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8074 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8075 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8076 |
u32 dmac_thr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8077 |
u16 hwm; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8078 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8079 |
if (hw->mac.type > e1000_82580) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8080 |
if (adapter->flags & IGB_FLAG_DMAC) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8081 |
u32 reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8082 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8083 |
/* force threshold to 0. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8084 |
wr32(E1000_DMCTXTH, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8085 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8086 |
/* DMA Coalescing high water mark needs to be greater |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8087 |
* than the Rx threshold. Set hwm to PBA - max frame |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8088 |
* size in 16B units, capping it at PBA - 6KB. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8089 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8090 |
hwm = 64 * pba - adapter->max_frame_size / 16; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8091 |
if (hwm < 64 * (pba - 6)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8092 |
hwm = 64 * (pba - 6); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8093 |
reg = rd32(E1000_FCRTC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8094 |
reg &= ~E1000_FCRTC_RTH_COAL_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8095 |
reg |= ((hwm << E1000_FCRTC_RTH_COAL_SHIFT) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8096 |
& E1000_FCRTC_RTH_COAL_MASK); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8097 |
wr32(E1000_FCRTC, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8098 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8099 |
/* Set the DMA Coalescing Rx threshold to PBA - 2 * max |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8100 |
* frame size, capping it at PBA - 10KB. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8101 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8102 |
dmac_thr = pba - adapter->max_frame_size / 512; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8103 |
if (dmac_thr < pba - 10) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8104 |
dmac_thr = pba - 10; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8105 |
reg = rd32(E1000_DMACR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8106 |
reg &= ~E1000_DMACR_DMACTHR_MASK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8107 |
reg |= ((dmac_thr << E1000_DMACR_DMACTHR_SHIFT) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8108 |
& E1000_DMACR_DMACTHR_MASK); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8109 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8110 |
/* transition to L0x or L1 if available..*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8111 |
reg |= (E1000_DMACR_DMAC_EN | E1000_DMACR_DMAC_LX_MASK); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8112 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8113 |
/* watchdog timer= +-1000 usec in 32usec intervals */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8114 |
reg |= (1000 >> 5); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8115 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8116 |
/* Disable BMC-to-OS Watchdog Enable */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8117 |
if (hw->mac.type != e1000_i354) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8118 |
reg &= ~E1000_DMACR_DC_BMC2OSW_EN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8119 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8120 |
wr32(E1000_DMACR, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8121 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8122 |
/* no lower threshold to disable |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8123 |
* coalescing(smart fifb)-UTRESH=0 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8124 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8125 |
wr32(E1000_DMCRTRH, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8126 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8127 |
reg = (IGB_DMCTLX_DCFLUSH_DIS | 0x4); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8128 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8129 |
wr32(E1000_DMCTLX, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8130 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8131 |
/* free space in tx packet buffer to wake from |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8132 |
* DMA coal |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8133 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8134 |
wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE - |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8135 |
(IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8136 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8137 |
/* make low power state decision controlled |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8138 |
* by DMA coal |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8139 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8140 |
reg = rd32(E1000_PCIEMISC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8141 |
reg &= ~E1000_PCIEMISC_LX_DECISION; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8142 |
wr32(E1000_PCIEMISC, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8143 |
} /* endif adapter->dmac is not disabled */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8144 |
} else if (hw->mac.type == e1000_82580) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8145 |
u32 reg = rd32(E1000_PCIEMISC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8146 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8147 |
wr32(E1000_PCIEMISC, reg & ~E1000_PCIEMISC_LX_DECISION); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8148 |
wr32(E1000_DMACR, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8149 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8150 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8151 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8152 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8153 |
* igb_read_i2c_byte - Reads 8 bit word over I2C |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8154 |
* @hw: pointer to hardware structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8155 |
* @byte_offset: byte offset to read |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8156 |
* @dev_addr: device address |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8157 |
* @data: value read |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8158 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8159 |
* Performs byte read operation over I2C interface at |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8160 |
* a specified device address. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8161 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8162 |
s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8163 |
u8 dev_addr, u8 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8164 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8165 |
struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8166 |
struct i2c_client *this_client = adapter->i2c_client; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8167 |
s32 status; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8168 |
u16 swfw_mask = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8169 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8170 |
if (!this_client) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8171 |
return E1000_ERR_I2C; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8172 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8173 |
swfw_mask = E1000_SWFW_PHY0_SM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8174 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8175 |
if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8176 |
return E1000_ERR_SWFW_SYNC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8177 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8178 |
status = i2c_smbus_read_byte_data(this_client, byte_offset); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8179 |
hw->mac.ops.release_swfw_sync(hw, swfw_mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8180 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8181 |
if (status < 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8182 |
return E1000_ERR_I2C; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8183 |
else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8184 |
*data = status; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8185 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8186 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8187 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8188 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8189 |
/** |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8190 |
* igb_write_i2c_byte - Writes 8 bit word over I2C |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8191 |
* @hw: pointer to hardware structure |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8192 |
* @byte_offset: byte offset to write |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8193 |
* @dev_addr: device address |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8194 |
* @data: value to write |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8195 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8196 |
* Performs byte write operation over I2C interface at |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8197 |
* a specified device address. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8198 |
**/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8199 |
s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8200 |
u8 dev_addr, u8 data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8201 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8202 |
struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8203 |
struct i2c_client *this_client = adapter->i2c_client; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8204 |
s32 status; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8205 |
u16 swfw_mask = E1000_SWFW_PHY0_SM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8206 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8207 |
if (!this_client) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8208 |
return E1000_ERR_I2C; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8209 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8210 |
if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8211 |
return E1000_ERR_SWFW_SYNC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8212 |
status = i2c_smbus_write_byte_data(this_client, byte_offset, data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8213 |
hw->mac.ops.release_swfw_sync(hw, swfw_mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8214 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8215 |
if (status) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8216 |
return E1000_ERR_I2C; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8217 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8218 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8219 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8220 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8221 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8222 |
int igb_reinit_queues(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8223 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8224 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8225 |
struct pci_dev *pdev = adapter->pdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8226 |
int err = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8227 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8228 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8229 |
igb_close(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8230 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8231 |
igb_reset_interrupt_capability(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8232 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8233 |
if (igb_init_interrupt_scheme(adapter, true)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8234 |
dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8235 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8236 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8237 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8238 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8239 |
err = igb_open(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8240 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8241 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8242 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8243 |
/* igb_main.c */ |