net/ice/base: update copyright date
[dpdk.git] / drivers / net / ice / base / ice_sched.c
index b75a44f..38d1f2c 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2020 Intel Corporation
+ * Copyright(c) 2001-2021 Intel Corporation
  */
 
 #include "ice_sched.h"
@@ -1040,7 +1040,15 @@ ice_sched_add_nodes_to_layer(struct ice_port_info *pi,
                                                         layer, new_num_nodes,
                                                         first_teid_ptr,
                                                         &num_added);
-               *num_nodes_added += num_added;
+               if (status == ICE_SUCCESS)
+                       *num_nodes_added += num_added;
+               /* added more nodes than requested ? */
+               if (*num_nodes_added > num_nodes) {
+                       ice_debug(pi->hw, ICE_DBG_SCHED, "added extra nodes %d %d\n", num_nodes,
+                                 *num_nodes_added);
+                       status = ICE_ERR_CFG;
+                       break;
+               }
                /* break if all the nodes are added successfully */
                if (status == ICE_SUCCESS && (*num_nodes_added == num_nodes))
                        break;
@@ -1063,7 +1071,7 @@ ice_sched_add_nodes_to_layer(struct ice_port_info *pi,
                        if (num_added)
                                first_teid_ptr = &temp;
 
-                       new_num_nodes = num_nodes - num_added;
+                       new_num_nodes = num_nodes - *num_nodes_added;
                }
        }
        return status;
@@ -1361,7 +1369,7 @@ enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw)
                         ice_memdup(hw, buf->layer_props,
                                    (hw->num_tx_sched_layers *
                                     sizeof(*hw->layer_info)),
-                                   ICE_DMA_TO_DMA);
+                                   ICE_NONDMA_TO_NONDMA);
        if (!hw->layer_info) {
                status = ICE_ERR_NO_MEMORY;
                goto sched_query_out;
@@ -4289,7 +4297,7 @@ ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,
        ice_sched_rm_unused_rl_prof(hw);
 
        layer_num = ice_sched_get_rl_prof_layer(pi, rl_type,
-               node->tx_sched_layer);
+                                               node->tx_sched_layer);
        if (layer_num >= hw->num_tx_sched_layers)
                return ICE_ERR_PARAM;