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()
193 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_notify_vf_reset()
201 abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id; in i40e_vc_notify_vf_reset()
205 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, VIRTCHNL_OP_EVENT, in i40e_vc_notify_vf_reset()
219 struct i40e_pf *pf = vf->pf; in i40e_vc_reset_vf() local
234 if (test_bit(__I40E_VFS_RELEASING, pf->state)) in i40e_vc_reset_vf()
242 dev_warn(&vf->pf->pdev->dev, in i40e_vc_reset_vf()
246 dev_dbg(&vf->pf->pdev->dev, in i40e_vc_reset_vf()
260 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vsi_id() local
261 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_vsi_id()
277 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_queue_id() local
278 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_queue_id()
292 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vector_id() local
294 return vector_id < pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_isvalid_vector_id()
310 struct i40e_pf *pf = vf->pf; in i40e_vc_get_pf_queue_id() local
311 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_get_pf_queue_id()
372 struct i40e_pf *pf = vf->pf; in i40e_config_irq_link_list() local
373 struct i40e_hw *hw = &pf->hw; in i40e_config_irq_link_list()
386 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) + in i40e_config_irq_link_list()
476 struct i40e_pf *pf = vf->pf; in i40e_release_iwarp_qvlist() local
484 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_release_iwarp_qvlist()
488 struct i40e_hw *hw = &pf->hw; in i40e_release_iwarp_qvlist()
529 struct i40e_pf *pf = vf->pf; in i40e_config_iwarp_qvlist() local
530 struct i40e_hw *hw = &pf->hw; in i40e_config_iwarp_qvlist()
537 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_iwarp_qvlist()
540 dev_warn(&pf->pdev->dev, in i40e_config_iwarp_qvlist()
558 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_iwarp_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()
710 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
711 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_config_vsi_rx_queue()
712 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
769 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
779 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
800 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
805 vsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, pf->vsi[pf->lan_vsi]->seid, in i40e_alloc_vsi_res()
809 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
811 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
817 u64 hena = i40e_pf_get_default_rss_hena(pf); in i40e_alloc_vsi_res()
836 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
843 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
846 wr32(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)hena); in i40e_alloc_vsi_res()
847 wr32(&pf->hw, I40E_VFQF_HENA1(1, vf->vf_id), (u32)(hena >> 32)); in i40e_alloc_vsi_res()
851 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
869 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
872 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
889 struct i40e_pf *pf = vf->pf; in i40e_map_pf_queues_to_vsi() local
890 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_queues_to_vsi()
903 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_queues_to_vsi()
936 struct i40e_pf *pf = vf->pf; in i40e_map_pf_to_vf_queues() local
937 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_to_vf_queues()
951 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_to_vf_queues()
974 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
975 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
1003 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
1004 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
1023 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
1024 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
1037 pf->queues_left += vf->num_queue_pairs - in i40e_free_vf_res()
1043 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
1056 i40e_vsi_release(pf->vsi[vf->ch[j].vsi_idx]); in i40e_free_vf_res()
1061 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
1104 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
1109 vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF) in i40e_alloc_vf_res()
1110 pf->num_vf_qps = vf->num_req_queues; in i40e_alloc_vf_res()
1112 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_alloc_vf_res()
1118 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
1122 if (pf->queues_left >= in i40e_alloc_vf_res()
1133 dev_info(&pf->pdev->dev, "VF %d: Not enough queues to allocate, disabling ADq\n", in i40e_alloc_vf_res()
1145 pf->queues_left -= in i40e_alloc_vf_res()
1179 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
1180 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
1279 struct i40e_pf *pf = vf->pf; in i40e_set_vsi_promisc() local
1280 struct i40e_hw *hw = &pf->hw; in i40e_set_vsi_promisc()
1290 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1292 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1296 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1306 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1308 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1312 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1323 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1325 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1329 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1339 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1341 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1345 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1373 struct i40e_pf *pf = vf->pf; in i40e_config_vf_promiscuous_mode() local
1379 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vf_promiscuous_mode()
1442 struct i40e_pf *pf = vf->pf; in i40e_trigger_vf_reset() local
1443 struct i40e_hw *hw = &pf->hw; in i40e_trigger_vf_reset()
1469 dev_info(&pf->pdev->dev, in i40e_trigger_vf_reset()
1488 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_trigger_vf_reset()
1502 struct i40e_pf *pf = vf->pf; in i40e_cleanup_reset_vf() local
1503 struct i40e_hw *hw = &pf->hw; in i40e_cleanup_reset_vf()
1535 i40e_notify_client_of_vf_reset(pf, abs_vf_id); in i40e_cleanup_reset_vf()
1556 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
1557 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
1562 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) in i40e_reset_vf()
1566 if (test_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_vf()
1596 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
1602 i40e_vsi_stop_rings(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_vf()
1625 bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) in i40e_reset_all_vfs() argument
1627 struct i40e_hw *hw = &pf->hw; in i40e_reset_all_vfs()
1633 if (!pf->num_alloc_vfs) in i40e_reset_all_vfs()
1637 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_all_vfs()
1641 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1642 vf = &pf->vf[v]; in i40e_reset_all_vfs()
1645 i40e_trigger_vf_reset(&pf->vf[v], flr); in i40e_reset_all_vfs()
1654 for (i = 0, v = 0; i < 10 && v < pf->num_alloc_vfs; i++) { in i40e_reset_all_vfs()
1660 while (v < pf->num_alloc_vfs) { in i40e_reset_all_vfs()
1661 vf = &pf->vf[v]; in i40e_reset_all_vfs()
1681 if (v < pf->num_alloc_vfs) in i40e_reset_all_vfs()
1682 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_all_vfs()
1683 pf->vf[v].vf_id); in i40e_reset_all_vfs()
1689 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1691 if (pf->vf[v].lan_vsi_idx == 0) in i40e_reset_all_vfs()
1698 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[v].lan_vsi_idx]); in i40e_reset_all_vfs()
1704 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1706 if (pf->vf[v].lan_vsi_idx == 0) in i40e_reset_all_vfs()
1713 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[v].lan_vsi_idx]); in i40e_reset_all_vfs()
1722 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1727 i40e_cleanup_reset_vf(&pf->vf[v]); in i40e_reset_all_vfs()
1732 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_reset_all_vfs()
1743 void i40e_free_vfs(struct i40e_pf *pf) in i40e_free_vfs() argument
1745 struct i40e_hw *hw = &pf->hw; in i40e_free_vfs()
1749 if (!pf->vf) in i40e_free_vfs()
1752 set_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1753 while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_free_vfs()
1756 i40e_notify_client_of_vf_enable(pf, 0); in i40e_free_vfs()
1762 if (!pci_vfs_assigned(pf->pdev)) in i40e_free_vfs()
1763 pci_disable_sriov(pf->pdev); in i40e_free_vfs()
1765 dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); in i40e_free_vfs()
1768 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1769 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1772 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1775 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1776 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1779 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1783 tmp = pf->num_alloc_vfs; in i40e_free_vfs()
1784 pf->num_alloc_vfs = 0; in i40e_free_vfs()
1786 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1787 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
1789 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
1792 kfree(pf->vf); in i40e_free_vfs()
1793 pf->vf = NULL; in i40e_free_vfs()
1799 if (!pci_vfs_assigned(pf->pdev)) { in i40e_free_vfs()
1809 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_free_vfs()
1810 clear_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1821 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) in i40e_alloc_vfs() argument
1827 i40e_irq_dynamic_disable_icr0(pf); in i40e_alloc_vfs()
1830 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { in i40e_alloc_vfs()
1831 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); in i40e_alloc_vfs()
1833 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_alloc_vfs()
1834 pf->num_alloc_vfs = 0; in i40e_alloc_vfs()
1844 pf->vf = vfs; in i40e_alloc_vfs()
1848 vfs[i].pf = pf; in i40e_alloc_vfs()
1859 pf->num_alloc_vfs = num_alloc_vfs; in i40e_alloc_vfs()
1862 i40e_reset_all_vfs(pf, false); in i40e_alloc_vfs()
1864 i40e_notify_client_of_vf_enable(pf, num_alloc_vfs); in i40e_alloc_vfs()
1868 i40e_free_vfs(pf); in i40e_alloc_vfs()
1871 i40e_irq_dynamic_enable_icr0(pf); in i40e_alloc_vfs()
1886 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_enable() local
1890 if (test_bit(__I40E_TESTING, pf->state)) { in i40e_pci_sriov_enable()
1898 i40e_free_vfs(pf); in i40e_pci_sriov_enable()
1902 if (num_vfs > pf->num_req_vfs) { in i40e_pci_sriov_enable()
1904 num_vfs, pf->num_req_vfs); in i40e_pci_sriov_enable()
1910 err = i40e_alloc_vfs(pf, num_vfs); in i40e_pci_sriov_enable()
1935 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_configure() local
1938 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_pci_sriov_configure()
1944 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_pci_sriov_configure()
1945 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1946 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1952 if (!pci_vfs_assigned(pf->pdev)) { in i40e_pci_sriov_configure()
1953 i40e_free_vfs(pf); in i40e_pci_sriov_configure()
1954 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1955 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1962 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_pci_sriov_configure()
1981 struct i40e_pf *pf; in i40e_vc_send_msg_to_vf() local
1987 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1990 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1991 hw = &pf->hw; in i40e_vc_send_msg_to_vf()
1997 dev_info(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
1999 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
2075 struct i40e_pf *pf = vf->pf; in i40e_del_qch() local
2083 i40e_vsi_release(pf->vsi[vf->ch[i].vsi_idx]); in i40e_del_qch()
2101 u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size; in i40e_vc_get_max_frame_size()
2119 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg() local
2147 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
2151 if (i40e_vf_client_capable(pf, vf->vf_id) && in i40e_vc_get_vf_resources_msg()
2162 if ((pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) && in i40e_vc_get_vf_resources_msg()
2169 if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) { in i40e_vc_get_vf_resources_msg()
2178 if ((pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE) && in i40e_vc_get_vf_resources_msg()
2183 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_vc_get_vf_resources_msg()
2184 dev_err(&pf->pdev->dev, in i40e_vc_get_vf_resources_msg()
2193 if (pf->hw_features & I40E_HW_WB_ON_ITR_CAPABLE) { in i40e_vc_get_vf_resources_msg()
2207 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_get_vf_resources_msg()
2249 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
2259 dev_err(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2294 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2299 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2306 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2311 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2336 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
2426 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = in i40e_vc_config_queues_msg()
2430 vsi = pf->vsi[vf->ch[i].vsi_idx]; in i40e_vc_config_queues_msg()
2497 vf->pf->hw.func_caps.num_msix_vectors_vf) { in i40e_vc_config_irq_map_msg()
2539 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_tx_rings() local
2544 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_ctrl_vf_tx_rings()
2562 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_rx_rings() local
2567 ret = i40e_control_wait_rx_q(pf, vsi->base_queue + q_id, in i40e_ctrl_vf_rx_rings()
2602 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
2608 dev_info(&pf->pdev->dev, in i40e_vc_enable_queues_msg()
2630 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_enable_queues_msg()
2635 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_enable_queues_msg()
2645 if (i40e_vsi_start_rings(pf->vsi[vf->ch[i].vsi_idx])) in i40e_vc_enable_queues_msg()
2668 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
2687 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_disable_queues_msg()
2692 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_disable_queues_msg()
2714 struct i40e_pf *pf = vf->pf; in i40e_check_enough_queue() local
2717 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_enough_queue()
2724 pile = pf->qp_pile; in i40e_check_enough_queue()
2772 struct i40e_pf *pf = vf->pf; in i40e_vc_request_queues_msg() local
2778 dev_err(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2783 } else if (req_pairs - cur_pairs > pf->queues_left) { in i40e_vc_request_queues_msg()
2784 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2788 pf->queues_left); in i40e_vc_request_queues_msg()
2789 vfres->num_queue_pairs = pf->queues_left + cur_pairs; in i40e_vc_request_queues_msg()
2791 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2818 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
2835 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
2875 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission() local
2876 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_vf_permission()
2886 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_check_vf_permission()
2901 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2919 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2937 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
2948 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
2970 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
2988 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_add_mac_addr_msg()
3009 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
3023 dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n", in i40e_vc_del_mac_addr_msg()
3031 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
3047 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_del_mac_addr_msg()
3082 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
3089 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3102 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3107 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
3121 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3126 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3132 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3153 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
3171 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
3183 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3188 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3209 struct i40e_pf *pf = vf->pf; in i40e_vc_iwarp_msg() local
3210 int abs_vf_id = vf->vf_id + pf->hw.func_caps.vf_base_id; in i40e_vc_iwarp_msg()
3219 i40e_notify_client_of_vf_msg(pf->vsi[pf->lan_vsi], abs_vf_id, in i40e_vc_iwarp_msg()
3274 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_key() local
3285 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_key()
3304 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_lut() local
3322 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_lut()
3340 struct i40e_pf *pf = vf->pf; in i40e_vc_get_rss_hena() local
3356 vrh->hena = i40e_pf_get_default_rss_hena(pf); in i40e_vc_get_rss_hena()
3376 struct i40e_pf *pf = vf->pf; in i40e_vc_set_rss_hena() local
3377 struct i40e_hw *hw = &pf->hw; in i40e_vc_set_rss_hena()
3410 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_enable_vlan_stripping()
3436 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_disable_vlan_stripping()
3457 struct i40e_pf *pf = vf->pf; in i40e_validate_cloud_filter() local
3465 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3474 dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n", in i40e_validate_cloud_filter()
3489 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_validate_cloud_filter()
3493 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3508 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3517 dev_err(&pf->pdev->dev, in i40e_validate_cloud_filter()
3527 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest MAC addr %pM\n", in i40e_validate_cloud_filter()
3536 dev_info(&pf->pdev->dev, "VF %d: Invalid Source MAC addr %pM\n", in i40e_validate_cloud_filter()
3544 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest port\n", in i40e_validate_cloud_filter()
3552 dev_info(&pf->pdev->dev, "VF %d: Invalid Source port\n", in i40e_validate_cloud_filter()
3560 dev_info(&pf->pdev->dev, "VF %d: Invalid Flow type\n", in i40e_validate_cloud_filter()
3567 dev_info(&pf->pdev->dev, "VF %d: invalid VLAN ID\n", in i40e_validate_cloud_filter()
3585 struct i40e_pf *pf = vf->pf; in i40e_find_vsi_from_seid() local
3590 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id); in i40e_find_vsi_from_seid()
3606 struct i40e_pf *pf = vf->pf; in i40e_del_all_cloud_filters() local
3616 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()
3627 dev_err(&pf->pdev->dev, in i40e_del_all_cloud_filters()
3630 i40e_aq_str(&pf->hw, in i40e_del_all_cloud_filters()
3631 pf->hw.aq.asq_last_status)); in i40e_del_all_cloud_filters()
3652 struct i40e_pf *pf = vf->pf; in i40e_vc_del_cloud_filter() local
3664 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3672 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3715 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_del_cloud_filter()
3720 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_del_cloud_filter()
3730 dev_err(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3733 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_del_cloud_filter()
3784 struct i40e_pf *pf = vf->pf; in i40e_vc_add_cloud_filter() local
3795 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3803 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3849 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_add_cloud_filter()
3854 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_add_cloud_filter()
3864 dev_err(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3867 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_add_cloud_filter()
3892 struct i40e_pf *pf = vf->pf; in i40e_vc_add_qch_msg() local
3893 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_add_qch_msg()
3905 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3912 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3921 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3932 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3943 if (pf->queues_left < adq_request_qps) { in i40e_vc_add_qch_msg()
3944 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3960 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3971 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4006 struct i40e_pf *pf = vf->pf; in i40e_vc_del_qch_msg() local
4019 dev_info(&pf->pdev->dev, in i40e_vc_del_qch_msg()
4023 dev_info(&pf->pdev->dev, "VF %d trying to delete queue channels but ADq isn't enabled\n", in i40e_vc_del_qch_msg()
4050 int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
4053 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
4058 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
4059 if (local_vf_id < 0 || local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
4061 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
4072 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
4169 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
4186 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
4188 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
4193 if (!test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_vc_process_vflr_event()
4206 clear_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_vc_process_vflr_event()
4207 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
4211 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
4230 static int i40e_validate_vf(struct i40e_pf *pf, int vf_id) in i40e_validate_vf() argument
4236 if (vf_id >= pf->num_alloc_vfs) { in i40e_validate_vf()
4237 dev_err(&pf->pdev->dev, in i40e_validate_vf()
4242 vf = &pf->vf[vf_id]; in i40e_validate_vf()
4243 vsi = i40e_find_vsi_from_id(pf, vf->lan_vsi_id); in i40e_validate_vf()
4262 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
4270 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_mac()
4271 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_mac()
4276 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_mac()
4280 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_mac()
4294 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_mac()
4299 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
4302 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
4327 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
4335 dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id); in i40e_ndo_set_vf_mac()
4338 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", in i40e_ndo_set_vf_mac()
4346 dev_info(&pf->pdev->dev, "Bring down and up the VF interface to make this change effective.\n"); in i40e_ndo_set_vf_mac()
4349 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_mac()
4369 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
4374 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_port_vlan()
4375 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_port_vlan()
4380 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_port_vlan()
4385 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
4391 dev_err(&pf->pdev->dev, "VF VLAN protocol is not supported\n"); in i40e_ndo_set_vf_port_vlan()
4396 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_port_vlan()
4397 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4399 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_port_vlan()
4447 dev_err(&pf->pdev->dev, "Unable to config VF promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4458 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
4487 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
4498 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4502 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4509 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_port_vlan()
4526 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
4531 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_bw()
4532 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_bw()
4537 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_bw()
4542 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
4548 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_bw()
4549 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
4551 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_bw()
4563 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_bw()
4580 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
4584 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_get_vf_config()
4585 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_get_vf_config()
4590 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_get_vf_config()
4594 vf = &pf->vf[vf_id]; in i40e_ndo_get_vf_config()
4596 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
4622 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_get_vf_config()
4637 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
4638 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_ndo_set_vf_link_state()
4640 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
4648 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_link_state()
4649 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_link_state()
4654 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
4655 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
4660 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
4687 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_link_state()
4711 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_link_state()
4727 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
4729 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
4733 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_spoofchk()
4734 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_spoofchk()
4739 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
4740 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
4745 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
4747 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_spoofchk()
4758 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
4759 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
4766 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()
4771 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_spoofchk()
4786 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_trust() local
4790 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_trust()
4791 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_trust()
4796 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_trust()
4797 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_trust()
4802 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_ndo_set_vf_trust()
4803 dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n"); in i40e_ndo_set_vf_trust()
4808 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_trust()
4816 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4817 pf->vsi[vf->lan_vsi_idx]->flags |= I40E_VSI_FLAG_FILTER_CHANGED; in i40e_ndo_set_vf_trust()
4820 dev_info(&pf->pdev->dev, "VF %u is now %strusted\n", in i40e_ndo_set_vf_trust()
4825 dev_info(&pf->pdev->dev, in i40e_ndo_set_vf_trust()
4833 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4847 struct i40e_pf *pf = np->vsi->back; in i40e_get_vf_stats() local
4853 if (i40e_validate_vf(pf, vf_id)) in i40e_get_vf_stats()
4856 vf = &pf->vf[vf_id]; in i40e_get_vf_stats()
4858 dev_err(&pf->pdev->dev, "VF %d in reset. Try again.\n", vf_id); in i40e_get_vf_stats()
4862 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_get_vf_stats()