From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id EDB05A0C4D;
	Thu, 17 Jun 2021 12:18:49 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id A0A39410EB;
	Thu, 17 Jun 2021 12:18:43 +0200 (CEST)
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by mails.dpdk.org (Postfix) with ESMTP id B21E04067A
 for <dev@dpdk.org>; Thu, 17 Jun 2021 12:18:36 +0200 (CEST)
IronPort-SDR: J6gAB8ipAvNGIc4tNCDjcmGc730uCl+xfCfy+GMjLNq6821QXrw3kztta/TJ30V8buNi0AVpNh
 RgZA77PnRHBg==
X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="206297210"
X-IronPort-AV: E=Sophos;i="5.83,280,1616482800"; d="scan'208";a="206297210"
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 17 Jun 2021 03:18:33 -0700
IronPort-SDR: i2aLbtoHxU2gDlCRkm5VgMaXV5VLivmP/KrfFrAqY2lwsZYc/ttlH2atFxxllmdbPv8o0uly0X
 0xrABvsCwozA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.83,280,1616482800"; d="scan'208";a="488603102"
Received: from dpdk-xuting-main.sh.intel.com ([10.67.117.76])
 by fmsmga002.fm.intel.com with ESMTP; 17 Jun 2021 03:18:32 -0700
From: Ting Xu <ting.xu@intel.com>
To: dev@dpdk.org
Cc: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com,
 qiming.yang@intel.com
Date: Thu, 17 Jun 2021 18:17:05 +0800
Message-Id: <20210617101708.113951-3-ting.xu@intel.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210617101708.113951-1-ting.xu@intel.com>
References: <20210601014034.36100-1-ting.xu@intel.com>
 <20210617101708.113951-1-ting.xu@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v2 2/5] net/ice/base: support DCF query port ETS
 adminq
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

In the adminq command query port ETS function, the root node teid is
needed. However, for DCF, the root node is not initialized, 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.

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

diff --git a/drivers/net/ice/base/ice_dcb.c b/drivers/net/ice/base/ice_dcb.c
index 0aaa5ae8c1..08c950cd9a 100644
--- a/drivers/net/ice/base/ice_dcb.c
+++ b/drivers/net/ice/base/ice_dcb.c
@@ -1483,7 +1483,8 @@ ice_aq_query_port_ets(struct ice_port_info *pi,
 		return ICE_ERR_PARAM;
 	cmd = &desc.params.port_ets;
 	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_query_port_ets);
-	cmd->port_teid = pi->root->info.node_teid;
+	if (pi->root)
+		cmd->port_teid = pi->root->info.node_teid;
 
 	status = ice_aq_send_cmd(pi->hw, &desc, buf, buf_size, cd);
 	return status;
-- 
2.25.1