net/ice: enable CVL DCF device reset API
PATCH 1/1 net/ice: enable CVL DCF device reset API
From: Dapeng Yu <[email protected]>
DCF PMD needs to support rte_eth_dev_reset, the reason is when a DCF instance is killed, all the flow rules still exists in hardware, when DCF gets to reconnect, it already lost the flow context, and if the application wants to create new rules, it may fail due to firmware reports rules already exist.
The rte_eth_dev_reset API provides a more elegant way for the application to reset DCF when reconnect happens.
--- drivers/net/ice/ice_dcf.c | 28 ++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 2 ++ drivers/net/ice/ice_dcf_ethdev.c | 41 ++++++++++++++++++++++++++++++++ drivers/net/ice/ice_dcf_parent.c | 5 ++++ 4 files changed, 76 insertions(+)
drivers/net/ice/ice_dcf.c +28 -0
@@ -337,6 +337,9 @@ ice_dcf_mode_disable(struct ice_dcf_hw *hw) {int err; +if (hw->resetting) +return 0 ; + err =ice_dcf_send_cmd_req_no_irq (hw,VIRTCHNL_OP_DCF_DISABLE ,NULL ,0 );if (err) {
@@ -721,11 +724,25 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)iavf_shutdown_adminq (&hw->avf);rte_free (hw->arq_buf); + hw->arq_buf =NULL ; +rte_free (hw->vf_vsi_map); + hw->vf_vsi_map =NULL ; +rte_free (hw->vf_res); + hw->vf_res =NULL ; +rte_free (hw->rss_lut); + hw->rss_lut =NULL ; +rte_free (hw->rss_key); + hw->rss_key =NULL ; +rte_free (hw->qos_bw_cfg); + hw->qos_bw_cfg =NULL ; + +rte_free (hw->ets_config); + hw->ets_config =NULL ; } static int
@@ -1009,6 +1026,9 @@ ice_dcf_disable_queues(struct ice_dcf_hw *hw)struct dcf_virtchnl_cmd args;int err; +if (hw->resetting) +return 0 ; +memset (&queue_select,0 ,sizeof (queue_select)); queue_select.vsi_id = hw->vsi_res->vsi_id;
@@ -1063,6 +1083,14 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add)struct dcf_virtchnl_cmd args;int len, err =0 ; +if (hw->resetting) { +if (!add) +return 0 ; + +PMD_DRV_LOG (ERR ,"fail to add all MACs for VF resetting" ); +return -EIO ; + } + len =sizeof (struct virtchnl_ether_addr_list ); addr = hw->eth_dev->data->mac_addrs; len +=sizeof (struct virtchnl_ether_addr );
drivers/net/ice/ice_dcf.h +2 -0
@@ -111,6 +111,8 @@ struct ice_dcf_hw {/* Link status */ bool link_up;uint32_t link_speed; + +bool resetting; }; int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
drivers/net/ice/ice_dcf_ethdev.c +41 -0
99 lines not on this page · raw message
drivers/net/ice/ice_dcf_parent.c +5 -0
@@ -234,6 +234,7 @@ ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,case VIRTCHNL_EVENT_RESET_IMPENDING :PMD_DRV_LOG (DEBUG ,"VIRTCHNL_EVENT_RESET_IMPENDING event" );start_vsi_reset_thread (dcf_hw, false,0 ); + dcf_hw->resetting = true;break ;case VIRTCHNL_EVENT_LINK_CHANGE :PMD_DRV_LOG (DEBUG ,"VIRTCHNL_EVENT_LINK_CHANGE event" );
@@ -357,6 +358,7 @@ ice_dcf_init_parent_hw(struct ice_hw *hw) err_unroll_alloc:ice_free (hw, hw->port_info); hw->port_info =NULL ; + hw->switch_info =NULL ;return status; }
@@ -370,6 +372,7 @@ static void ice_dcf_uninit_parent_hw(struct ice_hw *hw)ice_free (hw, hw->port_info); hw->port_info =NULL ; + hw->switch_info =NULL ;ice_clear_all_vsi_ctx (hw); }
@@ -485,6 +488,8 @@ ice_dcf_uninit_parent_adapter(struct rte_eth_dev *eth_dev)struct ice_hw *parent_hw = &parent_adapter->hw; eth_dev->data->mac_addrs =NULL ; +rte_free (parent_adapter->pf.main_vsi); + parent_adapter->pf.main_vsi =NULL ;ice_flow_uninit (parent_adapter);ice_dcf_uninit_parent_hw (parent_hw);
Signature · 1 line
2.27.0
Quoted 17 lines
-----Original Message-----
From: Yu, DapengX <[email protected]>
Sent: Wednesday, September 1, 2021 1:26 PM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Yu, DapengX <[email protected]>
Subject: [PATCH] net/ice: enable CVL DCF device reset APIFrom: Dapeng Yu <[email protected]>
DCF PMD needs to support
rte_eth_dev_reset, the reason is when a DCF instance is killed, all the flow rules still exists in hardware, when DCF gets to reconnect, it already lost the flow context, and if the application wants to create new rules, it may fail due to firmware reports rules already exist.
Quoted 4 lines
The
rte_eth_dev_resetAPI provides a more elegant way for the application to reset DCF when reconnect happens.Signed-off-by Dapeng Yu <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi