From: Ting Xu <ting...@intel.com>

In the adminq command query port ETS function, the root node teid is
needed. However, for DCF, the root node is not initialized at parent HW
init stage, which will cause error when we refer to the variable. In
this patch, we will check whether the root node is available or not first.
If not available in DCF case, after receiving virtchnl message, PF will
add the root node info before sending adminq command to FW.

Signed-off-by: Ting Xu <ting...@intel.com>
Signed-off-by: Ian Stokes <ian.sto...@intel.com>
---
 drivers/net/ice/base/ice_dcb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ice/base/ice_dcb.c b/drivers/net/ice/base/ice_dcb.c
index 4ef54613b1..81ce11343d 100644
--- a/drivers/net/ice/base/ice_dcb.c
+++ b/drivers/net/ice/base/ice_dcb.c
@@ -1559,12 +1559,11 @@ ice_aq_query_port_ets(struct ice_port_info *pi,
        struct ice_aq_desc desc;
        int status;
 
-       if (!pi)
+       if (!pi || !pi->root)
                return ICE_ERR_PARAM;
        cmd = &desc.params.port_ets;
        ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_query_port_ets);
-       if (pi->root)
-               cmd->port_teid = pi->root->info.node_teid;
+       cmd->port_teid = pi->root->info.node_teid;
 
        status = ice_aq_send_cmd(pi->hw, &desc, buf, buf_size, cd);
        return status;
-- 
2.43.0

Reply via email to