Lines Matching full:pf

10  * @pf: pointer to the PF structure
16 * send a message to all VFs on a given PF
18 static void i40e_vc_vf_broadcast(struct i40e_pf *pf, in i40e_vc_vf_broadcast() argument
23 struct i40e_hw *hw = &pf->hw; in i40e_vc_vf_broadcast()
24 struct i40e_vf *vf = pf->vf; in i40e_vc_vf_broadcast()
27 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { in i40e_vc_vf_broadcast()
51 struct i40e_pf *pf = vf->pf; in i40e_vc_notify_vf_link_state() local
52 struct i40e_hw *hw = &pf->hw; in i40e_vc_notify_vf_link_state()
53 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_notify_vf_link_state()
80 * @pf: pointer to the PF structure
82 * send a link status message to all VFs on a given PF
84 void i40e_vc_notify_link_state(struct i40e_pf *pf) in i40e_vc_notify_link_state() argument
88 for (i = 0; i < pf->num_alloc_vfs; i++) in i40e_vc_notify_link_state()
89 i40e_vc_notify_vf_link_state(&pf->vf[i]); in i40e_vc_notify_link_state()
94 * @pf: pointer to the PF structure
96 * indicate a pending reset to all VFs on a given PF
98 void i40e_vc_notify_reset(struct i40e_pf *pf) in i40e_vc_notify_reset() argument
104 i40e_vc_vf_broadcast(pf, VIRTCHNL_OP_EVENT, 0, in i40e_vc_notify_reset()
120 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_notify_vf_reset()
128 abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id; in i40e_vc_notify_vf_reset()
132 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, VIRTCHNL_OP_EVENT, in i40e_vc_notify_vf_reset()
161 dev_warn(&vf->pf->pdev->dev, in i40e_vc_disable_vf()
175 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vsi_id() local
176 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_vsi_id()
192 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_queue_id() local
193 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_queue_id()
207 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vector_id() local
209 return vector_id < pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_isvalid_vector_id()
220 * return PF relative queue id
225 struct i40e_pf *pf = vf->pf; in i40e_vc_get_pf_queue_id() local
226 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_get_pf_queue_id()
287 struct i40e_pf *pf = vf->pf; in i40e_config_irq_link_list() local
288 struct i40e_hw *hw = &pf->hw; in i40e_config_irq_link_list()
301 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) + in i40e_config_irq_link_list()
391 struct i40e_pf *pf = vf->pf; in i40e_release_iwarp_qvlist() local
399 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_release_iwarp_qvlist()
403 struct i40e_hw *hw = &pf->hw; in i40e_release_iwarp_qvlist()
444 struct i40e_pf *pf = vf->pf; in i40e_config_iwarp_qvlist() local
445 struct i40e_hw *hw = &pf->hw; in i40e_config_iwarp_qvlist()
452 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_iwarp_qvlist()
455 dev_warn(&pf->pdev->dev, in i40e_config_iwarp_qvlist()
473 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_config_iwarp_qvlist()
547 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_tx_queue() local
548 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_tx_queue()
560 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vsi_tx_queue()
580 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
590 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
624 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
625 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
681 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
691 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
712 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
717 vsi = i40e_vsi_setup(pf, I40E_VSI_SRIOV, pf->vsi[pf->lan_vsi]->seid, in i40e_alloc_vsi_res()
721 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
723 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
729 u64 hena = i40e_pf_get_default_rss_hena(pf); in i40e_alloc_vsi_res()
748 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
755 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
758 wr32(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)hena); in i40e_alloc_vsi_res()
759 wr32(&pf->hw, I40E_VFQF_HENA1(1, vf->vf_id), (u32)(hena >> 32)); in i40e_alloc_vsi_res()
763 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
781 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
784 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
796 * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This
797 * function takes care of first part VSILAN_QTABLE, mapping pf queues to VSI.
801 struct i40e_pf *pf = vf->pf; in i40e_map_pf_queues_to_vsi() local
802 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_queues_to_vsi()
815 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_queues_to_vsi()
843 * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This
848 struct i40e_pf *pf = vf->pf; in i40e_map_pf_to_vf_queues() local
849 struct i40e_hw *hw = &pf->hw; in i40e_map_pf_to_vf_queues()
863 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_map_pf_to_vf_queues()
886 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
887 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
915 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
916 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
935 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
936 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
949 pf->queues_left += vf->num_queue_pairs - in i40e_free_vf_res()
955 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
968 i40e_vsi_release(pf->vsi[vf->ch[j].vsi_idx]); in i40e_free_vf_res()
973 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
1016 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
1021 vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF) in i40e_alloc_vf_res()
1022 pf->num_vf_qps = vf->num_req_queues; in i40e_alloc_vf_res()
1024 pf->num_vf_qps = I40E_DEFAULT_QUEUES_PER_VF; in i40e_alloc_vf_res()
1030 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
1034 if (pf->queues_left >= in i40e_alloc_vf_res()
1045 dev_info(&pf->pdev->dev, "VF %d: Not enough queues to allocate, disabling ADq\n", in i40e_alloc_vf_res()
1057 pf->queues_left -= in i40e_alloc_vf_res()
1091 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
1092 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
1175 struct i40e_pf *pf = vf->pf; in i40e_set_vsi_promisc() local
1176 struct i40e_hw *hw = &pf->hw; in i40e_set_vsi_promisc()
1185 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1187 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1190 i40e_stat_str(&pf->hw, aq_ret), in i40e_set_vsi_promisc()
1191 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1201 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1203 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1206 i40e_stat_str(&pf->hw, aq_ret), in i40e_set_vsi_promisc()
1207 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1218 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1220 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1223 i40e_stat_str(&pf->hw, aq_ret), in i40e_set_vsi_promisc()
1224 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1234 int aq_err = pf->hw.aq.asq_last_status; in i40e_set_vsi_promisc()
1236 dev_err(&pf->pdev->dev, in i40e_set_vsi_promisc()
1239 i40e_stat_str(&pf->hw, aq_ret), in i40e_set_vsi_promisc()
1240 i40e_aq_str(&pf->hw, aq_err)); in i40e_set_vsi_promisc()
1269 struct i40e_pf *pf = vf->pf; in i40e_config_vf_promiscuous_mode() local
1274 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vf_promiscuous_mode()
1311 struct i40e_pf *pf = vf->pf; in i40e_trigger_vf_reset() local
1312 struct i40e_hw *hw = &pf->hw; in i40e_trigger_vf_reset()
1343 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_trigger_vf_reset()
1357 struct i40e_pf *pf = vf->pf; in i40e_cleanup_reset_vf() local
1358 struct i40e_hw *hw = &pf->hw; in i40e_cleanup_reset_vf()
1390 i40e_notify_client_of_vf_reset(pf, abs_vf_id); in i40e_cleanup_reset_vf()
1411 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
1412 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
1417 if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) in i40e_reset_vf()
1423 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_vf()
1449 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
1455 i40e_vsi_stop_rings(pf->vsi[vf->lan_vsi_idx]); in i40e_reset_vf()
1460 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_reset_vf()
1467 * @pf: pointer to the PF structure
1472 * VF after the wait. This is useful during PF routines which need to reset
1477 bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) in i40e_reset_all_vfs() argument
1479 struct i40e_hw *hw = &pf->hw; in i40e_reset_all_vfs()
1485 if (!pf->num_alloc_vfs) in i40e_reset_all_vfs()
1489 if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_reset_all_vfs()
1493 for (v = 0; v < pf->num_alloc_vfs; v++) in i40e_reset_all_vfs()
1494 i40e_trigger_vf_reset(&pf->vf[v], flr); in i40e_reset_all_vfs()
1502 for (i = 0, v = 0; i < 10 && v < pf->num_alloc_vfs; i++) { in i40e_reset_all_vfs()
1508 while (v < pf->num_alloc_vfs) { in i40e_reset_all_vfs()
1509 vf = &pf->vf[v]; in i40e_reset_all_vfs()
1527 if (v < pf->num_alloc_vfs) in i40e_reset_all_vfs()
1528 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_all_vfs()
1529 pf->vf[v].vf_id); in i40e_reset_all_vfs()
1535 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1537 if (pf->vf[v].lan_vsi_idx == 0) in i40e_reset_all_vfs()
1540 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[v].lan_vsi_idx]); in i40e_reset_all_vfs()
1546 for (v = 0; v < pf->num_alloc_vfs; v++) { in i40e_reset_all_vfs()
1548 if (pf->vf[v].lan_vsi_idx == 0) in i40e_reset_all_vfs()
1551 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[v].lan_vsi_idx]); in i40e_reset_all_vfs()
1560 for (v = 0; v < pf->num_alloc_vfs; v++) in i40e_reset_all_vfs()
1561 i40e_cleanup_reset_vf(&pf->vf[v]); in i40e_reset_all_vfs()
1564 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_reset_all_vfs()
1571 * @pf: pointer to the PF structure
1575 void i40e_free_vfs(struct i40e_pf *pf) in i40e_free_vfs() argument
1577 struct i40e_hw *hw = &pf->hw; in i40e_free_vfs()
1581 if (!pf->vf) in i40e_free_vfs()
1583 while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) in i40e_free_vfs()
1586 i40e_notify_client_of_vf_enable(pf, 0); in i40e_free_vfs()
1592 if (!pci_vfs_assigned(pf->pdev)) in i40e_free_vfs()
1593 pci_disable_sriov(pf->pdev); in i40e_free_vfs()
1595 dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); in i40e_free_vfs()
1598 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1599 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1602 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1605 for (i = 0; i < pf->num_alloc_vfs; i++) { in i40e_free_vfs()
1606 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1609 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); in i40e_free_vfs()
1613 tmp = pf->num_alloc_vfs; in i40e_free_vfs()
1614 pf->num_alloc_vfs = 0; in i40e_free_vfs()
1616 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
1617 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
1619 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
1622 kfree(pf->vf); in i40e_free_vfs()
1623 pf->vf = NULL; in i40e_free_vfs()
1629 if (!pci_vfs_assigned(pf->pdev)) { in i40e_free_vfs()
1639 clear_bit(__I40E_VF_DISABLE, pf->state); in i40e_free_vfs()
1645 * @pf: pointer to the PF structure
1650 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) in i40e_alloc_vfs() argument
1656 i40e_irq_dynamic_disable_icr0(pf); in i40e_alloc_vfs()
1659 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { in i40e_alloc_vfs()
1660 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); in i40e_alloc_vfs()
1662 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_alloc_vfs()
1663 pf->num_alloc_vfs = 0; in i40e_alloc_vfs()
1673 pf->vf = vfs; in i40e_alloc_vfs()
1677 vfs[i].pf = pf; in i40e_alloc_vfs()
1688 pf->num_alloc_vfs = num_alloc_vfs; in i40e_alloc_vfs()
1691 i40e_reset_all_vfs(pf, false); in i40e_alloc_vfs()
1693 i40e_notify_client_of_vf_enable(pf, num_alloc_vfs); in i40e_alloc_vfs()
1697 i40e_free_vfs(pf); in i40e_alloc_vfs()
1700 i40e_irq_dynamic_enable_icr0(pf); in i40e_alloc_vfs()
1715 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_enable() local
1719 if (test_bit(__I40E_TESTING, pf->state)) { in i40e_pci_sriov_enable()
1727 i40e_free_vfs(pf); in i40e_pci_sriov_enable()
1731 if (num_vfs > pf->num_req_vfs) { in i40e_pci_sriov_enable()
1733 num_vfs, pf->num_req_vfs); in i40e_pci_sriov_enable()
1739 err = i40e_alloc_vfs(pf, num_vfs); in i40e_pci_sriov_enable()
1764 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_configure() local
1767 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_pci_sriov_configure()
1773 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_pci_sriov_configure()
1774 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1775 i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG); in i40e_pci_sriov_configure()
1781 if (!pci_vfs_assigned(pf->pdev)) { in i40e_pci_sriov_configure()
1782 i40e_free_vfs(pf); in i40e_pci_sriov_configure()
1783 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1784 i40e_do_reset_safe(pf, I40E_PF_RESET_FLAG); in i40e_pci_sriov_configure()
1791 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_pci_sriov_configure()
1810 struct i40e_pf *pf; in i40e_vc_send_msg_to_vf() local
1816 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1819 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1820 hw = &pf->hw; in i40e_vc_send_msg_to_vf()
1826 dev_info(&pf->pdev->dev, "VF %d failed opcode %d, retval: %d\n", in i40e_vc_send_msg_to_vf()
1830 dev_err(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
1833 dev_err(&pf->pdev->dev, "Use PF Control I/F to enable the VF\n"); in i40e_vc_send_msg_to_vf()
1845 dev_info(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
1847 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
1874 * called from the VF to request the API version used by the PF
1897 struct i40e_pf *pf = vf->pf; in i40e_del_qch() local
1905 i40e_vsi_release(pf->vsi[vf->ch[i].vsi_idx]); in i40e_del_qch()
1922 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg() local
1949 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
1953 if (i40e_vf_client_capable(pf, vf->vf_id) && in i40e_vc_get_vf_resources_msg()
1964 if ((pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) && in i40e_vc_get_vf_resources_msg()
1971 if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) { in i40e_vc_get_vf_resources_msg()
1980 if ((pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE) && in i40e_vc_get_vf_resources_msg()
1985 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_vc_get_vf_resources_msg()
1986 dev_err(&pf->pdev->dev, in i40e_vc_get_vf_resources_msg()
1995 if (pf->hw_features & I40E_HW_WB_ON_ITR_CAPABLE) { in i40e_vc_get_vf_resources_msg()
2009 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_get_vf_resources_msg()
2039 * unlike other virtchnl messages, PF driver
2060 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
2070 dev_err(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2105 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2110 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2117 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2122 dev_info(&pf->pdev->dev, in i40e_vc_config_promiscuous_mode_msg()
2146 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
2216 * it cares is about its own queues. PF configures these queues in i40e_vc_config_queues_msg()
2236 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = in i40e_vc_config_queues_msg()
2240 pf->vsi[vf->ch[i].vsi_idx]->num_queue_pairs = in i40e_vc_config_queues_msg()
2301 vf->pf->hw.func_caps.num_msix_vectors_vf) { in i40e_vc_config_irq_map_msg()
2343 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_tx_rings() local
2348 ret = i40e_control_wait_tx_q(vsi->seid, pf, in i40e_ctrl_vf_tx_rings()
2366 struct i40e_pf *pf = vsi->back; in i40e_ctrl_vf_rx_rings() local
2371 ret = i40e_control_wait_rx_q(pf, vsi->base_queue + q_id, in i40e_ctrl_vf_rx_rings()
2406 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
2426 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_enable_queues_msg()
2431 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_enable_queues_msg()
2441 if (i40e_vsi_start_rings(pf->vsi[vf->ch[i].vsi_idx])) in i40e_vc_enable_queues_msg()
2466 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
2488 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues, in i40e_vc_disable_queues_msg()
2493 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues, in i40e_vc_disable_queues_msg()
2510 * different number. If the request is successful, PF will reset the VF and
2511 * return 0. If unsuccessful, PF will send message informing VF of number of
2520 struct i40e_pf *pf = vf->pf; in i40e_vc_request_queues_msg() local
2526 dev_err(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2531 } else if (req_pairs - cur_pairs > pf->queues_left) { in i40e_vc_request_queues_msg()
2532 dev_warn(&pf->pdev->dev, in i40e_vc_request_queues_msg()
2536 pf->queues_left); in i40e_vc_request_queues_msg()
2537 vfres->num_queue_pairs = pf->queues_left + cur_pairs; in i40e_vc_request_queues_msg()
2561 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
2578 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
2618 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission() local
2619 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_check_vf_permission()
2629 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_check_vf_permission()
2644 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2662 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
2680 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
2691 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
2713 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
2731 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_add_mac_addr_msg()
2752 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
2766 dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n", in i40e_vc_del_mac_addr_msg()
2774 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
2790 dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n", in i40e_vc_del_mac_addr_msg()
2825 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
2832 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
2845 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
2850 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
2864 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
2869 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_add_vlan_msg()
2875 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
2896 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
2914 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
2926 i40e_aq_set_vsi_uc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
2931 i40e_aq_set_vsi_mc_promisc_on_vlan(&pf->hw, vsi->seid, in i40e_vc_remove_vlan_msg()
2952 struct i40e_pf *pf = vf->pf; in i40e_vc_iwarp_msg() local
2953 int abs_vf_id = vf->vf_id + pf->hw.func_caps.vf_base_id; in i40e_vc_iwarp_msg()
2962 i40e_notify_client_of_vf_msg(pf->vsi[pf->lan_vsi], abs_vf_id, in i40e_vc_iwarp_msg()
3017 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_key() local
3028 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_key()
3047 struct i40e_pf *pf = vf->pf; in i40e_vc_config_rss_lut() local
3065 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_config_rss_lut()
3083 struct i40e_pf *pf = vf->pf; in i40e_vc_get_rss_hena() local
3099 vrh->hena = i40e_pf_get_default_rss_hena(pf); in i40e_vc_get_rss_hena()
3119 struct i40e_pf *pf = vf->pf; in i40e_vc_set_rss_hena() local
3120 struct i40e_hw *hw = &pf->hw; in i40e_vc_set_rss_hena()
3153 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_enable_vlan_stripping()
3179 vsi = vf->pf->vsi[vf->lan_vsi_idx]; in i40e_vc_disable_vlan_stripping()
3200 struct i40e_pf *pf = vf->pf; in i40e_validate_cloud_filter() local
3208 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3217 dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n", in i40e_validate_cloud_filter()
3232 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_validate_cloud_filter()
3236 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3251 dev_info(&pf->pdev->dev, in i40e_validate_cloud_filter()
3260 dev_err(&pf->pdev->dev, in i40e_validate_cloud_filter()
3270 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest MAC addr %pM\n", in i40e_validate_cloud_filter()
3279 dev_info(&pf->pdev->dev, "VF %d: Invalid Source MAC addr %pM\n", in i40e_validate_cloud_filter()
3287 dev_info(&pf->pdev->dev, "VF %d: Invalid Dest port\n", in i40e_validate_cloud_filter()
3295 dev_info(&pf->pdev->dev, "VF %d: Invalid Source port\n", in i40e_validate_cloud_filter()
3303 dev_info(&pf->pdev->dev, "VF %d: Invalid Flow type\n", in i40e_validate_cloud_filter()
3310 dev_info(&pf->pdev->dev, "VF %d: invalid VLAN ID\n", in i40e_validate_cloud_filter()
3328 struct i40e_pf *pf = vf->pf; in i40e_find_vsi_from_seid() local
3333 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id); in i40e_find_vsi_from_seid()
3349 struct i40e_pf *pf = vf->pf; in i40e_del_all_cloud_filters() local
3359 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()
3370 dev_err(&pf->pdev->dev, in i40e_del_all_cloud_filters()
3372 vf->vf_id, i40e_stat_str(&pf->hw, ret), in i40e_del_all_cloud_filters()
3373 i40e_aq_str(&pf->hw, in i40e_del_all_cloud_filters()
3374 pf->hw.aq.asq_last_status)); in i40e_del_all_cloud_filters()
3395 struct i40e_pf *pf = vf->pf; in i40e_vc_del_cloud_filter() local
3407 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3415 dev_info(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3458 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_del_cloud_filter()
3463 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_del_cloud_filter()
3473 dev_err(&pf->pdev->dev, in i40e_vc_del_cloud_filter()
3475 vf->vf_id, i40e_stat_str(&pf->hw, ret), in i40e_vc_del_cloud_filter()
3476 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_del_cloud_filter()
3527 struct i40e_pf *pf = vf->pf; in i40e_vc_add_cloud_filter() local
3538 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3546 dev_info(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3592 dev_info(&pf->pdev->dev, "VF %d: Flow type not configured\n", in i40e_vc_add_cloud_filter()
3597 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx]; in i40e_vc_add_cloud_filter()
3607 dev_err(&pf->pdev->dev, in i40e_vc_add_cloud_filter()
3609 vf->vf_id, i40e_stat_str(&pf->hw, ret), in i40e_vc_add_cloud_filter()
3610 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); in i40e_vc_add_cloud_filter()
3635 struct i40e_pf *pf = vf->pf; in i40e_vc_add_qch_msg() local
3636 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_add_qch_msg()
3648 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3655 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3664 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3675 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3686 if (pf->queues_left < adq_request_qps) { in i40e_vc_add_qch_msg()
3687 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3721 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3732 dev_err(&pf->pdev->dev, in i40e_vc_add_qch_msg()
3773 struct i40e_pf *pf = vf->pf; in i40e_vc_del_qch_msg() local
3786 dev_info(&pf->pdev->dev, in i40e_vc_del_qch_msg()
3790 dev_info(&pf->pdev->dev, "VF %d trying to delete queue channels but ADq isn't enabled\n", in i40e_vc_del_qch_msg()
3808 * @pf: pointer to the PF structure
3818 int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
3821 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
3826 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
3827 if (local_vf_id < 0 || local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
3829 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
3840 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
3937 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
3949 * @pf: pointer to the PF structure
3954 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
3956 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
3961 if (!test_bit(__I40E_VFLR_EVENT_PENDING, pf->state)) in i40e_vc_process_vflr_event()
3974 clear_bit(__I40E_VFLR_EVENT_PENDING, pf->state); in i40e_vc_process_vflr_event()
3975 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
3979 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
3991 * @pf: the physical function
3998 static int i40e_validate_vf(struct i40e_pf *pf, int vf_id) in i40e_validate_vf() argument
4004 if (vf_id >= pf->num_alloc_vfs) { in i40e_validate_vf()
4005 dev_err(&pf->pdev->dev, in i40e_validate_vf()
4010 vf = &pf->vf[vf_id]; in i40e_validate_vf()
4011 vsi = i40e_find_vsi_from_id(pf, vf->lan_vsi_id); in i40e_validate_vf()
4030 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
4038 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_mac()
4039 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_mac()
4044 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_mac()
4048 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_mac()
4049 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
4055 * to show on the newly loaded vsi under pf->vsi[id]. in i40e_ndo_set_vf_mac()
4060 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
4066 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_mac()
4073 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
4098 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
4106 dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id); in i40e_ndo_set_vf_mac()
4109 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", in i40e_ndo_set_vf_mac()
4117 dev_info(&pf->pdev->dev, "Bring down and up the VF interface to make this change effective.\n"); in i40e_ndo_set_vf_mac()
4120 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_mac()
4168 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
4173 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_port_vlan()
4174 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_port_vlan()
4179 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_port_vlan()
4184 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
4190 dev_err(&pf->pdev->dev, "VF VLAN protocol is not supported\n"); in i40e_ndo_set_vf_port_vlan()
4195 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_port_vlan()
4196 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4198 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_port_vlan()
4209 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_port_vlan()
4218 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
4257 dev_err(&pf->pdev->dev, "Unable to config VF promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4268 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
4297 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
4308 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n"); in i40e_ndo_set_vf_port_vlan()
4315 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_port_vlan()
4332 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
4337 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_bw()
4338 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_bw()
4343 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_set_vf_bw()
4348 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
4354 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_bw()
4355 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
4357 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_bw()
4369 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_bw()
4386 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
4390 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_get_vf_config()
4391 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_get_vf_config()
4396 ret = i40e_validate_vf(pf, vf_id); in i40e_ndo_get_vf_config()
4400 vf = &pf->vf[vf_id]; in i40e_ndo_get_vf_config()
4402 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
4428 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_get_vf_config()
4443 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
4445 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
4450 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_link_state()
4451 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_link_state()
4456 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
4457 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
4462 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
4472 pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP; in i40e_ndo_set_vf_link_state()
4475 pf->hw.phy.link_info.link_speed; in i40e_ndo_set_vf_link_state()
4498 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_link_state()
4514 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
4516 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
4520 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_spoofchk()
4521 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_spoofchk()
4526 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
4527 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
4532 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
4534 dev_err(&pf->pdev->dev, "VF %d still in reset. Try again.\n", in i40e_ndo_set_vf_spoofchk()
4545 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
4546 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
4553 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()
4558 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_spoofchk()
4564 * @netdev: network interface device structure of the pf
4573 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_trust() local
4577 if (test_and_set_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state)) { in i40e_ndo_set_vf_trust()
4578 dev_warn(&pf->pdev->dev, "Unable to configure VFs, other operation is pending.\n"); in i40e_ndo_set_vf_trust()
4583 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_trust()
4584 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_trust()
4589 if (pf->flags & I40E_FLAG_MFP_ENABLED) { in i40e_ndo_set_vf_trust()
4590 dev_err(&pf->pdev->dev, "Trusted VF not supported in MFP mode.\n"); in i40e_ndo_set_vf_trust()
4595 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_trust()
4602 dev_info(&pf->pdev->dev, "VF %u is now %strusted\n", in i40e_ndo_set_vf_trust()
4607 dev_info(&pf->pdev->dev, in i40e_ndo_set_vf_trust()
4615 clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); in i40e_ndo_set_vf_trust()
4621 * @netdev: the netdev of the PF
4629 struct i40e_pf *pf = np->vsi->back; in i40e_get_vf_stats() local
4635 if (i40e_validate_vf(pf, vf_id)) in i40e_get_vf_stats()
4638 vf = &pf->vf[vf_id]; in i40e_get_vf_stats()
4640 dev_err(&pf->pdev->dev, "VF %d in reset. Try again.\n", vf_id); in i40e_get_vf_stats()
4644 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_get_vf_stats()