aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k.h9
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c6
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c8
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c93
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_iov.c51
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_main.c33
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_mbx.c34
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_netdev.c37
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_pci.c61
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_pf.c10
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_ptp.c5
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_vf.c6
12 files changed, 215 insertions, 138 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 59edfd4446cd..c8c8c5baefda 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -235,6 +235,9 @@ struct fm10k_vxlan_port {
235 __be16 port; 235 __be16 port;
236}; 236};
237 237
238/* one work queue for entire driver */
239extern struct workqueue_struct *fm10k_workqueue;
240
238struct fm10k_intfc { 241struct fm10k_intfc {
239 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 242 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
240 struct net_device *netdev; 243 struct net_device *netdev;
@@ -266,7 +269,6 @@ struct fm10k_intfc {
266 u64 tx_csum_errors; 269 u64 tx_csum_errors;
267 u64 alloc_failed; 270 u64 alloc_failed;
268 u64 rx_csum_errors; 271 u64 rx_csum_errors;
269 u64 rx_errors;
270 272
271 u64 tx_bytes_nic; 273 u64 tx_bytes_nic;
272 u64 tx_packets_nic; 274 u64 tx_packets_nic;
@@ -458,6 +460,9 @@ void fm10k_down(struct fm10k_intfc *interface);
458void fm10k_update_stats(struct fm10k_intfc *interface); 460void fm10k_update_stats(struct fm10k_intfc *interface);
459void fm10k_service_event_schedule(struct fm10k_intfc *interface); 461void fm10k_service_event_schedule(struct fm10k_intfc *interface);
460void fm10k_update_rx_drop_en(struct fm10k_intfc *interface); 462void fm10k_update_rx_drop_en(struct fm10k_intfc *interface);
463#ifdef CONFIG_NET_POLL_CONTROLLER
464void fm10k_netpoll(struct net_device *netdev);
465#endif
461 466
462/* Netdev */ 467/* Netdev */
463struct net_device *fm10k_alloc_netdev(void); 468struct net_device *fm10k_alloc_netdev(void);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c b/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
index 212a92dad222..5c7a4d7662d8 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -128,7 +128,7 @@ static int fm10k_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc)
128 * 128 *
129 * Returns that we support only IEEE DCB for this interface 129 * Returns that we support only IEEE DCB for this interface
130 **/ 130 **/
131static u8 fm10k_dcbnl_getdcbx(struct net_device *dev) 131static u8 fm10k_dcbnl_getdcbx(struct net_device __always_unused *dev)
132{ 132{
133 return DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_IEEE; 133 return DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_IEEE;
134} 134}
@@ -140,7 +140,7 @@ static u8 fm10k_dcbnl_getdcbx(struct net_device *dev)
140 * 140 *
141 * Returns error on attempt to enable anything but IEEE DCB for this interface 141 * Returns error on attempt to enable anything but IEEE DCB for this interface
142 **/ 142 **/
143static u8 fm10k_dcbnl_setdcbx(struct net_device *dev, u8 mode) 143static u8 fm10k_dcbnl_setdcbx(struct net_device __always_unused *dev, u8 mode)
144{ 144{
145 return (mode != (DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_IEEE)) ? 1 : 0; 145 return (mode != (DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_IEEE)) ? 1 : 0;
146} 146}
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c b/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c
index 4327f86218b9..f45b4d71adb8 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -36,14 +36,16 @@ static void *fm10k_dbg_desc_seq_start(struct seq_file *s, loff_t *pos)
36 return (*pos < ring->count) ? pos : NULL; 36 return (*pos < ring->count) ? pos : NULL;
37} 37}
38 38
39static void *fm10k_dbg_desc_seq_next(struct seq_file *s, void *v, loff_t *pos) 39static void *fm10k_dbg_desc_seq_next(struct seq_file *s,
40 void __always_unused *v, loff_t *pos)
40{ 41{
41 struct fm10k_ring *ring = s->private; 42 struct fm10k_ring *ring = s->private;
42 43
43 return (++(*pos) < ring->count) ? pos : NULL; 44 return (++(*pos) < ring->count) ? pos : NULL;
44} 45}
45 46
46static void fm10k_dbg_desc_seq_stop(struct seq_file *s, void *v) 47static void fm10k_dbg_desc_seq_stop(struct seq_file __always_unused *s,
48 __always_unused void *v)
47{ 49{
48 /* Do nothing. */ 50 /* Do nothing. */
49} 51}
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 33b6106c764b..4b9d9f88af70 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -57,13 +57,12 @@ static const struct fm10k_stats fm10k_gstrings_net_stats[] = {
57 .stat_offset = offsetof(struct fm10k_intfc, _stat) \ 57 .stat_offset = offsetof(struct fm10k_intfc, _stat) \
58} 58}
59 59
60static const struct fm10k_stats fm10k_gstrings_stats[] = { 60static const struct fm10k_stats fm10k_gstrings_global_stats[] = {
61 FM10K_STAT("tx_restart_queue", restart_queue), 61 FM10K_STAT("tx_restart_queue", restart_queue),
62 FM10K_STAT("tx_busy", tx_busy), 62 FM10K_STAT("tx_busy", tx_busy),
63 FM10K_STAT("tx_csum_errors", tx_csum_errors), 63 FM10K_STAT("tx_csum_errors", tx_csum_errors),
64 FM10K_STAT("rx_alloc_failed", alloc_failed), 64 FM10K_STAT("rx_alloc_failed", alloc_failed),
65 FM10K_STAT("rx_csum_errors", rx_csum_errors), 65 FM10K_STAT("rx_csum_errors", rx_csum_errors),
66 FM10K_STAT("rx_errors", rx_errors),
67 66
68 FM10K_STAT("tx_packets_nic", tx_packets_nic), 67 FM10K_STAT("tx_packets_nic", tx_packets_nic),
69 FM10K_STAT("tx_bytes_nic", tx_bytes_nic), 68 FM10K_STAT("tx_bytes_nic", tx_bytes_nic),
@@ -73,38 +72,42 @@ static const struct fm10k_stats fm10k_gstrings_stats[] = {
73 FM10K_STAT("rx_overrun_pf", rx_overrun_pf), 72 FM10K_STAT("rx_overrun_pf", rx_overrun_pf),
74 FM10K_STAT("rx_overrun_vf", rx_overrun_vf), 73 FM10K_STAT("rx_overrun_vf", rx_overrun_vf),
75 74
76 FM10K_STAT("timeout", stats.timeout.count),
77 FM10K_STAT("ur", stats.ur.count),
78 FM10K_STAT("ca", stats.ca.count),
79 FM10K_STAT("um", stats.um.count),
80 FM10K_STAT("xec", stats.xec.count),
81 FM10K_STAT("vlan_drop", stats.vlan_drop.count),
82 FM10K_STAT("loopback_drop", stats.loopback_drop.count),
83 FM10K_STAT("nodesc_drop", stats.nodesc_drop.count),
84
85 FM10K_STAT("swapi_status", hw.swapi.status), 75 FM10K_STAT("swapi_status", hw.swapi.status),
86 FM10K_STAT("mac_rules_used", hw.swapi.mac.used), 76 FM10K_STAT("mac_rules_used", hw.swapi.mac.used),
87 FM10K_STAT("mac_rules_avail", hw.swapi.mac.avail), 77 FM10K_STAT("mac_rules_avail", hw.swapi.mac.avail),
88 78
89 FM10K_STAT("mbx_tx_busy", hw.mbx.tx_busy), 79 FM10K_STAT("mbx_tx_busy", hw.mbx.tx_busy),
90 FM10K_STAT("mbx_tx_dropped", hw.mbx.tx_dropped), 80 FM10K_STAT("mbx_tx_oversized", hw.mbx.tx_dropped),
91 FM10K_STAT("mbx_tx_messages", hw.mbx.tx_messages), 81 FM10K_STAT("mbx_tx_messages", hw.mbx.tx_messages),
92 FM10K_STAT("mbx_tx_dwords", hw.mbx.tx_dwords), 82 FM10K_STAT("mbx_tx_dwords", hw.mbx.tx_dwords),
93 FM10K_STAT("mbx_rx_messages", hw.mbx.rx_messages), 83 FM10K_STAT("mbx_rx_messages", hw.mbx.rx_messages),
94 FM10K_STAT("mbx_rx_dwords", hw.mbx.rx_dwords), 84 FM10K_STAT("mbx_rx_dwords", hw.mbx.rx_dwords),
95 FM10K_STAT("mbx_rx_parse_err", hw.mbx.rx_parse_err), 85 FM10K_STAT("mbx_rx_parse_err", hw.mbx.rx_parse_err),
96 86
87 FM10K_STAT("tx_hang_count", tx_timeout_count),
88
97 FM10K_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts), 89 FM10K_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
98}; 90};
99 91
100#define FM10K_GLOBAL_STATS_LEN ARRAY_SIZE(fm10k_gstrings_stats) 92static const struct fm10k_stats fm10k_gstrings_pf_stats[] = {
93 FM10K_STAT("timeout", stats.timeout.count),
94 FM10K_STAT("ur", stats.ur.count),
95 FM10K_STAT("ca", stats.ca.count),
96 FM10K_STAT("um", stats.um.count),
97 FM10K_STAT("xec", stats.xec.count),
98 FM10K_STAT("vlan_drop", stats.vlan_drop.count),
99 FM10K_STAT("loopback_drop", stats.loopback_drop.count),
100 FM10K_STAT("nodesc_drop", stats.nodesc_drop.count),
101};
102
103#define FM10K_GLOBAL_STATS_LEN ARRAY_SIZE(fm10k_gstrings_global_stats)
104#define FM10K_PF_STATS_LEN ARRAY_SIZE(fm10k_gstrings_pf_stats)
101 105
102#define FM10K_QUEUE_STATS_LEN \ 106#define FM10K_QUEUE_STATS_LEN(_n) \
103 (MAX_QUEUES * 2 * (sizeof(struct fm10k_queue_stats) / sizeof(u64))) 107 ( (_n) * 2 * (sizeof(struct fm10k_queue_stats) / sizeof(u64)))
104 108
105#define FM10K_STATS_LEN (FM10K_GLOBAL_STATS_LEN + \ 109#define FM10K_STATIC_STATS_LEN (FM10K_GLOBAL_STATS_LEN + \
106 FM10K_NETDEV_STATS_LEN + \ 110 FM10K_NETDEV_STATS_LEN)
107 FM10K_QUEUE_STATS_LEN)
108 111
109static const char fm10k_gstrings_test[][ETH_GSTRING_LEN] = { 112static const char fm10k_gstrings_test[][ETH_GSTRING_LEN] = {
110 "Mailbox test (on/offline)" 113 "Mailbox test (on/offline)"
@@ -117,9 +120,9 @@ enum fm10k_self_test_types {
117 FM10K_TEST_MAX = FM10K_TEST_LEN 120 FM10K_TEST_MAX = FM10K_TEST_LEN
118}; 121};
119 122
120static void fm10k_get_strings(struct net_device *dev, u32 stringset, 123static void fm10k_get_strings(struct net_device *dev, u32 stringset, u8 *data)
121 u8 *data)
122{ 124{
125 struct fm10k_intfc *interface = netdev_priv(dev);
123 char *p = (char *)data; 126 char *p = (char *)data;
124 int i; 127 int i;
125 128
@@ -135,12 +138,19 @@ static void fm10k_get_strings(struct net_device *dev, u32 stringset,
135 p += ETH_GSTRING_LEN; 138 p += ETH_GSTRING_LEN;
136 } 139 }
137 for (i = 0; i < FM10K_GLOBAL_STATS_LEN; i++) { 140 for (i = 0; i < FM10K_GLOBAL_STATS_LEN; i++) {
138 memcpy(p, fm10k_gstrings_stats[i].stat_string, 141 memcpy(p, fm10k_gstrings_global_stats[i].stat_string,
139 ETH_GSTRING_LEN); 142 ETH_GSTRING_LEN);
140 p += ETH_GSTRING_LEN; 143 p += ETH_GSTRING_LEN;
141 } 144 }
142 145
143 for (i = 0; i < MAX_QUEUES; i++) { 146 if (interface->hw.mac.type != fm10k_mac_vf)
147 for (i = 0; i < FM10K_PF_STATS_LEN; i++) {
148 memcpy(p, fm10k_gstrings_pf_stats[i].stat_string,
149 ETH_GSTRING_LEN);
150 p += ETH_GSTRING_LEN;
151 }
152
153 for (i = 0; i < interface->hw.mac.max_queues; i++) {
144 sprintf(p, "tx_queue_%u_packets", i); 154 sprintf(p, "tx_queue_%u_packets", i);
145 p += ETH_GSTRING_LEN; 155 p += ETH_GSTRING_LEN;
146 sprintf(p, "tx_queue_%u_bytes", i); 156 sprintf(p, "tx_queue_%u_bytes", i);
@@ -156,18 +166,28 @@ static void fm10k_get_strings(struct net_device *dev, u32 stringset,
156 166
157static int fm10k_get_sset_count(struct net_device *dev, int sset) 167static int fm10k_get_sset_count(struct net_device *dev, int sset)
158{ 168{
169 struct fm10k_intfc *interface = netdev_priv(dev);
170 struct fm10k_hw *hw = &interface->hw;
171 int stats_len = FM10K_STATIC_STATS_LEN;
172
159 switch (sset) { 173 switch (sset) {
160 case ETH_SS_TEST: 174 case ETH_SS_TEST:
161 return FM10K_TEST_LEN; 175 return FM10K_TEST_LEN;
162 case ETH_SS_STATS: 176 case ETH_SS_STATS:
163 return FM10K_STATS_LEN; 177 stats_len += FM10K_QUEUE_STATS_LEN(hw->mac.max_queues);
178
179 if (hw->mac.type != fm10k_mac_vf)
180 stats_len += FM10K_PF_STATS_LEN;
181
182 return stats_len;
164 default: 183 default:
165 return -EOPNOTSUPP; 184 return -EOPNOTSUPP;
166 } 185 }
167} 186}
168 187
169static void fm10k_get_ethtool_stats(struct net_device *netdev, 188static void fm10k_get_ethtool_stats(struct net_device *netdev,
170 struct ethtool_stats *stats, u64 *data) 189 struct ethtool_stats __always_unused *stats,
190 u64 *data)
171{ 191{
172 const int stat_count = sizeof(struct fm10k_queue_stats) / sizeof(u64); 192 const int stat_count = sizeof(struct fm10k_queue_stats) / sizeof(u64);
173 struct fm10k_intfc *interface = netdev_priv(netdev); 193 struct fm10k_intfc *interface = netdev_priv(netdev);
@@ -184,12 +204,21 @@ static void fm10k_get_ethtool_stats(struct net_device *netdev,
184 } 204 }
185 205
186 for (i = 0; i < FM10K_GLOBAL_STATS_LEN; i++) { 206 for (i = 0; i < FM10K_GLOBAL_STATS_LEN; i++) {
187 p = (char *)interface + fm10k_gstrings_stats[i].stat_offset; 207 p = (char *)interface +
188 *(data++) = (fm10k_gstrings_stats[i].sizeof_stat == 208 fm10k_gstrings_global_stats[i].stat_offset;
209 *(data++) = (fm10k_gstrings_global_stats[i].sizeof_stat ==
189 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 210 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
190 } 211 }
191 212
192 for (i = 0; i < MAX_QUEUES; i++) { 213 if (interface->hw.mac.type != fm10k_mac_vf)
214 for (i = 0; i < FM10K_PF_STATS_LEN; i++) {
215 p = (char *)interface +
216 fm10k_gstrings_pf_stats[i].stat_offset;
217 *(data++) = (fm10k_gstrings_pf_stats[i].sizeof_stat ==
218 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
219 }
220
221 for (i = 0; i < interface->hw.mac.max_queues; i++) {
193 struct fm10k_ring *ring; 222 struct fm10k_ring *ring;
194 u64 *queue_stat; 223 u64 *queue_stat;
195 224
@@ -369,7 +398,7 @@ static void fm10k_get_drvinfo(struct net_device *dev,
369 strncpy(info->bus_info, pci_name(interface->pdev), 398 strncpy(info->bus_info, pci_name(interface->pdev),
370 sizeof(info->bus_info) - 1); 399 sizeof(info->bus_info) - 1);
371 400
372 info->n_stats = FM10K_STATS_LEN; 401 info->n_stats = fm10k_get_sset_count(dev, ETH_SS_STATS);
373 402
374 info->regdump_len = fm10k_get_regs_len(dev); 403 info->regdump_len = fm10k_get_regs_len(dev);
375} 404}
@@ -645,7 +674,7 @@ static int fm10k_get_rss_hash_opts(struct fm10k_intfc *interface,
645} 674}
646 675
647static int fm10k_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 676static int fm10k_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
648 u32 *rule_locs) 677 u32 __always_unused *rule_locs)
649{ 678{
650 struct fm10k_intfc *interface = netdev_priv(dev); 679 struct fm10k_intfc *interface = netdev_priv(dev);
651 int ret = -EOPNOTSUPP; 680 int ret = -EOPNOTSUPP;
@@ -851,7 +880,7 @@ static void fm10k_self_test(struct net_device *dev,
851 eth_test->flags |= ETH_TEST_FL_FAILED; 880 eth_test->flags |= ETH_TEST_FL_FAILED;
852} 881}
853 882
854static u32 fm10k_get_reta_size(struct net_device *netdev) 883static u32 fm10k_get_reta_size(struct net_device __always_unused *netdev)
855{ 884{
856 return FM10K_RETA_SIZE * FM10K_RETA_ENTRIES_PER_REG; 885 return FM10K_RETA_SIZE * FM10K_RETA_ENTRIES_PER_REG;
857} 886}
@@ -911,7 +940,7 @@ static int fm10k_set_reta(struct net_device *netdev, const u32 *indir)
911 return 0; 940 return 0;
912} 941}
913 942
914static u32 fm10k_get_rssrk_size(struct net_device *netdev) 943static u32 fm10k_get_rssrk_size(struct net_device __always_unused *netdev)
915{ 944{
916 return FM10K_RSSRK_SIZE * FM10K_RSSRK_ENTRIES_PER_REG; 945 return FM10K_RSSRK_SIZE * FM10K_RSSRK_ENTRIES_PER_REG;
917} 946}
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
index a02308f5048f..5b08e6284a3c 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -47,7 +47,7 @@ s32 fm10k_iov_event(struct fm10k_intfc *interface)
47{ 47{
48 struct fm10k_hw *hw = &interface->hw; 48 struct fm10k_hw *hw = &interface->hw;
49 struct fm10k_iov_data *iov_data; 49 struct fm10k_iov_data *iov_data;
50 s64 mbicr, vflre; 50 s64 vflre;
51 int i; 51 int i;
52 52
53 /* if there is no iov_data then there is no mailboxes to process */ 53 /* if there is no iov_data then there is no mailboxes to process */
@@ -63,7 +63,7 @@ s32 fm10k_iov_event(struct fm10k_intfc *interface)
63 goto read_unlock; 63 goto read_unlock;
64 64
65 if (!(fm10k_read_reg(hw, FM10K_EICR) & FM10K_EICR_VFLR)) 65 if (!(fm10k_read_reg(hw, FM10K_EICR) & FM10K_EICR_VFLR))
66 goto process_mbx; 66 goto read_unlock;
67 67
68 /* read VFLRE to determine if any VFs have been reset */ 68 /* read VFLRE to determine if any VFs have been reset */
69 do { 69 do {
@@ -86,32 +86,6 @@ s32 fm10k_iov_event(struct fm10k_intfc *interface)
86 } 86 }
87 } while (i != iov_data->num_vfs); 87 } while (i != iov_data->num_vfs);
88 88
89process_mbx:
90 /* read MBICR to determine which VFs require attention */
91 mbicr = fm10k_read_reg(hw, FM10K_MBICR(1));
92 mbicr <<= 32;
93 mbicr |= fm10k_read_reg(hw, FM10K_MBICR(0));
94
95 i = iov_data->next_vf_mbx ? : iov_data->num_vfs;
96
97 for (mbicr <<= 64 - i; i--; mbicr += mbicr) {
98 struct fm10k_mbx_info *mbx = &iov_data->vf_info[i].mbx;
99
100 if (mbicr >= 0)
101 continue;
102
103 if (!hw->mbx.ops.tx_ready(&hw->mbx, FM10K_VFMBX_MSG_MTU))
104 break;
105
106 mbx->ops.process(hw, mbx);
107 }
108
109 if (i >= 0) {
110 iov_data->next_vf_mbx = i + 1;
111 } else if (iov_data->next_vf_mbx) {
112 iov_data->next_vf_mbx = 0;
113 goto process_mbx;
114 }
115read_unlock: 89read_unlock:
116 rcu_read_unlock(); 90 rcu_read_unlock();
117 91
@@ -139,6 +113,13 @@ s32 fm10k_iov_mbx(struct fm10k_intfc *interface)
139 /* lock the mailbox for transmit and receive */ 113 /* lock the mailbox for transmit and receive */
140 fm10k_mbx_lock(interface); 114 fm10k_mbx_lock(interface);
141 115
116 /* Most VF messages sent to the PF cause the PF to respond by
117 * requesting from the SM mailbox. This means that too many VF
118 * messages processed at once could cause a mailbox timeout on the PF.
119 * To prevent this, store a pointer to the next VF mbx to process. Use
120 * that as the start of the loop so that we don't starve whichever VF
121 * got ignored on the previous run.
122 */
142process_mbx: 123process_mbx:
143 for (i = iov_data->next_vf_mbx ? : iov_data->num_vfs; i--;) { 124 for (i = iov_data->next_vf_mbx ? : iov_data->num_vfs; i--;) {
144 struct fm10k_vf_info *vf_info = &iov_data->vf_info[i]; 125 struct fm10k_vf_info *vf_info = &iov_data->vf_info[i];
@@ -155,10 +136,6 @@ process_mbx:
155 mbx->ops.connect(hw, mbx); 136 mbx->ops.connect(hw, mbx);
156 } 137 }
157 138
158 /* no work pending, then just continue */
159 if (mbx->ops.tx_complete(mbx) && !mbx->ops.rx_ready(mbx))
160 continue;
161
162 /* guarantee we have free space in the SM mailbox */ 139 /* guarantee we have free space in the SM mailbox */
163 if (!hw->mbx.ops.tx_ready(&hw->mbx, FM10K_VFMBX_MSG_MTU)) 140 if (!hw->mbx.ops.tx_ready(&hw->mbx, FM10K_VFMBX_MSG_MTU))
164 break; 141 break;
@@ -167,6 +144,10 @@ process_mbx:
167 mbx->ops.process(hw, mbx); 144 mbx->ops.process(hw, mbx);
168 } 145 }
169 146
147 /* if we stopped processing mailboxes early, update next_vf_mbx.
148 * Otherwise, reset next_vf_mbx, and restart loop so that we process
149 * the remaining mailboxes we skipped at the start.
150 */
170 if (i >= 0) { 151 if (i >= 0) {
171 iov_data->next_vf_mbx = i + 1; 152 iov_data->next_vf_mbx = i + 1;
172 } else if (iov_data->next_vf_mbx) { 153 } else if (iov_data->next_vf_mbx) {
@@ -488,8 +469,8 @@ int fm10k_ndo_set_vf_vlan(struct net_device *netdev, int vf_idx, u16 vid,
488 return 0; 469 return 0;
489} 470}
490 471
491int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx, int unused, 472int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx,
492 int rate) 473 int __always_unused unused, int rate)
493{ 474{
494 struct fm10k_intfc *interface = netdev_priv(netdev); 475 struct fm10k_intfc *interface = netdev_priv(netdev);
495 struct fm10k_iov_data *iov_data = interface->iov_data; 476 struct fm10k_iov_data *iov_data = interface->iov_data;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index c325bc0c8338..1b0661e3573b 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -28,7 +28,7 @@
28 28
29#include "fm10k.h" 29#include "fm10k.h"
30 30
31#define DRV_VERSION "0.12.2-k" 31#define DRV_VERSION "0.15.2-k"
32const char fm10k_driver_version[] = DRV_VERSION; 32const char fm10k_driver_version[] = DRV_VERSION;
33char fm10k_driver_name[] = "fm10k"; 33char fm10k_driver_name[] = "fm10k";
34static const char fm10k_driver_string[] = 34static const char fm10k_driver_string[] =
@@ -41,6 +41,9 @@ MODULE_DESCRIPTION("Intel(R) Ethernet Switch Host Interface Driver");
41MODULE_LICENSE("GPL"); 41MODULE_LICENSE("GPL");
42MODULE_VERSION(DRV_VERSION); 42MODULE_VERSION(DRV_VERSION);
43 43
44/* single workqueue for entire fm10k driver */
45struct workqueue_struct *fm10k_workqueue = NULL;
46
44/** 47/**
45 * fm10k_init_module - Driver Registration Routine 48 * fm10k_init_module - Driver Registration Routine
46 * 49 *
@@ -52,6 +55,10 @@ static int __init fm10k_init_module(void)
52 pr_info("%s - version %s\n", fm10k_driver_string, fm10k_driver_version); 55 pr_info("%s - version %s\n", fm10k_driver_string, fm10k_driver_version);
53 pr_info("%s\n", fm10k_copyright); 56 pr_info("%s\n", fm10k_copyright);
54 57
58 /* create driver workqueue */
59 if (!fm10k_workqueue)
60 fm10k_workqueue = create_workqueue("fm10k");
61
55 fm10k_dbg_init(); 62 fm10k_dbg_init();
56 63
57 return fm10k_register_pci_driver(); 64 return fm10k_register_pci_driver();
@@ -69,6 +76,11 @@ static void __exit fm10k_exit_module(void)
69 fm10k_unregister_pci_driver(); 76 fm10k_unregister_pci_driver();
70 77
71 fm10k_dbg_exit(); 78 fm10k_dbg_exit();
79
80 /* destroy driver workqueue */
81 flush_workqueue(fm10k_workqueue);
82 destroy_workqueue(fm10k_workqueue);
83 fm10k_workqueue = NULL;
72} 84}
73module_exit(fm10k_exit_module); 85module_exit(fm10k_exit_module);
74 86
@@ -209,7 +221,7 @@ static inline bool fm10k_page_is_reserved(struct page *page)
209 221
210static bool fm10k_can_reuse_rx_page(struct fm10k_rx_buffer *rx_buffer, 222static bool fm10k_can_reuse_rx_page(struct fm10k_rx_buffer *rx_buffer,
211 struct page *page, 223 struct page *page,
212 unsigned int truesize) 224 unsigned int __maybe_unused truesize)
213{ 225{
214 /* avoid re-using remote pages */ 226 /* avoid re-using remote pages */
215 if (unlikely(fm10k_page_is_reserved(page))) 227 if (unlikely(fm10k_page_is_reserved(page)))
@@ -240,7 +252,6 @@ static bool fm10k_can_reuse_rx_page(struct fm10k_rx_buffer *rx_buffer,
240 252
241/** 253/**
242 * fm10k_add_rx_frag - Add contents of Rx buffer to sk_buff 254 * fm10k_add_rx_frag - Add contents of Rx buffer to sk_buff
243 * @rx_ring: rx descriptor ring to transact packets on
244 * @rx_buffer: buffer containing page to add 255 * @rx_buffer: buffer containing page to add
245 * @rx_desc: descriptor containing length of buffer written by hardware 256 * @rx_desc: descriptor containing length of buffer written by hardware
246 * @skb: sk_buff to place the data into 257 * @skb: sk_buff to place the data into
@@ -253,8 +264,7 @@ static bool fm10k_can_reuse_rx_page(struct fm10k_rx_buffer *rx_buffer,
253 * The function will then update the page offset if necessary and return 264 * The function will then update the page offset if necessary and return
254 * true if the buffer can be reused by the interface. 265 * true if the buffer can be reused by the interface.
255 **/ 266 **/
256static bool fm10k_add_rx_frag(struct fm10k_ring *rx_ring, 267static bool fm10k_add_rx_frag(struct fm10k_rx_buffer *rx_buffer,
257 struct fm10k_rx_buffer *rx_buffer,
258 union fm10k_rx_desc *rx_desc, 268 union fm10k_rx_desc *rx_desc,
259 struct sk_buff *skb) 269 struct sk_buff *skb)
260{ 270{
@@ -330,7 +340,7 @@ static struct sk_buff *fm10k_fetch_rx_buffer(struct fm10k_ring *rx_ring,
330 DMA_FROM_DEVICE); 340 DMA_FROM_DEVICE);
331 341
332 /* pull page into skb */ 342 /* pull page into skb */
333 if (fm10k_add_rx_frag(rx_ring, rx_buffer, rx_desc, skb)) { 343 if (fm10k_add_rx_frag(rx_buffer, rx_desc, skb)) {
334 /* hand second half of page back to the ring */ 344 /* hand second half of page back to the ring */
335 fm10k_reuse_rx_page(rx_ring, rx_buffer); 345 fm10k_reuse_rx_page(rx_ring, rx_buffer);
336 } else { 346 } else {
@@ -412,7 +422,7 @@ static void fm10k_rx_hwtstamp(struct fm10k_ring *rx_ring,
412} 422}
413 423
414static void fm10k_type_trans(struct fm10k_ring *rx_ring, 424static void fm10k_type_trans(struct fm10k_ring *rx_ring,
415 union fm10k_rx_desc *rx_desc, 425 union fm10k_rx_desc __maybe_unused *rx_desc,
416 struct sk_buff *skb) 426 struct sk_buff *skb)
417{ 427{
418 struct net_device *dev = rx_ring->netdev; 428 struct net_device *dev = rx_ring->netdev;
@@ -509,8 +519,6 @@ static bool fm10k_is_non_eop(struct fm10k_ring *rx_ring,
509 519
510/** 520/**
511 * fm10k_pull_tail - fm10k specific version of skb_pull_tail 521 * fm10k_pull_tail - fm10k specific version of skb_pull_tail
512 * @rx_ring: rx descriptor ring packet is being transacted on
513 * @rx_desc: pointer to the EOP Rx descriptor
514 * @skb: pointer to current skb being adjusted 522 * @skb: pointer to current skb being adjusted
515 * 523 *
516 * This function is an fm10k specific version of __pskb_pull_tail. The 524 * This function is an fm10k specific version of __pskb_pull_tail. The
@@ -520,9 +528,7 @@ static bool fm10k_is_non_eop(struct fm10k_ring *rx_ring,
520 * As a result we can do things like drop a frag and maintain an accurate 528 * As a result we can do things like drop a frag and maintain an accurate
521 * truesize for the skb. 529 * truesize for the skb.
522 */ 530 */
523static void fm10k_pull_tail(struct fm10k_ring *rx_ring, 531static void fm10k_pull_tail(struct sk_buff *skb)
524 union fm10k_rx_desc *rx_desc,
525 struct sk_buff *skb)
526{ 532{
527 struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0]; 533 struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
528 unsigned char *va; 534 unsigned char *va;
@@ -576,7 +582,7 @@ static bool fm10k_cleanup_headers(struct fm10k_ring *rx_ring,
576 582
577 /* place header in linear portion of buffer */ 583 /* place header in linear portion of buffer */
578 if (skb_is_nonlinear(skb)) 584 if (skb_is_nonlinear(skb))
579 fm10k_pull_tail(rx_ring, rx_desc, skb); 585 fm10k_pull_tail(skb);
580 586
581 /* if eth_skb_pad returns an error the skb was freed */ 587 /* if eth_skb_pad returns an error the skb was freed */
582 if (eth_skb_pad(skb)) 588 if (eth_skb_pad(skb))
@@ -1197,7 +1203,6 @@ void fm10k_tx_timeout_reset(struct fm10k_intfc *interface)
1197{ 1203{
1198 /* Do the reset outside of interrupt context */ 1204 /* Do the reset outside of interrupt context */
1199 if (!test_bit(__FM10K_DOWN, &interface->state)) { 1205 if (!test_bit(__FM10K_DOWN, &interface->state)) {
1200 netdev_err(interface->netdev, "Reset interface\n");
1201 interface->tx_timeout_count++; 1206 interface->tx_timeout_count++;
1202 interface->flags |= FM10K_FLAG_RESET_REQUESTED; 1207 interface->flags |= FM10K_FLAG_RESET_REQUESTED;
1203 fm10k_service_event_schedule(interface); 1208 fm10k_service_event_schedule(interface);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index 14ee696e9830..1b2738380518 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -126,6 +126,18 @@ static u16 fm10k_fifo_head_drop(struct fm10k_mbx_fifo *fifo)
126} 126}
127 127
128/** 128/**
129 * fm10k_fifo_drop_all - Drop all messages in FIFO
130 * @fifo: pointer to FIFO
131 *
132 * This function resets the head pointer to drop all messages in the FIFO,
133 * and ensure the FIFO is empty.
134 **/
135static void fm10k_fifo_drop_all(struct fm10k_mbx_fifo *fifo)
136{
137 fifo->head = fifo->tail;
138}
139
140/**
129 * fm10k_mbx_index_len - Convert a head/tail index into a length value 141 * fm10k_mbx_index_len - Convert a head/tail index into a length value
130 * @mbx: pointer to mailbox 142 * @mbx: pointer to mailbox
131 * @head: head index 143 * @head: head index
@@ -315,7 +327,7 @@ static u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
315 } while (total_len < len); 327 } while (total_len < len);
316 328
317 /* message extends out of pushed section, but fits in FIFO */ 329 /* message extends out of pushed section, but fits in FIFO */
318 if ((len < total_len) && (msg_len <= mbx->rx.size)) 330 if ((len < total_len) && (msg_len <= mbx->max_size))
319 return 0; 331 return 0;
320 332
321 /* return length of invalid section */ 333 /* return length of invalid section */
@@ -326,8 +338,7 @@ static u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
326 * fm10k_mbx_write_copy - pulls data off of Tx FIFO and places it in mbmem 338 * fm10k_mbx_write_copy - pulls data off of Tx FIFO and places it in mbmem
327 * @mbx: pointer to mailbox 339 * @mbx: pointer to mailbox
328 * 340 *
329 * This function will take a section of the Rx FIFO and copy it into the 341 * This function will take a section of the Tx FIFO and copy it into the
330 mbx->tail--;
331 * mailbox memory. The offset in mbmem is based on the lower bits of the 342 * mailbox memory. The offset in mbmem is based on the lower bits of the
332 * tail and len determines the length to copy. 343 * tail and len determines the length to copy.
333 **/ 344 **/
@@ -818,7 +829,7 @@ static void fm10k_mbx_write(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
818 /* write new msg header to notify recipient of change */ 829 /* write new msg header to notify recipient of change */
819 fm10k_write_reg(hw, mbmem, mbx->mbx_hdr); 830 fm10k_write_reg(hw, mbmem, mbx->mbx_hdr);
820 831
821 /* write mailbox to sent interrupt */ 832 /* write mailbox to send interrupt */
822 if (mbx->mbx_lock) 833 if (mbx->mbx_lock)
823 fm10k_write_reg(hw, mbx->mbx_reg, mbx->mbx_lock); 834 fm10k_write_reg(hw, mbx->mbx_reg, mbx->mbx_lock);
824 835
@@ -1052,8 +1063,11 @@ static void fm10k_mbx_reset_work(struct fm10k_mbx_info *mbx)
1052 * @mbx: pointer to mailbox 1063 * @mbx: pointer to mailbox
1053 * @size: new value for max_size 1064 * @size: new value for max_size
1054 * 1065 *
1055 * This function will update the max_size value and drop any outgoing messages 1066 * This function updates the max_size value and drops any outgoing messages
1056 * from the head of the Tx FIFO that are larger than max_size. 1067 * at the head of the Tx FIFO if they are larger than max_size. It does not
1068 * drop all messages, as this is too difficult to parse and remove them from
1069 * the FIFO. Instead, rely on the checking to ensure that messages larger
1070 * than max_size aren't pushed into the memory buffer.
1057 **/ 1071 **/
1058static void fm10k_mbx_update_max_size(struct fm10k_mbx_info *mbx, u16 size) 1072static void fm10k_mbx_update_max_size(struct fm10k_mbx_info *mbx, u16 size)
1059{ 1073{
@@ -1371,9 +1385,11 @@ static void fm10k_mbx_disconnect(struct fm10k_hw *hw,
1371 timeout -= FM10K_MBX_POLL_DELAY; 1385 timeout -= FM10K_MBX_POLL_DELAY;
1372 } while ((timeout > 0) && (mbx->state != FM10K_STATE_CLOSED)); 1386 } while ((timeout > 0) && (mbx->state != FM10K_STATE_CLOSED));
1373 1387
1374 /* in case we didn't close just force the mailbox into shutdown */ 1388 /* in case we didn't close, just force the mailbox into shutdown and
1389 * drop all left over messages in the FIFO.
1390 */
1375 fm10k_mbx_connect_reset(mbx); 1391 fm10k_mbx_connect_reset(mbx);
1376 fm10k_mbx_update_max_size(mbx, 0); 1392 fm10k_fifo_drop_all(&mbx->tx);
1377 1393
1378 fm10k_write_reg(hw, mbx->mbmem_reg, 0); 1394 fm10k_write_reg(hw, mbx->mbmem_reg, 0);
1379} 1395}
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index d5b303dad95e..2f4f41b7eae7 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -770,15 +770,15 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
770 if (hw->mac.vlan_override) 770 if (hw->mac.vlan_override)
771 return -EACCES; 771 return -EACCES;
772 772
773 /* if default VLAN is already present do nothing */
774 if (vid == hw->mac.default_vid)
775 return -EBUSY;
776
777 /* update active_vlans bitmask */ 773 /* update active_vlans bitmask */
778 set_bit(vid, interface->active_vlans); 774 set_bit(vid, interface->active_vlans);
779 if (!set) 775 if (!set)
780 clear_bit(vid, interface->active_vlans); 776 clear_bit(vid, interface->active_vlans);
781 777
778 /* if default VLAN is already present do nothing */
779 if (vid == hw->mac.default_vid)
780 return 0;
781
782 fm10k_mbx_lock(interface); 782 fm10k_mbx_lock(interface);
783 783
784 /* only need to update the VLAN if not in promiscuous mode */ 784 /* only need to update the VLAN if not in promiscuous mode */
@@ -970,14 +970,7 @@ static void fm10k_set_rx_mode(struct net_device *dev)
970 970
971 fm10k_mbx_lock(interface); 971 fm10k_mbx_lock(interface);
972 972
973 /* synchronize all of the addresses */ 973 /* update xcast mode first, but only if it changed */
974 if (xcast_mode != FM10K_XCAST_MODE_PROMISC) {
975 __dev_uc_sync(dev, fm10k_uc_sync, fm10k_uc_unsync);
976 if (xcast_mode != FM10K_XCAST_MODE_ALLMULTI)
977 __dev_mc_sync(dev, fm10k_mc_sync, fm10k_mc_unsync);
978 }
979
980 /* if we aren't changing modes there is nothing to do */
981 if (interface->xcast_mode != xcast_mode) { 974 if (interface->xcast_mode != xcast_mode) {
982 /* update VLAN table */ 975 /* update VLAN table */
983 if (xcast_mode == FM10K_XCAST_MODE_PROMISC) 976 if (xcast_mode == FM10K_XCAST_MODE_PROMISC)
@@ -992,6 +985,13 @@ static void fm10k_set_rx_mode(struct net_device *dev)
992 interface->xcast_mode = xcast_mode; 985 interface->xcast_mode = xcast_mode;
993 } 986 }
994 987
988 /* synchronize all of the addresses */
989 if (xcast_mode != FM10K_XCAST_MODE_PROMISC) {
990 __dev_uc_sync(dev, fm10k_uc_sync, fm10k_uc_unsync);
991 if (xcast_mode != FM10K_XCAST_MODE_ALLMULTI)
992 __dev_mc_sync(dev, fm10k_mc_sync, fm10k_mc_unsync);
993 }
994
995 fm10k_mbx_unlock(interface); 995 fm10k_mbx_unlock(interface);
996} 996}
997 997
@@ -1051,6 +1051,9 @@ void fm10k_restore_rx_state(struct fm10k_intfc *interface)
1051 vid, true, 0); 1051 vid, true, 0);
1052 } 1052 }
1053 1053
1054 /* update xcast mode before syncronizing addresses */
1055 hw->mac.ops.update_xcast_mode(hw, glort, xcast_mode);
1056
1054 /* synchronize all of the addresses */ 1057 /* synchronize all of the addresses */
1055 if (xcast_mode != FM10K_XCAST_MODE_PROMISC) { 1058 if (xcast_mode != FM10K_XCAST_MODE_PROMISC) {
1056 __dev_uc_sync(netdev, fm10k_uc_sync, fm10k_uc_unsync); 1059 __dev_uc_sync(netdev, fm10k_uc_sync, fm10k_uc_unsync);
@@ -1058,9 +1061,6 @@ void fm10k_restore_rx_state(struct fm10k_intfc *interface)
1058 __dev_mc_sync(netdev, fm10k_mc_sync, fm10k_mc_unsync); 1061 __dev_mc_sync(netdev, fm10k_mc_sync, fm10k_mc_unsync);
1059 } 1062 }
1060 1063
1061 /* update xcast mode */
1062 hw->mac.ops.update_xcast_mode(hw, glort, xcast_mode);
1063
1064 fm10k_mbx_unlock(interface); 1064 fm10k_mbx_unlock(interface);
1065 1065
1066 /* record updated xcast mode state */ 1066 /* record updated xcast mode state */
@@ -1126,7 +1126,7 @@ static struct rtnl_link_stats64 *fm10k_get_stats64(struct net_device *netdev,
1126 } 1126 }
1127 1127
1128 for (i = 0; i < interface->num_tx_queues; i++) { 1128 for (i = 0; i < interface->num_tx_queues; i++) {
1129 ring = ACCESS_ONCE(interface->rx_ring[i]); 1129 ring = ACCESS_ONCE(interface->tx_ring[i]);
1130 1130
1131 if (!ring) 1131 if (!ring)
1132 continue; 1132 continue;
@@ -1382,6 +1382,9 @@ static const struct net_device_ops fm10k_netdev_ops = {
1382 .ndo_do_ioctl = fm10k_ioctl, 1382 .ndo_do_ioctl = fm10k_ioctl,
1383 .ndo_dfwd_add_station = fm10k_dfwd_add_station, 1383 .ndo_dfwd_add_station = fm10k_dfwd_add_station,
1384 .ndo_dfwd_del_station = fm10k_dfwd_del_station, 1384 .ndo_dfwd_del_station = fm10k_dfwd_del_station,
1385#ifdef CONFIG_NET_POLL_CONTROLLER
1386 .ndo_poll_controller = fm10k_netpoll,
1387#endif
1385 .ndo_features_check = fm10k_features_check, 1388 .ndo_features_check = fm10k_features_check,
1386}; 1389};
1387 1390
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 8978d55a1c51..df9fda38bdd1 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -94,7 +94,7 @@ void fm10k_service_event_schedule(struct fm10k_intfc *interface)
94{ 94{
95 if (!test_bit(__FM10K_SERVICE_DISABLE, &interface->state) && 95 if (!test_bit(__FM10K_SERVICE_DISABLE, &interface->state) &&
96 !test_and_set_bit(__FM10K_SERVICE_SCHED, &interface->state)) 96 !test_and_set_bit(__FM10K_SERVICE_SCHED, &interface->state))
97 schedule_work(&interface->service_task); 97 queue_work(fm10k_workqueue, &interface->service_task);
98} 98}
99 99
100static void fm10k_service_event_complete(struct fm10k_intfc *interface) 100static void fm10k_service_event_complete(struct fm10k_intfc *interface)
@@ -191,7 +191,6 @@ static void fm10k_reset_subtask(struct fm10k_intfc *interface)
191 interface->flags &= ~FM10K_FLAG_RESET_REQUESTED; 191 interface->flags &= ~FM10K_FLAG_RESET_REQUESTED;
192 192
193 netdev_err(interface->netdev, "Reset interface\n"); 193 netdev_err(interface->netdev, "Reset interface\n");
194 interface->tx_timeout_count++;
195 194
196 fm10k_reinit(interface); 195 fm10k_reinit(interface);
197} 196}
@@ -357,11 +356,10 @@ void fm10k_update_stats(struct fm10k_intfc *interface)
357 net_stats->rx_packets = pkts; 356 net_stats->rx_packets = pkts;
358 interface->alloc_failed = alloc_failed; 357 interface->alloc_failed = alloc_failed;
359 interface->rx_csum_errors = rx_csum_errors; 358 interface->rx_csum_errors = rx_csum_errors;
360 interface->rx_errors = rx_errors;
361 359
362 hw->mac.ops.update_hw_stats(hw, &interface->stats); 360 hw->mac.ops.update_hw_stats(hw, &interface->stats);
363 361
364 for (i = 0; i < FM10K_MAX_QUEUES_PF; i++) { 362 for (i = 0; i < hw->mac.max_queues; i++) {
365 struct fm10k_hw_stats_q *q = &interface->stats.q[i]; 363 struct fm10k_hw_stats_q *q = &interface->stats.q[i];
366 364
367 tx_bytes_nic += q->tx_bytes.count; 365 tx_bytes_nic += q->tx_bytes.count;
@@ -378,7 +376,7 @@ void fm10k_update_stats(struct fm10k_intfc *interface)
378 interface->rx_drops_nic = rx_drops_nic; 376 interface->rx_drops_nic = rx_drops_nic;
379 377
380 /* Fill out the OS statistics structure */ 378 /* Fill out the OS statistics structure */
381 net_stats->rx_errors = interface->stats.xec.count; 379 net_stats->rx_errors = rx_errors;
382 net_stats->rx_dropped = interface->stats.nodesc_drop.count; 380 net_stats->rx_dropped = interface->stats.nodesc_drop.count;
383} 381}
384 382
@@ -808,7 +806,7 @@ static void fm10k_napi_enable_all(struct fm10k_intfc *interface)
808 } 806 }
809} 807}
810 808
811static irqreturn_t fm10k_msix_clean_rings(int irq, void *data) 809static irqreturn_t fm10k_msix_clean_rings(int __always_unused irq, void *data)
812{ 810{
813 struct fm10k_q_vector *q_vector = data; 811 struct fm10k_q_vector *q_vector = data;
814 812
@@ -818,7 +816,7 @@ static irqreturn_t fm10k_msix_clean_rings(int irq, void *data)
818 return IRQ_HANDLED; 816 return IRQ_HANDLED;
819} 817}
820 818
821static irqreturn_t fm10k_msix_mbx_vf(int irq, void *data) 819static irqreturn_t fm10k_msix_mbx_vf(int __always_unused irq, void *data)
822{ 820{
823 struct fm10k_intfc *interface = data; 821 struct fm10k_intfc *interface = data;
824 struct fm10k_hw *hw = &interface->hw; 822 struct fm10k_hw *hw = &interface->hw;
@@ -840,6 +838,28 @@ static irqreturn_t fm10k_msix_mbx_vf(int irq, void *data)
840 return IRQ_HANDLED; 838 return IRQ_HANDLED;
841} 839}
842 840
841#ifdef CONFIG_NET_POLL_CONTROLLER
842/**
843 * fm10k_netpoll - A Polling 'interrupt' handler
844 * @netdev: network interface device structure
845 *
846 * This is used by netconsole to send skbs without having to re-enable
847 * interrupts. It's not called while the normal interrupt routine is executing.
848 **/
849void fm10k_netpoll(struct net_device *netdev)
850{
851 struct fm10k_intfc *interface = netdev_priv(netdev);
852 int i;
853
854 /* if interface is down do nothing */
855 if (test_bit(__FM10K_DOWN, &interface->state))
856 return;
857
858 for (i = 0; i < interface->num_q_vectors; i++)
859 fm10k_msix_clean_rings(0, interface->q_vector[i]);
860}
861
862#endif
843#define FM10K_ERR_MSG(type) case (type): error = #type; break 863#define FM10K_ERR_MSG(type) case (type): error = #type; break
844static void fm10k_print_fault(struct fm10k_intfc *interface, int type, 864static void fm10k_print_fault(struct fm10k_intfc *interface, int type,
845 struct fm10k_fault *fault) 865 struct fm10k_fault *fault)
@@ -964,7 +984,7 @@ static void fm10k_reset_drop_on_empty(struct fm10k_intfc *interface, u32 eicr)
964 } 984 }
965} 985}
966 986
967static irqreturn_t fm10k_msix_mbx_pf(int irq, void *data) 987static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
968{ 988{
969 struct fm10k_intfc *interface = data; 989 struct fm10k_intfc *interface = data;
970 struct fm10k_hw *hw = &interface->hw; 990 struct fm10k_hw *hw = &interface->hw;
@@ -986,6 +1006,7 @@ static irqreturn_t fm10k_msix_mbx_pf(int irq, void *data)
986 /* service mailboxes */ 1006 /* service mailboxes */
987 if (fm10k_mbx_trylock(interface)) { 1007 if (fm10k_mbx_trylock(interface)) {
988 mbx->ops.process(hw, mbx); 1008 mbx->ops.process(hw, mbx);
1009 /* handle VFLRE events */
989 fm10k_iov_event(interface); 1010 fm10k_iov_event(interface);
990 fm10k_mbx_unlock(interface); 1011 fm10k_mbx_unlock(interface);
991 } 1012 }
@@ -1002,6 +1023,8 @@ static irqreturn_t fm10k_msix_mbx_pf(int irq, void *data)
1002 1023
1003 /* we should validate host state after interrupt event */ 1024 /* we should validate host state after interrupt event */
1004 hw->mac.get_host_state = 1; 1025 hw->mac.get_host_state = 1;
1026
1027 /* validate host state, and handle VF mailboxes in the service task */
1005 fm10k_service_event_schedule(interface); 1028 fm10k_service_event_schedule(interface);
1006 1029
1007 /* re-enable mailbox interrupt and indicate 20us delay */ 1030 /* re-enable mailbox interrupt and indicate 20us delay */
@@ -1069,7 +1092,7 @@ static s32 fm10k_mbx_mac_addr(struct fm10k_hw *hw, u32 **results,
1069} 1092}
1070 1093
1071static s32 fm10k_1588_msg_vf(struct fm10k_hw *hw, u32 **results, 1094static s32 fm10k_1588_msg_vf(struct fm10k_hw *hw, u32 **results,
1072 struct fm10k_mbx_info *mbx) 1095 struct fm10k_mbx_info __always_unused *mbx)
1073{ 1096{
1074 struct fm10k_intfc *interface; 1097 struct fm10k_intfc *interface;
1075 u64 timestamp; 1098 u64 timestamp;
@@ -1089,7 +1112,7 @@ static s32 fm10k_1588_msg_vf(struct fm10k_hw *hw, u32 **results,
1089 1112
1090/* generic error handler for mailbox issues */ 1113/* generic error handler for mailbox issues */
1091static s32 fm10k_mbx_error(struct fm10k_hw *hw, u32 **results, 1114static s32 fm10k_mbx_error(struct fm10k_hw *hw, u32 **results,
1092 struct fm10k_mbx_info *mbx) 1115 struct fm10k_mbx_info __always_unused *mbx)
1093{ 1116{
1094 struct fm10k_intfc *interface; 1117 struct fm10k_intfc *interface;
1095 struct pci_dev *pdev; 1118 struct pci_dev *pdev;
@@ -1165,7 +1188,7 @@ static s32 fm10k_lport_map(struct fm10k_hw *hw, u32 **results,
1165} 1188}
1166 1189
1167static s32 fm10k_update_pvid(struct fm10k_hw *hw, u32 **results, 1190static s32 fm10k_update_pvid(struct fm10k_hw *hw, u32 **results,
1168 struct fm10k_mbx_info *mbx) 1191 struct fm10k_mbx_info __always_unused *mbx)
1169{ 1192{
1170 struct fm10k_intfc *interface; 1193 struct fm10k_intfc *interface;
1171 u16 glort, pvid; 1194 u16 glort, pvid;
@@ -1206,7 +1229,7 @@ static s32 fm10k_update_pvid(struct fm10k_hw *hw, u32 **results,
1206} 1229}
1207 1230
1208static s32 fm10k_1588_msg_pf(struct fm10k_hw *hw, u32 **results, 1231static s32 fm10k_1588_msg_pf(struct fm10k_hw *hw, u32 **results,
1209 struct fm10k_mbx_info *mbx) 1232 struct fm10k_mbx_info __always_unused *mbx)
1210{ 1233{
1211 struct fm10k_swapi_1588_timestamp timestamp; 1234 struct fm10k_swapi_1588_timestamp timestamp;
1212 struct fm10k_iov_data *iov_data; 1235 struct fm10k_iov_data *iov_data;
@@ -1488,7 +1511,7 @@ void fm10k_up(struct fm10k_intfc *interface)
1488 /* enable transmits */ 1511 /* enable transmits */
1489 netif_tx_start_all_queues(interface->netdev); 1512 netif_tx_start_all_queues(interface->netdev);
1490 1513
1491 /* kick off the service timer */ 1514 /* kick off the service timer now */
1492 hw->mac.get_host_state = 1; 1515 hw->mac.get_host_state = 1;
1493 mod_timer(&interface->service_timer, jiffies); 1516 mod_timer(&interface->service_timer, jiffies);
1494} 1517}
@@ -1528,8 +1551,6 @@ void fm10k_down(struct fm10k_intfc *interface)
1528 /* disable polling routines */ 1551 /* disable polling routines */
1529 fm10k_napi_disable_all(interface); 1552 fm10k_napi_disable_all(interface);
1530 1553
1531 del_timer_sync(&interface->service_timer);
1532
1533 /* capture stats one last time before stopping interface */ 1554 /* capture stats one last time before stopping interface */
1534 fm10k_update_stats(interface); 1555 fm10k_update_stats(interface);
1535 1556
@@ -1655,6 +1676,9 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
1655 (unsigned long)interface); 1676 (unsigned long)interface);
1656 INIT_WORK(&interface->service_task, fm10k_service_task); 1677 INIT_WORK(&interface->service_task, fm10k_service_task);
1657 1678
1679 /* kick off service timer now, even when interface is down */
1680 mod_timer(&interface->service_timer, (HZ * 2) + jiffies);
1681
1658 /* Intitialize timestamp data */ 1682 /* Intitialize timestamp data */
1659 fm10k_ts_init(interface); 1683 fm10k_ts_init(interface);
1660 1684
@@ -1871,6 +1895,8 @@ static void fm10k_remove(struct pci_dev *pdev)
1871 struct fm10k_intfc *interface = pci_get_drvdata(pdev); 1895 struct fm10k_intfc *interface = pci_get_drvdata(pdev);
1872 struct net_device *netdev = interface->netdev; 1896 struct net_device *netdev = interface->netdev;
1873 1897
1898 del_timer_sync(&interface->service_timer);
1899
1874 set_bit(__FM10K_SERVICE_DISABLE, &interface->state); 1900 set_bit(__FM10K_SERVICE_DISABLE, &interface->state);
1875 cancel_work_sync(&interface->service_task); 1901 cancel_work_sync(&interface->service_task);
1876 1902
@@ -1984,7 +2010,8 @@ static int fm10k_resume(struct pci_dev *pdev)
1984 * a sleep state. The fm10k hardware does not support wake on lan so the 2010 * a sleep state. The fm10k hardware does not support wake on lan so the
1985 * driver simply needs to shut down the device so it is in a low power state. 2011 * driver simply needs to shut down the device so it is in a low power state.
1986 **/ 2012 **/
1987static int fm10k_suspend(struct pci_dev *pdev, pm_message_t state) 2013static int fm10k_suspend(struct pci_dev *pdev,
2014 pm_message_t __always_unused state)
1988{ 2015{
1989 struct fm10k_intfc *interface = pci_get_drvdata(pdev); 2016 struct fm10k_intfc *interface = pci_get_drvdata(pdev);
1990 struct net_device *netdev = interface->netdev; 2017 struct net_device *netdev = interface->netdev;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index 159cd8463800..891e21874b2a 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -329,6 +329,9 @@ static s32 fm10k_update_xc_addr_pf(struct fm10k_hw *hw, u16 glort,
329 struct fm10k_mac_update mac_update; 329 struct fm10k_mac_update mac_update;
330 u32 msg[5]; 330 u32 msg[5];
331 331
332 /* clear set bit from VLAN ID */
333 vid &= ~FM10K_VLAN_CLEAR;
334
332 /* if glort or vlan are not valid return error */ 335 /* if glort or vlan are not valid return error */
333 if (!fm10k_glort_valid_pf(hw, glort) || vid >= FM10K_VLAN_TABLE_VID_MAX) 336 if (!fm10k_glort_valid_pf(hw, glort) || vid >= FM10K_VLAN_TABLE_VID_MAX)
334 return FM10K_ERR_PARAM; 337 return FM10K_ERR_PARAM;
@@ -676,7 +679,8 @@ static s32 fm10k_iov_assign_resources_pf(struct fm10k_hw *hw, u16 num_vfs,
676 /* loop through unallocated rings assigning them back to PF */ 679 /* loop through unallocated rings assigning them back to PF */
677 for (i = FM10K_MAX_QUEUES_PF; i < vf_q_idx; i++) { 680 for (i = FM10K_MAX_QUEUES_PF; i < vf_q_idx; i++) {
678 fm10k_write_reg(hw, FM10K_TXDCTL(i), 0); 681 fm10k_write_reg(hw, FM10K_TXDCTL(i), 0);
679 fm10k_write_reg(hw, FM10K_TXQCTL(i), FM10K_TXQCTL_PF | vid); 682 fm10k_write_reg(hw, FM10K_TXQCTL(i), FM10K_TXQCTL_PF |
683 FM10K_TXQCTL_UNLIMITED_BW | vid);
680 fm10k_write_reg(hw, FM10K_RXQCTL(i), FM10K_RXQCTL_PF); 684 fm10k_write_reg(hw, FM10K_RXQCTL(i), FM10K_RXQCTL_PF);
681 } 685 }
682 686
@@ -1249,8 +1253,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
1249 } 1253 }
1250 1254
1251 /* notify switch of request for new multicast address */ 1255 /* notify switch of request for new multicast address */
1252 err = hw->mac.ops.update_mc_addr(hw, vf_info->glort, mac, 1256 err = hw->mac.ops.update_mc_addr(hw, vf_info->glort, mac, vlan,
1253 !(vlan & FM10K_VLAN_CLEAR), 0); 1257 !(vlan & FM10K_VLAN_CLEAR));
1254 } 1258 }
1255 1259
1256 return err; 1260 return err;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c b/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c
index 02008e976d18..9043633c3e50 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ptp.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -319,7 +319,8 @@ static int fm10k_ptp_settime(struct ptp_clock_info *ptp,
319} 319}
320 320
321static int fm10k_ptp_enable(struct ptp_clock_info *ptp, 321static int fm10k_ptp_enable(struct ptp_clock_info *ptp,
322 struct ptp_clock_request *rq, int on) 322 struct ptp_clock_request *rq,
323 int __always_unused on)
323{ 324{
324 struct ptp_clock_time *t = &rq->perout.period; 325 struct ptp_clock_time *t = &rq->perout.period;
325 struct fm10k_intfc *interface; 326 struct fm10k_intfc *interface;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
index 17219678439a..94f0f6a146d9 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
@@ -1,5 +1,5 @@
1/* Intel Ethernet Switch Host Interface Driver 1/* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation. 2 * Copyright(c) 2013 - 2015 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -124,6 +124,10 @@ static s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
124 /* record maximum queue count */ 124 /* record maximum queue count */
125 hw->mac.max_queues = i; 125 hw->mac.max_queues = i;
126 126
127 /* fetch default VLAN */
128 hw->mac.default_vid = (fm10k_read_reg(hw, FM10K_TXQCTL(0)) &
129 FM10K_TXQCTL_VID_MASK) >> FM10K_TXQCTL_VID_SHIFT;
130
127 return 0; 131 return 0;
128} 132}
129 133