Lines Matching refs:pf

33  * @pf: pointer to the pf info
38 static inline void i40e_vc_disable_vf(struct i40e_pf *pf, struct i40e_vf *vf)
40 struct i40e_hw *hw = &pf->hw;
58 struct i40e_pf *pf = vf->pf;
60 return pf->vsi[vsi_id]->vf_id == vf->vf_id;
74 struct i40e_pf *pf = vf->pf;
76 return qid < pf->vsi[vsi_id]->alloc_queue_pairs;
88 struct i40e_pf *pf = vf->pf;
90 return vector_id < pf->hw.func_caps.num_msix_vectors_vf;
101 * return pf relative queue id
106 struct i40e_pf *pf = vf->pf;
107 struct i40e_vsi *vsi = pf->vsi[vsi_idx];
133 struct i40e_pf *pf = vf->pf;
134 struct i40e_hw *hw = &pf->hw;
147 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) +
234 struct i40e_pf *pf = vf->pf;
235 struct i40e_hw *hw = &pf->hw;
249 tx_ctx.rdylist = le16_to_cpu(pf->vsi[vsi_idx]->info.qs_handle[0]);
257 dev_err(&pf->pdev->dev,
267 dev_err(&pf->pdev->dev,
301 struct i40e_pf *pf = vf->pf;
302 struct i40e_hw *hw = &pf->hw;
358 dev_err(&pf->pdev->dev,
368 dev_err(&pf->pdev->dev,
389 struct i40e_pf *pf = vf->pf;
393 vsi = i40e_vsi_setup(pf, type, pf->vsi[pf->lan_vsi]->seid, vf->vf_id);
396 dev_err(&pf->pdev->dev,
398 vf->vf_id, pf->hw.aq.asq_last_status);
406 dev_info(&pf->pdev->dev,
420 dev_info(&pf->pdev->dev,
425 dev_info(&pf->pdev->dev,
432 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
436 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid,
439 dev_err(&pf->pdev->dev, "Unable to set tx rate, VF %d, error code %d.\n",
455 struct i40e_pf *pf = vf->pf;
456 struct i40e_hw *hw = &pf->hw;
472 for (j = 0; j < pf->vsi[vf->lan_vsi_index]->alloc_queue_pairs; j++) {
481 if (j * 2 >= pf->vsi[vf->lan_vsi_index]->alloc_queue_pairs) {
505 struct i40e_pf *pf = vf->pf;
506 struct i40e_hw *hw = &pf->hw;
525 struct i40e_pf *pf = vf->pf;
526 struct i40e_hw *hw = &pf->hw;
532 i40e_vsi_release(pf->vsi[vf->lan_vsi_index]);
536 msix_vf = pf->hw.func_caps.num_msix_vectors_vf;
580 struct i40e_pf *pf = vf->pf;
588 total_queue_pairs += pf->vsi[vf->lan_vsi_index]->alloc_queue_pairs;
617 struct i40e_pf *pf = vf->pf;
618 struct i40e_hw *hw = &pf->hw;
644 struct i40e_pf *pf = vf->pf;
645 struct i40e_hw *hw = &pf->hw;
665 dev_err(&pf->pdev->dev, "VF %d PCI transactions stuck\n",
686 dev_err(&pf->pdev->dev, "VF reset check timeout on VF %d\n",
698 i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_index], false);
714 * @pf: pointer to the pf structure
718 static void i40e_enable_pf_switch_lb(struct i40e_pf *pf)
720 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
724 ctxt.seid = pf->main_vsi_seid;
725 ctxt.pf_num = pf->hw.pf_id;
727 aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL);
729 dev_info(&pf->pdev->dev,
730 "%s couldn't get pf vsi config, err %d, aq_err %d\n",
731 __func__, aq_ret, pf->hw.aq.asq_last_status);
740 dev_info(&pf->pdev->dev,
749 * @pf: pointer to the pf structure
753 static void i40e_disable_pf_switch_lb(struct i40e_pf *pf)
755 struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
759 ctxt.seid = pf->main_vsi_seid;
760 ctxt.pf_num = pf->hw.pf_id;
762 aq_ret = i40e_aq_get_vsi_params(&pf->hw, &ctxt, NULL);
764 dev_info(&pf->pdev->dev,
765 "%s couldn't get pf vsi config, err %d, aq_err %d\n",
766 __func__, aq_ret, pf->hw.aq.asq_last_status);
775 dev_info(&pf->pdev->dev,
783 * @pf: pointer to the pf structure
787 void i40e_free_vfs(struct i40e_pf *pf)
789 struct i40e_hw *hw = &pf->hw;
793 if (!pf->vf)
797 i40e_irq_dynamic_disable_icr0(pf);
801 tmp = pf->num_alloc_vfs;
802 pf->num_alloc_vfs = 0;
804 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states))
805 i40e_free_vf_res(&pf->vf[i]);
807 i40e_disable_vf_mappings(&pf->vf[i]);
810 kfree(pf->vf);
811 pf->vf = NULL;
817 if (!pci_vfs_assigned(pf->pdev)) {
818 pci_disable_sriov(pf->pdev);
827 i40e_disable_pf_switch_lb(pf);
829 dev_warn(&pf->pdev->dev,
834 i40e_irq_dynamic_enable_icr0(pf);
840 * @pf: pointer to the pf structure
845 int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
851 i40e_irq_dynamic_disable_icr0(pf);
854 if (pci_num_vf(pf->pdev) != num_alloc_vfs) {
855 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs);
857 dev_err(&pf->pdev->dev,
859 pf->num_alloc_vfs = 0;
869 pf->vf = vfs;
873 vfs[i].pf = pf;
886 pf->num_alloc_vfs = num_alloc_vfs;
888 i40e_enable_pf_switch_lb(pf);
891 i40e_free_vfs(pf);
894 i40e_irq_dynamic_enable_icr0(pf);
909 struct i40e_pf *pf = pci_get_drvdata(pdev);
915 i40e_free_vfs(pf);
919 if (num_vfs > pf->num_req_vfs) {
924 err = i40e_alloc_vfs(pf, num_vfs);
949 struct i40e_pf *pf = pci_get_drvdata(pdev);
954 if (!pci_vfs_assigned(pf->pdev)) {
955 i40e_free_vfs(pf);
978 struct i40e_pf *pf;
984 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
987 pf = vf->pf;
988 hw = &pf->hw;
994 dev_err(&pf->pdev->dev, "Failed opcode %d Error: %d\n",
998 dev_err(&pf->pdev->dev,
1001 dev_err(&pf->pdev->dev, "Use PF Control I/F to enable the VF\n");
1011 dev_err(&pf->pdev->dev,
1013 vf->vf_id, pf->hw.aq.asq_last_status);
1064 struct i40e_pf *pf = vf->pf;
1087 vsi = pf->vsi[vf->lan_vsi_index];
1093 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf;
1098 pf->vsi[vf->lan_vsi_index]->alloc_queue_pairs;
1121 * unlike other virtchnl messages, pf driver
1144 struct i40e_pf *pf = vf->pf;
1145 struct i40e_hw *hw = &pf->hw;
1153 (pf->vsi[info->vsi_id]->type != I40E_VSI_FCOE)) {
1157 vsi = pf->vsi[info->vsi_id];
1184 struct i40e_pf *pf = vf->pf;
1219 pf->vsi[vf->lan_vsi_index]->num_queue_pairs = qci->num_queue_pairs;
1302 struct i40e_pf *pf = vf->pf;
1320 if (i40e_vsi_control_rings(pf->vsi[vsi_id], true))
1341 struct i40e_pf *pf = vf->pf;
1359 if (i40e_vsi_control_rings(pf->vsi[vsi_id], false))
1380 struct i40e_pf *pf = vf->pf;
1397 vsi = pf->vsi[vqs->vsi_id];
1423 struct i40e_pf *pf = vf->pf;
1428 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n", macaddr);
1438 dev_err(&pf->pdev->dev,
1457 struct i40e_pf *pf = vf->pf;
1475 vsi = pf->vsi[vsi_id];
1492 dev_err(&pf->pdev->dev,
1501 dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n");
1521 struct i40e_pf *pf = vf->pf;
1537 dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n",
1543 vsi = pf->vsi[vsi_id];
1552 dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n");
1572 struct i40e_pf *pf = vf->pf;
1588 dev_err(&pf->pdev->dev,
1593 vsi = pf->vsi[vsi_id];
1604 dev_err(&pf->pdev->dev,
1626 struct i40e_pf *pf = vf->pf;
1646 vsi = pf->vsi[vsi_id];
1655 dev_err(&pf->pdev->dev,
1773 * @pf: pointer to the pf structure
1782 int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode,
1785 struct i40e_hw *hw = &pf->hw;
1790 pf->vf_aq_requests++;
1791 if (local_vf_id >= pf->num_alloc_vfs)
1793 vf = &(pf->vf[local_vf_id]);
1798 dev_err(&pf->pdev->dev, "Invalid message from vf %d, opcode %d, len %d\n",
1846 dev_err(&pf->pdev->dev, "Unsupported opcode %d from vf %d\n",
1858 * @pf: pointer to the pf structure
1863 int i40e_vc_process_vflr_event(struct i40e_pf *pf)
1866 struct i40e_hw *hw = &pf->hw;
1869 if (!test_bit(__I40E_VFLR_EVENT_PENDING, &pf->state))
1872 clear_bit(__I40E_VFLR_EVENT_PENDING, &pf->state);
1873 for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) {
1877 vf = &pf->vf[vf_id];
1883 if (!test_bit(__I40E_DOWN, &pf->state))
1899 * @pf: pointer to the pf structure
1907 static void i40e_vc_vf_broadcast(struct i40e_pf *pf,
1912 struct i40e_hw *hw = &pf->hw;
1913 struct i40e_vf *vf = pf->vf;
1916 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
1933 * @pf: pointer to the pf structure
1937 void i40e_vc_notify_link_state(struct i40e_pf *pf)
1940 struct i40e_hw *hw = &pf->hw;
1941 struct i40e_vf *vf = pf->vf;
1942 struct i40e_link_status *ls = &pf->hw.phy.link_info;
1947 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
1966 * @pf: pointer to the pf structure
1970 void i40e_vc_notify_reset(struct i40e_pf *pf)
1976 i40e_vc_vf_broadcast(pf, I40E_VIRTCHNL_OP_EVENT, I40E_SUCCESS,
1992 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
2000 abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id;
2004 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT,
2021 struct i40e_pf *pf = vsi->back;
2027 if (vf_id >= pf->num_alloc_vfs) {
2028 dev_err(&pf->pdev->dev,
2034 vf = &(pf->vf[vf_id]);
2035 vsi = pf->vsi[vf->lan_vsi_index];
2037 dev_err(&pf->pdev->dev,
2044 dev_err(&pf->pdev->dev,
2060 dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id);
2063 dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
2070 i40e_vc_disable_vf(pf, vf);
2071 dev_info(&pf->pdev->dev, "Reload the VF driver to make this change effective.\n");
2090 struct i40e_pf *pf = np->vsi->back;
2096 if (vf_id >= pf->num_alloc_vfs) {
2097 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id);
2103 dev_err(&pf->pdev->dev, "Invalid VF Parameters\n");
2108 vf = &(pf->vf[vf_id]);
2109 vsi = pf->vsi[vf->lan_vsi_index];
2111 dev_err(&pf->pdev->dev, "Uninitialized VF %d\n", vf_id);
2117 dev_err(&pf->pdev->dev,
2124 i40e_vc_disable_vf(pf, vf);
2147 ret, pf->hw.aq.asq_last_status);
2157 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n",
2175 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n");
2202 struct i40e_pf *pf = np->vsi->back;
2209 if (vf_id >= pf->num_alloc_vfs) {
2210 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d.\n", vf_id);
2216 dev_err(&pf->pdev->dev, "Invalid min tx rate (%d) (greater than 0) specified for vf %d.\n",
2221 vf = &(pf->vf[vf_id]);
2222 vsi = pf->vsi[vf->lan_vsi_index];
2224 dev_err(&pf->pdev->dev, "Uninitialized VF %d.\n", vf_id);
2229 switch (pf->hw.phy.link_info.link_speed) {
2244 dev_err(&pf->pdev->dev, "Invalid max tx rate %d specified for vf %d.",
2251 dev_warn(&pf->pdev->dev, "Setting max Tx rate to minimum usable value of 50Mbps.\n");
2256 ret = i40e_aq_config_vsi_bw_limit(&pf->hw, vsi->seid,
2260 dev_err(&pf->pdev->dev, "Unable to set max tx rate, error code %d.\n",
2283 struct i40e_pf *pf = vsi->back;
2288 if (vf_id >= pf->num_alloc_vfs) {
2289 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id);
2294 vf = &(pf->vf[vf_id]);
2296 vsi = pf->vsi[vf->lan_vsi_index];
2298 dev_err(&pf->pdev->dev, "Uninitialized VF %d\n", vf_id);
2336 struct i40e_pf *pf = np->vsi->back;
2338 struct i40e_hw *hw = &pf->hw;
2344 if (vf_id >= pf->num_alloc_vfs) {
2345 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id);
2350 vf = &pf->vf[vf_id];
2360 pf->hw.phy.link_info.link_info & I40E_AQ_LINK_UP;
2362 pf->hw.phy.link_info.link_speed;
2400 struct i40e_pf *pf = vsi->back;
2402 struct i40e_hw *hw = &pf->hw;
2407 if (vf_id >= pf->num_alloc_vfs) {
2408 dev_err(&pf->pdev->dev, "Invalid VF Identifier %d\n", vf_id);
2413 vf = &(pf->vf[vf_id]);
2420 ctxt.seid = pf->vsi[vf->lan_vsi_index]->seid;
2421 ctxt.pf_num = pf->hw.pf_id;
2427 dev_err(&pf->pdev->dev, "Error %d updating VSI parameters\n",