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()
532 struct i40e_pf *pf = vf->pf; in i40e_config_rdma_qvlist() local
533 struct i40e_hw *hw = &pf->hw; in i40e_config_rdma_qvlist()
541 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_rdma_qvlist()
544 dev_warn(&pf->pdev->dev, in i40e_config_rdma_qvlist()
562 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_rdma_qvlist()
636 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_tx_queue() local
637 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_tx_queue()
649 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vsi_tx_queue()
669 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
679 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
712 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
713 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_config_vsi_rx_queue()
714 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
771 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
781 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
802 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
807 vsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, pf->vsi[pf->lan_vsi]->seid, in i40e_alloc_vsi_res()
811 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
813 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
819 u64 hena = i40e_pf_get_default_rss_hena(pf); in i40e_alloc_vsi_res()
838 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
845 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
848 wr32(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)hena); in i40e_alloc_vsi_res()
849 wr32(&pf->hw, I40E_VFQF_HENA1(1, vf->vf_id), (u32)(hena >> 32)); in i40e_alloc_vsi_res()
853 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
871 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
874 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
886 * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This
887 * function takes care of first part VSILAN_QTABLE, mapping pf queues to VSI.
891 struct i40e_pf *pf = vf->pf; in i40e_map_pf_queues_to_vsi() local
892 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_queues_to_vsi()
905 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_queues_to_vsi()
933 * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This
938 struct i40e_pf *pf = vf->pf; in i40e_map_pf_to_vf_queues() local
939 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_to_vf_queues()
953 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_to_vf_queues()
976 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
977 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
1005 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
1006 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
1025 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
1026 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
1039 pf->queues_left += vf->num_queue_pairs - in i40e_free_vf_res()
1045 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
1058 i40e_vsi_release(pf->vsi[vf->ch[j].vsi_idx]); in i40e_free_vf_res()
1063 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
1106 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
1111 vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF) in i40e_alloc_vf_res()
1112 pf->num_vf_qps = vf->num_req_queues; in i40e_alloc_vf_res()
1114 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_alloc_vf_res()
1120 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
1124 if (pf->queues_left >= in i40e_alloc_vf_res()
1135 dev_info(&pf->pdev->dev, "VF %d: Not enough queues to allocate, disabling ADq\n", in i40e_alloc_vf_res()
1147 pf->queues_left -= in i40e_alloc_vf_res()
1181 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
1182 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
1281 struct i40e_pf *pf = vf->pf; in i40e_set_vsi_promisc() local
1282 struct i40e_hw *hw = &pf->hw; in i40e_set_vsi_promisc()
1292 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1294 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1298 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1308 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1310 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1314 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1325 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1327 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1331 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1341 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1343 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1347 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1375 struct i40e_pf *pf = vf->pf; in i40e_config_vf_promiscuous_mode() local
1381 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vf_promiscuous_mode()
1444 struct i40e_pf *pf = vf->pf; in i40e_trigger_vf_reset() local
1445 struct i40e_hw *hw = &pf->hw; in i40e_trigger_vf_reset()
1471 dev_info(&pf->pdev->dev, in i40e_trigger_vf_reset()
1490 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_trigger_vf_reset()
1504 struct i40e_pf *pf = vf->pf; in i40e_cleanup_reset_vf() local
1505 struct i40e_hw *hw = &pf->hw; in i40e_cleanup_reset_vf()
1537 i40e_notify_client_of_vf_reset(pf, abs_vf_id); in i40e_cleanup_reset_vf()
1558 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
1559 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
1564 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) in i40e_reset_vf()
1568 if (test_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_vf()
1598 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
1604 i40e_vsi_stop_rings(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_vf()
1617 * @pf: pointer to the PF structure
1622 * VF after the wait. This is useful during PF routines which need to reset
1627 bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) in i40e_reset_all_vfs() argument
1629 struct i40e_hw *hw = &pf->hw; in i40e_reset_all_vfs()
1635 if (!pf->num_alloc_vfs) in i40e_reset_all_vfs()
1639 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_all_vfs()
1643 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1644 vf = &pf->vf[v]; in i40e_reset_all_vfs()
1647 i40e_trigger_vf_reset(&pf->vf[v], flr); in i40e_reset_all_vfs()
1656 for (i = 0, v = 0; i < 10 && v < pf->num_alloc_vfs; i++) { in i40e_reset_all_vfs()
1662 while (v < pf->num_alloc_vfs) { in i40e_reset_all_vfs()
1663 vf = &pf->vf[v]; in i40e_reset_all_vfs()
1683 if (v < pf->num_alloc_vfs) in i40e_reset_all_vfs()
1684 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_all_vfs()
1685 pf->vf[v].vf_id); in i40e_reset_all_vfs()
1691 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1693 if (pf->vf[v].lan_vsi_idx == 0) in i40e_reset_all_vfs()
1700 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[v].lan_vsi_idx]); in i40e_reset_all_vfs()
1706 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1708 if (pf->vf[v].lan_vsi_idx == 0) in i40e_reset_all_vfs()
1715 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[v].lan_vsi_idx]); in i40e_reset_all_vfs()
1724 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1729 i40e_cleanup_reset_vf(&pf->vf[v]); in i40e_reset_all_vfs()
1734 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_reset_all_vfs()
1741 * @pf: pointer to the PF structure
1745 void i40e_free_vfs(struct i40e_pf *pf) in i40e_free_vfs() argument
1747 struct i40e_hw *hw = &pf->hw; in i40e_free_vfs()
1751 if (!pf->vf) in i40e_free_vfs()
1754 set_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1755 while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_free_vfs()
1758 i40e_notify_client_of_vf_enable(pf, 0); in i40e_free_vfs()
1764 if (!pci_vfs_assigned(pf->pdev)) in i40e_free_vfs()
1765 pci_disable_sriov(pf->pdev); in i40e_free_vfs()
1767 dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); in i40e_free_vfs()
1770 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1771 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1774 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1777 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1778 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1781 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1785 tmp = pf->num_alloc_vfs; in i40e_free_vfs()
1786 pf->num_alloc_vfs = 0; in i40e_free_vfs()
1788 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1789 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
1791 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
1794 kfree(pf->vf); in i40e_free_vfs()
1795 pf->vf = NULL; in i40e_free_vfs()
1801 if (!pci_vfs_assigned(pf->pdev)) { in i40e_free_vfs()
1811 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_free_vfs()
1812 clear_bit(__I40E_VFS_RELEASING, pf->state); in i40e_free_vfs()
1818 * @pf: pointer to the PF structure
1823 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) in i40e_alloc_vfs() argument
1829 i40e_irq_dynamic_disable_icr0(pf); in i40e_alloc_vfs()
1832 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { in i40e_alloc_vfs()
1833 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); in i40e_alloc_vfs()
1835 clear_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_alloc_vfs()
1836 pf->num_alloc_vfs = 0; in i40e_alloc_vfs()
1846 pf->vf = vfs; in i40e_alloc_vfs()
1850 vfs[i].pf = pf; in i40e_alloc_vfs()
1861 pf->num_alloc_vfs = num_alloc_vfs; in i40e_alloc_vfs()
1864 i40e_reset_all_vfs(pf, false); in i40e_alloc_vfs()
1866 i40e_notify_client_of_vf_enable(pf, num_alloc_vfs); in i40e_alloc_vfs()
1870 i40e_free_vfs(pf); in i40e_alloc_vfs()
1873 i40e_irq_dynamic_enable_icr0(pf); in i40e_alloc_vfs()
1888 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_enable() local
1892 if (test_bit(__I40E_TESTING, pf->state)) { in i40e_pci_sriov_enable()
1900 i40e_free_vfs(pf); in i40e_pci_sriov_enable()
1904 if (num_vfs > pf->num_req_vfs) { in i40e_pci_sriov_enable()
1906 num_vfs, pf->num_req_vfs); in i40e_pci_sriov_enable()
1912 err = i40e_alloc_vfs(pf, num_vfs); in i40e_pci_sriov_enable()
1937 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_configure() local
1940 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_pci_sriov_configure()
1946 if (!test_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags)) { in i40e_pci_sriov_configure()
1947 set_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_pci_sriov_configure()
1948 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1954 if (!pci_vfs_assigned(pf->pdev)) { in i40e_pci_sriov_configure()
1955 i40e_free_vfs(pf); in i40e_pci_sriov_configure()
1956 clear_bit(I40E_FLAG_VEB_MODE_ENA, pf->flags); in i40e_pci_sriov_configure()
1957 i40e_do_reset_safe(pf, I40E_PF_RESET_AND_REBUILD_FLAG); in i40e_pci_sriov_configure()
1964 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_pci_sriov_configure()
1983 struct i40e_pf *pf; in i40e_vc_send_msg_to_vf() local
1989 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1992 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1993 hw = &pf->hw; in i40e_vc_send_msg_to_vf()
1999 dev_info(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
2001 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
2054 * called from the VF to request the API version used by the PF
2077 struct i40e_pf *pf = vf->pf; in i40e_del_qch() local
2085 i40e_vsi_release(pf->vsi[vf->ch[i].vsi_idx]); in i40e_del_qch()
2098 * it's in a port VLAN so the PF needs to account for this in max frame size
2103 u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size; in i40e_vc_get_max_frame_size()
2121 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg() local
2149 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
2153 if (i40e_vf_client_capable(pf, vf->vf_id) && in i40e_vc_get_vf_resources_msg()
2164 if (test_bit(I40E_HW_CAP_RSS_AQ, pf->hw.caps) && in i40e_vc_get_vf_resources_msg()
2171 if (test_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE, pf->hw.caps)) { in i40e_vc_get_vf_resources_msg()
2180 if (test_bit(I40E_HW_CAP_OUTER_UDP_CSUM, pf->hw.caps) && in i40e_vc_get_vf_resources_msg()
2185 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) { in i40e_vc_get_vf_resources_msg()
2186 dev_err(&pf->pdev->dev, in i40e_vc_get_vf_resources_msg()
2195 if (test_bit(I40E_HW_CAP_WB_ON_ITR, pf->hw.caps)) { in i40e_vc_get_vf_resources_msg()
2209 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_get_vf_resources_msg()
2251 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
2261 dev_err(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2296 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2301 dev_info(&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()
2338 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
2408 * it cares is about its own queues. PF configures these queues in i40e_vc_config_queues_msg()
2428 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = in i40e_vc_config_queues_msg()
2432 vsi = pf->vsi[vf->ch[i].vsi_idx]; in i40e_vc_config_queues_msg()
2499 vf->pf->hw.func_caps.num_msix_vectors_vf) { in i40e_vc_config_irq_map_msg()
2541 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_tx_rings() local
2546 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_ctrl_vf_tx_rings()
2564 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_rx_rings() local
2569 ret = i40e_control_wait_rx_q(pf, vsi->base_queue + q_id, in i40e_ctrl_vf_rx_rings()
2604 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
2610 dev_info(&pf->pdev->dev, in i40e_vc_enable_queues_msg()
2632 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_enable_queues_msg()
2637 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_enable_queues_msg()
2647 if (i40e_vsi_start_rings(pf->vsi[vf->ch[i].vsi_idx])) in i40e_vc_enable_queues_msg()
2670 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
2689 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_disable_queues_msg()
2694 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_disable_queues_msg()
2716 struct i40e_pf *pf = vf->pf; in i40e_check_enough_queue() local
2719 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_enough_queue()
2726 pile = pf->qp_pile; in i40e_check_enough_queue()
2764 * different number. If the request is successful, PF will reset the VF and
2765 * return 0. If unsuccessful, PF will send message informing VF of number of
2774 struct i40e_pf *pf = vf->pf; in i40e_vc_request_queues_msg() local
2780 dev_err(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2785 } else if (req_pairs - cur_pairs > pf->queues_left) { in i40e_vc_request_queues_msg()
2786 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2790 pf->queues_left); in i40e_vc_request_queues_msg()
2791 vfres->num_queue_pairs = pf->queues_left + cur_pairs; in i40e_vc_request_queues_msg()
2793 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2820 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
2837 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
2904 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission() local
2905 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_vf_permission()
2906 struct i40e_hw *hw = &pf->hw; in i40e_check_vf_permission()
2916 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_check_vf_permission()
2931 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2949 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2960 I40E_VC_MAX_MACVLAN_PER_TRUSTED_VF(pf->num_alloc_vfs, in i40e_check_vf_permission()
2962 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
3047 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
3058 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
3080 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
3095 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_add_mac_addr_msg()
3116 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
3130 dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n", in i40e_vc_del_mac_addr_msg()
3136 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
3144 * administratively by PF or if VF is trusted. in i40e_vc_del_mac_addr_msg()
3167 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_del_mac_addr_msg()
3202 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
3209 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3222 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3227 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
3241 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3246 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3252 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3273 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
3291 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
3303 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3308 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3329 struct i40e_pf *pf = vf->pf; in i40e_vc_rdma_msg() local
3330 int abs_vf_id = vf->vf_id + pf->hw.func_caps.vf_base_id; in i40e_vc_rdma_msg()
3339 i40e_notify_client_of_vf_msg(pf->vsi[pf->lan_vsi], abs_vf_id, in i40e_vc_rdma_msg()
3394 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_key() local
3405 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_key()
3424 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_lut() local
3442 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_lut()
3460 struct i40e_pf *pf = vf->pf; in i40e_vc_get_rss_hena() local
3476 vrh->hena = i40e_pf_get_default_rss_hena(pf); in i40e_vc_get_rss_hena()
3496 struct i40e_pf *pf = vf->pf; in i40e_vc_set_rss_hena() local
3497 struct i40e_hw *hw = &pf->hw; in i40e_vc_set_rss_hena()
3530 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_enable_vlan_stripping()
3556 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_disable_vlan_stripping()
3577 struct i40e_pf *pf = vf->pf; in i40e_validate_cloud_filter() local
3585 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3594 dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n", in i40e_validate_cloud_filter()
3609 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_validate_cloud_filter()
3613 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3628 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3637 dev_err(&pf->pdev->dev, in i40e_validate_cloud_filter()
3647 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest MAC addr %pM\n", in i40e_validate_cloud_filter()
3656 dev_info(&pf->pdev->dev, "VF %d: Invalid Source MAC addr %pM\n", in i40e_validate_cloud_filter()
3664 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest port\n", in i40e_validate_cloud_filter()
3672 dev_info(&pf->pdev->dev, "VF %d: Invalid Source port\n", in i40e_validate_cloud_filter()
3680 dev_info(&pf->pdev->dev, "VF %d: Invalid Flow type\n", in i40e_validate_cloud_filter()
3687 dev_info(&pf->pdev->dev, "VF %d: invalid VLAN ID\n", in i40e_validate_cloud_filter()
3705 struct i40e_pf *pf = vf->pf; in i40e_find_vsi_from_seid() local
3710 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id); in i40e_find_vsi_from_seid()
3726 struct i40e_pf *pf = vf->pf; in i40e_del_all_cloud_filters() local
3736 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()
3747 dev_err(&pf->pdev->dev, in i40e_del_all_cloud_filters()
3750 i40e_aq_str(&pf->hw, in i40e_del_all_cloud_filters()
3751 pf->hw.aq.asq_last_status)); in i40e_del_all_cloud_filters()
3772 struct i40e_pf *pf = vf->pf; in i40e_vc_del_cloud_filter() local
3784 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3792 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3835 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_del_cloud_filter()
3840 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_del_cloud_filter()
3850 dev_err(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3853 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_del_cloud_filter()
3904 struct i40e_pf *pf = vf->pf; in i40e_vc_add_cloud_filter() local
3915 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3923 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3971 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_add_cloud_filter()
3976 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_add_cloud_filter()
3986 dev_err(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3989 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_add_cloud_filter()
4014 struct i40e_pf *pf = vf->pf; in i40e_vc_add_qch_msg() local
4015 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_add_qch_msg()
4027 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4034 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4043 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4054 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4065 if (pf->queues_left < adq_request_qps) { in i40e_vc_add_qch_msg()
4066 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4082 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4093 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4128 struct i40e_pf *pf = vf->pf; in i40e_vc_del_qch_msg() local
4141 dev_info(&pf->pdev->dev, in i40e_vc_del_qch_msg()
4145 dev_info(&pf->pdev->dev, "VF %d trying to delete queue channels but ADq isn't enabled\n", in i40e_vc_del_qch_msg()
4162 * @pf: pointer to the PF structure
4172 int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
4175 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
4180 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
4181 if (local_vf_id < 0 || local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
4183 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
4194 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
4286 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
4298 * @pf: pointer to the PF structure
4303 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
4305 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
4310 if (!test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_vc_process_vflr_event()
4323 clear_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_vc_process_vflr_event()
4324 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
4328 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
4340 * @pf: the physical function
4347 static int i40e_validate_vf(struct i40e_pf *pf, int vf_id) in i40e_validate_vf() argument
4353 if (vf_id >= pf->num_alloc_vfs) { in i40e_validate_vf()
4354 dev_err(&pf->pdev->dev, in i40e_validate_vf()
4359 vf = &pf->vf[vf_id]; in i40e_validate_vf()
4360 vsi = i40e_find_vsi_from_id(pf, vf->lan_vsi_id); in i40e_validate_vf()
4391 dev_err(&vf->pf->pdev->dev, in i40e_check_vf_init_timeout()
4411 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
4418 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_mac()
4419 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_mac()
4424 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_mac()
4428 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_mac()
4433 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
4436 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
4461 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
4469 dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id); in i40e_ndo_set_vf_mac()
4472 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", in i40e_ndo_set_vf_mac()
4480 dev_info(&pf->pdev->dev, "Bring down and up the VF interface to make this change effective.\n"); in i40e_ndo_set_vf_mac()
4483 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_mac()
4503 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
4508 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_port_vlan()
4509 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_port_vlan()
4514 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_port_vlan()
4519 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
4525 dev_err(&pf->pdev->dev, "VF VLAN protocol is not supported\n"); in i40e_ndo_set_vf_port_vlan()
4530 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_port_vlan()
4535 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4579 dev_err(&pf->pdev->dev, "Unable to config VF promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4590 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
4619 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
4630 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4634 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4641 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_port_vlan()
4658 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
4663 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_bw()
4664 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_bw()
4669 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_bw()
4674 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
4680 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_bw()
4685 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
4693 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_bw()
4710 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
4714 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_get_vf_config()
4715 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_get_vf_config()
4720 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_get_vf_config()
4724 vf = &pf->vf[vf_id]; in i40e_ndo_get_vf_config()
4726 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
4751 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_get_vf_config()
4766 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
4767 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_ndo_set_vf_link_state()
4769 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
4777 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_link_state()
4778 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_link_state()
4783 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
4784 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
4789 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
4816 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_link_state()
4840 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_link_state()
4856 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
4858 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
4862 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_spoofchk()
4863 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_spoofchk()
4868 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
4869 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
4874 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
4885 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
4886 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
4893 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()
4898 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_spoofchk()
4904 * @netdev: network interface device structure of the pf
4913 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_trust() local
4917 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_trust()
4918 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_trust()
4923 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_trust()
4924 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_trust()
4929 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) { in i40e_ndo_set_vf_trust()
4930 dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n"); in i40e_ndo_set_vf_trust()
4935 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_trust()
4942 /* request PF to sync mac/vlan filters for the VF */ in i40e_ndo_set_vf_trust()
4943 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4944 pf->vsi[vf->lan_vsi_idx]->flags |= I40E_VSI_FLAG_FILTER_CHANGED; in i40e_ndo_set_vf_trust()
4947 dev_info(&pf->pdev->dev, "VF %u is now %strusted\n", in i40e_ndo_set_vf_trust()
4952 dev_info(&pf->pdev->dev, in i40e_ndo_set_vf_trust()
4960 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4966 * @netdev: the netdev of the PF
4974 struct i40e_pf *pf = np->vsi->back; in i40e_get_vf_stats() local
4980 if (i40e_validate_vf(pf, vf_id)) in i40e_get_vf_stats()
4983 vf = &pf->vf[vf_id]; in i40e_get_vf_stats()
4985 dev_err(&pf->pdev->dev, "VF %d in reset. Try again.\n", vf_id); in i40e_get_vf_stats()
4989 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_get_vf_stats()