build: fix libm detection in meson
[dpdk.git] / drivers / net / hns3 / hns3_ethdev_vf.c
index 4036749..b1736e7 100644 (file)
@@ -1096,6 +1096,14 @@ err_init_hardware:
        return ret;
 }
 
+static int
+hns3vf_clear_vport_list(struct hns3_hw *hw)
+{
+       return hns3_send_mbx_msg(hw, HNS3_MBX_HANDLE_VF_TBL,
+                                HNS3_MBX_VPORT_LIST_CLEAR, NULL, 0, false,
+                                NULL, 0);
+}
+
 static int
 hns3vf_init_vf(struct rte_eth_dev *eth_dev)
 {
@@ -1147,6 +1155,12 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev)
 
        rte_eth_random_addr(hw->mac.mac_addr); /* Generate a random mac addr */
 
+       ret = hns3vf_clear_vport_list(hw);
+       if (ret) {
+               PMD_INIT_LOG(ERR, "Failed to clear tbl list: %d", ret);
+               goto err_get_config;
+       }
+
        ret = hns3vf_init_hardware(hns);
        if (ret)
                goto err_get_config;
@@ -1232,6 +1246,7 @@ hns3vf_dev_stop(struct rte_eth_dev *eth_dev)
                hns3_dev_release_mbufs(hns);
                hw->adapter_state = HNS3_NIC_CONFIGURED;
        }
+       rte_eal_alarm_cancel(hns3vf_service_handler, eth_dev);
        rte_spinlock_unlock(&hw->lock);
 }
 
@@ -1251,7 +1266,6 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev)
        hns3_reset_abort(hns);
        hw->adapter_state = HNS3_NIC_CLOSED;
        rte_eal_alarm_cancel(hns3vf_keep_alive_handler, eth_dev);
-       rte_eal_alarm_cancel(hns3vf_service_handler, eth_dev);
        hns3vf_configure_all_mc_mac_addr(hns, true);
        hns3vf_remove_all_vlan_table(hns);
        hns3vf_uninit_vf(eth_dev);
@@ -1272,8 +1286,6 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,
        struct hns3_mac *mac = &hw->mac;
        struct rte_eth_link new_link;
 
-       hns3vf_request_link_info(hw);
-
        memset(&new_link, 0, sizeof(new_link));
        switch (mac->link_speed) {
        case ETH_SPEED_NUM_10M:
@@ -1338,6 +1350,8 @@ hns3vf_dev_start(struct rte_eth_dev *eth_dev)
        rte_spinlock_unlock(&hw->lock);
        hns3_set_rxtx_function(eth_dev);
        hns3_mp_req_start_rxtx(eth_dev);
+       rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler,
+                         eth_dev);
        return 0;
 }
 
@@ -1775,8 +1789,6 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
        }
        rte_eal_alarm_set(HNS3VF_KEEP_ALIVE_INTERVAL, hns3vf_keep_alive_handler,
                          eth_dev);
-       rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler,
-                         eth_dev);
        return 0;
 
 err_rte_zmalloc: