From: Paul Greenwalt <[email protected]>

In some cases, after NVM update finish and triggers EMPR, FW will return
invalid information about Tx Scheduler topology
(in reply to ice_sched_query_res_alloc(), we end up with 0 as a number
children to allocate in 4th layer, then adding 5th layer nodes would
crash).

As in this scenario we need to reboot the platform anyway, it is safe to
just fail building the scheduler tree.

Add a warning, so we will be sure that this was the case.

Signed-off-by: Paul Greenwalt <[email protected]>
Signed-off-by: Soumyadeep Hore <[email protected]>
---
 drivers/net/intel/ice/base/ice_sched.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/intel/ice/base/ice_sched.c 
b/drivers/net/intel/ice/base/ice_sched.c
index be9393a7d6..3a0907eda7 100644
--- a/drivers/net/intel/ice/base/ice_sched.c
+++ b/drivers/net/intel/ice/base/ice_sched.c
@@ -174,6 +174,16 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
                return ICE_ERR_PARAM;
        }
 
+       /* After NVM update FW will(in some cases) not return proper
+        * topology, bail out early in such cases
+        * (as there is a need of platform reboot anyway).
+        */
+       if (!parent->children) {
+               ice_debug(hw, ICE_DBG_SCHED, "Parent (teid = 0x%x) hasn't 
prepared to have children, aborting\n",
+                       LE32_TO_CPU(info->parent_teid));
+               return ICE_ERR_PARAM;
+       }
+
        /* query the current node information from FW before adding it
         * to the SW DB
         */
-- 
2.47.1

Reply via email to