X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fnet%2Fice%2Fice_dcf_sched.c;h=dcf2723494d4a64284c7ccb71d89ee915ea02a15;hb=70ada0c508c1aa2e9556e9ef4acca7fd740e1f1e;hp=1e16654d9054c26bdbde2327be353084e2dd3792;hpb=931ee54072b143e973d861509c30af8928f30324;p=dpdk.git diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c index 1e16654d90..dcf2723494 100644 --- a/drivers/net/ice/ice_dcf_sched.c +++ b/drivers/net/ice/ice_dcf_sched.c @@ -32,6 +32,9 @@ const struct rte_tm_ops ice_dcf_tm_ops = { .node_delete = ice_dcf_node_delete, }; +#define ICE_DCF_SCHED_TC_NODE 0xffff +#define ICE_DCF_VFID 0 + void ice_dcf_tm_conf_init(struct rte_eth_dev *dev) { @@ -709,6 +712,32 @@ ice_dcf_replay_vf_bw(struct ice_dcf_hw *hw, uint16_t vf_id) return ICE_SUCCESS; } +int +ice_dcf_clear_bw(struct ice_dcf_hw *hw) +{ + uint16_t vf_id; + uint32_t tc; + int ret, size; + + size = sizeof(struct virtchnl_dcf_bw_cfg_list) + + sizeof(struct virtchnl_dcf_bw_cfg) * + (hw->tm_conf.nb_tc_node - 1); + + for (vf_id = 0; vf_id < hw->num_vfs; vf_id++) { + for (tc = 0; tc < hw->tm_conf.nb_tc_node; tc++) { + hw->qos_bw_cfg[vf_id]->cfg[tc].shaper.peak = 0; + hw->qos_bw_cfg[vf_id]->cfg[tc].shaper.committed = 0; + } + ret = ice_dcf_set_vf_bw(hw, hw->qos_bw_cfg[vf_id], size); + if (ret) { + PMD_DRV_LOG(DEBUG, "VF %u BW clear failed", vf_id); + return ICE_ERR_CFG; + } + } + + return ICE_SUCCESS; +} + static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, __rte_unused struct rte_tm_error *error) @@ -748,7 +777,6 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev, cir_total = 0; /* init tc bw configuration */ -#define ICE_DCF_SCHED_TC_NODE 0xffff tc_bw->vf_id = ICE_DCF_SCHED_TC_NODE; tc_bw->node_type = VIRTCHNL_DCF_TARGET_TC_BW; tc_bw->num_elem = hw->tm_conf.nb_tc_node; @@ -805,7 +833,7 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev, goto fail_clear; } /* store the bandwidth information for replay */ - ice_memcpy(hw->qos_bw_cfg[vf_id], vf_bw, sizeof(*vf_bw), + ice_memcpy(hw->qos_bw_cfg[vf_id], vf_bw, size, ICE_NONDMA_TO_NONDMA); ice_memset(vf_bw, 0, size, ICE_NONDMA_MEM); } @@ -825,6 +853,15 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev, if (ret_val) goto fail_clear; + /* store TC node bw configuration */ + hw->qos_bw_cfg[ICE_DCF_VFID] = rte_zmalloc("tc_bw_cfg", size, 0); + if (!hw->qos_bw_cfg[ICE_DCF_VFID]) { + ret_val = ICE_ERR_NO_MEMORY; + goto fail_clear; + } + ice_memcpy(hw->qos_bw_cfg[ICE_DCF_VFID], tc_bw, size, + ICE_NONDMA_TO_NONDMA); + hw->tm_conf.committed = true; return ret_val;