|
@@ -1473,21 +1473,8 @@ static int hclge_alloc_vport(struct hclge_dev *hdev)
|
|
|
hdev->vport = vport;
|
|
|
hdev->num_alloc_vport = num_vport;
|
|
|
|
|
|
-#ifdef CONFIG_PCI_IOV
|
|
|
- /* Enable SRIOV */
|
|
|
- if (hdev->num_req_vfs) {
|
|
|
- dev_info(&pdev->dev, "active VFs(%d) found, enabling SRIOV\n",
|
|
|
- hdev->num_req_vfs);
|
|
|
- ret = pci_enable_sriov(hdev->pdev, hdev->num_req_vfs);
|
|
|
- if (ret) {
|
|
|
- hdev->num_alloc_vfs = 0;
|
|
|
- dev_err(&pdev->dev, "SRIOV enable failed %d\n",
|
|
|
- ret);
|
|
|
- return ret;
|
|
|
- }
|
|
|
- }
|
|
|
- hdev->num_alloc_vfs = hdev->num_req_vfs;
|
|
|
-#endif
|
|
|
+ if (IS_ENABLED(CONFIG_PCI_IOV))
|
|
|
+ hdev->num_alloc_vfs = hdev->num_req_vfs;
|
|
|
|
|
|
for (i = 0; i < num_vport; i++) {
|
|
|
vport->back = hdev;
|
|
@@ -2946,21 +2933,6 @@ static void hclge_service_task(struct work_struct *work)
|
|
|
hclge_service_complete(hdev);
|
|
|
}
|
|
|
|
|
|
-static void hclge_disable_sriov(struct hclge_dev *hdev)
|
|
|
-{
|
|
|
- /* If our VFs are assigned we cannot shut down SR-IOV
|
|
|
- * without causing issues, so just leave the hardware
|
|
|
- * available but disabled
|
|
|
- */
|
|
|
- if (pci_vfs_assigned(hdev->pdev)) {
|
|
|
- dev_warn(&hdev->pdev->dev,
|
|
|
- "disabling driver while VFs are assigned\n");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- pci_disable_sriov(hdev->pdev);
|
|
|
-}
|
|
|
-
|
|
|
struct hclge_vport *hclge_get_vport(struct hnae3_handle *handle)
|
|
|
{
|
|
|
/* VF handle has no client */
|
|
@@ -3784,6 +3756,7 @@ static int hclge_ae_start(struct hnae3_handle *handle)
|
|
|
hclge_cfg_mac_mode(hdev, true);
|
|
|
clear_bit(HCLGE_STATE_DOWN, &hdev->state);
|
|
|
mod_timer(&hdev->service_timer, jiffies + HZ);
|
|
|
+ hdev->hw.mac.link = 0;
|
|
|
|
|
|
/* reset tqp stats */
|
|
|
hclge_reset_tqp_stats(handle);
|
|
@@ -3820,7 +3793,6 @@ static void hclge_ae_stop(struct hnae3_handle *handle)
|
|
|
|
|
|
/* reset tqp stats */
|
|
|
hclge_reset_tqp_stats(handle);
|
|
|
- hclge_update_link_status(hdev);
|
|
|
}
|
|
|
|
|
|
static int hclge_get_mac_vlan_cmd_status(struct hclge_vport *vport,
|
|
@@ -5407,7 +5379,7 @@ static int hclge_pci_init(struct hclge_dev *hdev)
|
|
|
ret = pci_enable_device(pdev);
|
|
|
if (ret) {
|
|
|
dev_err(&pdev->dev, "failed to enable PCI device\n");
|
|
|
- goto err_no_drvdata;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
|
|
@@ -5445,8 +5417,6 @@ err_clr_master:
|
|
|
pci_release_regions(pdev);
|
|
|
err_disable_device:
|
|
|
pci_disable_device(pdev);
|
|
|
-err_no_drvdata:
|
|
|
- pci_set_drvdata(pdev, NULL);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
@@ -5455,6 +5425,7 @@ static void hclge_pci_uninit(struct hclge_dev *hdev)
|
|
|
{
|
|
|
struct pci_dev *pdev = hdev->pdev;
|
|
|
|
|
|
+ pcim_iounmap(pdev, hdev->hw.io_base);
|
|
|
pci_free_irq_vectors(pdev);
|
|
|
pci_clear_master(pdev);
|
|
|
pci_release_mem_regions(pdev);
|
|
@@ -5540,7 +5511,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|
|
ret = hclge_map_tqp(hdev);
|
|
|
if (ret) {
|
|
|
dev_err(&pdev->dev, "Map tqp error, ret = %d.\n", ret);
|
|
|
- goto err_sriov_disable;
|
|
|
+ goto err_msi_irq_uninit;
|
|
|
}
|
|
|
|
|
|
if (hdev->hw.mac.media_type == HNAE3_MEDIA_TYPE_COPPER) {
|
|
@@ -5548,7 +5519,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|
|
if (ret) {
|
|
|
dev_err(&hdev->pdev->dev,
|
|
|
"mdio config fail ret=%d\n", ret);
|
|
|
- goto err_sriov_disable;
|
|
|
+ goto err_msi_irq_uninit;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5612,9 +5583,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|
|
err_mdiobus_unreg:
|
|
|
if (hdev->hw.mac.phydev)
|
|
|
mdiobus_unregister(hdev->hw.mac.mdio_bus);
|
|
|
-err_sriov_disable:
|
|
|
- if (IS_ENABLED(CONFIG_PCI_IOV))
|
|
|
- hclge_disable_sriov(hdev);
|
|
|
err_msi_irq_uninit:
|
|
|
hclge_misc_irq_uninit(hdev);
|
|
|
err_msi_uninit:
|
|
@@ -5622,10 +5590,10 @@ err_msi_uninit:
|
|
|
err_cmd_uninit:
|
|
|
hclge_destroy_cmd_queue(&hdev->hw);
|
|
|
err_pci_uninit:
|
|
|
+ pcim_iounmap(pdev, hdev->hw.io_base);
|
|
|
pci_clear_master(pdev);
|
|
|
pci_release_regions(pdev);
|
|
|
pci_disable_device(pdev);
|
|
|
- pci_set_drvdata(pdev, NULL);
|
|
|
out:
|
|
|
return ret;
|
|
|
}
|
|
@@ -5717,9 +5685,6 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|
|
|
|
|
set_bit(HCLGE_STATE_DOWN, &hdev->state);
|
|
|
|
|
|
- if (IS_ENABLED(CONFIG_PCI_IOV))
|
|
|
- hclge_disable_sriov(hdev);
|
|
|
-
|
|
|
if (hdev->service_timer.function)
|
|
|
del_timer_sync(&hdev->service_timer);
|
|
|
if (hdev->service_task.func)
|
|
@@ -6287,7 +6252,9 @@ static int hclge_init(void)
|
|
|
{
|
|
|
pr_info("%s is initializing\n", HCLGE_NAME);
|
|
|
|
|
|
- return hnae3_register_ae_algo(&ae_algo);
|
|
|
+ hnae3_register_ae_algo(&ae_algo);
|
|
|
+
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
static void hclge_exit(void)
|