Lines Matching refs:pf

20 static void i40e_vc_vf_broadcast(struct i40e_pf *pf,  in i40e_vc_vf_broadcast()  argument
25 struct i40e_hw *hw = &pf->hw; in i40e_vc_vf_broadcast()
26 struct i40e_vf *vf = pf->vf; in i40e_vc_vf_broadcast()
29 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { in i40e_vc_vf_broadcast()
113 struct i40e_pf *pf = vf->pf; in i40e_vc_notify_vf_link_state() local
114 struct i40e_hw *hw = &pf->hw; in i40e_vc_notify_vf_link_state()
115 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_notify_vf_link_state()
133 void i40e_vc_notify_link_state(struct i40e_pf *pf) in i40e_vc_notify_link_state() argument
137 for (i = 0; i < pf->num_alloc_vfs; i++) in i40e_vc_notify_link_state()
138 i40e_vc_notify_vf_link_state(&pf->vf[i]); in i40e_vc_notify_link_state()
147 void i40e_vc_notify_reset(struct i40e_pf *pf) in i40e_vc_notify_reset() argument
153 i40e_vc_vf_broadcast(pf, VIRTCHNL_OP_EVENT, 0, in i40e_vc_notify_reset()
195 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_notify_vf_reset()
203 abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id; in i40e_vc_notify_vf_reset()
207 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, VIRTCHNL_OP_EVENT, in i40e_vc_notify_vf_reset()
221 struct i40e_pf *pf = vf->pf; in i40e_vc_reset_vf() local
236 if (test_bit(__I40E_VFS_RELEASING, pf->state)) in i40e_vc_reset_vf()
244 dev_warn(&vf->pf->pdev->dev, in i40e_vc_reset_vf()
248 dev_dbg(&vf->pf->pdev->dev, in i40e_vc_reset_vf()
262 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vsi_id() local
263 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_vsi_id()
279 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_queue_id() local
280 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_queue_id()
294 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vector_id() local
296 return vector_id < pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_isvalid_vector_id()
312 struct i40e_pf *pf = vf->pf; in i40e_vc_get_pf_queue_id() local
313 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_get_pf_queue_id()
374 struct i40e_pf *pf = vf->pf; in i40e_config_irq_link_list() local
375 struct i40e_hw *hw = &pf->hw; in i40e_config_irq_link_list()
388 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) + in i40e_config_irq_link_list()
478 struct i40e_pf *pf = vf->pf; in i40e_release_rdma_qvlist() local
486 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_release_rdma_qvlist()
490 struct i40e_hw *hw = &pf->hw; in i40e_release_rdma_qvlist()
530 struct i40e_pf *pf = vf->pf; in i40e_config_rdma_qvlist() local
531 struct i40e_hw *hw = &pf->hw; in i40e_config_rdma_qvlist()
539 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_rdma_qvlist()
542 dev_warn(&pf->pdev->dev, in i40e_config_rdma_qvlist()
560 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_rdma_qvlist()
632 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_tx_queue() local
633 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_tx_queue()
645 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vsi_tx_queue()
665 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
675 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
708 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
709 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_config_vsi_rx_queue()
710 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
767 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
777 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
799 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
803 main_vsi = i40e_pf_get_main_vsi(pf); in i40e_alloc_vsi_res()
804 vsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, main_vsi->seid, vf->vf_id); in i40e_alloc_vsi_res()
807 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
809 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
815 u64 hena = i40e_pf_get_default_rss_hena(pf); in i40e_alloc_vsi_res()
834 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
841 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
844 wr32(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)hena); in i40e_alloc_vsi_res()
845 wr32(&pf->hw, I40E_VFQF_HENA1(1, vf->vf_id), (u32)(hena >> 32)); in i40e_alloc_vsi_res()
849 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
867 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
870 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
887 struct i40e_pf *pf = vf->pf; in i40e_map_pf_queues_to_vsi() local
888 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_queues_to_vsi()
901 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_queues_to_vsi()
934 struct i40e_pf *pf = vf->pf; in i40e_map_pf_to_vf_queues() local
935 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_to_vf_queues()
949 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_to_vf_queues()
972 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
973 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
1001 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
1002 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
1021 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
1022 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
1035 pf->queues_left += vf->num_queue_pairs - in i40e_free_vf_res()
1041 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
1054 i40e_vsi_release(pf->vsi[vf->ch[j].vsi_idx]); in i40e_free_vf_res()
1059 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
1102 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
1107 vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF) in i40e_alloc_vf_res()
1108 pf->num_vf_qps = vf->num_req_queues; in i40e_alloc_vf_res()
1110 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_alloc_vf_res()
1116 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
1120 if (pf->queues_left >= in i40e_alloc_vf_res()
1131 dev_info(&pf->pdev->dev, "VF %d: Not enough queues to allocate, disabling ADq\n", in i40e_alloc_vf_res()
1143 pf->queues_left -= in i40e_alloc_vf_res()
1177 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
1178 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
1277 struct i40e_pf *pf = vf->pf; in i40e_set_vsi_promisc() local
1278 struct i40e_hw *hw = &pf->hw; in i40e_set_vsi_promisc()
1288 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1290 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1294 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1304 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1306 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1310 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1321 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1323 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1327 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1337 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1339 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1343 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1371 struct i40e_pf *pf = vf->pf; in i40e_config_vf_promiscuous_mode() local
1377 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vf_promiscuous_mode()
1440 struct i40e_pf *pf = vf->pf; in i40e_trigger_vf_reset() local
1441 struct i40e_hw *hw = &pf->hw; in i40e_trigger_vf_reset()
1467 dev_info(&pf->pdev->dev, in i40e_trigger_vf_reset()
1486 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_trigger_vf_reset()
1500 struct i40e_pf *pf = vf->pf; in i40e_cleanup_reset_vf() local
1501 struct i40e_hw *hw = &pf->hw; in i40e_cleanup_reset_vf()
1533 i40e_notify_client_of_vf_reset(pf, abs_vf_id); in i40e_cleanup_reset_vf()
1554 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
1555 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
1560 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) in i40e_reset_vf()
1564 if (test_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_vf()
1594 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
1600 i40e_vsi_stop_rings(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_vf()
1623 bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) in i40e_reset_all_vfs() argument
1625 struct i40e_hw *hw = &pf->hw; in i40e_reset_all_vfs()
1631 if (!pf->num_alloc_vfs) in i40e_reset_all_vfs()
1635 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_all_vfs()
1639 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1651 for (i = 0, vf = &pf->vf[0]; i < 10 && vf < &pf->vf[pf->num_alloc_vfs]; ++i) { in i40e_reset_all_vfs()
1657 while (vf < &pf->vf[pf->num_alloc_vfs]) { in i40e_reset_all_vfs()
1677 if (vf < &pf->vf[pf->num_alloc_vfs]) in i40e_reset_all_vfs()
1678 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_all_vfs()
1685 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1694 i40e_vsi_stop_rings_no_wait(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_all_vfs()
1700 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1709 i40e_vsi_wait_queues_disabled(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_all_vfs()
1718 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1728 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_reset_all_vfs()
1739 void i40e_free_vfs(struct i40e_pf *pf) in i40e_free_vfs() argument
1741 struct i40e_hw *hw = &pf->hw; in i40e_free_vfs()
1745 if (!pf->vf) in i40e_free_vfs()
1748 set_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1749 while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_free_vfs()
1752 i40e_notify_client_of_vf_enable(pf, 0); in i40e_free_vfs()
1758 if (!pci_vfs_assigned(pf->pdev)) in i40e_free_vfs()
1759 pci_disable_sriov(pf->pdev); in i40e_free_vfs()
1761 dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); in i40e_free_vfs()
1764 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1765 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1768 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1771 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1772 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1775 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1779 tmp = pf->num_alloc_vfs; in i40e_free_vfs()
1780 pf->num_alloc_vfs = 0; in i40e_free_vfs()
1782 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1783 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
1785 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
1788 kfree(pf->vf); in i40e_free_vfs()
1789 pf->vf = NULL; in i40e_free_vfs()
1795 if (!pci_vfs_assigned(pf->pdev)) { in i40e_free_vfs()
1805 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_free_vfs()
1806 clear_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1817 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) in i40e_alloc_vfs() argument
1823 i40e_irq_dynamic_disable_icr0(pf); in i40e_alloc_vfs()
1826 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { in i40e_alloc_vfs()
1827 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); in i40e_alloc_vfs()
1829 clear_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_alloc_vfs()
1830 pf->num_alloc_vfs = 0; in i40e_alloc_vfs()
1840 pf->vf = vfs; in i40e_alloc_vfs()
1844 vfs[i].pf = pf; in i40e_alloc_vfs()
1855 pf->num_alloc_vfs = num_alloc_vfs; in i40e_alloc_vfs()
1858 i40e_reset_all_vfs(pf, false); in i40e_alloc_vfs()
1860 i40e_notify_client_of_vf_enable(pf, num_alloc_vfs); in i40e_alloc_vfs()
1864 i40e_free_vfs(pf); in i40e_alloc_vfs()
1867 i40e_irq_dynamic_enable_icr0(pf); in i40e_alloc_vfs()
1882 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_enable() local
1886 if (test_bit(__I40E_TESTING, pf->state)) { in i40e_pci_sriov_enable()
1894 i40e_free_vfs(pf); in i40e_pci_sriov_enable()
1898 if (num_vfs > pf->num_req_vfs) { in i40e_pci_sriov_enable()
1900 num_vfs, pf->num_req_vfs); in i40e_pci_sriov_enable()
1906 err = i40e_alloc_vfs(pf, num_vfs); in i40e_pci_sriov_enable()
1931 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_configure() local
1934 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_pci_sriov_configure()
1940 if (!test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags)) { in i40e_pci_sriov_configure()
1941 set_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_pci_sriov_configure()
1942 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1948 if (!pci_vfs_assigned(pf->pdev)) { in i40e_pci_sriov_configure()
1949 i40e_free_vfs(pf); in i40e_pci_sriov_configure()
1950 clear_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_pci_sriov_configure()
1951 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1958 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_pci_sriov_configure()
1977 struct i40e_pf *pf; in i40e_vc_send_msg_to_vf() local
1983 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1986 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1987 hw = &pf->hw; in i40e_vc_send_msg_to_vf()
1993 dev_info(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
1995 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
2071 struct i40e_pf *pf = vf->pf; in i40e_del_qch() local
2079 i40e_vsi_release(pf->vsi[vf->ch[i].vsi_idx]); in i40e_del_qch()
2097 u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size; in i40e_vc_get_max_frame_size()
2115 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg() local
2143 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
2147 if (i40e_vf_client_capable(pf, vf->vf_id) && in i40e_vc_get_vf_resources_msg()
2158 if (test_bit(I40E_HW_CAP_RSS_AQ, pf->hw.caps) && in i40e_vc_get_vf_resources_msg()
2165 if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE, pf->hw.caps)) { in i40e_vc_get_vf_resources_msg()
2174 if (test_bit(I40E_HW_CAP_OUTER_UDP_CSUM, pf->hw.caps) && in i40e_vc_get_vf_resources_msg()
2179 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) { in i40e_vc_get_vf_resources_msg()
2180 dev_err(&pf->pdev->dev, in i40e_vc_get_vf_resources_msg()
2189 if (test_bit(I40E_HW_CAP_WB_ON_ITR, pf->hw.caps)) { in i40e_vc_get_vf_resources_msg()
2203 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_get_vf_resources_msg()
2247 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
2257 dev_err(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2292 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2297 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2304 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2309 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2334 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
2424 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = in i40e_vc_config_queues_msg()
2428 vsi = pf->vsi[vf->ch[i].vsi_idx]; in i40e_vc_config_queues_msg()
2495 vf->pf->hw.func_caps.num_msix_vectors_vf) { in i40e_vc_config_irq_map_msg()
2537 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_tx_rings() local
2542 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_ctrl_vf_tx_rings()
2560 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_rx_rings() local
2565 ret = i40e_control_wait_rx_q(pf, vsi->base_queue + q_id, in i40e_ctrl_vf_rx_rings()
2600 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
2606 dev_info(&pf->pdev->dev, in i40e_vc_enable_queues_msg()
2628 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_enable_queues_msg()
2633 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_enable_queues_msg()
2643 if (i40e_vsi_start_rings(pf->vsi[vf->ch[i].vsi_idx])) in i40e_vc_enable_queues_msg()
2666 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
2685 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_disable_queues_msg()
2690 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_disable_queues_msg()
2712 struct i40e_pf *pf = vf->pf; in i40e_check_enough_queue() local
2715 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_enough_queue()
2722 pile = pf->qp_pile; in i40e_check_enough_queue()
2770 struct i40e_pf *pf = vf->pf; in i40e_vc_request_queues_msg() local
2776 dev_err(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2781 } else if (req_pairs - cur_pairs > pf->queues_left) { in i40e_vc_request_queues_msg()
2782 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2786 pf->queues_left); in i40e_vc_request_queues_msg()
2787 vfres->num_queue_pairs = pf->queues_left + cur_pairs; in i40e_vc_request_queues_msg()
2789 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2816 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
2833 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
2900 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission() local
2901 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_vf_permission()
2902 struct i40e_hw *hw = &pf->hw; in i40e_check_vf_permission()
2912 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_check_vf_permission()
2927 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2945 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2956 I40E_VC_MAX_MACVLAN_PER_TRUSTED_VF(pf->num_alloc_vfs, in i40e_check_vf_permission()
2958 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
3043 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
3054 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
3076 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
3091 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_add_mac_addr_msg()
3112 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
3126 dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n", in i40e_vc_del_mac_addr_msg()
3132 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
3164 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_del_mac_addr_msg()
3199 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
3206 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3219 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3224 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
3238 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3243 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3249 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3270 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
3288 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
3300 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3305 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3326 struct i40e_pf *pf = vf->pf; in i40e_vc_rdma_msg() local
3337 main_vsi = i40e_pf_get_main_vsi(pf); in i40e_vc_rdma_msg()
3338 abs_vf_id = vf->vf_id + pf->hw.func_caps.vf_base_id; in i40e_vc_rdma_msg()
3393 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_key() local
3404 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_key()
3423 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_lut() local
3441 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_lut()
3459 struct i40e_pf *pf = vf->pf; in i40e_vc_get_rss_hena() local
3475 vrh->hena = i40e_pf_get_default_rss_hena(pf); in i40e_vc_get_rss_hena()
3495 struct i40e_pf *pf = vf->pf; in i40e_vc_set_rss_hena() local
3496 struct i40e_hw *hw = &pf->hw; in i40e_vc_set_rss_hena()
3529 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_enable_vlan_stripping()
3555 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_disable_vlan_stripping()
3576 struct i40e_pf *pf = vf->pf; in i40e_validate_cloud_filter() local
3584 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3593 dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n", in i40e_validate_cloud_filter()
3608 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_validate_cloud_filter()
3612 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3627 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3636 dev_err(&pf->pdev->dev, in i40e_validate_cloud_filter()
3646 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest MAC addr %pM\n", in i40e_validate_cloud_filter()
3655 dev_info(&pf->pdev->dev, "VF %d: Invalid Source MAC addr %pM\n", in i40e_validate_cloud_filter()
3663 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest port\n", in i40e_validate_cloud_filter()
3671 dev_info(&pf->pdev->dev, "VF %d: Invalid Source port\n", in i40e_validate_cloud_filter()
3679 dev_info(&pf->pdev->dev, "VF %d: Invalid Flow type\n", in i40e_validate_cloud_filter()
3686 dev_info(&pf->pdev->dev, "VF %d: invalid VLAN ID\n", in i40e_validate_cloud_filter()
3704 struct i40e_pf *pf = vf->pf; in i40e_find_vsi_from_seid() local
3709 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id); in i40e_find_vsi_from_seid()
3725 struct i40e_pf *pf = vf->pf; in i40e_del_all_cloud_filters() local
3735 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()
3746 dev_err(&pf->pdev->dev, in i40e_del_all_cloud_filters()
3749 i40e_aq_str(&pf->hw, in i40e_del_all_cloud_filters()
3750 pf->hw.aq.asq_last_status)); in i40e_del_all_cloud_filters()
3771 struct i40e_pf *pf = vf->pf; in i40e_vc_del_cloud_filter() local
3783 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3791 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3834 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_del_cloud_filter()
3839 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_del_cloud_filter()
3849 dev_err(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3852 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_del_cloud_filter()
3903 struct i40e_pf *pf = vf->pf; in i40e_vc_add_cloud_filter() local
3914 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3922 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3970 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_add_cloud_filter()
3975 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_add_cloud_filter()
3985 dev_err(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3988 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_add_cloud_filter()
4013 struct i40e_pf *pf = vf->pf; in i40e_vc_add_qch_msg() local
4014 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_add_qch_msg()
4026 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4033 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4042 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4053 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4064 if (pf->queues_left < adq_request_qps) { in i40e_vc_add_qch_msg()
4065 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4081 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4092 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4127 struct i40e_pf *pf = vf->pf; in i40e_vc_del_qch_msg() local
4140 dev_info(&pf->pdev->dev, in i40e_vc_del_qch_msg()
4144 dev_info(&pf->pdev->dev, "VF %d trying to delete queue channels but ADq isn't enabled\n", in i40e_vc_del_qch_msg()
4171 int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
4174 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
4179 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
4180 if (local_vf_id < 0 || local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
4182 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
4193 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
4285 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
4302 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
4304 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
4309 if (!test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_vc_process_vflr_event()
4322 clear_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_vc_process_vflr_event()
4323 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
4327 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
4346 static int i40e_validate_vf(struct i40e_pf *pf, int vf_id) in i40e_validate_vf() argument
4352 if (vf_id >= pf->num_alloc_vfs) { in i40e_validate_vf()
4353 dev_err(&pf->pdev->dev, in i40e_validate_vf()
4358 vf = &pf->vf[vf_id]; in i40e_validate_vf()
4359 vsi = i40e_find_vsi_from_id(pf, vf->lan_vsi_id); in i40e_validate_vf()
4390 dev_err(&vf->pf->pdev->dev, in i40e_check_vf_init_timeout()
4410 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
4417 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_mac()
4418 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_mac()
4423 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_mac()
4427 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_mac()
4432 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
4435 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
4460 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
4468 dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id); in i40e_ndo_set_vf_mac()
4471 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", in i40e_ndo_set_vf_mac()
4479 dev_info(&pf->pdev->dev, "Bring down and up the VF interface to make this change effective.\n"); in i40e_ndo_set_vf_mac()
4482 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_mac()
4502 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
4507 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_port_vlan()
4508 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_port_vlan()
4513 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_port_vlan()
4518 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
4524 dev_err(&pf->pdev->dev, "VF VLAN protocol is not supported\n"); in i40e_ndo_set_vf_port_vlan()
4529 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_port_vlan()
4534 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4578 dev_err(&pf->pdev->dev, "Unable to config VF promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4589 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
4618 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
4629 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4633 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4640 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_port_vlan()
4657 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
4662 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_bw()
4663 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_bw()
4668 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_bw()
4673 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
4679 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_bw()
4684 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
4692 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_bw()
4709 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
4713 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_get_vf_config()
4714 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_get_vf_config()
4719 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_get_vf_config()
4723 vf = &pf->vf[vf_id]; in i40e_ndo_get_vf_config()
4725 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
4750 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_get_vf_config()
4765 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
4766 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_ndo_set_vf_link_state()
4768 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
4776 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_link_state()
4777 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_link_state()
4782 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
4783 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
4788 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
4815 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_link_state()
4839 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_link_state()
4855 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
4857 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
4861 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_spoofchk()
4862 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_spoofchk()
4867 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
4868 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
4873 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
4884 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
4885 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
4892 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()
4897 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_spoofchk()
4912 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_trust() local
4916 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_trust()
4917 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_trust()
4922 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_trust()
4923 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_trust()
4928 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) { in i40e_ndo_set_vf_trust()
4929 dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n"); in i40e_ndo_set_vf_trust()
4934 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_trust()
4942 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4943 pf->vsi[vf->lan_vsi_idx]->flags |= I40E_VSI_FLAG_FILTER_CHANGED; in i40e_ndo_set_vf_trust()
4946 dev_info(&pf->pdev->dev, "VF %u is now %strusted\n", in i40e_ndo_set_vf_trust()
4951 dev_info(&pf->pdev->dev, in i40e_ndo_set_vf_trust()
4959 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4973 struct i40e_pf *pf = np->vsi->back; in i40e_get_vf_stats() local
4979 if (i40e_validate_vf(pf, vf_id)) in i40e_get_vf_stats()
4982 vf = &pf->vf[vf_id]; in i40e_get_vf_stats()
4984 dev_err(&pf->pdev->dev, "VF %d in reset. Try again.\n", vf_id); in i40e_get_vf_stats()
4988 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_get_vf_stats()