aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-03-14 22:18:48 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-14 22:18:48 -0400
commit21396689cc093f2ab7ae29c9937e94e51ae96732 (patch)
tree2f9d86d4dd18a0d246deea48be96d8c9ca2fda75
parent983f59617aabbbfadbc73b897b9a78e6ffd92841 (diff)
parent6494294f277fdef1409b844b3d6eb1439c3fad8c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates This series contains updates to igb, i40e and i40evf. I provide a code comment fix which David Miller noticed in the last series of patches I submitted. Shannon provides a patch to cleanup the NAPI structs when deleting the netdev. Anjali provides several patches for i40e, first fixes a bug in the update filter logic which was causing a kernel panic. Then provides a fix to rename an error bit to correctly indicate the error. Adds a definition for a new state variable to keep track of features automatically disabled due to hardware resource limitations versus user enforced feature disabled. Anjali provides a patch to add code to handle when there is a filter programming error due to a full table, which also resolves a previous compile warning about an unused "*pf" variable introduced in the last i40e series patch submission. Jesse provides three i40e patches to cleanup strings to make more consistent and to align with other Intel drivers. Akeem cleans up a misleading function header comment for i40e. Mitch provides a fix for i40e/i40evf to use the correctly reported number of MSI-X vectors in the PF an VF. Then provides a patch to use dma_set_mask_and_coherent() which was introduced in v3.13 and simplifies the DMA mapping code a bit. v2: - dropped the 2 ixgbe patches from Emil based on feedback from David Miller, where the 2 fixes should be handled in the net core to fix all drivers ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e.h10
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c25
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c37
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c190
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c60
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_type.h6
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c9
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_type.h6
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c19
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c2
10 files changed, 269 insertions, 95 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 838b69b74edf..bd1b4690a608 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -152,7 +152,10 @@ struct i40e_lump_tracking {
152}; 152};
153 153
154#define I40E_DEFAULT_ATR_SAMPLE_RATE 20 154#define I40E_DEFAULT_ATR_SAMPLE_RATE 20
155#define I40E_FDIR_MAX_RAW_PACKET_SIZE 512 155#define I40E_FDIR_MAX_RAW_PACKET_SIZE 512
156#define I40E_FDIR_BUFFER_FULL_MARGIN 10
157#define I40E_FDIR_BUFFER_HEAD_ROOM 200
158
156struct i40e_fdir_filter { 159struct i40e_fdir_filter {
157 struct hlist_node fdir_node; 160 struct hlist_node fdir_node;
158 /* filter ipnut set */ 161 /* filter ipnut set */
@@ -263,6 +266,9 @@ struct i40e_pf {
263#define I40E_FLAG_VXLAN_FILTER_SYNC (u64)(1 << 27) 266#define I40E_FLAG_VXLAN_FILTER_SYNC (u64)(1 << 27)
264#endif 267#endif
265 268
269 /* tracks features that get auto disabled by errors */
270 u64 auto_disable_flags;
271
266 bool stat_offsets_loaded; 272 bool stat_offsets_loaded;
267 struct i40e_hw_port_stats stats; 273 struct i40e_hw_port_stats stats;
268 struct i40e_hw_port_stats stats_offsets; 274 struct i40e_hw_port_stats stats_offsets;
@@ -550,6 +556,8 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
550 struct i40e_pf *pf, bool add); 556 struct i40e_pf *pf, bool add);
551int i40e_add_del_fdir(struct i40e_vsi *vsi, 557int i40e_add_del_fdir(struct i40e_vsi *vsi,
552 struct i40e_fdir_filter *input, bool add); 558 struct i40e_fdir_filter *input, bool add);
559void i40e_fdir_check_and_reenable(struct i40e_pf *pf);
560int i40e_get_current_fd_count(struct i40e_pf *pf);
553void i40e_set_ethtool_ops(struct net_device *netdev); 561void i40e_set_ethtool_ops(struct net_device *netdev);
554struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi, 562struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
555 u8 *macaddr, s16 vlan, 563 u8 *macaddr, s16 vlan,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index 57fc86496f30..afd43d7973fa 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -1011,10 +1011,12 @@ static void i40e_dbg_dump_veb_all(struct i40e_pf *pf)
1011 **/ 1011 **/
1012static void i40e_dbg_cmd_fd_ctrl(struct i40e_pf *pf, u64 flag, bool enable) 1012static void i40e_dbg_cmd_fd_ctrl(struct i40e_pf *pf, u64 flag, bool enable)
1013{ 1013{
1014 if (enable) 1014 if (enable) {
1015 pf->flags |= flag; 1015 pf->flags |= flag;
1016 else 1016 } else {
1017 pf->flags &= ~flag; 1017 pf->flags &= ~flag;
1018 pf->auto_disable_flags |= flag;
1019 }
1018 dev_info(&pf->pdev->dev, "requesting a pf reset\n"); 1020 dev_info(&pf->pdev->dev, "requesting a pf reset\n");
1019 i40e_do_reset_safe(pf, (1 << __I40E_PF_RESET_REQUESTED)); 1021 i40e_do_reset_safe(pf, (1 << __I40E_PF_RESET_REQUESTED));
1020} 1022}
@@ -1467,19 +1469,19 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1467 pf->msg_enable); 1469 pf->msg_enable);
1468 } 1470 }
1469 } else if (strncmp(cmd_buf, "pfr", 3) == 0) { 1471 } else if (strncmp(cmd_buf, "pfr", 3) == 0) {
1470 dev_info(&pf->pdev->dev, "forcing PFR\n"); 1472 dev_info(&pf->pdev->dev, "debugfs: forcing PFR\n");
1471 i40e_do_reset_safe(pf, (1 << __I40E_PF_RESET_REQUESTED)); 1473 i40e_do_reset_safe(pf, (1 << __I40E_PF_RESET_REQUESTED));
1472 1474
1473 } else if (strncmp(cmd_buf, "corer", 5) == 0) { 1475 } else if (strncmp(cmd_buf, "corer", 5) == 0) {
1474 dev_info(&pf->pdev->dev, "forcing CoreR\n"); 1476 dev_info(&pf->pdev->dev, "debugfs: forcing CoreR\n");
1475 i40e_do_reset_safe(pf, (1 << __I40E_CORE_RESET_REQUESTED)); 1477 i40e_do_reset_safe(pf, (1 << __I40E_CORE_RESET_REQUESTED));
1476 1478
1477 } else if (strncmp(cmd_buf, "globr", 5) == 0) { 1479 } else if (strncmp(cmd_buf, "globr", 5) == 0) {
1478 dev_info(&pf->pdev->dev, "forcing GlobR\n"); 1480 dev_info(&pf->pdev->dev, "debugfs: forcing GlobR\n");
1479 i40e_do_reset_safe(pf, (1 << __I40E_GLOBAL_RESET_REQUESTED)); 1481 i40e_do_reset_safe(pf, (1 << __I40E_GLOBAL_RESET_REQUESTED));
1480 1482
1481 } else if (strncmp(cmd_buf, "empr", 4) == 0) { 1483 } else if (strncmp(cmd_buf, "empr", 4) == 0) {
1482 dev_info(&pf->pdev->dev, "forcing EMPR\n"); 1484 dev_info(&pf->pdev->dev, "debugfs: forcing EMPR\n");
1483 i40e_do_reset_safe(pf, (1 << __I40E_EMP_RESET_REQUESTED)); 1485 i40e_do_reset_safe(pf, (1 << __I40E_EMP_RESET_REQUESTED));
1484 1486
1485 } else if (strncmp(cmd_buf, "read", 4) == 0) { 1487 } else if (strncmp(cmd_buf, "read", 4) == 0) {
@@ -1670,6 +1672,15 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1670 bool add = false; 1672 bool add = false;
1671 int ret; 1673 int ret;
1672 1674
1675 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED))
1676 goto command_write_done;
1677
1678 if (strncmp(cmd_buf, "add", 3) == 0)
1679 add = true;
1680
1681 if (add && (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED))
1682 goto command_write_done;
1683
1673 asc_packet = kzalloc(I40E_FDIR_MAX_RAW_PACKET_SIZE, 1684 asc_packet = kzalloc(I40E_FDIR_MAX_RAW_PACKET_SIZE,
1674 GFP_KERNEL); 1685 GFP_KERNEL);
1675 if (!asc_packet) 1686 if (!asc_packet)
@@ -1684,8 +1695,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1684 goto command_write_done; 1695 goto command_write_done;
1685 } 1696 }
1686 1697
1687 if (strncmp(cmd_buf, "add", 3) == 0)
1688 add = true;
1689 cnt = sscanf(&cmd_buf[13], 1698 cnt = sscanf(&cmd_buf[13],
1690 "%hx %2hhx %2hhx %hx %2hhx %2hhx %hx %x %hd %511s", 1699 "%hx %2hhx %2hhx %hx %2hhx %2hhx %hx %x %hd %511s",
1691 &fd_data.q_index, 1700 &fd_data.q_index,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index d34ff31fddd8..8ee224fdc1d1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -1357,6 +1357,24 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
1357} 1357}
1358 1358
1359/** 1359/**
1360 * i40e_match_fdir_input_set - Match a new filter against an existing one
1361 * @rule: The filter already added
1362 * @input: The new filter to comapre against
1363 *
1364 * Returns true if the two input set match
1365 **/
1366static bool i40e_match_fdir_input_set(struct i40e_fdir_filter *rule,
1367 struct i40e_fdir_filter *input)
1368{
1369 if ((rule->dst_ip[0] != input->dst_ip[0]) ||
1370 (rule->src_ip[0] != input->src_ip[0]) ||
1371 (rule->dst_port != input->dst_port) ||
1372 (rule->src_port != input->src_port))
1373 return false;
1374 return true;
1375}
1376
1377/**
1360 * i40e_update_ethtool_fdir_entry - Updates the fdir filter entry 1378 * i40e_update_ethtool_fdir_entry - Updates the fdir filter entry
1361 * @vsi: Pointer to the targeted VSI 1379 * @vsi: Pointer to the targeted VSI
1362 * @input: The filter to update or NULL to indicate deletion 1380 * @input: The filter to update or NULL to indicate deletion
@@ -1391,11 +1409,10 @@ static int i40e_update_ethtool_fdir_entry(struct i40e_vsi *vsi,
1391 1409
1392 /* if there is an old rule occupying our place remove it */ 1410 /* if there is an old rule occupying our place remove it */
1393 if (rule && (rule->fd_id == sw_idx)) { 1411 if (rule && (rule->fd_id == sw_idx)) {
1394 if (!input || (rule->fd_id != input->fd_id)) { 1412 if (input && !i40e_match_fdir_input_set(rule, input))
1395 cmd->fs.flow_type = rule->flow_type; 1413 err = i40e_add_del_fdir(vsi, rule, false);
1396 err = i40e_add_del_fdir_ethtool(vsi, cmd, false); 1414 else if (!input)
1397 } 1415 err = i40e_add_del_fdir(vsi, rule, false);
1398
1399 hlist_del(&rule->fdir_node); 1416 hlist_del(&rule->fdir_node);
1400 kfree(rule); 1417 kfree(rule);
1401 pf->fdir_pf_active_filters--; 1418 pf->fdir_pf_active_filters--;
@@ -1443,6 +1460,7 @@ static int i40e_del_fdir_entry(struct i40e_vsi *vsi,
1443 1460
1444 ret = i40e_update_ethtool_fdir_entry(vsi, NULL, fsp->location, cmd); 1461 ret = i40e_update_ethtool_fdir_entry(vsi, NULL, fsp->location, cmd);
1445 1462
1463 i40e_fdir_check_and_reenable(pf);
1446 return ret; 1464 return ret;
1447} 1465}
1448 1466
@@ -1466,9 +1484,16 @@ static int i40e_add_del_fdir_ethtool(struct i40e_vsi *vsi,
1466 if (!vsi) 1484 if (!vsi)
1467 return -EINVAL; 1485 return -EINVAL;
1468 1486
1469 fsp = (struct ethtool_rx_flow_spec *)&cmd->fs;
1470 pf = vsi->back; 1487 pf = vsi->back;
1471 1488
1489 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED))
1490 return -EOPNOTSUPP;
1491
1492 if (add && (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED))
1493 return -ENOSPC;
1494
1495 fsp = (struct ethtool_rx_flow_spec *)&cmd->fs;
1496
1472 if (fsp->location >= (pf->hw.func_caps.fd_filters_best_effort + 1497 if (fsp->location >= (pf->hw.func_caps.fd_filters_best_effort +
1473 pf->hw.func_caps.fd_filters_guaranteed)) { 1498 pf->hw.func_caps.fd_filters_guaranteed)) {
1474 return -EINVAL; 1499 return -EINVAL;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 43d391bb65c4..7379e5a9126b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -1985,7 +1985,7 @@ static int i40e_vlan_rx_add_vid(struct net_device *netdev,
1985 * @netdev: network interface to be adjusted 1985 * @netdev: network interface to be adjusted
1986 * @vid: vlan id to be removed 1986 * @vid: vlan id to be removed
1987 * 1987 *
1988 * net_device_ops implementation for adding vlan ids 1988 * net_device_ops implementation for removing vlan ids
1989 **/ 1989 **/
1990static int i40e_vlan_rx_kill_vid(struct net_device *netdev, 1990static int i40e_vlan_rx_kill_vid(struct net_device *netdev,
1991 __always_unused __be16 proto, u16 vid) 1991 __always_unused __be16 proto, u16 vid)
@@ -2436,6 +2436,9 @@ static void i40e_fdir_filter_restore(struct i40e_vsi *vsi)
2436 struct i40e_pf *pf = vsi->back; 2436 struct i40e_pf *pf = vsi->back;
2437 struct hlist_node *node; 2437 struct hlist_node *node;
2438 2438
2439 if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED))
2440 return;
2441
2439 hlist_for_each_entry_safe(filter, node, 2442 hlist_for_each_entry_safe(filter, node,
2440 &pf->fdir_filter_list, fdir_node) { 2443 &pf->fdir_filter_list, fdir_node) {
2441 i40e_add_del_fdir(vsi, filter, true); 2444 i40e_add_del_fdir(vsi, filter, true);
@@ -2453,8 +2456,6 @@ static int i40e_vsi_configure(struct i40e_vsi *vsi)
2453 i40e_set_vsi_rx_mode(vsi); 2456 i40e_set_vsi_rx_mode(vsi);
2454 i40e_restore_vlan(vsi); 2457 i40e_restore_vlan(vsi);
2455 i40e_vsi_config_dcb_rings(vsi); 2458 i40e_vsi_config_dcb_rings(vsi);
2456 if (vsi->type == I40E_VSI_FDIR)
2457 i40e_fdir_filter_restore(vsi);
2458 err = i40e_vsi_configure_tx(vsi); 2459 err = i40e_vsi_configure_tx(vsi);
2459 if (!err) 2460 if (!err)
2460 err = i40e_vsi_configure_rx(vsi); 2461 err = i40e_vsi_configure_rx(vsi);
@@ -2582,7 +2583,7 @@ static void i40e_configure_msi_and_legacy(struct i40e_vsi *vsi)
2582 /* FIRSTQ_INDX = 0, FIRSTQ_TYPE = 0 (rx) */ 2583 /* FIRSTQ_INDX = 0, FIRSTQ_TYPE = 0 (rx) */
2583 wr32(hw, I40E_PFINT_LNKLST0, 0); 2584 wr32(hw, I40E_PFINT_LNKLST0, 0);
2584 2585
2585 /* Associate the queue pair to the vector and enable the q int */ 2586 /* Associate the queue pair to the vector and enable the queue int */
2586 val = I40E_QINT_RQCTL_CAUSE_ENA_MASK | 2587 val = I40E_QINT_RQCTL_CAUSE_ENA_MASK |
2587 (I40E_RX_ITR << I40E_QINT_RQCTL_ITR_INDX_SHIFT) | 2588 (I40E_RX_ITR << I40E_QINT_RQCTL_ITR_INDX_SHIFT) |
2588 (I40E_QUEUE_TYPE_TX << I40E_QINT_TQCTL_NEXTQ_TYPE_SHIFT); 2589 (I40E_QUEUE_TYPE_TX << I40E_QINT_TQCTL_NEXTQ_TYPE_SHIFT);
@@ -2891,8 +2892,7 @@ static irqreturn_t i40e_intr(int irq, void *data)
2891 icr0_remaining); 2892 icr0_remaining);
2892 if ((icr0_remaining & I40E_PFINT_ICR0_PE_CRITERR_MASK) || 2893 if ((icr0_remaining & I40E_PFINT_ICR0_PE_CRITERR_MASK) ||
2893 (icr0_remaining & I40E_PFINT_ICR0_PCI_EXCEPTION_MASK) || 2894 (icr0_remaining & I40E_PFINT_ICR0_PCI_EXCEPTION_MASK) ||
2894 (icr0_remaining & I40E_PFINT_ICR0_ECC_ERR_MASK) || 2895 (icr0_remaining & I40E_PFINT_ICR0_ECC_ERR_MASK)) {
2895 (icr0_remaining & I40E_PFINT_ICR0_MAL_DETECT_MASK)) {
2896 dev_info(&pf->pdev->dev, "device will be reset\n"); 2896 dev_info(&pf->pdev->dev, "device will be reset\n");
2897 set_bit(__I40E_PF_RESET_REQUESTED, &pf->state); 2897 set_bit(__I40E_PF_RESET_REQUESTED, &pf->state);
2898 i40e_service_event_schedule(pf); 2898 i40e_service_event_schedule(pf);
@@ -3755,8 +3755,8 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc,
3755 NULL); 3755 NULL);
3756 if (aq_ret) { 3756 if (aq_ret) {
3757 dev_info(&vsi->back->pdev->dev, 3757 dev_info(&vsi->back->pdev->dev,
3758 "%s: AQ command Config VSI BW allocation per TC failed = %d\n", 3758 "AQ command Config VSI BW allocation per TC failed = %d\n",
3759 __func__, vsi->back->hw.aq.asq_last_status); 3759 vsi->back->hw.aq.asq_last_status);
3760 return -EINVAL; 3760 return -EINVAL;
3761 } 3761 }
3762 3762
@@ -4085,6 +4085,10 @@ static int i40e_up_complete(struct i40e_vsi *vsi)
4085 } else if (vsi->netdev) { 4085 } else if (vsi->netdev) {
4086 netdev_info(vsi->netdev, "NIC Link is Down\n"); 4086 netdev_info(vsi->netdev, "NIC Link is Down\n");
4087 } 4087 }
4088
4089 /* replay FDIR SB filters */
4090 if (vsi->type == I40E_VSI_FDIR)
4091 i40e_fdir_filter_restore(vsi);
4088 i40e_service_event_schedule(pf); 4092 i40e_service_event_schedule(pf);
4089 4093
4090 return 0; 4094 return 0;
@@ -4364,7 +4368,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)
4364 * for the warning interrupt will deal with the shutdown 4368 * for the warning interrupt will deal with the shutdown
4365 * and recovery of the switch setup. 4369 * and recovery of the switch setup.
4366 */ 4370 */
4367 dev_info(&pf->pdev->dev, "GlobalR requested\n"); 4371 dev_dbg(&pf->pdev->dev, "GlobalR requested\n");
4368 val = rd32(&pf->hw, I40E_GLGEN_RTRIG); 4372 val = rd32(&pf->hw, I40E_GLGEN_RTRIG);
4369 val |= I40E_GLGEN_RTRIG_GLOBR_MASK; 4373 val |= I40E_GLGEN_RTRIG_GLOBR_MASK;
4370 wr32(&pf->hw, I40E_GLGEN_RTRIG, val); 4374 wr32(&pf->hw, I40E_GLGEN_RTRIG, val);
@@ -4375,7 +4379,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)
4375 * 4379 *
4376 * Same as Global Reset, except does *not* include the MAC/PHY 4380 * Same as Global Reset, except does *not* include the MAC/PHY
4377 */ 4381 */
4378 dev_info(&pf->pdev->dev, "CoreR requested\n"); 4382 dev_dbg(&pf->pdev->dev, "CoreR requested\n");
4379 val = rd32(&pf->hw, I40E_GLGEN_RTRIG); 4383 val = rd32(&pf->hw, I40E_GLGEN_RTRIG);
4380 val |= I40E_GLGEN_RTRIG_CORER_MASK; 4384 val |= I40E_GLGEN_RTRIG_CORER_MASK;
4381 wr32(&pf->hw, I40E_GLGEN_RTRIG, val); 4385 wr32(&pf->hw, I40E_GLGEN_RTRIG, val);
@@ -4409,7 +4413,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)
4409 * the switch, since we need to do all the recovery as 4413 * the switch, since we need to do all the recovery as
4410 * for the Core Reset. 4414 * for the Core Reset.
4411 */ 4415 */
4412 dev_info(&pf->pdev->dev, "PFR requested\n"); 4416 dev_dbg(&pf->pdev->dev, "PFR requested\n");
4413 i40e_handle_reset_warning(pf); 4417 i40e_handle_reset_warning(pf);
4414 4418
4415 } else if (reset_flags & (1 << __I40E_REINIT_REQUESTED)) { 4419 } else if (reset_flags & (1 << __I40E_REINIT_REQUESTED)) {
@@ -4458,18 +4462,18 @@ bool i40e_dcb_need_reconfig(struct i40e_pf *pf,
4458 &old_cfg->etscfg.prioritytable, 4462 &old_cfg->etscfg.prioritytable,
4459 sizeof(new_cfg->etscfg.prioritytable))) { 4463 sizeof(new_cfg->etscfg.prioritytable))) {
4460 need_reconfig = true; 4464 need_reconfig = true;
4461 dev_info(&pf->pdev->dev, "ETS UP2TC changed.\n"); 4465 dev_dbg(&pf->pdev->dev, "ETS UP2TC changed.\n");
4462 } 4466 }
4463 4467
4464 if (memcmp(&new_cfg->etscfg.tcbwtable, 4468 if (memcmp(&new_cfg->etscfg.tcbwtable,
4465 &old_cfg->etscfg.tcbwtable, 4469 &old_cfg->etscfg.tcbwtable,
4466 sizeof(new_cfg->etscfg.tcbwtable))) 4470 sizeof(new_cfg->etscfg.tcbwtable)))
4467 dev_info(&pf->pdev->dev, "ETS TC BW Table changed.\n"); 4471 dev_dbg(&pf->pdev->dev, "ETS TC BW Table changed.\n");
4468 4472
4469 if (memcmp(&new_cfg->etscfg.tsatable, 4473 if (memcmp(&new_cfg->etscfg.tsatable,
4470 &old_cfg->etscfg.tsatable, 4474 &old_cfg->etscfg.tsatable,
4471 sizeof(new_cfg->etscfg.tsatable))) 4475 sizeof(new_cfg->etscfg.tsatable)))
4472 dev_info(&pf->pdev->dev, "ETS TSA Table changed.\n"); 4476 dev_dbg(&pf->pdev->dev, "ETS TSA Table changed.\n");
4473 } 4477 }
4474 4478
4475 /* Check if PFC configuration has changed */ 4479 /* Check if PFC configuration has changed */
@@ -4477,7 +4481,7 @@ bool i40e_dcb_need_reconfig(struct i40e_pf *pf,
4477 &old_cfg->pfc, 4481 &old_cfg->pfc,
4478 sizeof(new_cfg->pfc))) { 4482 sizeof(new_cfg->pfc))) {
4479 need_reconfig = true; 4483 need_reconfig = true;
4480 dev_info(&pf->pdev->dev, "PFC config change detected.\n"); 4484 dev_dbg(&pf->pdev->dev, "PFC config change detected.\n");
4481 } 4485 }
4482 4486
4483 /* Check if APP Table has changed */ 4487 /* Check if APP Table has changed */
@@ -4485,7 +4489,7 @@ bool i40e_dcb_need_reconfig(struct i40e_pf *pf,
4485 &old_cfg->app, 4489 &old_cfg->app,
4486 sizeof(new_cfg->app))) { 4490 sizeof(new_cfg->app))) {
4487 need_reconfig = true; 4491 need_reconfig = true;
4488 dev_info(&pf->pdev->dev, "APP Table change detected.\n"); 4492 dev_dbg(&pf->pdev->dev, "APP Table change detected.\n");
4489 } 4493 }
4490 4494
4491 return need_reconfig; 4495 return need_reconfig;
@@ -4535,7 +4539,7 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,
4535 4539
4536 /* No change detected in DCBX configs */ 4540 /* No change detected in DCBX configs */
4537 if (!memcmp(&tmp_dcbx_cfg, dcbx_cfg, sizeof(tmp_dcbx_cfg))) { 4541 if (!memcmp(&tmp_dcbx_cfg, dcbx_cfg, sizeof(tmp_dcbx_cfg))) {
4538 dev_info(&pf->pdev->dev, "No change detected in DCBX configuration.\n"); 4542 dev_dbg(&pf->pdev->dev, "No change detected in DCBX configuration.\n");
4539 goto exit; 4543 goto exit;
4540 } 4544 }
4541 4545
@@ -4593,8 +4597,8 @@ static void i40e_handle_lan_overflow_event(struct i40e_pf *pf,
4593 struct i40e_vf *vf; 4597 struct i40e_vf *vf;
4594 u16 vf_id; 4598 u16 vf_id;
4595 4599
4596 dev_info(&pf->pdev->dev, "%s: Rx Queue Number = %d QTX_CTL=0x%08x\n", 4600 dev_dbg(&pf->pdev->dev, "overflow Rx Queue Number = %d QTX_CTL=0x%08x\n",
4597 __func__, queue, qtx_ctl); 4601 queue, qtx_ctl);
4598 4602
4599 /* Queue belongs to VF, find the VF and issue VF reset */ 4603 /* Queue belongs to VF, find the VF and issue VF reset */
4600 if (((qtx_ctl & I40E_QTX_CTL_PFVF_Q_MASK) 4604 if (((qtx_ctl & I40E_QTX_CTL_PFVF_Q_MASK)
@@ -4624,6 +4628,54 @@ static void i40e_service_event_complete(struct i40e_pf *pf)
4624} 4628}
4625 4629
4626/** 4630/**
4631 * i40e_get_current_fd_count - Get the count of FD filters programmed in the HW
4632 * @pf: board private structure
4633 **/
4634int i40e_get_current_fd_count(struct i40e_pf *pf)
4635{
4636 int val, fcnt_prog;
4637 val = rd32(&pf->hw, I40E_PFQF_FDSTAT);
4638 fcnt_prog = (val & I40E_PFQF_FDSTAT_GUARANT_CNT_MASK) +
4639 ((val & I40E_PFQF_FDSTAT_BEST_CNT_MASK) >>
4640 I40E_PFQF_FDSTAT_BEST_CNT_SHIFT);
4641 return fcnt_prog;
4642}
4643
4644/**
4645 * i40e_fdir_check_and_reenable - Function to reenabe FD ATR or SB if disabled
4646 * @pf: board private structure
4647 **/
4648void i40e_fdir_check_and_reenable(struct i40e_pf *pf)
4649{
4650 u32 fcnt_prog, fcnt_avail;
4651
4652 /* Check if, FD SB or ATR was auto disabled and if there is enough room
4653 * to re-enable
4654 */
4655 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
4656 (pf->flags & I40E_FLAG_FD_SB_ENABLED))
4657 return;
4658 fcnt_prog = i40e_get_current_fd_count(pf);
4659 fcnt_avail = pf->hw.fdir_shared_filter_count +
4660 pf->fdir_pf_filter_count;
4661 if (fcnt_prog < (fcnt_avail - I40E_FDIR_BUFFER_HEAD_ROOM)) {
4662 if ((pf->flags & I40E_FLAG_FD_SB_ENABLED) &&
4663 (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)) {
4664 pf->auto_disable_flags &= ~I40E_FLAG_FD_SB_ENABLED;
4665 dev_info(&pf->pdev->dev, "FD Sideband/ntuple is being enabled since we have space in the table now\n");
4666 }
4667 }
4668 /* Wait for some more space to be available to turn on ATR */
4669 if (fcnt_prog < (fcnt_avail - I40E_FDIR_BUFFER_HEAD_ROOM * 2)) {
4670 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
4671 (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED)) {
4672 pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
4673 dev_info(&pf->pdev->dev, "ATR is being enabled since we have space in the table now\n");
4674 }
4675 }
4676}
4677
4678/**
4627 * i40e_fdir_reinit_subtask - Worker thread to reinit FDIR filter table 4679 * i40e_fdir_reinit_subtask - Worker thread to reinit FDIR filter table
4628 * @pf: board private structure 4680 * @pf: board private structure
4629 **/ 4681 **/
@@ -4632,11 +4684,14 @@ static void i40e_fdir_reinit_subtask(struct i40e_pf *pf)
4632 if (!(pf->flags & I40E_FLAG_FDIR_REQUIRES_REINIT)) 4684 if (!(pf->flags & I40E_FLAG_FDIR_REQUIRES_REINIT))
4633 return; 4685 return;
4634 4686
4635 pf->flags &= ~I40E_FLAG_FDIR_REQUIRES_REINIT;
4636
4637 /* if interface is down do nothing */ 4687 /* if interface is down do nothing */
4638 if (test_bit(__I40E_DOWN, &pf->state)) 4688 if (test_bit(__I40E_DOWN, &pf->state))
4639 return; 4689 return;
4690 i40e_fdir_check_and_reenable(pf);
4691
4692 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
4693 (pf->flags & I40E_FLAG_FD_SB_ENABLED))
4694 pf->flags &= ~I40E_FLAG_FDIR_REQUIRES_REINIT;
4640} 4695}
4641 4696
4642/** 4697/**
@@ -4946,7 +5001,7 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)
4946 event.msg_size); 5001 event.msg_size);
4947 break; 5002 break;
4948 case i40e_aqc_opc_lldp_update_mib: 5003 case i40e_aqc_opc_lldp_update_mib:
4949 dev_info(&pf->pdev->dev, "ARQ: Update LLDP MIB event received\n"); 5004 dev_dbg(&pf->pdev->dev, "ARQ: Update LLDP MIB event received\n");
4950#ifdef CONFIG_I40E_DCB 5005#ifdef CONFIG_I40E_DCB
4951 rtnl_lock(); 5006 rtnl_lock();
4952 ret = i40e_handle_lldp_event(pf, &event); 5007 ret = i40e_handle_lldp_event(pf, &event);
@@ -4954,7 +5009,7 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)
4954#endif /* CONFIG_I40E_DCB */ 5009#endif /* CONFIG_I40E_DCB */
4955 break; 5010 break;
4956 case i40e_aqc_opc_event_lan_overflow: 5011 case i40e_aqc_opc_event_lan_overflow:
4957 dev_info(&pf->pdev->dev, "ARQ LAN queue overflow event received\n"); 5012 dev_dbg(&pf->pdev->dev, "ARQ LAN queue overflow event received\n");
4958 i40e_handle_lan_overflow_event(pf, &event); 5013 i40e_handle_lan_overflow_event(pf, &event);
4959 break; 5014 break;
4960 case i40e_aqc_opc_send_msg_to_peer: 5015 case i40e_aqc_opc_send_msg_to_peer:
@@ -5231,7 +5286,7 @@ static int i40e_prep_for_reset(struct i40e_pf *pf)
5231 if (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state)) 5286 if (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state))
5232 return 0; 5287 return 0;
5233 5288
5234 dev_info(&pf->pdev->dev, "Tearing down internal switch for reset\n"); 5289 dev_dbg(&pf->pdev->dev, "Tearing down internal switch for reset\n");
5235 5290
5236 if (i40e_check_asq_alive(hw)) 5291 if (i40e_check_asq_alive(hw))
5237 i40e_vc_notify_reset(pf); 5292 i40e_vc_notify_reset(pf);
@@ -5278,7 +5333,7 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
5278 5333
5279 if (test_bit(__I40E_DOWN, &pf->state)) 5334 if (test_bit(__I40E_DOWN, &pf->state))
5280 goto end_core_reset; 5335 goto end_core_reset;
5281 dev_info(&pf->pdev->dev, "Rebuilding internal switch\n"); 5336 dev_dbg(&pf->pdev->dev, "Rebuilding internal switch\n");
5282 5337
5283 /* rebuild the basics for the AdminQ, HMC, and initial HW switch */ 5338 /* rebuild the basics for the AdminQ, HMC, and initial HW switch */
5284 ret = i40e_init_adminq(&pf->hw); 5339 ret = i40e_init_adminq(&pf->hw);
@@ -5328,7 +5383,7 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
5328 * try to recover minimal use by getting the basic PF VSI working. 5383 * try to recover minimal use by getting the basic PF VSI working.
5329 */ 5384 */
5330 if (pf->vsi[pf->lan_vsi]->uplink_seid != pf->mac_seid) { 5385 if (pf->vsi[pf->lan_vsi]->uplink_seid != pf->mac_seid) {
5331 dev_info(&pf->pdev->dev, "attempting to rebuild switch\n"); 5386 dev_dbg(&pf->pdev->dev, "attempting to rebuild switch\n");
5332 /* find the one VEB connected to the MAC, and find orphans */ 5387 /* find the one VEB connected to the MAC, and find orphans */
5333 for (v = 0; v < I40E_MAX_VEB; v++) { 5388 for (v = 0; v < I40E_MAX_VEB; v++) {
5334 if (!pf->veb[v]) 5389 if (!pf->veb[v])
@@ -5393,7 +5448,7 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
5393 dv.subbuild_version = 0; 5448 dv.subbuild_version = 0;
5394 i40e_aq_send_driver_version(&pf->hw, &dv, NULL); 5449 i40e_aq_send_driver_version(&pf->hw, &dv, NULL);
5395 5450
5396 dev_info(&pf->pdev->dev, "PF reset done\n"); 5451 dev_info(&pf->pdev->dev, "reset complete\n");
5397 5452
5398end_core_reset: 5453end_core_reset:
5399 clear_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state); 5454 clear_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state);
@@ -5442,7 +5497,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
5442 u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK) 5497 u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK)
5443 >> I40E_GL_MDET_TX_QUEUE_SHIFT; 5498 >> I40E_GL_MDET_TX_QUEUE_SHIFT;
5444 dev_info(&pf->pdev->dev, 5499 dev_info(&pf->pdev->dev,
5445 "Malicious Driver Detection TX event 0x%02x on q %d of function 0x%02x\n", 5500 "Malicious Driver Detection event 0x%02x on TX queue %d of function 0x%02x\n",
5446 event, queue, func); 5501 event, queue, func);
5447 wr32(hw, I40E_GL_MDET_TX, 0xffffffff); 5502 wr32(hw, I40E_GL_MDET_TX, 0xffffffff);
5448 mdd_detected = true; 5503 mdd_detected = true;
@@ -5456,7 +5511,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
5456 u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK) 5511 u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK)
5457 >> I40E_GL_MDET_RX_QUEUE_SHIFT; 5512 >> I40E_GL_MDET_RX_QUEUE_SHIFT;
5458 dev_info(&pf->pdev->dev, 5513 dev_info(&pf->pdev->dev,
5459 "Malicious Driver Detection RX event 0x%02x on q %d of function 0x%02x\n", 5514 "Malicious Driver Detection event 0x%02x on RX queue %d of function 0x%02x\n",
5460 event, queue, func); 5515 event, queue, func);
5461 wr32(hw, I40E_GL_MDET_RX, 0xffffffff); 5516 wr32(hw, I40E_GL_MDET_RX, 0xffffffff);
5462 mdd_detected = true; 5517 mdd_detected = true;
@@ -6293,12 +6348,8 @@ static int i40e_sw_init(struct i40e_pf *pf)
6293 (pf->hw.func_caps.fd_filters_best_effort > 0)) { 6348 (pf->hw.func_caps.fd_filters_best_effort > 0)) {
6294 pf->flags |= I40E_FLAG_FD_ATR_ENABLED; 6349 pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
6295 pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE; 6350 pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE;
6296 dev_info(&pf->pdev->dev,
6297 "Flow Director ATR mode Enabled\n");
6298 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) { 6351 if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) {
6299 pf->flags |= I40E_FLAG_FD_SB_ENABLED; 6352 pf->flags |= I40E_FLAG_FD_SB_ENABLED;
6300 dev_info(&pf->pdev->dev,
6301 "Flow Director Side Band mode Enabled\n");
6302 } else { 6353 } else {
6303 dev_info(&pf->pdev->dev, 6354 dev_info(&pf->pdev->dev,
6304 "Flow Director Side Band mode Disabled in MFP mode\n"); 6355 "Flow Director Side Band mode Disabled in MFP mode\n");
@@ -6322,9 +6373,6 @@ static int i40e_sw_init(struct i40e_pf *pf)
6322 pf->num_req_vfs = min_t(int, 6373 pf->num_req_vfs = min_t(int,
6323 pf->hw.func_caps.num_vfs, 6374 pf->hw.func_caps.num_vfs,
6324 I40E_MAX_VF_COUNT); 6375 I40E_MAX_VF_COUNT);
6325 dev_info(&pf->pdev->dev,
6326 "Number of VFs being requested for PF[%d] = %d\n",
6327 pf->hw.pf_id, pf->num_req_vfs);
6328 } 6376 }
6329#endif /* CONFIG_PCI_IOV */ 6377#endif /* CONFIG_PCI_IOV */
6330 pf->eeprom_version = 0xDEAD; 6378 pf->eeprom_version = 0xDEAD;
@@ -6806,8 +6854,6 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
6806 if (vsi->netdev) { 6854 if (vsi->netdev) {
6807 /* results in a call to i40e_close() */ 6855 /* results in a call to i40e_close() */
6808 unregister_netdev(vsi->netdev); 6856 unregister_netdev(vsi->netdev);
6809 free_netdev(vsi->netdev);
6810 vsi->netdev = NULL;
6811 } 6857 }
6812 } else { 6858 } else {
6813 if (!test_and_set_bit(__I40E_DOWN, &vsi->state)) 6859 if (!test_and_set_bit(__I40E_DOWN, &vsi->state))
@@ -6826,6 +6872,10 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
6826 6872
6827 i40e_vsi_delete(vsi); 6873 i40e_vsi_delete(vsi);
6828 i40e_vsi_free_q_vectors(vsi); 6874 i40e_vsi_free_q_vectors(vsi);
6875 if (vsi->netdev) {
6876 free_netdev(vsi->netdev);
6877 vsi->netdev = NULL;
6878 }
6829 i40e_vsi_clear_rings(vsi); 6879 i40e_vsi_clear_rings(vsi);
6830 i40e_vsi_clear(vsi); 6880 i40e_vsi_clear(vsi);
6831 6881
@@ -6880,8 +6930,7 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi)
6880 } 6930 }
6881 6931
6882 if (vsi->base_vector) { 6932 if (vsi->base_vector) {
6883 dev_info(&pf->pdev->dev, 6933 dev_info(&pf->pdev->dev, "VSI %d has non-zero base vector %d\n",
6884 "VSI %d has non-zero base vector %d\n",
6885 vsi->seid, vsi->base_vector); 6934 vsi->seid, vsi->base_vector);
6886 return -EEXIST; 6935 return -EEXIST;
6887 } 6936 }
@@ -6900,7 +6949,7 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi)
6900 vsi->num_q_vectors, vsi->idx); 6949 vsi->num_q_vectors, vsi->idx);
6901 if (vsi->base_vector < 0) { 6950 if (vsi->base_vector < 0) {
6902 dev_info(&pf->pdev->dev, 6951 dev_info(&pf->pdev->dev,
6903 "failed to get q tracking for VSI %d, err=%d\n", 6952 "failed to get queue tracking for VSI %d, err=%d\n",
6904 vsi->seid, vsi->base_vector); 6953 vsi->seid, vsi->base_vector);
6905 i40e_vsi_free_q_vectors(vsi); 6954 i40e_vsi_free_q_vectors(vsi);
6906 ret = -ENOENT; 6955 ret = -ENOENT;
@@ -7857,6 +7906,44 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
7857 return 0; 7906 return 0;
7858} 7907}
7859 7908
7909#define INFO_STRING_LEN 255
7910static void i40e_print_features(struct i40e_pf *pf)
7911{
7912 struct i40e_hw *hw = &pf->hw;
7913 char *buf, *string;
7914
7915 string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
7916 if (!string) {
7917 dev_err(&pf->pdev->dev, "Features string allocation failed\n");
7918 return;
7919 }
7920
7921 buf = string;
7922
7923 buf += sprintf(string, "Features: PF-id[%d] ", hw->pf_id);
7924#ifdef CONFIG_PCI_IOV
7925 buf += sprintf(buf, "VFs: %d ", pf->num_req_vfs);
7926#endif
7927 buf += sprintf(buf, "VSIs: %d QP: %d ", pf->hw.func_caps.num_vsis,
7928 pf->vsi[pf->lan_vsi]->num_queue_pairs);
7929
7930 if (pf->flags & I40E_FLAG_RSS_ENABLED)
7931 buf += sprintf(buf, "RSS ");
7932 buf += sprintf(buf, "FDir ");
7933 if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
7934 buf += sprintf(buf, "ATR ");
7935 if (pf->flags & I40E_FLAG_FD_SB_ENABLED)
7936 buf += sprintf(buf, "NTUPLE ");
7937 if (pf->flags & I40E_FLAG_DCB_ENABLED)
7938 buf += sprintf(buf, "DCB ");
7939 if (pf->flags & I40E_FLAG_PTP)
7940 buf += sprintf(buf, "PTP ");
7941
7942 BUG_ON(buf > (string + INFO_STRING_LEN));
7943 dev_info(&pf->pdev->dev, "%s\n", string);
7944 kfree(string);
7945}
7946
7860/** 7947/**
7861 * i40e_probe - Device initialization routine 7948 * i40e_probe - Device initialization routine
7862 * @pdev: PCI device information struct 7949 * @pdev: PCI device information struct
@@ -7883,16 +7970,12 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
7883 return err; 7970 return err;
7884 7971
7885 /* set up for high or low dma */ 7972 /* set up for high or low dma */
7886 if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) { 7973 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
7887 /* coherent mask for the same size will always succeed if 7974 if (err)
7888 * dma_set_mask does 7975 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
7889 */ 7976 if (err) {
7890 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); 7977 dev_err(&pdev->dev,
7891 } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { 7978 "DMA configuration failed: 0x%x\n", err);
7892 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
7893 } else {
7894 dev_err(&pdev->dev, "DMA configuration failed: %d\n", err);
7895 err = -EIO;
7896 goto err_dma; 7979 goto err_dma;
7897 } 7980 }
7898 7981
@@ -8130,7 +8213,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8130 8213
8131 i40e_set_pci_config_data(hw, link_status); 8214 i40e_set_pci_config_data(hw, link_status);
8132 8215
8133 dev_info(&pdev->dev, "PCI Express: %s %s\n", 8216 dev_info(&pdev->dev, "PCI-Express: %s %s\n",
8134 (hw->bus.speed == i40e_bus_speed_8000 ? "Speed 8.0GT/s" : 8217 (hw->bus.speed == i40e_bus_speed_8000 ? "Speed 8.0GT/s" :
8135 hw->bus.speed == i40e_bus_speed_5000 ? "Speed 5.0GT/s" : 8218 hw->bus.speed == i40e_bus_speed_5000 ? "Speed 5.0GT/s" :
8136 hw->bus.speed == i40e_bus_speed_2500 ? "Speed 2.5GT/s" : 8219 hw->bus.speed == i40e_bus_speed_2500 ? "Speed 2.5GT/s" :
@@ -8147,6 +8230,9 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8147 dev_warn(&pdev->dev, "Please move the device to a different PCI-e link with more lanes and/or higher transfer rate.\n"); 8230 dev_warn(&pdev->dev, "Please move the device to a different PCI-e link with more lanes and/or higher transfer rate.\n");
8148 } 8231 }
8149 8232
8233 /* print a string summarizing features */
8234 i40e_print_features(pf);
8235
8150 return 0; 8236 return 0;
8151 8237
8152 /* Unwind what we've done if something failed in the setup */ 8238 /* Unwind what we've done if something failed in the setup */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 2081bdb214e5..daa3b295ff3d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -430,23 +430,61 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi,
430/** 430/**
431 * i40e_fd_handle_status - check the Programming Status for FD 431 * i40e_fd_handle_status - check the Programming Status for FD
432 * @rx_ring: the Rx ring for this descriptor 432 * @rx_ring: the Rx ring for this descriptor
433 * @qw: the descriptor data 433 * @rx_desc: the Rx descriptor for programming Status, not a packet descriptor.
434 * @prog_id: the id originally used for programming 434 * @prog_id: the id originally used for programming
435 * 435 *
436 * This is used to verify if the FD programming or invalidation 436 * This is used to verify if the FD programming or invalidation
437 * requested by SW to the HW is successful or not and take actions accordingly. 437 * requested by SW to the HW is successful or not and take actions accordingly.
438 **/ 438 **/
439static void i40e_fd_handle_status(struct i40e_ring *rx_ring, u32 qw, u8 prog_id) 439static void i40e_fd_handle_status(struct i40e_ring *rx_ring,
440 union i40e_rx_desc *rx_desc, u8 prog_id)
440{ 441{
441 struct pci_dev *pdev = rx_ring->vsi->back->pdev; 442 struct i40e_pf *pf = rx_ring->vsi->back;
443 struct pci_dev *pdev = pf->pdev;
444 u32 fcnt_prog, fcnt_avail;
442 u32 error; 445 u32 error;
446 u64 qw;
443 447
448 qw = le64_to_cpu(rx_desc->wb.qword1.status_error_len);
444 error = (qw & I40E_RX_PROG_STATUS_DESC_QW1_ERROR_MASK) >> 449 error = (qw & I40E_RX_PROG_STATUS_DESC_QW1_ERROR_MASK) >>
445 I40E_RX_PROG_STATUS_DESC_QW1_ERROR_SHIFT; 450 I40E_RX_PROG_STATUS_DESC_QW1_ERROR_SHIFT;
446 451
447 /* for now just print the Status */ 452 if (error == (0x1 << I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT)) {
448 dev_info(&pdev->dev, "FD programming id %02x, Status %08x\n", 453 dev_warn(&pdev->dev, "ntuple filter loc = %d, could not be added\n",
449 prog_id, error); 454 rx_desc->wb.qword0.hi_dword.fd_id);
455
456 /* filter programming failed most likely due to table full */
457 fcnt_prog = i40e_get_current_fd_count(pf);
458 fcnt_avail = pf->hw.fdir_shared_filter_count +
459 pf->fdir_pf_filter_count;
460
461 /* If ATR is running fcnt_prog can quickly change,
462 * if we are very close to full, it makes sense to disable
463 * FD ATR/SB and then re-enable it when there is room.
464 */
465 if (fcnt_prog >= (fcnt_avail - I40E_FDIR_BUFFER_FULL_MARGIN)) {
466 /* Turn off ATR first */
467 if (pf->flags | I40E_FLAG_FD_ATR_ENABLED) {
468 pf->flags &= ~I40E_FLAG_FD_ATR_ENABLED;
469 dev_warn(&pdev->dev, "FD filter space full, ATR for further flows will be turned off\n");
470 pf->auto_disable_flags |=
471 I40E_FLAG_FD_ATR_ENABLED;
472 pf->flags |= I40E_FLAG_FDIR_REQUIRES_REINIT;
473 } else if (pf->flags | I40E_FLAG_FD_SB_ENABLED) {
474 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED;
475 dev_warn(&pdev->dev, "FD filter space full, new ntuple rules will not be added\n");
476 pf->auto_disable_flags |=
477 I40E_FLAG_FD_SB_ENABLED;
478 pf->flags |= I40E_FLAG_FDIR_REQUIRES_REINIT;
479 }
480 } else {
481 dev_info(&pdev->dev, "FD filter programming error");
482 }
483 } else if (error ==
484 (0x1 << I40E_RX_PROG_STATUS_DESC_NO_FD_ENTRY_SHIFT)) {
485 netdev_info(rx_ring->vsi->netdev, "ntuple filter loc = %d, could not be removed\n",
486 rx_desc->wb.qword0.hi_dword.fd_id);
487 }
450} 488}
451 489
452/** 490/**
@@ -843,7 +881,7 @@ static void i40e_clean_programming_status(struct i40e_ring *rx_ring,
843 I40E_RX_PROG_STATUS_DESC_QW1_PROGID_SHIFT; 881 I40E_RX_PROG_STATUS_DESC_QW1_PROGID_SHIFT;
844 882
845 if (id == I40E_RX_PROG_STATUS_DESC_FD_FILTER_STATUS) 883 if (id == I40E_RX_PROG_STATUS_DESC_FD_FILTER_STATUS)
846 i40e_fd_handle_status(rx_ring, qw, id); 884 i40e_fd_handle_status(rx_ring, rx_desc, id);
847} 885}
848 886
849/** 887/**
@@ -1536,8 +1574,6 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
1536 if (!tx_ring->atr_sample_rate) 1574 if (!tx_ring->atr_sample_rate)
1537 return; 1575 return;
1538 1576
1539 tx_ring->atr_count++;
1540
1541 /* snag network header to get L4 type and address */ 1577 /* snag network header to get L4 type and address */
1542 hdr.network = skb_network_header(skb); 1578 hdr.network = skb_network_header(skb);
1543 1579
@@ -1559,6 +1595,12 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
1559 1595
1560 th = (struct tcphdr *)(hdr.network + hlen); 1596 th = (struct tcphdr *)(hdr.network + hlen);
1561 1597
1598 /* Due to lack of space, no more new filters can be programmed */
1599 if (th->syn && (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED))
1600 return;
1601
1602 tx_ring->atr_count++;
1603
1562 /* sample on all syn/fin packets or once every atr sample rate */ 1604 /* sample on all syn/fin packets or once every atr sample rate */
1563 if (!th->fin && !th->syn && (tx_ring->atr_count < tx_ring->atr_sample_rate)) 1605 if (!th->fin && !th->syn && (tx_ring->atr_count < tx_ring->atr_sample_rate))
1564 return; 1606 return;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 181a825d3160..5c902f448b1d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -458,6 +458,10 @@ union i40e_32byte_rx_desc {
458 union { 458 union {
459 __le32 rss; /* RSS Hash */ 459 __le32 rss; /* RSS Hash */
460 __le32 fcoe_param; /* FCoE DDP Context id */ 460 __le32 fcoe_param; /* FCoE DDP Context id */
461 /* Flow director filter id in case of
462 * Programming status desc WB
463 */
464 __le32 fd_id;
461 } hi_dword; 465 } hi_dword;
462 } qword0; 466 } qword0;
463 struct { 467 struct {
@@ -698,7 +702,7 @@ enum i40e_rx_prog_status_desc_prog_id_masks {
698enum i40e_rx_prog_status_desc_error_bits { 702enum i40e_rx_prog_status_desc_error_bits {
699 /* Note: These are predefined bit offsets */ 703 /* Note: These are predefined bit offsets */
700 I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT = 0, 704 I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT = 0,
701 I40E_RX_PROG_STATUS_DESC_NO_FD_QUOTA_SHIFT = 1, 705 I40E_RX_PROG_STATUS_DESC_NO_FD_ENTRY_SHIFT = 1,
702 I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT = 2, 706 I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT = 2,
703 I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT = 3 707 I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT = 3
704}; 708};
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 42cc6ba88005..7839343b967b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -69,7 +69,7 @@ static inline bool i40e_vc_isvalid_vector_id(struct i40e_vf *vf, u8 vector_id)
69{ 69{
70 struct i40e_pf *pf = vf->pf; 70 struct i40e_pf *pf = vf->pf;
71 71
72 return vector_id <= pf->hw.func_caps.num_msix_vectors_vf; 72 return vector_id < pf->hw.func_caps.num_msix_vectors_vf;
73} 73}
74 74
75/***********************vf resource mgmt routines*****************/ 75/***********************vf resource mgmt routines*****************/
@@ -126,8 +126,8 @@ static void i40e_config_irq_link_list(struct i40e_vf *vf, u16 vsi_idx,
126 reg_idx = I40E_VPINT_LNKLST0(vf->vf_id); 126 reg_idx = I40E_VPINT_LNKLST0(vf->vf_id);
127 else 127 else
128 reg_idx = I40E_VPINT_LNKLSTN( 128 reg_idx = I40E_VPINT_LNKLSTN(
129 (pf->hw.func_caps.num_msix_vectors_vf 129 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) +
130 * vf->vf_id) + (vector_id - 1)); 130 (vector_id - 1));
131 131
132 if (vecmap->rxq_map == 0 && vecmap->txq_map == 0) { 132 if (vecmap->rxq_map == 0 && vecmap->txq_map == 0) {
133 /* Special case - No queues mapped on this vector */ 133 /* Special case - No queues mapped on this vector */
@@ -506,7 +506,8 @@ static void i40e_free_vf_res(struct i40e_vf *vf)
506 vf->lan_vsi_index = 0; 506 vf->lan_vsi_index = 0;
507 vf->lan_vsi_id = 0; 507 vf->lan_vsi_id = 0;
508 } 508 }
509 msix_vf = pf->hw.func_caps.num_msix_vectors_vf + 1; 509 msix_vf = pf->hw.func_caps.num_msix_vectors_vf;
510
510 /* disable interrupts so the VF starts in a known state */ 511 /* disable interrupts so the VF starts in a known state */
511 for (i = 0; i < msix_vf; i++) { 512 for (i = 0; i < msix_vf; i++) {
512 /* format is same for both registers */ 513 /* format is same for both registers */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index 092aace2a76c..7189d6f08ddd 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -464,6 +464,10 @@ union i40e_32byte_rx_desc {
464 union { 464 union {
465 __le32 rss; /* RSS Hash */ 465 __le32 rss; /* RSS Hash */
466 __le32 fcoe_param; /* FCoE DDP Context id */ 466 __le32 fcoe_param; /* FCoE DDP Context id */
467 /* Flow director filter id in case of
468 * Programming status desc WB
469 */
470 __le32 fd_id;
467 } hi_dword; 471 } hi_dword;
468 } qword0; 472 } qword0;
469 struct { 473 struct {
@@ -704,7 +708,7 @@ enum i40e_rx_prog_status_desc_prog_id_masks {
704enum i40e_rx_prog_status_desc_error_bits { 708enum i40e_rx_prog_status_desc_error_bits {
705 /* Note: These are predefined bit offsets */ 709 /* Note: These are predefined bit offsets */
706 I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT = 0, 710 I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT = 0,
707 I40E_RX_PROG_STATUS_DESC_NO_FD_QUOTA_SHIFT = 1, 711 I40E_RX_PROG_STATUS_DESC_NO_FD_ENTRY_SHIFT = 1,
708 I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT = 2, 712 I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT = 2,
709 I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT = 3 713 I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT = 3
710}; 714};
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 11d0b61510b0..d62e27f6e83a 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -1141,7 +1141,7 @@ static int i40evf_set_interrupt_capability(struct i40evf_adapter *adapter)
1141 * (roughly) twice the number of vectors as there are CPU's. 1141 * (roughly) twice the number of vectors as there are CPU's.
1142 */ 1142 */
1143 v_budget = min(pairs, (int)(num_online_cpus() * 2)) + NONQ_VECS; 1143 v_budget = min(pairs, (int)(num_online_cpus() * 2)) + NONQ_VECS;
1144 v_budget = min(v_budget, (int)adapter->vf_res->max_vectors + 1); 1144 v_budget = min(v_budget, (int)adapter->vf_res->max_vectors);
1145 1145
1146 /* A failure in MSI-X entry allocation isn't fatal, but it does 1146 /* A failure in MSI-X entry allocation isn't fatal, but it does
1147 * mean we disable MSI-X capabilities of the adapter. 1147 * mean we disable MSI-X capabilities of the adapter.
@@ -2182,17 +2182,12 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2182 if (err) 2182 if (err)
2183 return err; 2183 return err;
2184 2184
2185 if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) { 2185 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
2186 /* coherent mask for the same size will always succeed if 2186 if (err)
2187 * dma_set_mask does 2187 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
2188 */ 2188 if (err) {
2189 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); 2189 dev_err(&pdev->dev,
2190 } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { 2190 "DMA configuration failed: 0x%x\n", err);
2191 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
2192 } else {
2193 dev_err(&pdev->dev, "%s: DMA configuration failed: %d\n",
2194 __func__, err);
2195 err = -EIO;
2196 goto err_dma; 2191 goto err_dma;
2197 } 2192 }
2198 2193
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 340a3449e1e9..ea8b9c41cf9f 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1978,7 +1978,7 @@ void igb_reset(struct igb_adapter *adapter)
1978 } 1978 }
1979 } 1979 }
1980#endif 1980#endif
1981 /*Re-establish EEE setting */ 1981 /* Re-establish EEE setting */
1982 if (hw->phy.media_type == e1000_media_type_copper) { 1982 if (hw->phy.media_type == e1000_media_type_copper) {
1983 switch (mac->type) { 1983 switch (mac->type) {
1984 case e1000_i350: 1984 case e1000_i350: