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()
714 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
715 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_config_vsi_rx_queue()
716 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
773 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
783 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
804 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
809 vsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, pf->vsi[pf->lan_vsi]->seid, in i40e_alloc_vsi_res()
813 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
815 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
821 u64 hena = i40e_pf_get_default_rss_hena(pf); in i40e_alloc_vsi_res()
840 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
847 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
850 wr32(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)hena); in i40e_alloc_vsi_res()
851 wr32(&pf->hw, I40E_VFQF_HENA1(1, vf->vf_id), (u32)(hena >> 32)); in i40e_alloc_vsi_res()
855 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
873 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
876 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
888 * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This
889 * function takes care of first part VSILAN_QTABLE, mapping pf queues to VSI.
893 struct i40e_pf *pf = vf->pf; in i40e_map_pf_queues_to_vsi() local
894 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_queues_to_vsi()
907 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_queues_to_vsi()
935 * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This
940 struct i40e_pf *pf = vf->pf; in i40e_map_pf_to_vf_queues() local
941 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_to_vf_queues()
955 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_to_vf_queues()
978 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
979 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
1007 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
1008 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
1027 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
1028 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
1041 pf->queues_left += vf->num_queue_pairs - in i40e_free_vf_res()
1047 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
1060 i40e_vsi_release(pf->vsi[vf->ch[j].vsi_idx]); in i40e_free_vf_res()
1065 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
1108 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
1113 vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF) in i40e_alloc_vf_res()
1114 pf->num_vf_qps = vf->num_req_queues; in i40e_alloc_vf_res()
1116 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_alloc_vf_res()
1122 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
1126 if (pf->queues_left >= in i40e_alloc_vf_res()
1137 dev_info(&pf->pdev->dev, "VF %d: Not enough queues to allocate, disabling ADq\n", in i40e_alloc_vf_res()
1149 pf->queues_left -= in i40e_alloc_vf_res()
1183 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
1184 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
1283 struct i40e_pf *pf = vf->pf; in i40e_set_vsi_promisc() local
1284 struct i40e_hw *hw = &pf->hw; in i40e_set_vsi_promisc()
1294 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1296 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1300 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1310 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1312 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1316 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1327 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1329 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1333 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1343 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1345 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1349 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1377 struct i40e_pf *pf = vf->pf; in i40e_config_vf_promiscuous_mode() local
1383 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vf_promiscuous_mode()
1446 struct i40e_pf *pf = vf->pf; in i40e_trigger_vf_reset() local
1447 struct i40e_hw *hw = &pf->hw; in i40e_trigger_vf_reset()
1473 dev_info(&pf->pdev->dev, in i40e_trigger_vf_reset()
1492 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_trigger_vf_reset()
1506 struct i40e_pf *pf = vf->pf; in i40e_cleanup_reset_vf() local
1507 struct i40e_hw *hw = &pf->hw; in i40e_cleanup_reset_vf()
1539 i40e_notify_client_of_vf_reset(pf, abs_vf_id); in i40e_cleanup_reset_vf()
1560 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
1561 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
1566 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) in i40e_reset_vf()
1570 if (test_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_vf()
1600 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
1606 i40e_vsi_stop_rings(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_vf()
1619 * @pf: pointer to the PF structure
1624 * VF after the wait. This is useful during PF routines which need to reset
1629 bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) in i40e_reset_all_vfs() argument
1631 struct i40e_hw *hw = &pf->hw; in i40e_reset_all_vfs()
1637 if (!pf->num_alloc_vfs) in i40e_reset_all_vfs()
1641 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_all_vfs()
1645 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1657 for (i = 0, vf = &pf->vf[0]; i < 10 && vf < &pf->vf[pf->num_alloc_vfs]; ++i) { in i40e_reset_all_vfs()
1663 while (vf < &pf->vf[pf->num_alloc_vfs]) { in i40e_reset_all_vfs()
1683 if (vf < &pf->vf[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()
1691 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1700 i40e_vsi_stop_rings_no_wait(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_all_vfs()
1706 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { in i40e_reset_all_vfs()
1715 i40e_vsi_wait_queues_disabled(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_all_vfs()
1724 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) { 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 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; 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 (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_pci_sriov_configure()
1947 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; 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 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; 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 ((pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) && in i40e_vc_get_vf_resources_msg()
2171 if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) { in i40e_vc_get_vf_resources_msg()
2180 if ((pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE) && in i40e_vc_get_vf_resources_msg()
2185 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_vc_get_vf_resources_msg()
2186 dev_err(&pf->pdev->dev, in i40e_vc_get_vf_resources_msg()
2195 if (pf->hw_features & I40E_HW_WB_ON_ITR_CAPABLE) { 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()
2253 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
2263 dev_err(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2298 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2303 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2310 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2315 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2340 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
2410 * it cares is about its own queues. PF configures these queues in i40e_vc_config_queues_msg()
2430 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = in i40e_vc_config_queues_msg()
2434 vsi = pf->vsi[vf->ch[i].vsi_idx]; in i40e_vc_config_queues_msg()
2501 vf->pf->hw.func_caps.num_msix_vectors_vf) { in i40e_vc_config_irq_map_msg()
2543 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_tx_rings() local
2548 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_ctrl_vf_tx_rings()
2566 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_rx_rings() local
2571 ret = i40e_control_wait_rx_q(pf, vsi->base_queue + q_id, in i40e_ctrl_vf_rx_rings()
2606 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
2612 dev_info(&pf->pdev->dev, in i40e_vc_enable_queues_msg()
2634 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_enable_queues_msg()
2639 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_enable_queues_msg()
2649 if (i40e_vsi_start_rings(pf->vsi[vf->ch[i].vsi_idx])) in i40e_vc_enable_queues_msg()
2672 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
2691 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_disable_queues_msg()
2696 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_disable_queues_msg()
2718 struct i40e_pf *pf = vf->pf; in i40e_check_enough_queue() local
2721 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_enough_queue()
2728 pile = pf->qp_pile; in i40e_check_enough_queue()
2766 * different number. If the request is successful, PF will reset the VF and
2767 * return 0. If unsuccessful, PF will send message informing VF of number of
2776 struct i40e_pf *pf = vf->pf; in i40e_vc_request_queues_msg() local
2782 dev_err(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2787 } else if (req_pairs - cur_pairs > pf->queues_left) { in i40e_vc_request_queues_msg()
2788 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2792 pf->queues_left); in i40e_vc_request_queues_msg()
2793 vfres->num_queue_pairs = pf->queues_left + cur_pairs; in i40e_vc_request_queues_msg()
2795 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2822 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
2839 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
2906 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission() local
2907 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_vf_permission()
2908 struct i40e_hw *hw = &pf->hw; in i40e_check_vf_permission()
2918 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_check_vf_permission()
2933 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2951 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2962 I40E_VC_MAX_MACVLAN_PER_TRUSTED_VF(pf->num_alloc_vfs, in i40e_check_vf_permission()
2964 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
3049 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
3060 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
3082 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
3097 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_add_mac_addr_msg()
3118 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
3132 dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n", in i40e_vc_del_mac_addr_msg()
3138 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
3146 * administratively by PF or if VF is trusted. in i40e_vc_del_mac_addr_msg()
3170 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_del_mac_addr_msg()
3205 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
3212 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3225 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3230 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
3244 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3249 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
3255 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
3276 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
3294 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
3306 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3311 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
3332 struct i40e_pf *pf = vf->pf; in i40e_vc_rdma_msg() local
3333 int abs_vf_id = vf->vf_id + pf->hw.func_caps.vf_base_id; in i40e_vc_rdma_msg()
3342 i40e_notify_client_of_vf_msg(pf->vsi[pf->lan_vsi], abs_vf_id, in i40e_vc_rdma_msg()
3397 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_key() local
3408 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_key()
3427 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_lut() local
3445 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_lut()
3463 struct i40e_pf *pf = vf->pf; in i40e_vc_get_rss_hena() local
3479 vrh->hena = i40e_pf_get_default_rss_hena(pf); in i40e_vc_get_rss_hena()
3499 struct i40e_pf *pf = vf->pf; in i40e_vc_set_rss_hena() local
3500 struct i40e_hw *hw = &pf->hw; in i40e_vc_set_rss_hena()
3533 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_enable_vlan_stripping()
3559 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_disable_vlan_stripping()
3580 struct i40e_pf *pf = vf->pf; in i40e_validate_cloud_filter() local
3588 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3597 dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n", in i40e_validate_cloud_filter()
3612 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_validate_cloud_filter()
3616 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3631 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3640 dev_err(&pf->pdev->dev, in i40e_validate_cloud_filter()
3650 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest MAC addr %pM\n", in i40e_validate_cloud_filter()
3659 dev_info(&pf->pdev->dev, "VF %d: Invalid Source MAC addr %pM\n", in i40e_validate_cloud_filter()
3667 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest port\n", in i40e_validate_cloud_filter()
3675 dev_info(&pf->pdev->dev, "VF %d: Invalid Source port\n", in i40e_validate_cloud_filter()
3683 dev_info(&pf->pdev->dev, "VF %d: Invalid Flow type\n", in i40e_validate_cloud_filter()
3690 dev_info(&pf->pdev->dev, "VF %d: invalid VLAN ID\n", in i40e_validate_cloud_filter()
3708 struct i40e_pf *pf = vf->pf; in i40e_find_vsi_from_seid() local
3713 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id); in i40e_find_vsi_from_seid()
3729 struct i40e_pf *pf = vf->pf; in i40e_del_all_cloud_filters() local
3739 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()
3750 dev_err(&pf->pdev->dev, in i40e_del_all_cloud_filters()
3753 i40e_aq_str(&pf->hw, in i40e_del_all_cloud_filters()
3754 pf->hw.aq.asq_last_status)); in i40e_del_all_cloud_filters()
3775 struct i40e_pf *pf = vf->pf; in i40e_vc_del_cloud_filter() local
3787 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3795 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3838 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_del_cloud_filter()
3843 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_del_cloud_filter()
3853 dev_err(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3856 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_del_cloud_filter()
3907 struct i40e_pf *pf = vf->pf; in i40e_vc_add_cloud_filter() local
3918 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3926 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3974 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_add_cloud_filter()
3979 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_add_cloud_filter()
3989 dev_err(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3992 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_add_cloud_filter()
4017 struct i40e_pf *pf = vf->pf; in i40e_vc_add_qch_msg() local
4018 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_add_qch_msg()
4030 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4037 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4046 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4057 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4068 if (pf->queues_left < adq_request_qps) { in i40e_vc_add_qch_msg()
4069 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4085 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4096 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
4131 struct i40e_pf *pf = vf->pf; in i40e_vc_del_qch_msg() local
4144 dev_info(&pf->pdev->dev, in i40e_vc_del_qch_msg()
4148 dev_info(&pf->pdev->dev, "VF %d trying to delete queue channels but ADq isn't enabled\n", in i40e_vc_del_qch_msg()
4165 * @pf: pointer to the PF structure
4175 int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
4178 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
4183 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
4184 if (local_vf_id < 0 || local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
4186 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
4197 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
4289 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
4301 * @pf: pointer to the PF structure
4306 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
4308 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
4313 if (!test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_vc_process_vflr_event()
4326 clear_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_vc_process_vflr_event()
4327 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
4331 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
4343 * @pf: the physical function
4350 static int i40e_validate_vf(struct i40e_pf *pf, int vf_id) in i40e_validate_vf() argument
4356 if (vf_id >= pf->num_alloc_vfs) { in i40e_validate_vf()
4357 dev_err(&pf->pdev->dev, in i40e_validate_vf()
4362 vf = &pf->vf[vf_id]; in i40e_validate_vf()
4363 vsi = i40e_find_vsi_from_id(pf, vf->lan_vsi_id); in i40e_validate_vf()
4394 dev_err(&vf->pf->pdev->dev, in i40e_check_vf_init_timeout()
4414 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
4421 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_mac()
4422 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_mac()
4427 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_mac()
4431 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_mac()
4436 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
4439 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
4464 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
4472 dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id); in i40e_ndo_set_vf_mac()
4475 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", in i40e_ndo_set_vf_mac()
4483 dev_info(&pf->pdev->dev, "Bring down and up the VF interface to make this change effective.\n"); in i40e_ndo_set_vf_mac()
4486 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_mac()
4506 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
4511 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_port_vlan()
4512 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_port_vlan()
4517 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_port_vlan()
4522 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
4528 dev_err(&pf->pdev->dev, "VF VLAN protocol is not supported\n"); in i40e_ndo_set_vf_port_vlan()
4533 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_port_vlan()
4538 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4582 dev_err(&pf->pdev->dev, "Unable to config VF promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4593 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
4622 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
4633 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4637 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4644 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_port_vlan()
4661 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
4666 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_bw()
4667 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_bw()
4672 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_bw()
4677 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
4683 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_bw()
4688 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
4696 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_bw()
4713 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
4717 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_get_vf_config()
4718 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_get_vf_config()
4723 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_get_vf_config()
4727 vf = &pf->vf[vf_id]; in i40e_ndo_get_vf_config()
4729 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
4755 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_get_vf_config()
4770 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
4771 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_ndo_set_vf_link_state()
4773 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
4781 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_link_state()
4782 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_link_state()
4787 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
4788 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
4793 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
4820 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_link_state()
4844 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_link_state()
4860 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
4862 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
4866 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_spoofchk()
4867 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_spoofchk()
4872 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
4873 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
4878 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
4889 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
4890 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
4897 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()
4902 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_spoofchk()
4908 * @netdev: network interface device structure of the pf
4917 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_trust() local
4921 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_trust()
4922 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_trust()
4927 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_trust()
4928 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_trust()
4933 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_ndo_set_vf_trust()
4934 dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n"); in i40e_ndo_set_vf_trust()
4939 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_trust()
4946 /* request PF to sync mac/vlan filters for the VF */ in i40e_ndo_set_vf_trust()
4947 set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4948 pf->vsi[vf->lan_vsi_idx]->flags |= I40E_VSI_FLAG_FILTER_CHANGED; in i40e_ndo_set_vf_trust()
4951 dev_info(&pf->pdev->dev, "VF %u is now %strusted\n", in i40e_ndo_set_vf_trust()
4956 dev_info(&pf->pdev->dev, in i40e_ndo_set_vf_trust()
4964 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4970 * @netdev: the netdev of the PF
4978 struct i40e_pf *pf = np->vsi->back; in i40e_get_vf_stats() local
4984 if (i40e_validate_vf(pf, vf_id)) in i40e_get_vf_stats()
4987 vf = &pf->vf[vf_id]; in i40e_get_vf_stats()
4989 dev_err(&pf->pdev->dev, "VF %d in reset. Try again.\n", vf_id); in i40e_get_vf_stats()
4993 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_get_vf_stats()