aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-04-15 17:29:00 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-15 17:29:00 -0400
commit6b9107d6a10b69cc0a675447bde9383dff8a1d4f (patch)
treece579f705e65eebb447204c3e8c3166ade049ed1 /drivers/net
parent074975d0374333f656c48487aa046a21a9b9d7a1 (diff)
parent2aea6dcb7864e174dada15728c43c5330637d424 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2015-04-14 This series contains updates to i40e and i40evf. Mitch provides a fix for i40e, where VFs were gone and the associated VSI's had been removed and the rings were not stopped, which in some circumstances cased memory corruption or DMAR errors. So stop all the rings associated with each VF before releasing its resources. Also cleaned up a poorly indented piece of code. Fixes VF link state, where VF devices were assuming link is up unless told otherwise, which means that VFs instantiated on a PF with no link, would report the wrong state. Anjali adds support to add Flow director Sideband rules for a VF from it's PF. Fixes a recently discovered hardware issue, where after a VFLR hardware might be indicating to us a reset completion little too early, so wait another 10 msec for cache to be cleaned up. Jesse enables the user to dump the internal hardware state for better debugging by allowing a bash script to acquire information about the internal hardware state. The data output to the kernel log is collected by the script and can then be sent to Intel. Also fixed a possible failure path to allocate memory that was found by smatch. Cleaned up unused local variables. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_common.c65
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_dcb.c6
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c45
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c29
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c16
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_nvm.c3
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_prototype.h5
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_type.h1
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c244
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_type.h1
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf.h1
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c9
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c42
13 files changed, 304 insertions, 163 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index d596f6624025..0bae22da014d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -2397,6 +2397,7 @@ i40e_aq_erase_nvm_exit:
2397#define I40E_DEV_FUNC_CAP_LED 0x61 2397#define I40E_DEV_FUNC_CAP_LED 0x61
2398#define I40E_DEV_FUNC_CAP_SDP 0x62 2398#define I40E_DEV_FUNC_CAP_SDP 0x62
2399#define I40E_DEV_FUNC_CAP_MDIO 0x63 2399#define I40E_DEV_FUNC_CAP_MDIO 0x63
2400#define I40E_DEV_FUNC_CAP_WR_CSR_PROT 0x64
2400 2401
2401/** 2402/**
2402 * i40e_parse_discover_capabilities 2403 * i40e_parse_discover_capabilities
@@ -2541,11 +2542,18 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
2541 p->fd_filters_guaranteed = number; 2542 p->fd_filters_guaranteed = number;
2542 p->fd_filters_best_effort = logical_id; 2543 p->fd_filters_best_effort = logical_id;
2543 break; 2544 break;
2545 case I40E_DEV_FUNC_CAP_WR_CSR_PROT:
2546 p->wr_csr_prot = (u64)number;
2547 p->wr_csr_prot |= (u64)logical_id << 32;
2548 break;
2544 default: 2549 default:
2545 break; 2550 break;
2546 } 2551 }
2547 } 2552 }
2548 2553
2554 if (p->fcoe)
2555 i40e_debug(hw, I40E_DEBUG_ALL, "device is FCoE capable\n");
2556
2549 /* Software override ensuring FCoE is disabled if npar or mfp 2557 /* Software override ensuring FCoE is disabled if npar or mfp
2550 * mode because it is not supported in these modes. 2558 * mode because it is not supported in these modes.
2551 */ 2559 */
@@ -3503,6 +3511,63 @@ void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status)
3503} 3511}
3504 3512
3505/** 3513/**
3514 * i40e_aq_debug_dump
3515 * @hw: pointer to the hardware structure
3516 * @cluster_id: specific cluster to dump
3517 * @table_id: table id within cluster
3518 * @start_index: index of line in the block to read
3519 * @buff_size: dump buffer size
3520 * @buff: dump buffer
3521 * @ret_buff_size: actual buffer size returned
3522 * @ret_next_table: next block to read
3523 * @ret_next_index: next index to read
3524 *
3525 * Dump internal FW/HW data for debug purposes.
3526 *
3527 **/
3528i40e_status i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
3529 u8 table_id, u32 start_index, u16 buff_size,
3530 void *buff, u16 *ret_buff_size,
3531 u8 *ret_next_table, u32 *ret_next_index,
3532 struct i40e_asq_cmd_details *cmd_details)
3533{
3534 struct i40e_aq_desc desc;
3535 struct i40e_aqc_debug_dump_internals *cmd =
3536 (struct i40e_aqc_debug_dump_internals *)&desc.params.raw;
3537 struct i40e_aqc_debug_dump_internals *resp =
3538 (struct i40e_aqc_debug_dump_internals *)&desc.params.raw;
3539 i40e_status status;
3540
3541 if (buff_size == 0 || !buff)
3542 return I40E_ERR_PARAM;
3543
3544 i40e_fill_default_direct_cmd_desc(&desc,
3545 i40e_aqc_opc_debug_dump_internals);
3546 /* Indirect Command */
3547 desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_BUF);
3548 if (buff_size > I40E_AQ_LARGE_BUF)
3549 desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
3550
3551 cmd->cluster_id = cluster_id;
3552 cmd->table_id = table_id;
3553 cmd->idx = cpu_to_le32(start_index);
3554
3555 desc.datalen = cpu_to_le16(buff_size);
3556
3557 status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details);
3558 if (!status) {
3559 if (ret_buff_size)
3560 *ret_buff_size = le16_to_cpu(desc.datalen);
3561 if (ret_next_table)
3562 *ret_next_table = resp->table_id;
3563 if (ret_next_index)
3564 *ret_next_index = le32_to_cpu(resp->idx);
3565 }
3566
3567 return status;
3568}
3569
3570/**
3506 * i40e_read_bw_from_alt_ram 3571 * i40e_read_bw_from_alt_ram
3507 * @hw: pointer to the hardware structure 3572 * @hw: pointer to the hardware structure
3508 * @max_bw: pointer for max_bw read 3573 * @max_bw: pointer for max_bw read
diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb.c b/drivers/net/ethernet/intel/i40e/i40e_dcb.c
index 6e1466756760..2547aa21b2ca 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_dcb.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_dcb.c
@@ -419,7 +419,7 @@ static void i40e_cee_to_dcb_v1_config(
419{ 419{
420 u16 status, tlv_status = le16_to_cpu(cee_cfg->tlv_status); 420 u16 status, tlv_status = le16_to_cpu(cee_cfg->tlv_status);
421 u16 app_prio = le16_to_cpu(cee_cfg->oper_app_prio); 421 u16 app_prio = le16_to_cpu(cee_cfg->oper_app_prio);
422 u8 i, tc, err, sync, oper; 422 u8 i, tc, err;
423 423
424 /* CEE PG data to ETS config */ 424 /* CEE PG data to ETS config */
425 dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; 425 dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc;
@@ -456,9 +456,7 @@ static void i40e_cee_to_dcb_v1_config(
456 status = (tlv_status & I40E_AQC_CEE_APP_STATUS_MASK) >> 456 status = (tlv_status & I40E_AQC_CEE_APP_STATUS_MASK) >>
457 I40E_AQC_CEE_APP_STATUS_SHIFT; 457 I40E_AQC_CEE_APP_STATUS_SHIFT;
458 err = (status & I40E_TLV_STATUS_ERR) ? 1 : 0; 458 err = (status & I40E_TLV_STATUS_ERR) ? 1 : 0;
459 sync = (status & I40E_TLV_STATUS_SYNC) ? 1 : 0; 459 /* Add APPs if Error is False */
460 oper = (status & I40E_TLV_STATUS_OPER) ? 1 : 0;
461 /* Add APPs if Error is False and Oper/Sync is True */
462 if (!err) { 460 if (!err) {
463 /* CEE operating configuration supports FCoE/iSCSI/FIP only */ 461 /* CEE operating configuration supports FCoE/iSCSI/FIP only */
464 dcbcfg->numapps = I40E_CEE_OPER_MAX_APPS; 462 dcbcfg->numapps = I40E_CEE_OPER_MAX_APPS;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index daa88263af66..34170eabca7d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -1388,6 +1388,50 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1388 r_cfg->app[i].selector, 1388 r_cfg->app[i].selector,
1389 r_cfg->app[i].protocolid); 1389 r_cfg->app[i].protocolid);
1390 } 1390 }
1391 } else if (strncmp(&cmd_buf[5], "debug fwdata", 12) == 0) {
1392 int cluster_id, table_id;
1393 int index, ret;
1394 u16 buff_len = 4096;
1395 u32 next_index;
1396 u8 next_table;
1397 u8 *buff;
1398 u16 rlen;
1399
1400 cnt = sscanf(&cmd_buf[18], "%i %i %i",
1401 &cluster_id, &table_id, &index);
1402 if (cnt != 3) {
1403 dev_info(&pf->pdev->dev,
1404 "dump debug fwdata <cluster_id> <table_id> <index>\n");
1405 goto command_write_done;
1406 }
1407
1408 dev_info(&pf->pdev->dev,
1409 "AQ debug dump fwdata params %x %x %x %x\n",
1410 cluster_id, table_id, index, buff_len);
1411 buff = kzalloc(buff_len, GFP_KERNEL);
1412 if (!buff)
1413 goto command_write_done;
1414
1415 ret = i40e_aq_debug_dump(&pf->hw, cluster_id, table_id,
1416 index, buff_len, buff, &rlen,
1417 &next_table, &next_index,
1418 NULL);
1419 if (ret) {
1420 dev_info(&pf->pdev->dev,
1421 "debug dump fwdata AQ Failed %d 0x%x\n",
1422 ret, pf->hw.aq.asq_last_status);
1423 kfree(buff);
1424 buff = NULL;
1425 goto command_write_done;
1426 }
1427 dev_info(&pf->pdev->dev,
1428 "AQ debug dump fwdata rlen=0x%x next_table=0x%x next_index=0x%x\n",
1429 rlen, next_table, next_index);
1430 print_hex_dump(KERN_INFO, "AQ buffer WB: ",
1431 DUMP_PREFIX_OFFSET, 16, 1,
1432 buff, rlen, true);
1433 kfree(buff);
1434 buff = NULL;
1391 } else { 1435 } else {
1392 dev_info(&pf->pdev->dev, 1436 dev_info(&pf->pdev->dev,
1393 "dump desc tx <vsi_seid> <ring_id> [<desc_n>], dump desc rx <vsi_seid> <ring_id> [<desc_n>],\n"); 1437 "dump desc tx <vsi_seid> <ring_id> [<desc_n>], dump desc rx <vsi_seid> <ring_id> [<desc_n>],\n");
@@ -1903,6 +1947,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1903 dev_info(&pf->pdev->dev, " dump desc rx <vsi_seid> <ring_id> [<desc_n>]\n"); 1947 dev_info(&pf->pdev->dev, " dump desc rx <vsi_seid> <ring_id> [<desc_n>]\n");
1904 dev_info(&pf->pdev->dev, " dump desc aq\n"); 1948 dev_info(&pf->pdev->dev, " dump desc aq\n");
1905 dev_info(&pf->pdev->dev, " dump reset stats\n"); 1949 dev_info(&pf->pdev->dev, " dump reset stats\n");
1950 dev_info(&pf->pdev->dev, " dump debug fwdata <cluster_id> <table_id> <index>\n");
1906 dev_info(&pf->pdev->dev, " msg_enable [level]\n"); 1951 dev_info(&pf->pdev->dev, " msg_enable [level]\n");
1907 dev_info(&pf->pdev->dev, " read <reg>\n"); 1952 dev_info(&pf->pdev->dev, " read <reg>\n");
1908 dev_info(&pf->pdev->dev, " write <reg> <value>\n"); 1953 dev_info(&pf->pdev->dev, " write <reg> <value>\n");
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index c848b1862512..4cbaaeb902c4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -356,8 +356,7 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,
356 /* Set speed and duplex */ 356 /* Set speed and duplex */
357 switch (link_speed) { 357 switch (link_speed) {
358 case I40E_LINK_SPEED_40GB: 358 case I40E_LINK_SPEED_40GB:
359 /* need a SPEED_40000 in ethtool.h */ 359 ethtool_cmd_speed_set(ecmd, SPEED_40000);
360 ethtool_cmd_speed_set(ecmd, 40000);
361 break; 360 break;
362 case I40E_LINK_SPEED_20GB: 361 case I40E_LINK_SPEED_20GB:
363 ethtool_cmd_speed_set(ecmd, SPEED_20000); 362 ethtool_cmd_speed_set(ecmd, SPEED_20000);
@@ -1914,6 +1913,16 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,
1914 else 1913 else
1915 fsp->ring_cookie = rule->q_index; 1914 fsp->ring_cookie = rule->q_index;
1916 1915
1916 if (rule->dest_vsi != pf->vsi[pf->lan_vsi]->id) {
1917 struct i40e_vsi *vsi;
1918
1919 vsi = i40e_find_vsi_from_id(pf, rule->dest_vsi);
1920 if (vsi && vsi->type == I40E_VSI_SRIOV) {
1921 fsp->h_ext.data[1] = htonl(vsi->vf_id);
1922 fsp->m_ext.data[1] = htonl(0x1);
1923 }
1924 }
1925
1917 return 0; 1926 return 0;
1918} 1927}
1919 1928
@@ -2207,6 +2216,7 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
2207 struct i40e_fdir_filter *input; 2216 struct i40e_fdir_filter *input;
2208 struct i40e_pf *pf; 2217 struct i40e_pf *pf;
2209 int ret = -EINVAL; 2218 int ret = -EINVAL;
2219 u16 vf_id;
2210 2220
2211 if (!vsi) 2221 if (!vsi)
2212 return -EINVAL; 2222 return -EINVAL;
@@ -2267,7 +2277,22 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
2267 input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; 2277 input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src;
2268 input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; 2278 input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst;
2269 2279
2280 if (ntohl(fsp->m_ext.data[1])) {
2281 if (ntohl(fsp->h_ext.data[1]) >= pf->num_alloc_vfs) {
2282 netif_info(pf, drv, vsi->netdev, "Invalid VF id\n");
2283 goto free_input;
2284 }
2285 vf_id = ntohl(fsp->h_ext.data[1]);
2286 /* Find vsi id from vf id and override dest vsi */
2287 input->dest_vsi = pf->vf[vf_id].lan_vsi_id;
2288 if (input->q_index >= pf->vf[vf_id].num_queue_pairs) {
2289 netif_info(pf, drv, vsi->netdev, "Invalid queue id\n");
2290 goto free_input;
2291 }
2292 }
2293
2270 ret = i40e_add_del_fdir(vsi, input, true); 2294 ret = i40e_add_del_fdir(vsi, input, true);
2295free_input:
2271 if (ret) 2296 if (ret)
2272 kfree(input); 2297 kfree(input);
2273 else 2298 else
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 63de3f4b7a94..24481cd7e59a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -39,7 +39,7 @@ static const char i40e_driver_string[] =
39 39
40#define DRV_VERSION_MAJOR 1 40#define DRV_VERSION_MAJOR 1
41#define DRV_VERSION_MINOR 3 41#define DRV_VERSION_MINOR 3
42#define DRV_VERSION_BUILD 1 42#define DRV_VERSION_BUILD 2
43#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ 43#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
44 __stringify(DRV_VERSION_MINOR) "." \ 44 __stringify(DRV_VERSION_MINOR) "." \
45 __stringify(DRV_VERSION_BUILD) DRV_KERN 45 __stringify(DRV_VERSION_BUILD) DRV_KERN
@@ -7301,7 +7301,7 @@ err_out:
7301 * i40e_init_interrupt_scheme - Determine proper interrupt scheme 7301 * i40e_init_interrupt_scheme - Determine proper interrupt scheme
7302 * @pf: board private structure to initialize 7302 * @pf: board private structure to initialize
7303 **/ 7303 **/
7304static void i40e_init_interrupt_scheme(struct i40e_pf *pf) 7304static int i40e_init_interrupt_scheme(struct i40e_pf *pf)
7305{ 7305{
7306 int vectors = 0; 7306 int vectors = 0;
7307 ssize_t size; 7307 ssize_t size;
@@ -7343,11 +7343,17 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf)
7343 /* set up vector assignment tracking */ 7343 /* set up vector assignment tracking */
7344 size = sizeof(struct i40e_lump_tracking) + (sizeof(u16) * vectors); 7344 size = sizeof(struct i40e_lump_tracking) + (sizeof(u16) * vectors);
7345 pf->irq_pile = kzalloc(size, GFP_KERNEL); 7345 pf->irq_pile = kzalloc(size, GFP_KERNEL);
7346 if (!pf->irq_pile) {
7347 dev_err(&pf->pdev->dev, "error allocating irq_pile memory\n");
7348 return -ENOMEM;
7349 }
7346 pf->irq_pile->num_entries = vectors; 7350 pf->irq_pile->num_entries = vectors;
7347 pf->irq_pile->search_hint = 0; 7351 pf->irq_pile->search_hint = 0;
7348 7352
7349 /* track first vector for misc interrupts */ 7353 /* track first vector for misc interrupts, ignore return */
7350 (void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1); 7354 (void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1);
7355
7356 return 0;
7351} 7357}
7352 7358
7353/** 7359/**
@@ -9827,7 +9833,9 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9827 9833
9828 /* set up the main switch operations */ 9834 /* set up the main switch operations */
9829 i40e_determine_queue_usage(pf); 9835 i40e_determine_queue_usage(pf);
9830 i40e_init_interrupt_scheme(pf); 9836 err = i40e_init_interrupt_scheme(pf);
9837 if (err)
9838 goto err_switch_setup;
9831 9839
9832 /* The number of VSIs reported by the FW is the minimum guaranteed 9840 /* The number of VSIs reported by the FW is the minimum guaranteed
9833 * to us; HW supports far more and we share the remaining pool with 9841 * to us; HW supports far more and we share the remaining pool with
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index e49acd2accd3..554e49d02683 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -821,13 +821,12 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
821 int *errno) 821 int *errno)
822{ 822{
823 enum i40e_nvmupd_cmd upd_cmd; 823 enum i40e_nvmupd_cmd upd_cmd;
824 u8 transaction, module; 824 u8 transaction;
825 825
826 /* anything that doesn't match a recognized case is an error */ 826 /* anything that doesn't match a recognized case is an error */
827 upd_cmd = I40E_NVMUPD_INVALID; 827 upd_cmd = I40E_NVMUPD_INVALID;
828 828
829 transaction = i40e_nvmupd_get_transaction(cmd->config); 829 transaction = i40e_nvmupd_get_transaction(cmd->config);
830 module = i40e_nvmupd_get_module(cmd->config);
831 830
832 /* limits on data size */ 831 /* limits on data size */
833 if ((cmd->data_size < 1) || 832 if ((cmd->data_size < 1) ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
index fea0d37ecc72..7b34f1e660ea 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
@@ -303,4 +303,9 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw,
303 u16 vsi_seid, u16 queue, bool is_add, 303 u16 vsi_seid, u16 queue, bool is_add,
304 struct i40e_control_filter_stats *stats, 304 struct i40e_control_filter_stats *stats,
305 struct i40e_asq_cmd_details *cmd_details); 305 struct i40e_asq_cmd_details *cmd_details);
306i40e_status i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
307 u8 table_id, u32 start_index, u16 buff_size,
308 void *buff, u16 *ret_buff_size,
309 u8 *ret_next_table, u32 *ret_next_index,
310 struct i40e_asq_cmd_details *cmd_details);
306#endif /* _I40E_PROTOTYPE_H_ */ 311#endif /* _I40E_PROTOTYPE_H_ */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 67c7bc9e9c21..568e855da0f3 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -242,6 +242,7 @@ struct i40e_hw_capabilities {
242 u8 rx_buf_chain_len; 242 u8 rx_buf_chain_len;
243 u32 enabled_tcmap; 243 u32 enabled_tcmap;
244 u32 maxtc; 244 u32 maxtc;
245 u64 wr_csr_prot;
245}; 246};
246 247
247struct i40e_mac_info { 248struct i40e_mac_info {
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 4d69e1f04901..78d1c4ff565e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -26,6 +26,129 @@
26 26
27#include "i40e.h" 27#include "i40e.h"
28 28
29/*********************notification routines***********************/
30
31/**
32 * i40e_vc_vf_broadcast
33 * @pf: pointer to the PF structure
34 * @opcode: operation code
35 * @retval: return value
36 * @msg: pointer to the msg buffer
37 * @msglen: msg length
38 *
39 * send a message to all VFs on a given PF
40 **/
41static void i40e_vc_vf_broadcast(struct i40e_pf *pf,
42 enum i40e_virtchnl_ops v_opcode,
43 i40e_status v_retval, u8 *msg,
44 u16 msglen)
45{
46 struct i40e_hw *hw = &pf->hw;
47 struct i40e_vf *vf = pf->vf;
48 int i;
49
50 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
51 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
52 /* Not all vfs are enabled so skip the ones that are not */
53 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) &&
54 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states))
55 continue;
56
57 /* Ignore return value on purpose - a given VF may fail, but
58 * we need to keep going and send to all of them
59 */
60 i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval,
61 msg, msglen, NULL);
62 }
63}
64
65/**
66 * i40e_vc_notify_link_state
67 * @vf: pointer to the VF structure
68 *
69 * send a link status message to a single VF
70 **/
71static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)
72{
73 struct i40e_virtchnl_pf_event pfe;
74 struct i40e_pf *pf = vf->pf;
75 struct i40e_hw *hw = &pf->hw;
76 struct i40e_link_status *ls = &pf->hw.phy.link_info;
77 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
78
79 pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE;
80 pfe.severity = I40E_PF_EVENT_SEVERITY_INFO;
81 if (vf->link_forced) {
82 pfe.event_data.link_event.link_status = vf->link_up;
83 pfe.event_data.link_event.link_speed =
84 (vf->link_up ? I40E_LINK_SPEED_40GB : 0);
85 } else {
86 pfe.event_data.link_event.link_status =
87 ls->link_info & I40E_AQ_LINK_UP;
88 pfe.event_data.link_event.link_speed = ls->link_speed;
89 }
90 i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT,
91 0, (u8 *)&pfe, sizeof(pfe), NULL);
92}
93
94/**
95 * i40e_vc_notify_link_state
96 * @pf: pointer to the PF structure
97 *
98 * send a link status message to all VFs on a given PF
99 **/
100void i40e_vc_notify_link_state(struct i40e_pf *pf)
101{
102 int i;
103
104 for (i = 0; i < pf->num_alloc_vfs; i++)
105 i40e_vc_notify_vf_link_state(&pf->vf[i]);
106}
107
108/**
109 * i40e_vc_notify_reset
110 * @pf: pointer to the PF structure
111 *
112 * indicate a pending reset to all VFs on a given PF
113 **/
114void i40e_vc_notify_reset(struct i40e_pf *pf)
115{
116 struct i40e_virtchnl_pf_event pfe;
117
118 pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING;
119 pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM;
120 i40e_vc_vf_broadcast(pf, I40E_VIRTCHNL_OP_EVENT, 0,
121 (u8 *)&pfe, sizeof(struct i40e_virtchnl_pf_event));
122}
123
124/**
125 * i40e_vc_notify_vf_reset
126 * @vf: pointer to the VF structure
127 *
128 * indicate a pending reset to the given VF
129 **/
130void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
131{
132 struct i40e_virtchnl_pf_event pfe;
133 int abs_vf_id;
134
135 /* validate the request */
136 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
137 return;
138
139 /* verify if the VF is in either init or active before proceeding */
140 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) &&
141 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states))
142 return;
143
144 abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id;
145
146 pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING;
147 pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM;
148 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT,
149 0, (u8 *)&pfe,
150 sizeof(struct i40e_virtchnl_pf_event), NULL);
151}
29/***********************misc routines*****************************/ 152/***********************misc routines*****************************/
30 153
31/** 154/**
@@ -689,6 +812,9 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr)
689 } 812 }
690 } 813 }
691 814
815 if (flr)
816 usleep_range(10000, 20000);
817
692 if (!rsd) 818 if (!rsd)
693 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", 819 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n",
694 vf->vf_id); 820 vf->vf_id);
@@ -733,6 +859,11 @@ void i40e_free_vfs(struct i40e_pf *pf)
733 while (test_and_set_bit(__I40E_VF_DISABLE, &pf->state)) 859 while (test_and_set_bit(__I40E_VF_DISABLE, &pf->state))
734 usleep_range(1000, 2000); 860 usleep_range(1000, 2000);
735 861
862 for (i = 0; i < pf->num_alloc_vfs; i++)
863 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states))
864 i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx],
865 false);
866
736 /* Disable IOV before freeing resources. This lets any VF drivers 867 /* Disable IOV before freeing resources. This lets any VF drivers
737 * running in the host get themselves cleaned up before we yank 868 * running in the host get themselves cleaned up before we yank
738 * the carpet out from underneath their feet. 869 * the carpet out from underneath their feet.
@@ -1762,6 +1893,7 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode,
1762 break; 1893 break;
1763 case I40E_VIRTCHNL_OP_ENABLE_QUEUES: 1894 case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
1764 ret = i40e_vc_enable_queues_msg(vf, msg, msglen); 1895 ret = i40e_vc_enable_queues_msg(vf, msg, msglen);
1896 i40e_vc_notify_vf_link_state(vf);
1765 break; 1897 break;
1766 case I40E_VIRTCHNL_OP_DISABLE_QUEUES: 1898 case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
1767 ret = i40e_vc_disable_queues_msg(vf, msg, msglen); 1899 ret = i40e_vc_disable_queues_msg(vf, msg, msglen);
@@ -1835,118 +1967,6 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf)
1835} 1967}
1836 1968
1837/** 1969/**
1838 * i40e_vc_vf_broadcast
1839 * @pf: pointer to the PF structure
1840 * @opcode: operation code
1841 * @retval: return value
1842 * @msg: pointer to the msg buffer
1843 * @msglen: msg length
1844 *
1845 * send a message to all VFs on a given PF
1846 **/
1847static void i40e_vc_vf_broadcast(struct i40e_pf *pf,
1848 enum i40e_virtchnl_ops v_opcode,
1849 i40e_status v_retval, u8 *msg,
1850 u16 msglen)
1851{
1852 struct i40e_hw *hw = &pf->hw;
1853 struct i40e_vf *vf = pf->vf;
1854 int i;
1855
1856 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
1857 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1858 /* Not all VFs are enabled so skip the ones that are not */
1859 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) &&
1860 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states))
1861 continue;
1862
1863 /* Ignore return value on purpose - a given VF may fail, but
1864 * we need to keep going and send to all of them
1865 */
1866 i40e_aq_send_msg_to_vf(hw, abs_vf_id, v_opcode, v_retval,
1867 msg, msglen, NULL);
1868 }
1869}
1870
1871/**
1872 * i40e_vc_notify_link_state
1873 * @pf: pointer to the PF structure
1874 *
1875 * send a link status message to all VFs on a given PF
1876 **/
1877void i40e_vc_notify_link_state(struct i40e_pf *pf)
1878{
1879 struct i40e_virtchnl_pf_event pfe;
1880 struct i40e_hw *hw = &pf->hw;
1881 struct i40e_vf *vf = pf->vf;
1882 struct i40e_link_status *ls = &pf->hw.phy.link_info;
1883 int i;
1884
1885 pfe.event = I40E_VIRTCHNL_EVENT_LINK_CHANGE;
1886 pfe.severity = I40E_PF_EVENT_SEVERITY_INFO;
1887 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
1888 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1889 if (vf->link_forced) {
1890 pfe.event_data.link_event.link_status = vf->link_up;
1891 pfe.event_data.link_event.link_speed =
1892 (vf->link_up ? I40E_LINK_SPEED_40GB : 0);
1893 } else {
1894 pfe.event_data.link_event.link_status =
1895 ls->link_info & I40E_AQ_LINK_UP;
1896 pfe.event_data.link_event.link_speed = ls->link_speed;
1897 }
1898 i40e_aq_send_msg_to_vf(hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT,
1899 0, (u8 *)&pfe, sizeof(pfe),
1900 NULL);
1901 }
1902}
1903
1904/**
1905 * i40e_vc_notify_reset
1906 * @pf: pointer to the PF structure
1907 *
1908 * indicate a pending reset to all VFs on a given PF
1909 **/
1910void i40e_vc_notify_reset(struct i40e_pf *pf)
1911{
1912 struct i40e_virtchnl_pf_event pfe;
1913
1914 pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING;
1915 pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM;
1916 i40e_vc_vf_broadcast(pf, I40E_VIRTCHNL_OP_EVENT, I40E_SUCCESS,
1917 (u8 *)&pfe, sizeof(struct i40e_virtchnl_pf_event));
1918}
1919
1920/**
1921 * i40e_vc_notify_vf_reset
1922 * @vf: pointer to the VF structure
1923 *
1924 * indicate a pending reset to the given VF
1925 **/
1926void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
1927{
1928 struct i40e_virtchnl_pf_event pfe;
1929 int abs_vf_id;
1930
1931 /* validate the request */
1932 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
1933 return;
1934
1935 /* verify if the VF is in either init or active before proceeding */
1936 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) &&
1937 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states))
1938 return;
1939
1940 abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id;
1941
1942 pfe.event = I40E_VIRTCHNL_EVENT_RESET_IMPENDING;
1943 pfe.severity = I40E_PF_EVENT_SEVERITY_CERTAIN_DOOM;
1944 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT,
1945 I40E_SUCCESS, (u8 *)&pfe,
1946 sizeof(struct i40e_virtchnl_pf_event), NULL);
1947}
1948
1949/**
1950 * i40e_ndo_set_vf_mac 1970 * i40e_ndo_set_vf_mac
1951 * @netdev: network interface device structure 1971 * @netdev: network interface device structure
1952 * @vf_id: VF identifier 1972 * @vf_id: VF identifier
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index 9c79cb6abb2b..ec9d83a93379 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -242,6 +242,7 @@ struct i40e_hw_capabilities {
242 u8 rx_buf_chain_len; 242 u8 rx_buf_chain_len;
243 u32 enabled_tcmap; 243 u32 enabled_tcmap;
244 u32 maxtc; 244 u32 maxtc;
245 u64 wr_csr_prot;
245}; 246};
246 247
247struct i40e_mac_info { 248struct i40e_mac_info {
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h
index 34c8565031f6..1b98c25b3092 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf.h
+++ b/drivers/net/ethernet/intel/i40evf/i40evf.h
@@ -225,7 +225,6 @@ struct i40evf_adapter {
225#define I40E_FLAG_RX_CSUM_ENABLED I40EVF_FLAG_RX_CSUM_ENABLED 225#define I40E_FLAG_RX_CSUM_ENABLED I40EVF_FLAG_RX_CSUM_ENABLED
226 /* flags for admin queue service task */ 226 /* flags for admin queue service task */
227 u32 aq_required; 227 u32 aq_required;
228 u32 aq_pending;
229#define I40EVF_FLAG_AQ_ENABLE_QUEUES (u32)(1) 228#define I40EVF_FLAG_AQ_ENABLE_QUEUES (u32)(1)
230#define I40EVF_FLAG_AQ_DISABLE_QUEUES (u32)(1 << 1) 229#define I40EVF_FLAG_AQ_DISABLE_QUEUES (u32)(1 << 1)
231#define I40EVF_FLAG_AQ_ADD_MAC_FILTER (u32)(1 << 2) 230#define I40EVF_FLAG_AQ_ADD_MAC_FILTER (u32)(1 << 2)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 6d5f3b21c68a..7c53aca4b5a6 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -1008,7 +1008,6 @@ void i40evf_down(struct i40evf_adapter *adapter)
1008 adapter->state != __I40EVF_RESETTING) { 1008 adapter->state != __I40EVF_RESETTING) {
1009 /* cancel any current operation */ 1009 /* cancel any current operation */
1010 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; 1010 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
1011 adapter->aq_pending = 0;
1012 /* Schedule operations to close down the HW. Don't wait 1011 /* Schedule operations to close down the HW. Don't wait
1013 * here for this to complete. The watchdog is still running 1012 * here for this to complete. The watchdog is still running
1014 * and it will take care of this. 1013 * and it will take care of this.
@@ -1335,7 +1334,6 @@ static void i40evf_watchdog_task(struct work_struct *work)
1335 */ 1334 */
1336 return; 1335 return;
1337 } 1336 }
1338 adapter->aq_pending = 0;
1339 adapter->aq_required = 0; 1337 adapter->aq_required = 0;
1340 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; 1338 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
1341 goto watchdog_done; 1339 goto watchdog_done;
@@ -1355,7 +1353,6 @@ static void i40evf_watchdog_task(struct work_struct *work)
1355 adapter->flags |= I40EVF_FLAG_RESET_PENDING; 1353 adapter->flags |= I40EVF_FLAG_RESET_PENDING;
1356 dev_err(&adapter->pdev->dev, "Hardware reset detected\n"); 1354 dev_err(&adapter->pdev->dev, "Hardware reset detected\n");
1357 schedule_work(&adapter->reset_task); 1355 schedule_work(&adapter->reset_task);
1358 adapter->aq_pending = 0;
1359 adapter->aq_required = 0; 1356 adapter->aq_required = 0;
1360 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; 1357 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
1361 goto watchdog_done; 1358 goto watchdog_done;
@@ -1364,7 +1361,7 @@ static void i40evf_watchdog_task(struct work_struct *work)
1364 /* Process admin queue tasks. After init, everything gets done 1361 /* Process admin queue tasks. After init, everything gets done
1365 * here so we don't race on the admin queue. 1362 * here so we don't race on the admin queue.
1366 */ 1363 */
1367 if (adapter->aq_pending) { 1364 if (adapter->current_op) {
1368 if (!i40evf_asq_done(hw)) { 1365 if (!i40evf_asq_done(hw)) {
1369 dev_dbg(&adapter->pdev->dev, "Admin queue timeout\n"); 1366 dev_dbg(&adapter->pdev->dev, "Admin queue timeout\n");
1370 i40evf_send_api_ver(adapter); 1367 i40evf_send_api_ver(adapter);
@@ -2029,7 +2026,7 @@ static void i40evf_init_task(struct work_struct *work)
2029 if (err) { 2026 if (err) {
2030 dev_err(&pdev->dev, "Failed to set MAC type (%d)\n", 2027 dev_err(&pdev->dev, "Failed to set MAC type (%d)\n",
2031 err); 2028 err);
2032 goto err; 2029 goto err;
2033 } 2030 }
2034 err = i40evf_check_reset_complete(hw); 2031 err = i40evf_check_reset_complete(hw);
2035 if (err) { 2032 if (err) {
@@ -2249,7 +2246,6 @@ static void i40evf_shutdown(struct pci_dev *pdev)
2249 /* Prevent the watchdog from running. */ 2246 /* Prevent the watchdog from running. */
2250 adapter->state = __I40EVF_REMOVE; 2247 adapter->state = __I40EVF_REMOVE;
2251 adapter->aq_required = 0; 2248 adapter->aq_required = 0;
2252 adapter->aq_pending = 0;
2253 2249
2254#ifdef CONFIG_PM 2250#ifdef CONFIG_PM
2255 pci_save_state(pdev); 2251 pci_save_state(pdev);
@@ -2467,7 +2463,6 @@ static void i40evf_remove(struct pci_dev *pdev)
2467 /* Shut down all the garbage mashers on the detention level */ 2463 /* Shut down all the garbage mashers on the detention level */
2468 adapter->state = __I40EVF_REMOVE; 2464 adapter->state = __I40EVF_REMOVE;
2469 adapter->aq_required = 0; 2465 adapter->aq_required = 0;
2470 adapter->aq_pending = 0;
2471 i40evf_request_reset(adapter); 2466 i40evf_request_reset(adapter);
2472 msleep(20); 2467 msleep(20);
2473 /* If the FW isn't responding, kick it once, but only once. */ 2468 /* If the FW isn't responding, kick it once, but only once. */
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index 4240a496dc50..61e090558f31 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -250,7 +250,6 @@ void i40evf_configure_queues(struct i40evf_adapter *adapter)
250 vqpi++; 250 vqpi++;
251 } 251 }
252 252
253 adapter->aq_pending |= I40EVF_FLAG_AQ_CONFIGURE_QUEUES;
254 adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES; 253 adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES;
255 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES, 254 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
256 (u8 *)vqci, len); 255 (u8 *)vqci, len);
@@ -277,7 +276,6 @@ void i40evf_enable_queues(struct i40evf_adapter *adapter)
277 vqs.vsi_id = adapter->vsi_res->vsi_id; 276 vqs.vsi_id = adapter->vsi_res->vsi_id;
278 vqs.tx_queues = (1 << adapter->num_active_queues) - 1; 277 vqs.tx_queues = (1 << adapter->num_active_queues) - 1;
279 vqs.rx_queues = vqs.tx_queues; 278 vqs.rx_queues = vqs.tx_queues;
280 adapter->aq_pending |= I40EVF_FLAG_AQ_ENABLE_QUEUES;
281 adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES; 279 adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES;
282 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ENABLE_QUEUES, 280 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ENABLE_QUEUES,
283 (u8 *)&vqs, sizeof(vqs)); 281 (u8 *)&vqs, sizeof(vqs));
@@ -303,7 +301,6 @@ void i40evf_disable_queues(struct i40evf_adapter *adapter)
303 vqs.vsi_id = adapter->vsi_res->vsi_id; 301 vqs.vsi_id = adapter->vsi_res->vsi_id;
304 vqs.tx_queues = (1 << adapter->num_active_queues) - 1; 302 vqs.tx_queues = (1 << adapter->num_active_queues) - 1;
305 vqs.rx_queues = vqs.tx_queues; 303 vqs.rx_queues = vqs.tx_queues;
306 adapter->aq_pending |= I40EVF_FLAG_AQ_DISABLE_QUEUES;
307 adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES; 304 adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES;
308 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DISABLE_QUEUES, 305 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DISABLE_QUEUES,
309 (u8 *)&vqs, sizeof(vqs)); 306 (u8 *)&vqs, sizeof(vqs));
@@ -354,7 +351,6 @@ void i40evf_map_queues(struct i40evf_adapter *adapter)
354 vimi->vecmap[v_idx].txq_map = 0; 351 vimi->vecmap[v_idx].txq_map = 0;
355 vimi->vecmap[v_idx].rxq_map = 0; 352 vimi->vecmap[v_idx].rxq_map = 0;
356 353
357 adapter->aq_pending |= I40EVF_FLAG_AQ_MAP_VECTORS;
358 adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS; 354 adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS;
359 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP, 355 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
360 (u8 *)vimi, len); 356 (u8 *)vimi, len);
@@ -415,7 +411,6 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
415 f->add = false; 411 f->add = false;
416 } 412 }
417 } 413 }
418 adapter->aq_pending |= I40EVF_FLAG_AQ_ADD_MAC_FILTER;
419 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER; 414 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
420 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS, 415 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
421 (u8 *)veal, len); 416 (u8 *)veal, len);
@@ -476,7 +471,6 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
476 kfree(f); 471 kfree(f);
477 } 472 }
478 } 473 }
479 adapter->aq_pending |= I40EVF_FLAG_AQ_DEL_MAC_FILTER;
480 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER; 474 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
481 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS, 475 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
482 (u8 *)veal, len); 476 (u8 *)veal, len);
@@ -537,7 +531,6 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
537 f->add = false; 531 f->add = false;
538 } 532 }
539 } 533 }
540 adapter->aq_pending |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
541 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER; 534 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
542 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len); 535 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len);
543 kfree(vvfl); 536 kfree(vvfl);
@@ -598,7 +591,6 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
598 kfree(f); 591 kfree(f);
599 } 592 }
600 } 593 }
601 adapter->aq_pending |= I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
602 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER; 594 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
603 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len); 595 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len);
604 kfree(vvfl); 596 kfree(vvfl);
@@ -720,9 +712,6 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
720 __func__, v_retval, v_opcode); 712 __func__, v_retval, v_opcode);
721 } 713 }
722 switch (v_opcode) { 714 switch (v_opcode) {
723 case I40E_VIRTCHNL_OP_VERSION:
724 /* no action, but also not an error */
725 break;
726 case I40E_VIRTCHNL_OP_GET_STATS: { 715 case I40E_VIRTCHNL_OP_GET_STATS: {
727 struct i40e_eth_stats *stats = 716 struct i40e_eth_stats *stats =
728 (struct i40e_eth_stats *)msg; 717 (struct i40e_eth_stats *)msg;
@@ -740,39 +729,30 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
740 adapter->current_stats = *stats; 729 adapter->current_stats = *stats;
741 } 730 }
742 break; 731 break;
743 case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
744 adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ADD_MAC_FILTER);
745 break;
746 case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
747 adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DEL_MAC_FILTER);
748 break;
749 case I40E_VIRTCHNL_OP_ADD_VLAN:
750 adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ADD_VLAN_FILTER);
751 break;
752 case I40E_VIRTCHNL_OP_DEL_VLAN:
753 adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DEL_VLAN_FILTER);
754 break;
755 case I40E_VIRTCHNL_OP_ENABLE_QUEUES: 732 case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
756 adapter->aq_pending &= ~(I40EVF_FLAG_AQ_ENABLE_QUEUES);
757 /* enable transmits */ 733 /* enable transmits */
758 i40evf_irq_enable(adapter, true); 734 i40evf_irq_enable(adapter, true);
759 netif_tx_start_all_queues(adapter->netdev); 735 netif_tx_start_all_queues(adapter->netdev);
760 netif_carrier_on(adapter->netdev); 736 netif_carrier_on(adapter->netdev);
761 break; 737 break;
762 case I40E_VIRTCHNL_OP_DISABLE_QUEUES: 738 case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
763 adapter->aq_pending &= ~(I40EVF_FLAG_AQ_DISABLE_QUEUES);
764 i40evf_free_all_tx_resources(adapter); 739 i40evf_free_all_tx_resources(adapter);
765 i40evf_free_all_rx_resources(adapter); 740 i40evf_free_all_rx_resources(adapter);
766 break; 741 break;
767 case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES: 742 case I40E_VIRTCHNL_OP_VERSION:
768 adapter->aq_pending &= ~(I40EVF_FLAG_AQ_CONFIGURE_QUEUES); 743 case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
769 break;
770 case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP: 744 case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
771 adapter->aq_pending &= ~(I40EVF_FLAG_AQ_MAP_VECTORS); 745 /* Don't display an error if we get these out of sequence.
746 * If the firmware needed to get kicked, we'll get these and
747 * it's no problem.
748 */
749 if (v_opcode != adapter->current_op)
750 return;
772 break; 751 break;
773 default: 752 default:
774 dev_info(&adapter->pdev->dev, "Received unexpected message %d from PF\n", 753 if (v_opcode != adapter->current_op)
775 v_opcode); 754 dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n",
755 adapter->current_op, v_opcode);
776 break; 756 break;
777 } /* switch v_opcode */ 757 } /* switch v_opcode */
778 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; 758 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;