From: Dapeng Yu <dapengx...@intel.com>

Enable CVL DCF device reset API.

Signed-off-by: Dapeng Yu <dapengx...@intel.com>
Signed-off-by: Kevin Liu <kevinx....@intel.com>
---
 drivers/net/ice/ice_dcf.c | 24 ++++++++++++++++++++++++
 drivers/net/ice/ice_dcf.h |  1 +
 2 files changed, 25 insertions(+)

diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 885d58c0f4..9c2f13cf72 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -1163,3 +1163,27 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw,
        rte_free(list);
        return err;
 }
+
+int
+ice_dcf_cap_reset(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
+{
+       int ret;
+
+       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+
+       ice_dcf_disable_irq0(hw);
+       rte_intr_disable(intr_handle);
+       rte_intr_callback_unregister(intr_handle, ice_dcf_dev_interrupt_handler,
+                                    hw);
+       ret = ice_dcf_mode_disable(hw);
+       if (ret)
+               goto err;
+       ret = ice_dcf_get_vf_resource(hw);
+err:
+       rte_intr_callback_register(intr_handle, ice_dcf_dev_interrupt_handler,
+                                  hw);
+       rte_intr_enable(intr_handle);
+       ice_dcf_enable_irq0(hw);
+       return ret;
+}
diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h
index 32e6031bd9..8cf17e7700 100644
--- a/drivers/net/ice/ice_dcf.h
+++ b/drivers/net/ice/ice_dcf.h
@@ -137,6 +137,7 @@ int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw,
                                 uint8_t type);
 int ice_dcf_link_update(struct rte_eth_dev *dev,
                    __rte_unused int wait_to_complete);
+int ice_dcf_cap_reset(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
 void ice_dcf_tm_conf_init(struct rte_eth_dev *dev);
 void ice_dcf_tm_conf_uninit(struct rte_eth_dev *dev);
 int ice_dcf_replay_vf_bw(struct ice_dcf_hw *hw, uint16_t vf_id);
-- 
2.33.1

Reply via email to