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 14287A00C3;
	Mon, 15 Aug 2022 01:25:25 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id E7BC042C8C;
	Mon, 15 Aug 2022 01:23:12 +0200 (CEST)
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by mails.dpdk.org (Postfix) with ESMTP id 0341840146
 for <dev@dpdk.org>; Mon, 15 Aug 2022 01:23:10 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1660519391; x=1692055391;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=0s14fJylDVmlRfr9rrOzOEXqvLe5ArPlZonjFcLm40c=;
 b=SQzqVwiAwlTIglDCw1ezf9+Nfe1Fx7lY0bEAVO+Az/0wMdmgT5N3BqFi
 dB6NVxPnlt+6GqKIspxMUHOjIVM+iLoGpPzHuk5l1rTJSBvOIuM5k8sar
 mIzi9HFnCp1dojFvzR7zH9S2So7cX7Lavqz6sJBMghfTxBrHykQOvfCMa
 OHbMLDUQxqKzMNqgAEq5MuDIKXQrFUSRmwO+Y3POP2iTFb8J3h8KZi0L8
 yND7MKRqvJzdUuoVg23GGPtb9g2PkQMMytsawZx/BuM76XEQwGiJOXIvx
 iU7+gNr9wol1zpTzKbEfeVuz//Vax0gQ6AtqkPp/5J2WW3yRgVtvu1hiR w==;
X-IronPort-AV: E=McAfee;i="6400,9594,10439"; a="291857972"
X-IronPort-AV: E=Sophos;i="5.93,237,1654585200"; d="scan'208";a="291857972"
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 14 Aug 2022 16:23:10 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.93,237,1654585200"; d="scan'208";a="635283176"
Received: from dpdk-qzhan15-test02.sh.intel.com ([10.67.115.4])
 by orsmga008.jf.intel.com with ESMTP; 14 Aug 2022 16:23:09 -0700
From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
 Ben Shelton <benjamin.h.shelton@intel.com>
Subject: [PATCH v2 33/70] net/ice/base: add AQ command to config node attribute
Date: Mon, 15 Aug 2022 03:31:29 -0400
Message-Id: <20220815073206.2917968-34-qi.z.zhang@intel.com>
X-Mailer: git-send-email 2.31.1
In-Reply-To: <20220815073206.2917968-1-qi.z.zhang@intel.com>
References: <20220815071306.2910599-1-qi.z.zhang@intel.com>
 <20220815073206.2917968-1-qi.z.zhang@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
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

Added AQ command to config nod attribute.

Signed-off-by: Ben Shelton <benjamin.h.shelton@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_adminq_cmd.h | 17 +++++++++++++++++
 drivers/net/ice/base/ice_sched.c      | 27 +++++++++++++++++++++++++++
 drivers/net/ice/base/ice_sched.h      |  4 ++++
 3 files changed, 48 insertions(+)

diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h
index 8f7e13096c..9f84ffca67 100644
--- a/drivers/net/ice/base/ice_adminq_cmd.h
+++ b/drivers/net/ice/base/ice_adminq_cmd.h
@@ -1215,6 +1215,22 @@ struct ice_aqc_rl_profile_elem {
 	__le16 rl_encode;
 };
 
+/* Config Node Attributes (indirect 0x0419)
+ * Query Node Attributes (indirect 0x041A)
+ */
+struct ice_aqc_node_attr {
+	__le16 num_entries; /* Number of attributes structures in the buffer */
+	u8 reserved[6];
+	__le32 addr_high;
+	__le32 addr_low;
+};
+
+struct ice_aqc_node_attr_elem {
+	__le32 node_teid;
+	__le16 max_children;
+	__le16 children_level;
+};
+
 /* Configure L2 Node CGD (indirect 0x0414)
  * This indirect command allows configuring a congestion domain for given L2
  * node TEIDs in the scheduler topology.
@@ -2976,6 +2992,7 @@ struct ice_aq_desc {
 		struct ice_aqc_cfg_l2_node_cgd cfg_l2_node_cgd;
 		struct ice_aqc_query_port_ets port_ets;
 		struct ice_aqc_rl_profile rl_profile;
+		struct ice_aqc_node_attr node_attr;
 		struct ice_aqc_nvm nvm;
 		struct ice_aqc_nvm_cfg nvm_cfg;
 		struct ice_aqc_nvm_checksum nvm_checksum;
diff --git a/drivers/net/ice/base/ice_sched.c b/drivers/net/ice/base/ice_sched.c
index 71b5677f43..6f938d71a1 100644
--- a/drivers/net/ice/base/ice_sched.c
+++ b/drivers/net/ice/base/ice_sched.c
@@ -839,6 +839,33 @@ void ice_sched_cleanup_all(struct ice_hw *hw)
 	hw->max_cgds = 0;
 }
 
+/**
+ * ice_aq_cfg_node_attr - configure nodes' per-cone flattening attributes
+ * @hw: pointer to the HW struct
+ * @num_nodes: the number of nodes whose attributes to configure
+ * @buf: pointer to buffer
+ * @buf_size: buffer size in bytes
+ * @cd: pointer to command details structure or NULL
+ *
+ * Configure Node Attributes (0x0417)
+ */
+enum ice_status
+ice_aq_cfg_node_attr(struct ice_hw *hw, u16 num_nodes,
+		     struct ice_aqc_node_attr_elem *buf, u16 buf_size,
+		     struct ice_sq_cd *cd)
+{
+	struct ice_aqc_node_attr *cmd;
+	struct ice_aq_desc desc;
+
+	cmd = &desc.params.node_attr;
+	ice_fill_dflt_direct_cmd_desc(&desc,
+				      ice_aqc_opc_cfg_node_attr);
+	desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
+
+	cmd->num_entries = CPU_TO_LE16(num_nodes);
+	return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
+}
+
 /**
  * ice_aq_cfg_l2_node_cgd - configures L2 node to CGD mapping
  * @hw: pointer to the HW struct
diff --git a/drivers/net/ice/base/ice_sched.h b/drivers/net/ice/base/ice_sched.h
index c9f3f79eff..6b12a0688a 100644
--- a/drivers/net/ice/base/ice_sched.h
+++ b/drivers/net/ice/base/ice_sched.h
@@ -78,6 +78,10 @@ ice_aq_query_rl_profile(struct ice_hw *hw, u16 num_profiles,
 			struct ice_aqc_rl_profile_elem *buf, u16 buf_size,
 			struct ice_sq_cd *cd);
 enum ice_status
+ice_aq_cfg_node_attr(struct ice_hw *hw, u16 num_nodes,
+		     struct ice_aqc_node_attr_elem *buf, u16 buf_size,
+		     struct ice_sq_cd *cd);
+enum ice_status
 ice_aq_cfg_l2_node_cgd(struct ice_hw *hw, u16 num_nodes,
 		       struct ice_aqc_cfg_l2_node_cgd_elem *buf, u16 buf_size,
 		       struct ice_sq_cd *cd);
-- 
2.31.1