Lines Matching refs:pf
41 static void i40e_vc_vf_broadcast(struct i40e_pf *pf, in i40e_vc_vf_broadcast() argument
46 struct i40e_hw *hw = &pf->hw; in i40e_vc_vf_broadcast()
47 struct i40e_vf *vf = pf->vf; in i40e_vc_vf_broadcast()
50 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { in i40e_vc_vf_broadcast()
74 struct i40e_pf *pf = vf->pf; in i40e_vc_notify_vf_link_state() local
75 struct i40e_hw *hw = &pf->hw; in i40e_vc_notify_vf_link_state()
76 struct i40e_link_status *ls = &pf->hw.phy.link_info; in i40e_vc_notify_vf_link_state()
100 void i40e_vc_notify_link_state(struct i40e_pf *pf) in i40e_vc_notify_link_state() argument
104 for (i = 0; i < pf->num_alloc_vfs; i++) in i40e_vc_notify_link_state()
105 i40e_vc_notify_vf_link_state(&pf->vf[i]); in i40e_vc_notify_link_state()
114 void i40e_vc_notify_reset(struct i40e_pf *pf) in i40e_vc_notify_reset() argument
120 i40e_vc_vf_broadcast(pf, I40E_VIRTCHNL_OP_EVENT, 0, in i40e_vc_notify_reset()
136 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_notify_vf_reset()
144 abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; in i40e_vc_notify_vf_reset()
148 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, in i40e_vc_notify_vf_reset()
161 static inline void i40e_vc_disable_vf(struct i40e_pf *pf, struct i40e_vf *vf) in i40e_vc_disable_vf() argument
176 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vsi_id() local
177 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_vsi_id()
193 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_queue_id() local
194 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_queue_id()
208 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vector_id() local
210 return vector_id < pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_isvalid_vector_id()
226 struct i40e_pf *pf = vf->pf; in i40e_vc_get_pf_queue_id() local
227 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_get_pf_queue_id()
256 struct i40e_pf *pf = vf->pf; in i40e_config_irq_link_list() local
257 struct i40e_hw *hw = &pf->hw; in i40e_config_irq_link_list()
270 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) + in i40e_config_irq_link_list()
367 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_tx_queue() local
368 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_tx_queue()
376 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vsi_tx_queue()
392 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
402 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
436 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
437 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
493 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
503 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
524 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
528 vsi = i40e_vsi_setup(pf, type, pf->vsi[pf->lan_vsi]->seid, vf->vf_id); in i40e_alloc_vsi_res()
531 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
533 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
556 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
562 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
570 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
574 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
577 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
593 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
594 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
610 for (j = 0; j < pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; j++) { in i40e_enable_vf_mappings()
620 if (j * 2 >= pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs) { in i40e_enable_vf_mappings()
644 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
645 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
664 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
665 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
671 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
675 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
720 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
728 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
757 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
758 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
784 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
785 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
790 if (test_and_set_bit(__I40E_VF_DISABLE, &pf->state)) in i40e_reset_vf()
808 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_reset_vf()
832 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
844 i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], false); in i40e_reset_vf()
856 clear_bit(__I40E_VF_DISABLE, &pf->state); in i40e_reset_vf()
865 void i40e_free_vfs(struct i40e_pf *pf) in i40e_free_vfs() argument
867 struct i40e_hw *hw = &pf->hw; in i40e_free_vfs()
871 if (!pf->vf) in i40e_free_vfs()
873 while (test_and_set_bit(__I40E_VF_DISABLE, &pf->state)) in i40e_free_vfs()
876 for (i = 0; i < pf->num_alloc_vfs; i++) in i40e_free_vfs()
877 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
878 i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx], in i40e_free_vfs()
881 for (i = 0; i < pf->num_alloc_vfs; i++) in i40e_free_vfs()
882 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
883 i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx], in i40e_free_vfs()
890 if (!pci_vfs_assigned(pf->pdev)) in i40e_free_vfs()
891 pci_disable_sriov(pf->pdev); in i40e_free_vfs()
893 dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); in i40e_free_vfs()
898 tmp = pf->num_alloc_vfs; in i40e_free_vfs()
899 pf->num_alloc_vfs = 0; in i40e_free_vfs()
901 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
902 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
904 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
907 kfree(pf->vf); in i40e_free_vfs()
908 pf->vf = NULL; in i40e_free_vfs()
914 if (!pci_vfs_assigned(pf->pdev)) { in i40e_free_vfs()
924 clear_bit(__I40E_VF_DISABLE, &pf->state); in i40e_free_vfs()
935 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) in i40e_alloc_vfs() argument
941 i40e_irq_dynamic_disable_icr0(pf); in i40e_alloc_vfs()
944 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { in i40e_alloc_vfs()
945 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); in i40e_alloc_vfs()
947 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_alloc_vfs()
948 pf->num_alloc_vfs = 0; in i40e_alloc_vfs()
958 pf->vf = vfs; in i40e_alloc_vfs()
962 vfs[i].pf = pf; in i40e_alloc_vfs()
973 pf->num_alloc_vfs = num_alloc_vfs; in i40e_alloc_vfs()
977 i40e_free_vfs(pf); in i40e_alloc_vfs()
980 i40e_irq_dynamic_enable_icr0(pf); in i40e_alloc_vfs()
995 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_enable() local
999 if (test_bit(__I40E_TESTING, &pf->state)) { in i40e_pci_sriov_enable()
1007 i40e_free_vfs(pf); in i40e_pci_sriov_enable()
1011 if (num_vfs > pf->num_req_vfs) { in i40e_pci_sriov_enable()
1013 num_vfs, pf->num_req_vfs); in i40e_pci_sriov_enable()
1019 err = i40e_alloc_vfs(pf, num_vfs); in i40e_pci_sriov_enable()
1044 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_configure() local
1047 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_pci_sriov_configure()
1048 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1049 i40e_do_reset_safe(pf, in i40e_pci_sriov_configure()
1055 if (!pci_vfs_assigned(pf->pdev)) { in i40e_pci_sriov_configure()
1056 i40e_free_vfs(pf); in i40e_pci_sriov_configure()
1057 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1058 i40e_do_reset_safe(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED)); in i40e_pci_sriov_configure()
1081 struct i40e_pf *pf; in i40e_vc_send_msg_to_vf() local
1087 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1090 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1091 hw = &pf->hw; in i40e_vc_send_msg_to_vf()
1097 dev_err(&pf->pdev->dev, "Failed opcode %d Error: %d\n", in i40e_vc_send_msg_to_vf()
1101 dev_err(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
1104 dev_err(&pf->pdev->dev, "Use PF Control I/F to enable the VF\n"); in i40e_vc_send_msg_to_vf()
1116 dev_err(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
1118 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
1173 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg() local
1202 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
1205 if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE) { in i40e_vc_get_vf_resources_msg()
1218 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_get_vf_resources_msg()
1271 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
1272 struct i40e_hw *hw = &pf->hw; in i40e_vc_config_promiscuous_mode_msg()
1277 vsi = i40e_find_vsi_from_id(pf, info->vsi_id); in i40e_vc_config_promiscuous_mode_msg()
1311 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
1346 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = qci->num_queue_pairs; in i40e_vc_config_queues_msg()
1429 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
1448 if (i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], true)) in i40e_vc_enable_queues_msg()
1469 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
1487 if (i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], false)) in i40e_vc_disable_queues_msg()
1508 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
1525 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
1551 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission() local
1556 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", macaddr); in i40e_check_vf_permission()
1566 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
1585 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
1603 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
1625 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
1636 dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n"); in i40e_vc_add_mac_addr_msg()
1656 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
1672 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_vc_del_mac_addr_msg()
1678 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
1689 dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n"); in i40e_vc_del_mac_addr_msg()
1709 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
1725 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
1730 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
1742 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
1764 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
1784 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
1794 dev_err(&pf->pdev->dev, in i40e_vc_remove_vlan_msg()
1925 int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
1928 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
1933 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
1934 if (local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
1936 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
1941 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
1990 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
2007 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
2010 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
2013 if (!test_bit(__I40E_VFLR_EVENT_PENDING, &pf->state)) in i40e_vc_process_vflr_event()
2022 clear_bit(__I40E_VFLR_EVENT_PENDING, &pf->state); in i40e_vc_process_vflr_event()
2023 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
2027 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
2033 if (!test_bit(__I40E_DOWN, &pf->state)) in i40e_vc_process_vflr_event()
2053 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
2059 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_mac()
2060 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
2066 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_mac()
2067 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
2069 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
2076 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
2100 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id); in i40e_ndo_set_vf_mac()
2103 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
2110 i40e_vc_disable_vf(pf, vf); in i40e_ndo_set_vf_mac()
2111 dev_info(&pf->pdev->dev, "Reload the VF driver to make this change effective.\n"); in i40e_ndo_set_vf_mac()
2131 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
2138 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_port_vlan()
2139 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_port_vlan()
2145 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
2150 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_port_vlan()
2151 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
2153 dev_err(&pf->pdev->dev, "Uninitialized VF %d\n", vf_id); in i40e_ndo_set_vf_port_vlan()
2167 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_port_vlan()
2174 i40e_vc_disable_vf(pf, vf); in i40e_ndo_set_vf_port_vlan()
2197 ret, pf->hw.aq.asq_last_status); in i40e_ndo_set_vf_port_vlan()
2206 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
2224 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
2251 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
2258 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_bw()
2259 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d.\n", vf_id); in i40e_ndo_set_vf_bw()
2265 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
2270 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_bw()
2271 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
2273 dev_err(&pf->pdev->dev, "Uninitialized VF %d.\n", vf_id); in i40e_ndo_set_vf_bw()
2278 switch (pf->hw.phy.link_info.link_speed) { in i40e_ndo_set_vf_bw()
2293 dev_err(&pf->pdev->dev, "Invalid max tx rate %d specified for VF %d.", in i40e_ndo_set_vf_bw()
2300 dev_warn(&pf->pdev->dev, "Setting max Tx rate to minimum usable value of 50Mbps.\n"); in i40e_ndo_set_vf_bw()
2305 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_ndo_set_vf_bw()
2309 dev_err(&pf->pdev->dev, "Unable to set max tx rate, error code %d.\n", in i40e_ndo_set_vf_bw()
2332 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
2337 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_get_vf_config()
2338 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_get_vf_config()
2343 vf = &(pf->vf[vf_id]); in i40e_ndo_get_vf_config()
2345 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
2347 dev_err(&pf->pdev->dev, "Uninitialized VF %d\n", vf_id); in i40e_ndo_get_vf_config()
2385 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
2387 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
2393 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
2394 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
2399 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
2409 pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP; in i40e_ndo_set_vf_link_state()
2411 pf->hw.phy.link_info.link_speed; in i40e_ndo_set_vf_link_state()
2449 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
2451 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
2456 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
2457 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
2462 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
2469 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
2470 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
2477 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()