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
163 struct i40e_hw *hw = &pf->hw; in i40e_vc_disable_vf()
181 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vsi_id() local
182 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_vsi_id()
198 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_queue_id() local
199 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_isvalid_queue_id()
213 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vector_id() local
215 return vector_id < pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_isvalid_vector_id()
231 struct i40e_pf *pf = vf->pf; in i40e_vc_get_pf_queue_id() local
232 struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_vc_get_pf_queue_id()
261 struct i40e_pf *pf = vf->pf; in i40e_config_irq_link_list() local
262 struct i40e_hw *hw = &pf->hw; in i40e_config_irq_link_list()
275 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) + in i40e_config_irq_link_list()
362 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_tx_queue() local
363 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_tx_queue()
371 vsi = i40e_find_vsi_from_id(pf, vsi_id); in i40e_config_vsi_tx_queue()
387 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
397 dev_err(&pf->pdev->dev, in i40e_config_vsi_tx_queue()
431 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue() local
432 struct i40e_hw *hw = &pf->hw; in i40e_config_vsi_rx_queue()
488 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
498 dev_err(&pf->pdev->dev, in i40e_config_vsi_rx_queue()
519 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res() local
523 vsi = i40e_vsi_setup(pf, type, pf->vsi[pf->lan_vsi]->seid, vf->vf_id); in i40e_alloc_vsi_res()
526 dev_err(&pf->pdev->dev, in i40e_alloc_vsi_res()
528 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
547 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
552 dev_info(&pf->pdev->dev, in i40e_alloc_vsi_res()
559 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_alloc_vsi_res()
563 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_alloc_vsi_res()
566 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n", in i40e_alloc_vsi_res()
582 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings() local
583 struct i40e_hw *hw = &pf->hw; in i40e_enable_vf_mappings()
599 for (j = 0; j < pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; j++) { in i40e_enable_vf_mappings()
608 if (j * 2 >= pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs) { in i40e_enable_vf_mappings()
632 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings() local
633 struct i40e_hw *hw = &pf->hw; in i40e_disable_vf_mappings()
652 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res() local
653 struct i40e_hw *hw = &pf->hw; in i40e_free_vf_res()
659 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
663 msix_vf = pf->hw.func_caps.num_msix_vectors_vf; in i40e_free_vf_res()
707 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res() local
715 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
744 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci() local
745 struct i40e_hw *hw = &pf->hw; in i40e_quiesce_vf_pci()
771 struct i40e_pf *pf = vf->pf; in i40e_reset_vf() local
772 struct i40e_hw *hw = &pf->hw; in i40e_reset_vf()
777 if (test_and_set_bit(__I40E_VF_DISABLE, &pf->state)) in i40e_reset_vf()
795 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n", in i40e_reset_vf()
819 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n", in i40e_reset_vf()
831 i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], false); in i40e_reset_vf()
842 clear_bit(__I40E_VF_DISABLE, &pf->state); in i40e_reset_vf()
851 void i40e_free_vfs(struct i40e_pf *pf) in i40e_free_vfs() argument
853 struct i40e_hw *hw = &pf->hw; in i40e_free_vfs()
857 if (!pf->vf) in i40e_free_vfs()
859 while (test_and_set_bit(__I40E_VF_DISABLE, &pf->state)) in i40e_free_vfs()
862 for (i = 0; i < pf->num_alloc_vfs; i++) in i40e_free_vfs()
863 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
864 i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx], in i40e_free_vfs()
871 if (!pci_vfs_assigned(pf->pdev)) in i40e_free_vfs()
872 pci_disable_sriov(pf->pdev); in i40e_free_vfs()
874 dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); in i40e_free_vfs()
879 tmp = pf->num_alloc_vfs; in i40e_free_vfs()
880 pf->num_alloc_vfs = 0; in i40e_free_vfs()
882 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
883 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
885 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
888 kfree(pf->vf); in i40e_free_vfs()
889 pf->vf = NULL; in i40e_free_vfs()
895 if (!pci_vfs_assigned(pf->pdev)) { in i40e_free_vfs()
905 clear_bit(__I40E_VF_DISABLE, &pf->state); in i40e_free_vfs()
916 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) in i40e_alloc_vfs() argument
922 i40e_irq_dynamic_disable_icr0(pf); in i40e_alloc_vfs()
925 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { in i40e_alloc_vfs()
926 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); in i40e_alloc_vfs()
928 dev_err(&pf->pdev->dev, in i40e_alloc_vfs()
930 pf->num_alloc_vfs = 0; in i40e_alloc_vfs()
940 pf->vf = vfs; in i40e_alloc_vfs()
944 vfs[i].pf = pf; in i40e_alloc_vfs()
957 pf->num_alloc_vfs = num_alloc_vfs; in i40e_alloc_vfs()
961 i40e_free_vfs(pf); in i40e_alloc_vfs()
964 i40e_irq_dynamic_enable_icr0(pf); in i40e_alloc_vfs()
979 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_enable() local
985 i40e_free_vfs(pf); in i40e_pci_sriov_enable()
989 if (num_vfs > pf->num_req_vfs) { in i40e_pci_sriov_enable()
994 err = i40e_alloc_vfs(pf, num_vfs); in i40e_pci_sriov_enable()
1019 struct i40e_pf *pf = pci_get_drvdata(pdev); in i40e_pci_sriov_configure() local
1022 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) { in i40e_pci_sriov_configure()
1023 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1024 i40e_do_reset_safe(pf, in i40e_pci_sriov_configure()
1030 if (!pci_vfs_assigned(pf->pdev)) { in i40e_pci_sriov_configure()
1031 i40e_free_vfs(pf); in i40e_pci_sriov_configure()
1032 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED; in i40e_pci_sriov_configure()
1033 i40e_do_reset_safe(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED)); in i40e_pci_sriov_configure()
1056 struct i40e_pf *pf; in i40e_vc_send_msg_to_vf() local
1062 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1065 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1066 hw = &pf->hw; in i40e_vc_send_msg_to_vf()
1072 dev_err(&pf->pdev->dev, "Failed opcode %d Error: %d\n", in i40e_vc_send_msg_to_vf()
1076 dev_err(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
1079 dev_err(&pf->pdev->dev, "Use PF Control I/F to enable the VF\n"); in i40e_vc_send_msg_to_vf()
1089 dev_err(&pf->pdev->dev, in i40e_vc_send_msg_to_vf()
1091 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
1142 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg() local
1165 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
1171 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; in i40e_vc_get_vf_resources_msg()
1176 pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_vc_get_vf_resources_msg()
1222 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg() local
1223 struct i40e_hw *hw = &pf->hw; in i40e_vc_config_promiscuous_mode_msg()
1228 vsi = i40e_find_vsi_from_id(pf, info->vsi_id); in i40e_vc_config_promiscuous_mode_msg()
1262 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg() local
1297 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = qci->num_queue_pairs; in i40e_vc_config_queues_msg()
1380 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg() local
1399 if (i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], true)) in i40e_vc_enable_queues_msg()
1420 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg() local
1438 if (i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], false)) in i40e_vc_disable_queues_msg()
1459 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg() local
1476 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
1502 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission() local
1507 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", macaddr); in i40e_check_vf_permission()
1517 dev_err(&pf->pdev->dev, in i40e_check_vf_permission()
1536 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg() local
1554 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
1571 dev_err(&pf->pdev->dev, in i40e_vc_add_mac_addr_msg()
1580 dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n"); in i40e_vc_add_mac_addr_msg()
1600 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg() local
1616 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", in i40e_vc_del_mac_addr_msg()
1622 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
1631 dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n"); in i40e_vc_del_mac_addr_msg()
1651 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg() local
1667 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
1672 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
1683 dev_err(&pf->pdev->dev, in i40e_vc_add_vlan_msg()
1705 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg() local
1725 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
1734 dev_err(&pf->pdev->dev, in i40e_vc_remove_vlan_msg()
1861 int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode, in i40e_vc_process_vf_msg() argument
1864 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vf_msg()
1869 pf->vf_aq_requests++; in i40e_vc_process_vf_msg()
1870 if (local_vf_id >= pf->num_alloc_vfs) in i40e_vc_process_vf_msg()
1872 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
1877 dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n", in i40e_vc_process_vf_msg()
1926 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n", in i40e_vc_process_vf_msg()
1943 int i40e_vc_process_vflr_event(struct i40e_pf *pf) in i40e_vc_process_vflr_event() argument
1946 struct i40e_hw *hw = &pf->hw; in i40e_vc_process_vflr_event()
1949 if (!test_bit(__I40E_VFLR_EVENT_PENDING, &pf->state)) in i40e_vc_process_vflr_event()
1958 clear_bit(__I40E_VFLR_EVENT_PENDING, &pf->state); in i40e_vc_process_vflr_event()
1959 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) { in i40e_vc_process_vflr_event()
1963 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
1969 if (!test_bit(__I40E_DOWN, &pf->state)) in i40e_vc_process_vflr_event()
1989 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_mac() local
1995 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_mac()
1996 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
2002 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_mac()
2003 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
2005 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
2012 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_mac()
2028 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id); in i40e_ndo_set_vf_mac()
2031 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n"); in i40e_ndo_set_vf_mac()
2038 i40e_vc_disable_vf(pf, vf); in i40e_ndo_set_vf_mac()
2039 dev_info(&pf->pdev->dev, "Reload the VF driver to make this change effective.\n"); in i40e_ndo_set_vf_mac()
2058 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_port_vlan() local
2064 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_port_vlan()
2065 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_port_vlan()
2071 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n"); in i40e_ndo_set_vf_port_vlan()
2076 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_port_vlan()
2077 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
2079 dev_err(&pf->pdev->dev, "Uninitialized VF %d\n", vf_id); in i40e_ndo_set_vf_port_vlan()
2085 dev_err(&pf->pdev->dev, in i40e_ndo_set_vf_port_vlan()
2092 i40e_vc_disable_vf(pf, vf); in i40e_ndo_set_vf_port_vlan()
2115 ret, pf->hw.aq.asq_last_status); in i40e_ndo_set_vf_port_vlan()
2125 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", in i40e_ndo_set_vf_port_vlan()
2143 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); in i40e_ndo_set_vf_port_vlan()
2170 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_bw() local
2177 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_bw()
2178 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d.\n", vf_id); in i40e_ndo_set_vf_bw()
2184 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for VF %d.\n", in i40e_ndo_set_vf_bw()
2189 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_bw()
2190 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
2192 dev_err(&pf->pdev->dev, "Uninitialized VF %d.\n", vf_id); in i40e_ndo_set_vf_bw()
2197 switch (pf->hw.phy.link_info.link_speed) { in i40e_ndo_set_vf_bw()
2212 dev_err(&pf->pdev->dev, "Invalid max tx rate %d specified for VF %d.", in i40e_ndo_set_vf_bw()
2219 dev_warn(&pf->pdev->dev, "Setting max Tx rate to minimum usable value of 50Mbps.\n"); in i40e_ndo_set_vf_bw()
2224 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid, in i40e_ndo_set_vf_bw()
2228 dev_err(&pf->pdev->dev, "Unable to set max tx rate, error code %d.\n", in i40e_ndo_set_vf_bw()
2251 struct i40e_pf *pf = vsi->back; in i40e_ndo_get_vf_config() local
2256 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_get_vf_config()
2257 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_get_vf_config()
2262 vf = &(pf->vf[vf_id]); in i40e_ndo_get_vf_config()
2264 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
2266 dev_err(&pf->pdev->dev, "Uninitialized VF %d\n", vf_id); in i40e_ndo_get_vf_config()
2304 struct i40e_pf *pf = np->vsi->back; in i40e_ndo_set_vf_link_state() local
2306 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_link_state()
2312 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_link_state()
2313 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_link_state()
2318 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
2328 pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP; in i40e_ndo_set_vf_link_state()
2330 pf->hw.phy.link_info.link_speed; in i40e_ndo_set_vf_link_state()
2368 struct i40e_pf *pf = vsi->back; in i40e_ndo_set_vf_spoofchk() local
2370 struct i40e_hw *hw = &pf->hw; in i40e_ndo_set_vf_spoofchk()
2375 if (vf_id >= pf->num_alloc_vfs) { in i40e_ndo_set_vf_spoofchk()
2376 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id); in i40e_ndo_set_vf_spoofchk()
2381 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
2388 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()
2389 ctxt.pf_num = pf->hw.pf_id; in i40e_ndo_set_vf_spoofchk()
2396 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n", in i40e_ndo_set_vf_spoofchk()