Lines Matching full:pf

12  * @pf: pointer to the PF structure
18 * send a message to all VFs on a given 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()
80 * @pfe: pointer to PF event structure
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()
129 * @pf: pointer to the PF structure
131 * send a link status message to all VFs on a given PF
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()
143 * @pf: pointer to the PF structure
145 * indicate a pending reset to all VFs on a given PF
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()
163 /* Continue only if this is a PF */ in i40e_restore_all_vfs_msi_state()
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
233 /* If PF is in VFs releasing state reset VF is impossible, in i40e_vc_reset_vf()
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()
307 * return PF relative queue 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()
672 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
682 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
715 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
716 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_config_vsi_rx_queue()
717 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
781 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
791 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
813 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
817 main_vsi = i40e_pf_get_main_vsi(pf); in i40e_alloc_vsi_res()
818 vsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, main_vsi->seid, vf->vf_id); in i40e_alloc_vsi_res()
821 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
823 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
829 u64 hashcfg = i40e_pf_get_default_rss_hashcfg(pf); in i40e_alloc_vsi_res()
848 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
855 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
858 wr32(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)hashcfg); in i40e_alloc_vsi_res()
859 wr32(&pf->hw, I40E_VFQF_HENA1(1, vf->vf_id), in i40e_alloc_vsi_res()
864 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
882 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
885 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
897 * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This
898 * function takes care of first part VSILAN_QTABLE, mapping pf queues to VSI.
902 struct i40e_pf *pf = vf->pf; in i40e_map_pf_queues_to_vsi() local
903 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_queues_to_vsi()
916 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_queues_to_vsi()
944 * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This
949 struct i40e_pf *pf = vf->pf; in i40e_map_pf_to_vf_queues() local
950 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_to_vf_queues()
964 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_to_vf_queues()
987 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
988 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
1016 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
1017 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
1036 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
1037 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
1050 pf->queues_left += vf->num_queue_pairs - in i40e_free_vf_res()
1056 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
1069 i40e_vsi_release(pf->vsi[vf->ch[j].vsi_idx]); in i40e_free_vf_res()
1074 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
1117 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
1122 vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF) in i40e_alloc_vf_res()
1123 pf->num_vf_qps = vf->num_req_queues; in i40e_alloc_vf_res()
1125 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_alloc_vf_res()
1131 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
1135 if (pf->queues_left >= in i40e_alloc_vf_res()
1146 dev_info(&pf->pdev->dev, "VF %d: Not enough queues to allocate, disabling ADq\n", in i40e_alloc_vf_res()
1158 pf->queues_left -= in i40e_alloc_vf_res()
1192 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
1193 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
1292 struct i40e_pf *pf = vf->pf; in i40e_set_vsi_promisc() local
1293 struct i40e_hw *hw = &pf->hw; in i40e_set_vsi_promisc()
1303 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1305 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1318 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1320 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1334 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1336 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1349 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1351 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1382 struct i40e_pf *pf = vf->pf; in i40e_config_vf_promiscuous_mode() local
1388 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vf_promiscuous_mode()
1451 struct i40e_pf *pf = vf->pf; in i40e_trigger_vf_reset() local
1452 struct i40e_hw *hw = &pf->hw; in i40e_trigger_vf_reset()
1479 dev_info(&pf->pdev->dev, in i40e_trigger_vf_reset()
1498 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_trigger_vf_reset()
1512 struct i40e_pf *pf = vf->pf; in i40e_cleanup_reset_vf() local
1513 struct i40e_hw *hw = &pf->hw; in i40e_cleanup_reset_vf()
1545 i40e_notify_client_of_vf_reset(pf, abs_vf_id); in i40e_cleanup_reset_vf()
1566 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
1567 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
1572 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) in i40e_reset_vf()
1576 if (test_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_vf()
1606 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
1612 i40e_vsi_stop_rings(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_vf()
1625 * @pf: pointer to the PF structure
1630 * VF after the wait. This is useful during PF routines which need to reset
1635 bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) in i40e_reset_all_vfs() argument
1637 struct i40e_hw *hw = &pf->hw; in i40e_reset_all_vfs()
1643 if (!pf->num_alloc_vfs) in i40e_reset_all_vfs()
1647 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_all_vfs()
1651 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1663 for (i = 0, vf = &pf->vf[0]; i < 10 && vf < &pf->vf[pf->num_alloc_vfs]; ++i) { in i40e_reset_all_vfs()
1669 while (vf < &pf->vf[pf->num_alloc_vfs]) { in i40e_reset_all_vfs()
1689 if (vf < &pf->vf[pf->num_alloc_vfs]) in i40e_reset_all_vfs()
1690 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_all_vfs()
1697 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1706 i40e_vsi_stop_rings_no_wait(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_all_vfs()
1712 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1721 i40e_vsi_wait_queues_disabled(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_all_vfs()
1730 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1740 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_reset_all_vfs()
1747 * @pf: pointer to the PF structure
1751 void i40e_free_vfs(struct i40e_pf *pf) in i40e_free_vfs() argument
1753 struct i40e_hw *hw = &pf->hw; in i40e_free_vfs()
1757 if (!pf->vf) in i40e_free_vfs()
1760 set_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1761 while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_free_vfs()
1764 i40e_notify_client_of_vf_enable(pf, 0); in i40e_free_vfs()
1770 if (!pci_vfs_assigned(pf->pdev)) in i40e_free_vfs()
1771 pci_disable_sriov(pf->pdev); in i40e_free_vfs()
1773 dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); in i40e_free_vfs()
1776 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1777 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1780 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1783 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1784 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1787 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1791 tmp = pf->num_alloc_vfs; in i40e_free_vfs()
1792 pf->num_alloc_vfs = 0; in i40e_free_vfs()
1794 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1795 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
1797 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
1800 kfree(pf->vf); in i40e_free_vfs()
1801 pf->vf = NULL; in i40e_free_vfs()
1807 if (!pci_vfs_assigned(pf->pdev)) { in i40e_free_vfs()
1817 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_free_vfs()
1818 clear_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1824 * @pf: pointer to the PF structure
1829 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) in i40e_alloc_vfs() argument
1835 i40e_irq_dynamic_disable_icr0(pf); in i40e_alloc_vfs()
1838 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { in i40e_alloc_vfs()
1839 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); in i40e_alloc_vfs()
1841 clear_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_alloc_vfs()
1842 pf->num_alloc_vfs = 0; in i40e_alloc_vfs()
1852 pf->vf = vfs; in i40e_alloc_vfs()
1856 vfs[i].pf = pf; in i40e_alloc_vfs()
1867 pf->num_alloc_vfs = num_alloc_vfs; in i40e_alloc_vfs()
1870 i40e_reset_all_vfs(pf, false); in i40e_alloc_vfs()
1872 i40e_notify_client_of_vf_enable(pf, num_alloc_vfs); in i40e_alloc_vfs()
1876 i40e_free_vfs(pf); in i40e_alloc_vfs()
1879 i40e_irq_dynamic_enable_icr0(pf); in i40e_alloc_vfs()
1894 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_enable() local
1898 if (test_bit(__I40E_TESTING, pf->state)) { in i40e_pci_sriov_enable()
1906 i40e_free_vfs(pf); in i40e_pci_sriov_enable()
1910 if (num_vfs > pf->num_req_vfs) { in i40e_pci_sriov_enable()
1912 num_vfs, pf->num_req_vfs); in i40e_pci_sriov_enable()
1918 err = i40e_alloc_vfs(pf, num_vfs); in i40e_pci_sriov_enable()
1943 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_configure() local
1946 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_pci_sriov_configure()
1952 if (!test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags)) { in i40e_pci_sriov_configure()
1953 set_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_pci_sriov_configure()
1954 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1960 if (!pci_vfs_assigned(pf->pdev)) { in i40e_pci_sriov_configure()
1961 i40e_free_vfs(pf); in i40e_pci_sriov_configure()
1962 clear_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_pci_sriov_configure()
1963 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1970 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_pci_sriov_configure()
1989 struct i40e_pf *pf; in i40e_vc_send_msg_to_vf() local
1995 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1998 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1999 hw = &pf->hw; in i40e_vc_send_msg_to_vf()
2005 dev_info(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
2007 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
2060 * called from the VF to request the API version used by the PF
2083 struct i40e_pf *pf = vf->pf; in i40e_del_qch() local
2091 i40e_vsi_release(pf->vsi[vf->ch[i].vsi_idx]); in i40e_del_qch()
2104 * it's in a port VLAN so the PF needs to account for this in max frame size
2109 u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size; in i40e_vc_get_max_frame_size()
2127 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg() local
2158 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
2162 if (i40e_vf_client_capable(pf, vf->vf_id) && in i40e_vc_get_vf_resources_msg()
2173 if (test_bit(I40E_HW_CAP_RSS_AQ, pf->hw.caps) && in i40e_vc_get_vf_resources_msg()
2180 if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE, pf->hw.caps)) { in i40e_vc_get_vf_resources_msg()
2189 if (test_bit(I40E_HW_CAP_OUTER_UDP_CSUM, pf->hw.caps) && in i40e_vc_get_vf_resources_msg()
2194 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) { in i40e_vc_get_vf_resources_msg()
2195 dev_err(&pf->pdev->dev, in i40e_vc_get_vf_resources_msg()
2204 if (test_bit(I40E_HW_CAP_WB_ON_ITR, pf->hw.caps)) { in i40e_vc_get_vf_resources_msg()
2218 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_get_vf_resources_msg()
2263 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
2273 dev_err(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2308 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2313 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2320 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2325 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2350 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
2420 * it cares is about its own queues. PF configures these queues in i40e_vc_config_queues_msg()
2440 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = in i40e_vc_config_queues_msg()
2444 vsi = pf->vsi[vf->ch[i].vsi_idx]; in i40e_vc_config_queues_msg()
2513 vf->pf->hw.func_caps.num_msix_vectors_vf) { in i40e_vc_config_irq_map_msg()
2555 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_tx_rings() local
2560 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_ctrl_vf_tx_rings()
2578 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_rx_rings() local
2583 ret = i40e_control_wait_rx_q(pf, vsi->base_queue + q_id, in i40e_ctrl_vf_rx_rings()
2618 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
2624 dev_info(&pf->pdev->dev, in i40e_vc_enable_queues_msg()
2646 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_enable_queues_msg()
2651 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_enable_queues_msg()
2661 if (i40e_vsi_start_rings(pf->vsi[vf->ch[i].vsi_idx])) in i40e_vc_enable_queues_msg()
2684 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
2703 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_disable_queues_msg()
2708 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_disable_queues_msg()
2730 struct i40e_pf *pf = vf->pf; in i40e_check_enough_queue() local
2733 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_enough_queue()
2740 pile = pf->qp_pile; in i40e_check_enough_queue()
2778 * different number. If the request is successful, PF will reset the VF and
2779 * return 0. If unsuccessful, PF will send message informing VF of number of
2788 struct i40e_pf *pf = vf->pf; in i40e_vc_request_queues_msg() local
2794 dev_err(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2799 } else if (req_pairs - cur_pairs > pf->queues_left) { in i40e_vc_request_queues_msg()
2800 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2804 pf->queues_left); in i40e_vc_request_queues_msg()
2805 vfres->num_queue_pairs = pf->queues_left + cur_pairs; in i40e_vc_request_queues_msg()
2807 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2834 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
2851 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()
2914 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_check_vf_permission()
2928 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2950 mac_add_max = I40E_VC_MAX_MACVLAN_PER_TRUSTED_VF(pf->num_alloc_vfs, hw->num_ports); in i40e_check_vf_permission()
2959 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2963 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
3048 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
3059 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
3081 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
3096 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_add_mac_addr_msg()
3117 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
3131 dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n", in i40e_vc_del_mac_addr_msg()
3137 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
3145 * administratively by PF. in i40e_vc_del_mac_addr_msg()
3169 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_del_mac_addr_msg()
3204 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
3211 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3224 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3229 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
3243 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3248 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3254 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3275 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
3293 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
3305 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3310 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3331 struct i40e_pf *pf = vf->pf; in i40e_vc_rdma_msg() local
3342 main_vsi = i40e_pf_get_main_vsi(pf); in i40e_vc_rdma_msg()
3343 abs_vf_id = vf->vf_id + pf->hw.func_caps.vf_base_id; in i40e_vc_rdma_msg()
3398 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_key() local
3409 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_key()
3428 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_lut() local
3446 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_lut()
3464 struct i40e_pf *pf = vf->pf; in i40e_vc_get_rss_hashcfg() local
3480 vrh->hashcfg = i40e_pf_get_default_rss_hashcfg(pf); in i40e_vc_get_rss_hashcfg()
3500 struct i40e_pf *pf = vf->pf; in i40e_vc_set_rss_hashcfg() local
3501 struct i40e_hw *hw = &pf->hw; in i40e_vc_set_rss_hashcfg()
3535 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_enable_vlan_stripping()
3561 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_disable_vlan_stripping()
3582 struct i40e_pf *pf = vf->pf; in i40e_validate_cloud_filter() local
3590 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3599 dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n", in i40e_validate_cloud_filter()
3614 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_validate_cloud_filter()
3618 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3633 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3642 dev_err(&pf->pdev->dev, in i40e_validate_cloud_filter()
3652 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest MAC addr %pM\n", in i40e_validate_cloud_filter()
3661 dev_info(&pf->pdev->dev, "VF %d: Invalid Source MAC addr %pM\n", in i40e_validate_cloud_filter()
3669 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest port\n", in i40e_validate_cloud_filter()
3677 dev_info(&pf->pdev->dev, "VF %d: Invalid Source port\n", in i40e_validate_cloud_filter()
3685 dev_info(&pf->pdev->dev, "VF %d: Invalid Flow type\n", in i40e_validate_cloud_filter()
3692 dev_info(&pf->pdev->dev, "VF %d: invalid VLAN ID\n", in i40e_validate_cloud_filter()
3710 struct i40e_pf *pf = vf->pf; in i40e_find_vsi_from_seid() local
3715 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id); in i40e_find_vsi_from_seid()
3731 struct i40e_pf *pf = vf->pf; in i40e_del_all_cloud_filters() local
3741 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()
3752 dev_err(&pf->pdev->dev, in i40e_del_all_cloud_filters()
3755 libie_aq_str(pf->hw.aq.asq_last_status)); in i40e_del_all_cloud_filters()
3776 struct i40e_pf *pf = vf->pf; in i40e_vc_del_cloud_filter() local
3788 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3796 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3839 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_del_cloud_filter()
3844 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_del_cloud_filter()
3854 dev_err(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3857 libie_aq_str(pf->hw.aq.asq_last_status)); in i40e_vc_del_cloud_filter()
3910 struct i40e_pf *pf = vf->pf; in i40e_vc_add_cloud_filter() local
3921 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3929 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3937 dev_warn(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3985 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_add_cloud_filter()
3990 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_add_cloud_filter()
4000 dev_err(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
4003 libie_aq_str(pf->hw.aq.asq_last_status)); in i40e_vc_add_cloud_filter()
4028 struct i40e_pf *pf = vf->pf; in i40e_vc_add_qch_msg() local
4029 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_add_qch_msg()
4041 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4048 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4057 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4068 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4079 if (pf->queues_left < adq_request_qps) { in i40e_vc_add_qch_msg()
4080 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4096 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4107 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4142 struct i40e_pf *pf = vf->pf; in i40e_vc_del_qch_msg() local
4155 dev_info(&pf->pdev->dev, in i40e_vc_del_qch_msg()
4159 dev_info(&pf->pdev->dev, "VF %d trying to delete queue channels but ADq isn't enabled\n", in i40e_vc_del_qch_msg()
4176 * @pf: pointer to the PF structure
4186 int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
4189 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
4194 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
4195 if (local_vf_id < 0 || local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
4197 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
4208 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
4300 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
4312 * @pf: pointer to the PF structure
4317 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
4319 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
4324 if (!test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_vc_process_vflr_event()
4337 clear_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_vc_process_vflr_event()
4338 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
4342 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
4348 set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_vc_process_vflr_event()
4357 * @pf: the physical function
4364 static int i40e_validate_vf(struct i40e_pf *pf, int vf_id) in i40e_validate_vf() argument
4370 if (vf_id >= pf->num_alloc_vfs) { in i40e_validate_vf()
4371 dev_err(&pf->pdev->dev, in i40e_validate_vf()
4376 vf = &pf->vf[vf_id]; in i40e_validate_vf()
4377 vsi = i40e_find_vsi_from_id(pf, vf->lan_vsi_id); in i40e_validate_vf()
4408 dev_err(&vf->pf->pdev->dev, in i40e_check_vf_init_timeout()
4428 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
4435 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_mac()
4436 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_mac()
4441 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_mac()
4445 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_mac()
4450 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
4453 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
4478 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
4486 dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id); in i40e_ndo_set_vf_mac()
4489 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", in i40e_ndo_set_vf_mac()
4497 dev_info(&pf->pdev->dev, "Bring down and up the VF interface to make this change effective.\n"); in i40e_ndo_set_vf_mac()
4500 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_mac()
4520 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
4525 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_port_vlan()
4526 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_port_vlan()
4531 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_port_vlan()
4536 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
4542 dev_err(&pf->pdev->dev, "VF VLAN protocol is not supported\n"); in i40e_ndo_set_vf_port_vlan()
4547 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_port_vlan()
4552 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4596 dev_err(&pf->pdev->dev, "Unable to config VF promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4607 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
4636 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
4647 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4651 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4658 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_port_vlan()
4675 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
4680 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_bw()
4681 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_bw()
4686 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_bw()
4691 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
4697 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_bw()
4702 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
4710 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_bw()
4727 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
4731 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_get_vf_config()
4732 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_get_vf_config()
4737 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_get_vf_config()
4741 vf = &pf->vf[vf_id]; in i40e_ndo_get_vf_config()
4743 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
4768 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_get_vf_config()
4783 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
4784 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_ndo_set_vf_link_state()
4786 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
4794 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_link_state()
4795 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_link_state()
4800 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
4801 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
4806 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
4833 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_link_state()
4857 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_link_state()
4873 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
4875 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
4879 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_spoofchk()
4880 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_spoofchk()
4885 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
4886 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
4891 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
4902 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
4903 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
4910 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()
4915 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_spoofchk()
4921 * @netdev: network interface device structure of the pf
4930 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_trust() local
4934 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_trust()
4935 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_trust()
4940 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_trust()
4941 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_trust()
4946 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) { in i40e_ndo_set_vf_trust()
4947 dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n"); in i40e_ndo_set_vf_trust()
4952 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_trust()
4959 /* request PF to sync mac/vlan filters for the VF */ in i40e_ndo_set_vf_trust()
4960 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4961 pf->vsi[vf->lan_vsi_idx]->flags |= I40E_VSI_FLAG_FILTER_CHANGED; in i40e_ndo_set_vf_trust()
4964 dev_info(&pf->pdev->dev, "VF %u is now %strusted\n", in i40e_ndo_set_vf_trust()
4969 dev_info(&pf->pdev->dev, in i40e_ndo_set_vf_trust()
4977 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4983 * @netdev: the netdev of the PF
4991 struct i40e_pf *pf = np->vsi->back; in i40e_get_vf_stats() local
4997 if (i40e_validate_vf(pf, vf_id)) in i40e_get_vf_stats()
5000 vf = &pf->vf[vf_id]; in i40e_get_vf_stats()
5002 dev_err(&pf->pdev->dev, "VF %d in reset. Try again.\n", vf_id); in i40e_get_vf_stats()
5006 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_get_vf_stats()