aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-02-13 22:31:23 -0500
committerDavid S. Miller <davem@davemloft.net>2018-02-13 22:31:23 -0500
commit77079683617b60387ad23e91cc5b82693b3075ab (patch)
tree9f8c1cf848778538ce32f87ba6978e0ffd671136
parent153e1b84f477f716bc3f81e6cfae1a3d941fc7ec (diff)
parent693acdd0f18b4b2a52439804dd756db8397044da (diff)
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 40GbE Intel Wired LAN Driver Updates 2018-02-13 This series contains updates to i40e and i40evf. Wei Yongjun fixes a function that needed to be "static". Also fixes the use of GFP_KERNEL to GFP_ATOMIC when we have taken a spinlock. Mitch cleans up several info messages to not include the memory addresses being used on the off chance this information could be used maliciously. Alan provides several fixes to the broadcast filters starting with the triggering of overflow promiscuous in circumstances where we run out of space for broadcast filters to prevent traffic from being unexpectedly dropped. Refactored the code to improve the readability and maintainability when we are concerned about when and how overflow promiscuous is changed. Harshitha cleans up a message to make it more clear on what is being reset, so users are not confused and think the PF is resetting. Dave fixes an issue where the MAC, firmware version and NPAR checks used to determine if shutting off the firmware LLDP engine is supported or not, instead set a hardware flag which ethtool can use. Jake updates the VF driver to use __dev_uc_sync and __dev_mc_sync, like the PF driver. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e.h1
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c40
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c12
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c88
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c106
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c10
6 files changed, 119 insertions, 138 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index ebe795a7f5f9..4cf99292fc2f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -507,6 +507,7 @@ struct i40e_pf {
507#define I40E_HW_STOP_FW_LLDP BIT(16) 507#define I40E_HW_STOP_FW_LLDP BIT(16)
508#define I40E_HW_PORT_ID_VALID BIT(17) 508#define I40E_HW_PORT_ID_VALID BIT(17)
509#define I40E_HW_RESTART_AUTONEG BIT(18) 509#define I40E_HW_RESTART_AUTONEG BIT(18)
510#define I40E_HW_STOPPABLE_FW_LLDP BIT(19)
510 511
511 u64 flags; 512 u64 flags;
512#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(0) 513#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(0)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index e9fc51bd6c95..b829fd365693 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -155,8 +155,8 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
155 dev_info(&pf->pdev->dev, " vlan_features = 0x%08lx\n", 155 dev_info(&pf->pdev->dev, " vlan_features = 0x%08lx\n",
156 (unsigned long int)nd->vlan_features); 156 (unsigned long int)nd->vlan_features);
157 } 157 }
158 dev_info(&pf->pdev->dev, 158 dev_info(&pf->pdev->dev, " active_vlans is %s\n",
159 " vlgrp: & = %p\n", vsi->active_vlans); 159 vsi->active_vlans ? "<valid>" : "<null>");
160 dev_info(&pf->pdev->dev, 160 dev_info(&pf->pdev->dev,
161 " flags = 0x%08lx, netdev_registered = %i, current_netdev_flags = 0x%04x\n", 161 " flags = 0x%08lx, netdev_registered = %i, current_netdev_flags = 0x%04x\n",
162 vsi->flags, vsi->netdev_registered, vsi->current_netdev_flags); 162 vsi->flags, vsi->netdev_registered, vsi->current_netdev_flags);
@@ -270,14 +270,6 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
270 continue; 270 continue;
271 271
272 dev_info(&pf->pdev->dev, 272 dev_info(&pf->pdev->dev,
273 " rx_rings[%i]: desc = %p\n",
274 i, rx_ring->desc);
275 dev_info(&pf->pdev->dev,
276 " rx_rings[%i]: dev = %p, netdev = %p, rx_bi = %p\n",
277 i, rx_ring->dev,
278 rx_ring->netdev,
279 rx_ring->rx_bi);
280 dev_info(&pf->pdev->dev,
281 " rx_rings[%i]: state = %lu, queue_index = %d, reg_idx = %d\n", 273 " rx_rings[%i]: state = %lu, queue_index = %d, reg_idx = %d\n",
282 i, *rx_ring->state, 274 i, *rx_ring->state,
283 rx_ring->queue_index, 275 rx_ring->queue_index,
@@ -307,13 +299,8 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
307 rx_ring->rx_stats.realloc_count, 299 rx_ring->rx_stats.realloc_count,
308 rx_ring->rx_stats.page_reuse_count); 300 rx_ring->rx_stats.page_reuse_count);
309 dev_info(&pf->pdev->dev, 301 dev_info(&pf->pdev->dev,
310 " rx_rings[%i]: size = %i, dma = 0x%08lx\n", 302 " rx_rings[%i]: size = %i\n",
311 i, rx_ring->size, 303 i, rx_ring->size);
312 (unsigned long int)rx_ring->dma);
313 dev_info(&pf->pdev->dev,
314 " rx_rings[%i]: vsi = %p, q_vector = %p\n",
315 i, rx_ring->vsi,
316 rx_ring->q_vector);
317 dev_info(&pf->pdev->dev, 304 dev_info(&pf->pdev->dev,
318 " rx_rings[%i]: itr_setting = %d (%s)\n", 305 " rx_rings[%i]: itr_setting = %d (%s)\n",
319 i, rx_ring->itr_setting, 306 i, rx_ring->itr_setting,
@@ -326,14 +313,6 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
326 continue; 313 continue;
327 314
328 dev_info(&pf->pdev->dev, 315 dev_info(&pf->pdev->dev,
329 " tx_rings[%i]: desc = %p\n",
330 i, tx_ring->desc);
331 dev_info(&pf->pdev->dev,
332 " tx_rings[%i]: dev = %p, netdev = %p, tx_bi = %p\n",
333 i, tx_ring->dev,
334 tx_ring->netdev,
335 tx_ring->tx_bi);
336 dev_info(&pf->pdev->dev,
337 " tx_rings[%i]: state = %lu, queue_index = %d, reg_idx = %d\n", 316 " tx_rings[%i]: state = %lu, queue_index = %d, reg_idx = %d\n",
338 i, *tx_ring->state, 317 i, *tx_ring->state,
339 tx_ring->queue_index, 318 tx_ring->queue_index,
@@ -355,13 +334,8 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
355 tx_ring->tx_stats.tx_busy, 334 tx_ring->tx_stats.tx_busy,
356 tx_ring->tx_stats.tx_done_old); 335 tx_ring->tx_stats.tx_done_old);
357 dev_info(&pf->pdev->dev, 336 dev_info(&pf->pdev->dev,
358 " tx_rings[%i]: size = %i, dma = 0x%08lx\n", 337 " tx_rings[%i]: size = %i\n",
359 i, tx_ring->size, 338 i, tx_ring->size);
360 (unsigned long int)tx_ring->dma);
361 dev_info(&pf->pdev->dev,
362 " tx_rings[%i]: vsi = %p, q_vector = %p\n",
363 i, tx_ring->vsi,
364 tx_ring->q_vector);
365 dev_info(&pf->pdev->dev, 339 dev_info(&pf->pdev->dev,
366 " tx_rings[%i]: DCB tc = %d\n", 340 " tx_rings[%i]: DCB tc = %d\n",
367 i, tx_ring->dcb_tc); 341 i, tx_ring->dcb_tc);
@@ -466,8 +440,6 @@ static void i40e_dbg_dump_vsi_seid(struct i40e_pf *pf, int seid)
466 vsi->info.resp_reserved[6], vsi->info.resp_reserved[7], 440 vsi->info.resp_reserved[6], vsi->info.resp_reserved[7],
467 vsi->info.resp_reserved[8], vsi->info.resp_reserved[9], 441 vsi->info.resp_reserved[8], vsi->info.resp_reserved[9],
468 vsi->info.resp_reserved[10], vsi->info.resp_reserved[11]); 442 vsi->info.resp_reserved[10], vsi->info.resp_reserved[11]);
469 if (vsi->back)
470 dev_info(&pf->pdev->dev, " PF = %p\n", vsi->back);
471 dev_info(&pf->pdev->dev, " idx = %d\n", vsi->idx); 443 dev_info(&pf->pdev->dev, " idx = %d\n", vsi->idx);
472 dev_info(&pf->pdev->dev, 444 dev_info(&pf->pdev->dev,
473 " tc_config: numtc = %d, enabled_tc = 0x%x\n", 445 " tc_config: numtc = %d, enabled_tc = 0x%x\n",
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 29a7412b2fa6..0dcbbda164c4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -4426,17 +4426,9 @@ flags_complete:
4426 * unsupported FW versions. 4426 * unsupported FW versions.
4427 */ 4427 */
4428 if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP) { 4428 if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP) {
4429 if (pf->hw.func_caps.npar_enable) { 4429 if (!(pf->hw_features & I40E_HW_STOPPABLE_FW_LLDP)) {
4430 dev_warn(&pf->pdev->dev, 4430 dev_warn(&pf->pdev->dev,
4431 "Unable to change FW LLDP if NPAR active\n"); 4431 "Device does not support changing FW LLDP\n");
4432 return -EOPNOTSUPP;
4433 }
4434
4435 if (pf->hw.aq.api_maj_ver < 1 ||
4436 (pf->hw.aq.api_maj_ver == 1 &&
4437 pf->hw.aq.api_min_ver < 7)) {
4438 dev_warn(&pf->pdev->dev,
4439 "FW ver does not support changing FW LLDP\n");
4440 return -EOPNOTSUPP; 4432 return -EOPNOTSUPP;
4441 } 4433 }
4442 } 4434 }
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 70ecd9c3a163..101702af099f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -215,8 +215,8 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,
215 215
216 if (!pile || needed == 0 || id >= I40E_PILE_VALID_BIT) { 216 if (!pile || needed == 0 || id >= I40E_PILE_VALID_BIT) {
217 dev_info(&pf->pdev->dev, 217 dev_info(&pf->pdev->dev,
218 "param err: pile=%p needed=%d id=0x%04x\n", 218 "param err: pile=%s needed=%d id=0x%04x\n",
219 pile, needed, id); 219 pile ? "<valid>" : "<null>", needed, id);
220 return -EINVAL; 220 return -EINVAL;
221 } 221 }
222 222
@@ -1380,14 +1380,7 @@ struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
1380 1380
1381 ether_addr_copy(f->macaddr, macaddr); 1381 ether_addr_copy(f->macaddr, macaddr);
1382 f->vlan = vlan; 1382 f->vlan = vlan;
1383 /* If we're in overflow promisc mode, set the state directly 1383 f->state = I40E_FILTER_NEW;
1384 * to failed, so we don't bother to try sending the filter
1385 * to the hardware.
1386 */
1387 if (test_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state))
1388 f->state = I40E_FILTER_FAILED;
1389 else
1390 f->state = I40E_FILTER_NEW;
1391 INIT_HLIST_NODE(&f->hlist); 1384 INIT_HLIST_NODE(&f->hlist);
1392 1385
1393 key = i40e_addr_to_hkey(macaddr); 1386 key = i40e_addr_to_hkey(macaddr);
@@ -2116,17 +2109,16 @@ void i40e_aqc_del_filters(struct i40e_vsi *vsi, const char *vsi_name,
2116 * @list: the list of filters to send to firmware 2109 * @list: the list of filters to send to firmware
2117 * @add_head: Position in the add hlist 2110 * @add_head: Position in the add hlist
2118 * @num_add: the number of filters to add 2111 * @num_add: the number of filters to add
2119 * @promisc_change: set to true on exit if promiscuous mode was forced on
2120 * 2112 *
2121 * Send a request to firmware via AdminQ to add a chunk of filters. Will set 2113 * Send a request to firmware via AdminQ to add a chunk of filters. Will set
2122 * promisc_changed to true if the firmware has run out of space for more 2114 * __I40E_VSI_OVERFLOW_PROMISC bit in vsi->state if the firmware has run out of
2123 * filters. 2115 * space for more filters.
2124 */ 2116 */
2125static 2117static
2126void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name, 2118void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name,
2127 struct i40e_aqc_add_macvlan_element_data *list, 2119 struct i40e_aqc_add_macvlan_element_data *list,
2128 struct i40e_new_mac_filter *add_head, 2120 struct i40e_new_mac_filter *add_head,
2129 int num_add, bool *promisc_changed) 2121 int num_add)
2130{ 2122{
2131 struct i40e_hw *hw = &vsi->back->hw; 2123 struct i40e_hw *hw = &vsi->back->hw;
2132 int aq_err, fcnt; 2124 int aq_err, fcnt;
@@ -2136,7 +2128,6 @@ void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name,
2136 fcnt = i40e_update_filter_state(num_add, list, add_head); 2128 fcnt = i40e_update_filter_state(num_add, list, add_head);
2137 2129
2138 if (fcnt != num_add) { 2130 if (fcnt != num_add) {
2139 *promisc_changed = true;
2140 set_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state); 2131 set_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
2141 dev_warn(&vsi->back->pdev->dev, 2132 dev_warn(&vsi->back->pdev->dev,
2142 "Error %s adding RX filters on %s, promiscuous mode forced on\n", 2133 "Error %s adding RX filters on %s, promiscuous mode forced on\n",
@@ -2177,11 +2168,13 @@ i40e_aqc_broadcast_filter(struct i40e_vsi *vsi, const char *vsi_name,
2177 NULL); 2168 NULL);
2178 } 2169 }
2179 2170
2180 if (aq_ret) 2171 if (aq_ret) {
2172 set_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
2181 dev_warn(&vsi->back->pdev->dev, 2173 dev_warn(&vsi->back->pdev->dev,
2182 "Error %s setting broadcast promiscuous mode on %s\n", 2174 "Error %s, forcing overflow promiscuous on %s\n",
2183 i40e_aq_str(hw, hw->aq.asq_last_status), 2175 i40e_aq_str(hw, hw->aq.asq_last_status),
2184 vsi_name); 2176 vsi_name);
2177 }
2185 2178
2186 return aq_ret; 2179 return aq_ret;
2187} 2180}
@@ -2267,9 +2260,9 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2267 struct i40e_mac_filter *f; 2260 struct i40e_mac_filter *f;
2268 struct i40e_new_mac_filter *new, *add_head = NULL; 2261 struct i40e_new_mac_filter *new, *add_head = NULL;
2269 struct i40e_hw *hw = &vsi->back->hw; 2262 struct i40e_hw *hw = &vsi->back->hw;
2263 bool old_overflow, new_overflow;
2270 unsigned int failed_filters = 0; 2264 unsigned int failed_filters = 0;
2271 unsigned int vlan_filters = 0; 2265 unsigned int vlan_filters = 0;
2272 bool promisc_changed = false;
2273 char vsi_name[16] = "PF"; 2266 char vsi_name[16] = "PF";
2274 int filter_list_len = 0; 2267 int filter_list_len = 0;
2275 i40e_status aq_ret = 0; 2268 i40e_status aq_ret = 0;
@@ -2291,6 +2284,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2291 usleep_range(1000, 2000); 2284 usleep_range(1000, 2000);
2292 pf = vsi->back; 2285 pf = vsi->back;
2293 2286
2287 old_overflow = test_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
2288
2294 if (vsi->netdev) { 2289 if (vsi->netdev) {
2295 changed_flags = vsi->current_netdev_flags ^ vsi->netdev->flags; 2290 changed_flags = vsi->current_netdev_flags ^ vsi->netdev->flags;
2296 vsi->current_netdev_flags = vsi->netdev->flags; 2291 vsi->current_netdev_flags = vsi->netdev->flags;
@@ -2423,12 +2418,6 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2423 2418
2424 num_add = 0; 2419 num_add = 0;
2425 hlist_for_each_entry_safe(new, h, &tmp_add_list, hlist) { 2420 hlist_for_each_entry_safe(new, h, &tmp_add_list, hlist) {
2426 if (test_bit(__I40E_VSI_OVERFLOW_PROMISC,
2427 vsi->state)) {
2428 new->state = I40E_FILTER_FAILED;
2429 continue;
2430 }
2431
2432 /* handle broadcast filters by updating the broadcast 2421 /* handle broadcast filters by updating the broadcast
2433 * promiscuous flag instead of adding a MAC filter. 2422 * promiscuous flag instead of adding a MAC filter.
2434 */ 2423 */
@@ -2464,15 +2453,14 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2464 /* flush a full buffer */ 2453 /* flush a full buffer */
2465 if (num_add == filter_list_len) { 2454 if (num_add == filter_list_len) {
2466 i40e_aqc_add_filters(vsi, vsi_name, add_list, 2455 i40e_aqc_add_filters(vsi, vsi_name, add_list,
2467 add_head, num_add, 2456 add_head, num_add);
2468 &promisc_changed);
2469 memset(add_list, 0, list_size); 2457 memset(add_list, 0, list_size);
2470 num_add = 0; 2458 num_add = 0;
2471 } 2459 }
2472 } 2460 }
2473 if (num_add) { 2461 if (num_add) {
2474 i40e_aqc_add_filters(vsi, vsi_name, add_list, add_head, 2462 i40e_aqc_add_filters(vsi, vsi_name, add_list, add_head,
2475 num_add, &promisc_changed); 2463 num_add);
2476 } 2464 }
2477 /* Now move all of the filters from the temp add list back to 2465 /* Now move all of the filters from the temp add list back to
2478 * the VSI's list. 2466 * the VSI's list.
@@ -2501,24 +2489,16 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2501 } 2489 }
2502 spin_unlock_bh(&vsi->mac_filter_hash_lock); 2490 spin_unlock_bh(&vsi->mac_filter_hash_lock);
2503 2491
2504 /* If promiscuous mode has changed, we need to calculate a new
2505 * threshold for when we are safe to exit
2506 */
2507 if (promisc_changed)
2508 vsi->promisc_threshold = (vsi->active_filters * 3) / 4;
2509
2510 /* Check if we are able to exit overflow promiscuous mode. We can 2492 /* Check if we are able to exit overflow promiscuous mode. We can
2511 * safely exit if we didn't just enter, we no longer have any failed 2493 * safely exit if we didn't just enter, we no longer have any failed
2512 * filters, and we have reduced filters below the threshold value. 2494 * filters, and we have reduced filters below the threshold value.
2513 */ 2495 */
2514 if (test_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state) && 2496 if (old_overflow && !failed_filters &&
2515 !promisc_changed && !failed_filters && 2497 vsi->active_filters < vsi->promisc_threshold) {
2516 (vsi->active_filters < vsi->promisc_threshold)) {
2517 dev_info(&pf->pdev->dev, 2498 dev_info(&pf->pdev->dev,
2518 "filter logjam cleared on %s, leaving overflow promiscuous mode\n", 2499 "filter logjam cleared on %s, leaving overflow promiscuous mode\n",
2519 vsi_name); 2500 vsi_name);
2520 clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state); 2501 clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
2521 promisc_changed = true;
2522 vsi->promisc_threshold = 0; 2502 vsi->promisc_threshold = 0;
2523 } 2503 }
2524 2504
@@ -2528,6 +2508,14 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2528 goto out; 2508 goto out;
2529 } 2509 }
2530 2510
2511 new_overflow = test_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
2512
2513 /* If we are entering overflow promiscuous, we need to calculate a new
2514 * threshold for when we are safe to exit
2515 */
2516 if (!old_overflow && new_overflow)
2517 vsi->promisc_threshold = (vsi->active_filters * 3) / 4;
2518
2531 /* check for changes in promiscuous modes */ 2519 /* check for changes in promiscuous modes */
2532 if (changed_flags & IFF_ALLMULTI) { 2520 if (changed_flags & IFF_ALLMULTI) {
2533 bool cur_multipromisc; 2521 bool cur_multipromisc;
@@ -2548,12 +2536,11 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2548 } 2536 }
2549 } 2537 }
2550 2538
2551 if ((changed_flags & IFF_PROMISC) || promisc_changed) { 2539 if ((changed_flags & IFF_PROMISC) || old_overflow != new_overflow) {
2552 bool cur_promisc; 2540 bool cur_promisc;
2553 2541
2554 cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) || 2542 cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) ||
2555 test_bit(__I40E_VSI_OVERFLOW_PROMISC, 2543 new_overflow);
2556 vsi->state));
2557 aq_ret = i40e_set_promiscuous(pf, cur_promisc); 2544 aq_ret = i40e_set_promiscuous(pf, cur_promisc);
2558 if (aq_ret) { 2545 if (aq_ret) {
2559 retval = i40e_aq_rc_to_posix(aq_ret, 2546 retval = i40e_aq_rc_to_posix(aq_ret,
@@ -5381,7 +5368,7 @@ out:
5381 * @vsi: VSI to be configured 5368 * @vsi: VSI to be configured
5382 * 5369 *
5383 **/ 5370 **/
5384int i40e_get_link_speed(struct i40e_vsi *vsi) 5371static int i40e_get_link_speed(struct i40e_vsi *vsi)
5385{ 5372{
5386 struct i40e_pf *pf = vsi->back; 5373 struct i40e_pf *pf = vsi->back;
5387 5374
@@ -9954,18 +9941,17 @@ static int i40e_vsi_clear(struct i40e_vsi *vsi)
9954 9941
9955 mutex_lock(&pf->switch_mutex); 9942 mutex_lock(&pf->switch_mutex);
9956 if (!pf->vsi[vsi->idx]) { 9943 if (!pf->vsi[vsi->idx]) {
9957 dev_err(&pf->pdev->dev, "pf->vsi[%d] is NULL, just free vsi[%d](%p,type %d)\n", 9944 dev_err(&pf->pdev->dev, "pf->vsi[%d] is NULL, just free vsi[%d](type %d)\n",
9958 vsi->idx, vsi->idx, vsi, vsi->type); 9945 vsi->idx, vsi->idx, vsi->type);
9959 goto unlock_vsi; 9946 goto unlock_vsi;
9960 } 9947 }
9961 9948
9962 if (pf->vsi[vsi->idx] != vsi) { 9949 if (pf->vsi[vsi->idx] != vsi) {
9963 dev_err(&pf->pdev->dev, 9950 dev_err(&pf->pdev->dev,
9964 "pf->vsi[%d](%p, type %d) != vsi[%d](%p,type %d): no free!\n", 9951 "pf->vsi[%d](type %d) != vsi[%d](type %d): no free!\n",
9965 pf->vsi[vsi->idx]->idx, 9952 pf->vsi[vsi->idx]->idx,
9966 pf->vsi[vsi->idx],
9967 pf->vsi[vsi->idx]->type, 9953 pf->vsi[vsi->idx]->type,
9968 vsi->idx, vsi, vsi->type); 9954 vsi->idx, vsi->type);
9969 goto unlock_vsi; 9955 goto unlock_vsi;
9970 } 9956 }
9971 9957
@@ -11103,6 +11089,16 @@ static int i40e_sw_init(struct i40e_pf *pf)
11103 /* IWARP needs one extra vector for CQP just like MISC.*/ 11089 /* IWARP needs one extra vector for CQP just like MISC.*/
11104 pf->num_iwarp_msix = (int)num_online_cpus() + 1; 11090 pf->num_iwarp_msix = (int)num_online_cpus() + 1;
11105 } 11091 }
11092 /* Stopping the FW LLDP engine is only supported on the
11093 * XL710 with a FW ver >= 1.7. Also, stopping FW LLDP
11094 * engine is not supported if NPAR is functioning on this
11095 * part
11096 */
11097 if (pf->hw.mac.type == I40E_MAC_XL710 &&
11098 !pf->hw.func_caps.npar_enable &&
11099 (pf->hw.aq.api_maj_ver > 1 ||
11100 (pf->hw.aq.api_maj_ver == 1 && pf->hw.aq.api_min_ver > 6)))
11101 pf->hw_features |= I40E_HW_STOPPABLE_FW_LLDP;
11106 11102
11107#ifdef CONFIG_PCI_IOV 11103#ifdef CONFIG_PCI_IOV
11108 if (pf->hw.func_caps.num_vfs && pf->hw.partition_id == 1) { 11104 if (pf->hw.func_caps.num_vfs && pf->hw.partition_id == 1) {
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 6fd09926181a..34fd6c553879 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -785,7 +785,7 @@ static int i40evf_vlan_rx_kill_vid(struct net_device *netdev,
785 **/ 785 **/
786static struct 786static struct
787i40evf_mac_filter *i40evf_find_filter(struct i40evf_adapter *adapter, 787i40evf_mac_filter *i40evf_find_filter(struct i40evf_adapter *adapter,
788 u8 *macaddr) 788 const u8 *macaddr)
789{ 789{
790 struct i40evf_mac_filter *f; 790 struct i40evf_mac_filter *f;
791 791
@@ -808,7 +808,7 @@ i40evf_mac_filter *i40evf_find_filter(struct i40evf_adapter *adapter,
808 **/ 808 **/
809static struct 809static struct
810i40evf_mac_filter *i40evf_add_filter(struct i40evf_adapter *adapter, 810i40evf_mac_filter *i40evf_add_filter(struct i40evf_adapter *adapter,
811 u8 *macaddr) 811 const u8 *macaddr)
812{ 812{
813 struct i40evf_mac_filter *f; 813 struct i40evf_mac_filter *f;
814 814
@@ -880,50 +880,64 @@ static int i40evf_set_mac(struct net_device *netdev, void *p)
880} 880}
881 881
882/** 882/**
883 * i40evf_set_rx_mode - NDO callback to set the netdev filters 883 * i40evf_addr_sync - Callback for dev_(mc|uc)_sync to add address
884 * @netdev: network interface device structure 884 * @netdev: the netdevice
885 **/ 885 * @addr: address to add
886static void i40evf_set_rx_mode(struct net_device *netdev) 886 *
887 * Called by __dev_(mc|uc)_sync when an address needs to be added. We call
888 * __dev_(uc|mc)_sync from .set_rx_mode and guarantee to hold the hash lock.
889 */
890static int i40evf_addr_sync(struct net_device *netdev, const u8 *addr)
887{ 891{
888 struct i40evf_adapter *adapter = netdev_priv(netdev); 892 struct i40evf_adapter *adapter = netdev_priv(netdev);
889 struct i40evf_mac_filter *f, *ftmp;
890 struct netdev_hw_addr *uca;
891 struct netdev_hw_addr *mca;
892 struct netdev_hw_addr *ha;
893 893
894 /* add addr if not already in the filter list */ 894 if (i40evf_add_filter(adapter, addr))
895 netdev_for_each_uc_addr(uca, netdev) { 895 return 0;
896 i40evf_add_filter(adapter, uca->addr); 896 else
897 } 897 return -ENOMEM;
898 netdev_for_each_mc_addr(mca, netdev) { 898}
899 i40evf_add_filter(adapter, mca->addr);
900 }
901
902 spin_lock_bh(&adapter->mac_vlan_list_lock);
903
904 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
905 netdev_for_each_mc_addr(mca, netdev)
906 if (ether_addr_equal(mca->addr, f->macaddr))
907 goto bottom_of_search_loop;
908
909 netdev_for_each_uc_addr(uca, netdev)
910 if (ether_addr_equal(uca->addr, f->macaddr))
911 goto bottom_of_search_loop;
912 899
913 for_each_dev_addr(netdev, ha) 900/**
914 if (ether_addr_equal(ha->addr, f->macaddr)) 901 * i40evf_addr_unsync - Callback for dev_(mc|uc)_sync to remove address
915 goto bottom_of_search_loop; 902 * @netdev: the netdevice
903 * @addr: address to add
904 *
905 * Called by __dev_(mc|uc)_sync when an address needs to be removed. We call
906 * __dev_(uc|mc)_sync from .set_rx_mode and guarantee to hold the hash lock.
907 */
908static int i40evf_addr_unsync(struct net_device *netdev, const u8 *addr)
909{
910 struct i40evf_adapter *adapter = netdev_priv(netdev);
911 struct i40evf_mac_filter *f;
916 912
917 if (ether_addr_equal(f->macaddr, adapter->hw.mac.addr)) 913 /* Under some circumstances, we might receive a request to delete
918 goto bottom_of_search_loop; 914 * our own device address from our uc list. Because we store the
915 * device address in the VSI's MAC/VLAN filter list, we need to ignore
916 * such requests and not delete our device address from this list.
917 */
918 if (ether_addr_equal(addr, netdev->dev_addr))
919 return 0;
919 920
920 /* f->macaddr wasn't found in uc, mc, or ha list so delete it */ 921 f = i40evf_find_filter(adapter, addr);
922 if (f) {
921 f->remove = true; 923 f->remove = true;
922 adapter->aq_required |= I40EVF_FLAG_AQ_DEL_MAC_FILTER; 924 adapter->aq_required |= I40EVF_FLAG_AQ_DEL_MAC_FILTER;
923
924bottom_of_search_loop:
925 continue;
926 } 925 }
926 return 0;
927}
928
929/**
930 * i40evf_set_rx_mode - NDO callback to set the netdev filters
931 * @netdev: network interface device structure
932 **/
933static void i40evf_set_rx_mode(struct net_device *netdev)
934{
935 struct i40evf_adapter *adapter = netdev_priv(netdev);
936
937 spin_lock_bh(&adapter->mac_vlan_list_lock);
938 __dev_uc_sync(netdev, i40evf_addr_sync, i40evf_addr_unsync);
939 __dev_mc_sync(netdev, i40evf_addr_sync, i40evf_addr_unsync);
940 spin_unlock_bh(&adapter->mac_vlan_list_lock);
927 941
928 if (netdev->flags & IFF_PROMISC && 942 if (netdev->flags & IFF_PROMISC &&
929 !(adapter->flags & I40EVF_FLAG_PROMISC_ON)) 943 !(adapter->flags & I40EVF_FLAG_PROMISC_ON))
@@ -938,8 +952,6 @@ bottom_of_search_loop:
938 else if (!(netdev->flags & IFF_ALLMULTI) && 952 else if (!(netdev->flags & IFF_ALLMULTI) &&
939 adapter->flags & I40EVF_FLAG_ALLMULTI_ON) 953 adapter->flags & I40EVF_FLAG_ALLMULTI_ON)
940 adapter->aq_required |= I40EVF_FLAG_AQ_RELEASE_ALLMULTI; 954 adapter->aq_required |= I40EVF_FLAG_AQ_RELEASE_ALLMULTI;
941
942 spin_unlock_bh(&adapter->mac_vlan_list_lock);
943} 955}
944 956
945/** 957/**
@@ -1027,6 +1039,7 @@ static void i40evf_up_complete(struct i40evf_adapter *adapter)
1027void i40evf_down(struct i40evf_adapter *adapter) 1039void i40evf_down(struct i40evf_adapter *adapter)
1028{ 1040{
1029 struct net_device *netdev = adapter->netdev; 1041 struct net_device *netdev = adapter->netdev;
1042 struct i40evf_vlan_filter *vlf;
1030 struct i40evf_mac_filter *f; 1043 struct i40evf_mac_filter *f;
1031 1044
1032 if (adapter->state <= __I40EVF_DOWN_PENDING) 1045 if (adapter->state <= __I40EVF_DOWN_PENDING)
@@ -1040,12 +1053,17 @@ void i40evf_down(struct i40evf_adapter *adapter)
1040 1053
1041 spin_lock_bh(&adapter->mac_vlan_list_lock); 1054 spin_lock_bh(&adapter->mac_vlan_list_lock);
1042 1055
1056 /* clear the sync flag on all filters */
1057 __dev_uc_unsync(adapter->netdev, NULL);
1058 __dev_mc_unsync(adapter->netdev, NULL);
1059
1043 /* remove all MAC filters */ 1060 /* remove all MAC filters */
1044 list_for_each_entry(f, &adapter->mac_filter_list, list) { 1061 list_for_each_entry(f, &adapter->mac_filter_list, list) {
1045 f->remove = true; 1062 f->remove = true;
1046 } 1063 }
1064
1047 /* remove all VLAN filters */ 1065 /* remove all VLAN filters */
1048 list_for_each_entry(f, &adapter->vlan_filter_list, list) { 1066 list_for_each_entry(vlf, &adapter->vlan_filter_list, list) {
1049 f->remove = true; 1067 f->remove = true;
1050 } 1068 }
1051 1069
@@ -3067,6 +3085,7 @@ static void i40evf_remove(struct pci_dev *pdev)
3067{ 3085{
3068 struct net_device *netdev = pci_get_drvdata(pdev); 3086 struct net_device *netdev = pci_get_drvdata(pdev);
3069 struct i40evf_adapter *adapter = netdev_priv(netdev); 3087 struct i40evf_adapter *adapter = netdev_priv(netdev);
3088 struct i40evf_vlan_filter *vlf, *vlftmp;
3070 struct i40evf_mac_filter *f, *ftmp; 3089 struct i40evf_mac_filter *f, *ftmp;
3071 struct i40e_hw *hw = &adapter->hw; 3090 struct i40e_hw *hw = &adapter->hw;
3072 int err; 3091 int err;
@@ -3129,9 +3148,10 @@ static void i40evf_remove(struct pci_dev *pdev)
3129 list_del(&f->list); 3148 list_del(&f->list);
3130 kfree(f); 3149 kfree(f);
3131 } 3150 }
3132 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { 3151 list_for_each_entry_safe(vlf, vlftmp, &adapter->vlan_filter_list,
3133 list_del(&f->list); 3152 list) {
3134 kfree(f); 3153 list_del(&vlf->list);
3154 kfree(vlf);
3135 } 3155 }
3136 3156
3137 spin_unlock_bh(&adapter->mac_vlan_list_lock); 3157 spin_unlock_bh(&adapter->mac_vlan_list_lock);
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index d57a67285505..0700f0afe2d3 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -465,7 +465,7 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
465 more = true; 465 more = true;
466 } 466 }
467 467
468 veal = kzalloc(len, GFP_KERNEL); 468 veal = kzalloc(len, GFP_ATOMIC);
469 if (!veal) { 469 if (!veal) {
470 spin_unlock_bh(&adapter->mac_vlan_list_lock); 470 spin_unlock_bh(&adapter->mac_vlan_list_lock);
471 return; 471 return;
@@ -538,7 +538,7 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
538 (count * sizeof(struct virtchnl_ether_addr)); 538 (count * sizeof(struct virtchnl_ether_addr));
539 more = true; 539 more = true;
540 } 540 }
541 veal = kzalloc(len, GFP_KERNEL); 541 veal = kzalloc(len, GFP_ATOMIC);
542 if (!veal) { 542 if (!veal) {
543 spin_unlock_bh(&adapter->mac_vlan_list_lock); 543 spin_unlock_bh(&adapter->mac_vlan_list_lock);
544 return; 544 return;
@@ -612,7 +612,7 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
612 (count * sizeof(u16)); 612 (count * sizeof(u16));
613 more = true; 613 more = true;
614 } 614 }
615 vvfl = kzalloc(len, GFP_KERNEL); 615 vvfl = kzalloc(len, GFP_ATOMIC);
616 if (!vvfl) { 616 if (!vvfl) {
617 spin_unlock_bh(&adapter->mac_vlan_list_lock); 617 spin_unlock_bh(&adapter->mac_vlan_list_lock);
618 return; 618 return;
@@ -684,7 +684,7 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
684 (count * sizeof(u16)); 684 (count * sizeof(u16));
685 more = true; 685 more = true;
686 } 686 }
687 vvfl = kzalloc(len, GFP_KERNEL); 687 vvfl = kzalloc(len, GFP_ATOMIC);
688 if (!vvfl) { 688 if (!vvfl) {
689 spin_unlock_bh(&adapter->mac_vlan_list_lock); 689 spin_unlock_bh(&adapter->mac_vlan_list_lock);
690 return; 690 return;
@@ -1037,7 +1037,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
1037 i40evf_print_link_message(adapter); 1037 i40evf_print_link_message(adapter);
1038 break; 1038 break;
1039 case VIRTCHNL_EVENT_RESET_IMPENDING: 1039 case VIRTCHNL_EVENT_RESET_IMPENDING:
1040 dev_info(&adapter->pdev->dev, "PF reset warning received\n"); 1040 dev_info(&adapter->pdev->dev, "Reset warning received from the PF\n");
1041 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) { 1041 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) {
1042 adapter->flags |= I40EVF_FLAG_RESET_PENDING; 1042 adapter->flags |= I40EVF_FLAG_RESET_PENDING;
1043 dev_info(&adapter->pdev->dev, "Scheduling reset task\n"); 1043 dev_info(&adapter->pdev->dev, "Scheduling reset task\n");