[10/39] net/ice: enable CVL DCF device reset API

Message ID 20220407105706.18889-11-kevinx.liu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series support full function of DCF |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Kevin Liu April 7, 2022, 10:56 a.m. UTC
  From: Dapeng Yu <dapengx.yu@intel.com>

Enable CVL DCF device reset API.

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

Patch

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);