net/ice/base: check failed acts allocation
[dpdk.git] / drivers / net / ice / base / ice_sched.c
index e189e95..1374b9a 100644 (file)
@@ -165,8 +165,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
        parent = ice_sched_find_node_by_teid(pi->root,
                                             LE32_TO_CPU(info->parent_teid));
        if (!parent) {
-               ice_debug(hw, ICE_DBG_SCHED,
-                         "Parent Node not found for parent_teid=0x%x\n",
+               ice_debug(hw, ICE_DBG_SCHED, "Parent Node not found for parent_teid=0x%x\n",
                          LE32_TO_CPU(info->parent_teid));
                return ICE_ERR_PARAM;
        }
@@ -742,8 +741,7 @@ static void ice_sched_clear_rl_prof(struct ice_port_info *pi)
                        rl_prof_elem->prof_id_ref = 0;
                        status = ice_sched_del_rl_profile(hw, rl_prof_elem);
                        if (status) {
-                               ice_debug(hw, ICE_DBG_SCHED,
-                                         "Remove rl profile failed\n");
+                               ice_debug(hw, ICE_DBG_SCHED, "Remove rl profile failed\n");
                                /* On error, free mem required */
                                LIST_DEL(&rl_prof_elem->list_entry);
                                ice_free(hw, rl_prof_elem);
@@ -930,8 +928,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
        for (i = 0; i < num_nodes; i++) {
                status = ice_sched_add_node(pi, layer, &buf->generic[i]);
                if (status != ICE_SUCCESS) {
-                       ice_debug(hw, ICE_DBG_SCHED,
-                                 "add nodes in SW DB failed status =%d\n",
+                       ice_debug(hw, ICE_DBG_SCHED, "add nodes in SW DB failed status =%d\n",
                                  status);
                        break;
                }
@@ -939,8 +936,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
                teid = LE32_TO_CPU(buf->generic[i].node_teid);
                new_node = ice_sched_find_node_by_teid(parent, teid);
                if (!new_node) {
-                       ice_debug(hw, ICE_DBG_SCHED,
-                                 "Node is missing for teid =%d\n", teid);
+                       ice_debug(hw, ICE_DBG_SCHED, "Node is missing for teid =%d\n", teid);
                        break;
                }
 
@@ -1297,8 +1293,7 @@ struct ice_sched_node *ice_sched_get_node(struct ice_port_info *pi, u32 teid)
        ice_release_lock(&pi->sched_lock);
 
        if (!node)
-               ice_debug(pi->hw, ICE_DBG_SCHED,
-                         "Node not found for teid=0x%x\n", teid);
+               ice_debug(pi->hw, ICE_DBG_SCHED, "Node not found for teid=0x%x\n", teid);
 
        return node;
 }
@@ -1435,14 +1430,14 @@ ice_sched_find_node_in_subtree(struct ice_hw *hw, struct ice_sched_node *base,
 }
 
 /**
- * ice_sched_get_free_qgrp - Scan all Q group siblings and find a free node
+ * ice_sched_get_free_qgrp - Scan all queue group siblings and find a free node
  * @pi: port information structure
  * @vsi_node: software VSI handle
- * @qgrp_node: first Q group node identified for scanning
+ * @qgrp_node: first queue group node identified for scanning
  * @owner: LAN or RDMA
  *
- * This function retrieves a free LAN or RDMA Q group node by scanning
- * qgrp_node and its siblings for the Q group with the fewest number
+ * This function retrieves a free LAN or RDMA queue group node by scanning
+ * qgrp_node and its siblings for the queue group with the fewest number
  * of queues currently assigned.
  */
 static struct ice_sched_node *
@@ -1459,17 +1454,17 @@ ice_sched_get_free_qgrp(struct ice_port_info *pi,
        if (!min_children)
                return qgrp_node;
        min_qgrp = qgrp_node;
-       /* scan all Q groups until find a node which has less than the
-        * minimum number of children. This way all Q group nodes get
+       /* scan all queue groups until find a node which has less than the
+        * minimum number of children. This way all queue group nodes get
         * equal number of shares and active. The bandwidth will be equally
-        * distributed across all Qs.
+        * distributed across all queues.
         */
        while (qgrp_node) {
                /* make sure the qgroup node is part of the VSI subtree */
                if (ice_sched_find_node_in_subtree(pi->hw, vsi_node, qgrp_node))
                        if (qgrp_node->num_children < min_children &&
                            qgrp_node->owner == owner) {
-                               /* replace the new min Q group node */
+                               /* replace the new min queue group node */
                                min_qgrp = qgrp_node;
                                min_children = min_qgrp->num_children;
                                /* break if it has no children, */
@@ -2048,8 +2043,7 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)
                        continue;
 
                if (ice_sched_is_leaf_node_present(vsi_node)) {
-                       ice_debug(pi->hw, ICE_DBG_SCHED,
-                                 "VSI has leaf nodes in TC %d\n", i);
+                       ice_debug(pi->hw, ICE_DBG_SCHED, "VSI has leaf nodes in TC %d\n", i);
                        status = ICE_ERR_IN_USE;
                        goto exit_sched_rm_vsi_cfg;
                }
@@ -2891,8 +2885,7 @@ static void ice_sched_rm_unused_rl_prof(struct ice_port_info *pi)
                                         &pi->rl_prof_list[ln],
                                         ice_aqc_rl_profile_info, list_entry) {
                        if (!ice_sched_del_rl_profile(pi->hw, rl_prof_elem))
-                               ice_debug(pi->hw, ICE_DBG_SCHED,
-                                         "Removed rl profile\n");
+                               ice_debug(pi->hw, ICE_DBG_SCHED, "Removed rl profile\n");
                }
        }
 }
@@ -4143,8 +4136,7 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type,
                        /* Remove old profile ID from database */
                        status = ice_sched_del_rl_profile(pi->hw, rl_prof_elem);
                        if (status && status != ICE_ERR_IN_USE)
-                               ice_debug(pi->hw, ICE_DBG_SCHED,
-                                         "Remove rl profile failed\n");
+                               ice_debug(pi->hw, ICE_DBG_SCHED, "Remove rl profile failed\n");
                        break;
                }
        if (status == ICE_ERR_IN_USE)
@@ -5389,6 +5381,26 @@ void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw)
        ice_release_lock(&pi->sched_lock);
 }
 
+/**
+ * ice_sched_replay_root_node_bw - replay root node BW
+ * @pi: port information structure
+ *
+ * Replay root node BW settings.
+ */
+enum ice_status ice_sched_replay_root_node_bw(struct ice_port_info *pi)
+{
+       enum ice_status status = ICE_SUCCESS;
+
+       if (!pi->hw)
+               return ICE_ERR_PARAM;
+       ice_acquire_lock(&pi->sched_lock);
+
+       status = ice_sched_replay_node_bw(pi->hw, pi->root,
+                                         &pi->root_node_bw_t_info);
+       ice_release_lock(&pi->sched_lock);
+       return status;
+}
+
 /**
  * ice_sched_replay_tc_node_bw - replay TC node(s) BW
  * @pi: port information structure