Lines Matching refs:pf
18 static void i40e_vc_vf_broadcast(struct i40e_pf *pf, in i40e_vc_vf_broadcast() argument
23 struct i40e_hw *hw = &pf->hw; in i40e_vc_vf_broadcast()
24 struct i40e_vf *vf = pf->vf; in i40e_vc_vf_broadcast()
27 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { in i40e_vc_vf_broadcast()
111 struct i40e_pf *pf = vf->pf; in i40e_vc_notify_vf_link_state() local
112 struct i40e_hw *hw = &pf->hw; in i40e_vc_notify_vf_link_state()
113 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_notify_vf_link_state()
131 void i40e_vc_notify_link_state(struct i40e_pf *pf) in i40e_vc_notify_link_state() argument
135 for (i = 0; i < pf->num_alloc_vfs; i++) in i40e_vc_notify_link_state()
136 i40e_vc_notify_vf_link_state(&pf->vf[i]); in i40e_vc_notify_link_state()
145 void i40e_vc_notify_reset(struct i40e_pf *pf) in i40e_vc_notify_reset() argument
151 i40e_vc_vf_broadcast(pf, VIRTCHNL_OP_EVENT, 0, in i40e_vc_notify_reset()
167 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_notify_vf_reset()
175 abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id; in i40e_vc_notify_vf_reset()
179 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, VIRTCHNL_OP_EVENT, in i40e_vc_notify_vf_reset()
193 struct i40e_pf *pf = vf->pf; in i40e_vc_reset_vf() local
208 if (test_bit(__I40E_VFS_RELEASING, pf->state)) in i40e_vc_reset_vf()
216 dev_warn(&vf->pf->pdev->dev, in i40e_vc_reset_vf()
220 dev_dbg(&vf->pf->pdev->dev, in i40e_vc_reset_vf()
234 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vsi_id() local
235 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_vsi_id()
251 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_queue_id() local
252 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_queue_id()
266 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vector_id() local
268 return vector_id < pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_isvalid_vector_id()
284 struct i40e_pf *pf = vf->pf; in i40e_vc_get_pf_queue_id() local
285 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_get_pf_queue_id()
346 struct i40e_pf *pf = vf->pf; in i40e_config_irq_link_list() local
347 struct i40e_hw *hw = &pf->hw; in i40e_config_irq_link_list()
360 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) + in i40e_config_irq_link_list()
450 struct i40e_pf *pf = vf->pf; in i40e_release_iwarp_qvlist() local
458 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_release_iwarp_qvlist()
462 struct i40e_hw *hw = &pf->hw; in i40e_release_iwarp_qvlist()
503 struct i40e_pf *pf = vf->pf; in i40e_config_iwarp_qvlist() local
504 struct i40e_hw *hw = &pf->hw; in i40e_config_iwarp_qvlist()
511 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_iwarp_qvlist()
514 dev_warn(&pf->pdev->dev, in i40e_config_iwarp_qvlist()
532 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_iwarp_qvlist()
606 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_tx_queue() local
607 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_tx_queue()
619 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vsi_tx_queue()
639 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
649 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
684 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
685 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_config_vsi_rx_queue()
686 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
743 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
753 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
774 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
779 vsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, pf->vsi[pf->lan_vsi]->seid, in i40e_alloc_vsi_res()
783 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
785 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
791 u64 hena = i40e_pf_get_default_rss_hena(pf); in i40e_alloc_vsi_res()
810 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
817 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
820 wr32(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)hena); in i40e_alloc_vsi_res()
821 wr32(&pf->hw, I40E_VFQF_HENA1(1, vf->vf_id), (u32)(hena >> 32)); in i40e_alloc_vsi_res()
825 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
843 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
846 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
863 struct i40e_pf *pf = vf->pf; in i40e_map_pf_queues_to_vsi() local
864 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_queues_to_vsi()
877 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_queues_to_vsi()
910 struct i40e_pf *pf = vf->pf; in i40e_map_pf_to_vf_queues() local
911 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_to_vf_queues()
925 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_to_vf_queues()
948 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
949 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
977 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
978 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
997 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
998 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
1011 pf->queues_left += vf->num_queue_pairs - in i40e_free_vf_res()
1017 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
1030 i40e_vsi_release(pf->vsi[vf->ch[j].vsi_idx]); in i40e_free_vf_res()
1035 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
1078 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
1083 vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF) in i40e_alloc_vf_res()
1084 pf->num_vf_qps = vf->num_req_queues; in i40e_alloc_vf_res()
1086 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_alloc_vf_res()
1092 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
1096 if (pf->queues_left >= in i40e_alloc_vf_res()
1107 dev_info(&pf->pdev->dev, "VF %d: Not enough queues to allocate, disabling ADq\n", in i40e_alloc_vf_res()
1119 pf->queues_left -= in i40e_alloc_vf_res()
1153 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
1154 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
1254 struct i40e_pf *pf = vf->pf; in i40e_set_vsi_promisc() local
1255 struct i40e_hw *hw = &pf->hw; in i40e_set_vsi_promisc()
1264 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1266 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1269 i40e_stat_str(&pf->hw, aq_ret), in i40e_set_vsi_promisc()
1270 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1280 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1282 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1285 i40e_stat_str(&pf->hw, aq_ret), in i40e_set_vsi_promisc()
1286 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1297 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1299 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1302 i40e_stat_str(&pf->hw, aq_ret), in i40e_set_vsi_promisc()
1303 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1313 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1315 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1318 i40e_stat_str(&pf->hw, aq_ret), in i40e_set_vsi_promisc()
1319 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1348 struct i40e_pf *pf = vf->pf; in i40e_config_vf_promiscuous_mode() local
1353 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vf_promiscuous_mode()
1390 struct i40e_pf *pf = vf->pf; in i40e_trigger_vf_reset() local
1391 struct i40e_hw *hw = &pf->hw; in i40e_trigger_vf_reset()
1422 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_trigger_vf_reset()
1436 struct i40e_pf *pf = vf->pf; in i40e_cleanup_reset_vf() local
1437 struct i40e_hw *hw = &pf->hw; in i40e_cleanup_reset_vf()
1469 i40e_notify_client_of_vf_reset(pf, abs_vf_id); in i40e_cleanup_reset_vf()
1490 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
1491 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
1496 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) in i40e_reset_vf()
1502 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_vf()
1528 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
1534 i40e_vsi_stop_rings(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_vf()
1539 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_reset_vf()
1556 bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) in i40e_reset_all_vfs() argument
1558 struct i40e_hw *hw = &pf->hw; in i40e_reset_all_vfs()
1564 if (!pf->num_alloc_vfs) in i40e_reset_all_vfs()
1568 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_all_vfs()
1572 for (v = 0; v < pf->num_alloc_vfs; v++) in i40e_reset_all_vfs()
1573 i40e_trigger_vf_reset(&pf->vf[v], flr); in i40e_reset_all_vfs()
1581 for (i = 0, v = 0; i < 10 && v < pf->num_alloc_vfs; i++) { in i40e_reset_all_vfs()
1587 while (v < pf->num_alloc_vfs) { in i40e_reset_all_vfs()
1588 vf = &pf->vf[v]; in i40e_reset_all_vfs()
1606 if (v < pf->num_alloc_vfs) in i40e_reset_all_vfs()
1607 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_all_vfs()
1608 pf->vf[v].vf_id); in i40e_reset_all_vfs()
1614 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1616 if (pf->vf[v].lan_vsi_idx == 0) in i40e_reset_all_vfs()
1619 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[v].lan_vsi_idx]); in i40e_reset_all_vfs()
1625 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1627 if (pf->vf[v].lan_vsi_idx == 0) in i40e_reset_all_vfs()
1630 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[v].lan_vsi_idx]); in i40e_reset_all_vfs()
1639 for (v = 0; v < pf->num_alloc_vfs; v++) in i40e_reset_all_vfs()
1640 i40e_cleanup_reset_vf(&pf->vf[v]); in i40e_reset_all_vfs()
1643 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_reset_all_vfs()
1654 void i40e_free_vfs(struct i40e_pf *pf) in i40e_free_vfs() argument
1656 struct i40e_hw *hw = &pf->hw; in i40e_free_vfs()
1660 if (!pf->vf) in i40e_free_vfs()
1663 set_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1664 while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_free_vfs()
1667 i40e_notify_client_of_vf_enable(pf, 0); in i40e_free_vfs()
1673 if (!pci_vfs_assigned(pf->pdev)) in i40e_free_vfs()
1674 pci_disable_sriov(pf->pdev); in i40e_free_vfs()
1676 dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); in i40e_free_vfs()
1679 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1680 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1683 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1686 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1687 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1690 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1694 tmp = pf->num_alloc_vfs; in i40e_free_vfs()
1695 pf->num_alloc_vfs = 0; in i40e_free_vfs()
1697 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1698 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
1700 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
1703 kfree(pf->vf); in i40e_free_vfs()
1704 pf->vf = NULL; in i40e_free_vfs()
1710 if (!pci_vfs_assigned(pf->pdev)) { in i40e_free_vfs()
1720 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_free_vfs()
1721 clear_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1732 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) in i40e_alloc_vfs() argument
1738 i40e_irq_dynamic_disable_icr0(pf); in i40e_alloc_vfs()
1741 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { in i40e_alloc_vfs()
1742 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); in i40e_alloc_vfs()
1744 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_alloc_vfs()
1745 pf->num_alloc_vfs = 0; in i40e_alloc_vfs()
1755 pf->vf = vfs; in i40e_alloc_vfs()
1759 vfs[i].pf = pf; in i40e_alloc_vfs()
1770 pf->num_alloc_vfs = num_alloc_vfs; in i40e_alloc_vfs()
1773 i40e_reset_all_vfs(pf, false); in i40e_alloc_vfs()
1775 i40e_notify_client_of_vf_enable(pf, num_alloc_vfs); in i40e_alloc_vfs()
1779 i40e_free_vfs(pf); in i40e_alloc_vfs()
1782 i40e_irq_dynamic_enable_icr0(pf); in i40e_alloc_vfs()
1797 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_enable() local
1801 if (test_bit(__I40E_TESTING, pf->state)) { in i40e_pci_sriov_enable()
1809 i40e_free_vfs(pf); in i40e_pci_sriov_enable()
1813 if (num_vfs > pf->num_req_vfs) { in i40e_pci_sriov_enable()
1815 num_vfs, pf->num_req_vfs); in i40e_pci_sriov_enable()
1821 err = i40e_alloc_vfs(pf, num_vfs); in i40e_pci_sriov_enable()
1846 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_configure() local
1849 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_pci_sriov_configure()
1855 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_pci_sriov_configure()
1856 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1857 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1863 if (!pci_vfs_assigned(pf->pdev)) { in i40e_pci_sriov_configure()
1864 i40e_free_vfs(pf); in i40e_pci_sriov_configure()
1865 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1866 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1873 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_pci_sriov_configure()
1894 struct i40e_pf *pf; in i40e_vc_send_msg_to_vf_ex() local
1900 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf_ex()
1903 pf = vf->pf; in i40e_vc_send_msg_to_vf_ex()
1904 hw = &pf->hw; in i40e_vc_send_msg_to_vf_ex()
1910 dev_info(&pf->pdev->dev, "VF %d failed opcode %d, retval: %d\n", in i40e_vc_send_msg_to_vf_ex()
1914 dev_err(&pf->pdev->dev, in i40e_vc_send_msg_to_vf_ex()
1917 dev_err(&pf->pdev->dev, "Use PF Control I/F to enable the VF\n"); in i40e_vc_send_msg_to_vf_ex()
1929 dev_info(&pf->pdev->dev, in i40e_vc_send_msg_to_vf_ex()
1931 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf_ex()
2024 struct i40e_pf *pf = vf->pf; in i40e_del_qch() local
2032 i40e_vsi_release(pf->vsi[vf->ch[i].vsi_idx]); in i40e_del_qch()
2049 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg() local
2077 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
2081 if (i40e_vf_client_capable(pf, vf->vf_id) && in i40e_vc_get_vf_resources_msg()
2092 if ((pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) && in i40e_vc_get_vf_resources_msg()
2099 if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) { in i40e_vc_get_vf_resources_msg()
2108 if ((pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE) && in i40e_vc_get_vf_resources_msg()
2113 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_vc_get_vf_resources_msg()
2114 dev_err(&pf->pdev->dev, in i40e_vc_get_vf_resources_msg()
2123 if (pf->hw_features & I40E_HW_WB_ON_ITR_CAPABLE) { in i40e_vc_get_vf_resources_msg()
2137 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_get_vf_resources_msg()
2174 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
2184 dev_err(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2219 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2224 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2231 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2236 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2261 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
2351 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = in i40e_vc_config_queues_msg()
2355 vsi = pf->vsi[vf->ch[i].vsi_idx]; in i40e_vc_config_queues_msg()
2422 vf->pf->hw.func_caps.num_msix_vectors_vf) { in i40e_vc_config_irq_map_msg()
2464 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_tx_rings() local
2469 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_ctrl_vf_tx_rings()
2487 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_rx_rings() local
2492 ret = i40e_control_wait_rx_q(pf, vsi->base_queue + q_id, in i40e_ctrl_vf_rx_rings()
2527 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
2547 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_enable_queues_msg()
2552 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_enable_queues_msg()
2562 if (i40e_vsi_start_rings(pf->vsi[vf->ch[i].vsi_idx])) in i40e_vc_enable_queues_msg()
2585 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
2604 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_disable_queues_msg()
2609 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_disable_queues_msg()
2636 struct i40e_pf *pf = vf->pf; in i40e_vc_request_queues_msg() local
2642 dev_err(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2647 } else if (req_pairs - cur_pairs > pf->queues_left) { in i40e_vc_request_queues_msg()
2648 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2652 pf->queues_left); in i40e_vc_request_queues_msg()
2653 vfres->num_queue_pairs = pf->queues_left + cur_pairs; in i40e_vc_request_queues_msg()
2676 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
2693 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
2735 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission() local
2736 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_vf_permission()
2747 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_check_vf_permission()
2762 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2781 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2799 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
2811 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
2833 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
2851 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_add_mac_addr_msg()
2872 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
2886 dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n", in i40e_vc_del_mac_addr_msg()
2894 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
2910 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_del_mac_addr_msg()
2945 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
2952 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
2965 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
2970 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
2984 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
2989 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
2995 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3016 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
3034 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
3046 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3051 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3072 struct i40e_pf *pf = vf->pf; in i40e_vc_iwarp_msg() local
3073 int abs_vf_id = vf->vf_id + pf->hw.func_caps.vf_base_id; in i40e_vc_iwarp_msg()
3082 i40e_notify_client_of_vf_msg(pf->vsi[pf->lan_vsi], abs_vf_id, in i40e_vc_iwarp_msg()
3137 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_key() local
3148 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_key()
3167 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_lut() local
3185 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_lut()
3203 struct i40e_pf *pf = vf->pf; in i40e_vc_get_rss_hena() local
3219 vrh->hena = i40e_pf_get_default_rss_hena(pf); in i40e_vc_get_rss_hena()
3239 struct i40e_pf *pf = vf->pf; in i40e_vc_set_rss_hena() local
3240 struct i40e_hw *hw = &pf->hw; in i40e_vc_set_rss_hena()
3273 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_enable_vlan_stripping()
3299 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_disable_vlan_stripping()
3320 struct i40e_pf *pf = vf->pf; in i40e_validate_cloud_filter() local
3328 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3337 dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n", in i40e_validate_cloud_filter()
3352 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_validate_cloud_filter()
3356 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3371 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3380 dev_err(&pf->pdev->dev, in i40e_validate_cloud_filter()
3390 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest MAC addr %pM\n", in i40e_validate_cloud_filter()
3399 dev_info(&pf->pdev->dev, "VF %d: Invalid Source MAC addr %pM\n", in i40e_validate_cloud_filter()
3407 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest port\n", in i40e_validate_cloud_filter()
3415 dev_info(&pf->pdev->dev, "VF %d: Invalid Source port\n", in i40e_validate_cloud_filter()
3423 dev_info(&pf->pdev->dev, "VF %d: Invalid Flow type\n", in i40e_validate_cloud_filter()
3430 dev_info(&pf->pdev->dev, "VF %d: invalid VLAN ID\n", in i40e_validate_cloud_filter()
3448 struct i40e_pf *pf = vf->pf; in i40e_find_vsi_from_seid() local
3453 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id); in i40e_find_vsi_from_seid()
3469 struct i40e_pf *pf = vf->pf; in i40e_del_all_cloud_filters() local
3479 dev_err(&pf->pdev->dev, "VF %d: no VSI found for matching %u seid, can't delete cloud filter\n", in i40e_del_all_cloud_filters()
3490 dev_err(&pf->pdev->dev, in i40e_del_all_cloud_filters()
3492 vf->vf_id, i40e_stat_str(&pf->hw, ret), in i40e_del_all_cloud_filters()
3493 i40e_aq_str(&pf->hw, in i40e_del_all_cloud_filters()
3494 pf->hw.aq.asq_last_status)); in i40e_del_all_cloud_filters()
3515 struct i40e_pf *pf = vf->pf; in i40e_vc_del_cloud_filter() local
3527 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3535 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3578 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_del_cloud_filter()
3583 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_del_cloud_filter()
3593 dev_err(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3595 vf->vf_id, i40e_stat_str(&pf->hw, ret), in i40e_vc_del_cloud_filter()
3596 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_del_cloud_filter()
3647 struct i40e_pf *pf = vf->pf; in i40e_vc_add_cloud_filter() local
3658 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3666 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3712 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_add_cloud_filter()
3717 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_add_cloud_filter()
3727 dev_err(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3729 vf->vf_id, i40e_stat_str(&pf->hw, ret), in i40e_vc_add_cloud_filter()
3730 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_add_cloud_filter()
3755 struct i40e_pf *pf = vf->pf; in i40e_vc_add_qch_msg() local
3756 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_add_qch_msg()
3768 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3775 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3784 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3795 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3806 if (pf->queues_left < adq_request_qps) { in i40e_vc_add_qch_msg()
3807 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3823 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3834 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3869 struct i40e_pf *pf = vf->pf; in i40e_vc_del_qch_msg() local
3882 dev_info(&pf->pdev->dev, in i40e_vc_del_qch_msg()
3886 dev_info(&pf->pdev->dev, "VF %d trying to delete queue channels but ADq isn't enabled\n", in i40e_vc_del_qch_msg()
3913 int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
3916 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
3921 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
3922 if (local_vf_id < 0 || local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
3924 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
3935 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
4032 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
4049 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
4051 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
4056 if (!test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_vc_process_vflr_event()
4069 clear_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_vc_process_vflr_event()
4070 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
4074 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
4093 static int i40e_validate_vf(struct i40e_pf *pf, int vf_id) in i40e_validate_vf() argument
4099 if (vf_id >= pf->num_alloc_vfs) { in i40e_validate_vf()
4100 dev_err(&pf->pdev->dev, in i40e_validate_vf()
4105 vf = &pf->vf[vf_id]; in i40e_validate_vf()
4106 vsi = i40e_find_vsi_from_id(pf, vf->lan_vsi_id); in i40e_validate_vf()
4125 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
4133 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_mac()
4134 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_mac()
4139 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_mac()
4143 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_mac()
4157 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_mac()
4162 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
4165 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
4190 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
4198 dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id); in i40e_ndo_set_vf_mac()
4201 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", in i40e_ndo_set_vf_mac()
4209 dev_info(&pf->pdev->dev, "Bring down and up the VF interface to make this change effective.\n"); in i40e_ndo_set_vf_mac()
4212 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_mac()
4232 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
4237 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_port_vlan()
4238 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_port_vlan()
4243 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_port_vlan()
4248 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
4254 dev_err(&pf->pdev->dev, "VF VLAN protocol is not supported\n"); in i40e_ndo_set_vf_port_vlan()
4259 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_port_vlan()
4260 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4262 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_port_vlan()
4274 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4311 dev_err(&pf->pdev->dev, "Unable to config VF promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4322 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
4351 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
4362 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4369 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_port_vlan()
4386 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
4391 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_bw()
4392 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_bw()
4397 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_bw()
4402 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
4408 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_bw()
4409 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
4411 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_bw()
4423 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_bw()
4440 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
4444 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_get_vf_config()
4445 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_get_vf_config()
4450 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_get_vf_config()
4454 vf = &pf->vf[vf_id]; in i40e_ndo_get_vf_config()
4456 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
4482 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_get_vf_config()
4497 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
4498 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_ndo_set_vf_link_state()
4500 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
4505 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_link_state()
4506 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_link_state()
4511 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
4512 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
4517 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
4547 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_link_state()
4563 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
4565 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
4569 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_spoofchk()
4570 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_spoofchk()
4575 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
4576 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
4581 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
4583 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_spoofchk()
4594 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
4595 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
4602 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()
4607 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_spoofchk()
4622 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_trust() local
4626 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_trust()
4627 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_trust()
4632 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_trust()
4633 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_trust()
4638 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_ndo_set_vf_trust()
4639 dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n"); in i40e_ndo_set_vf_trust()
4644 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_trust()
4651 dev_info(&pf->pdev->dev, "VF %u is now %strusted\n", in i40e_ndo_set_vf_trust()
4656 dev_info(&pf->pdev->dev, in i40e_ndo_set_vf_trust()
4664 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4678 struct i40e_pf *pf = np->vsi->back; in i40e_get_vf_stats() local
4684 if (i40e_validate_vf(pf, vf_id)) in i40e_get_vf_stats()
4687 vf = &pf->vf[vf_id]; in i40e_get_vf_stats()
4689 dev_err(&pf->pdev->dev, "VF %d in reset. Try again.\n", vf_id); in i40e_get_vf_stats()
4693 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_get_vf_stats()