From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CC8B845BA3; Tue, 22 Oct 2024 18:40:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12DA9402E1; Tue, 22 Oct 2024 18:40:04 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mails.dpdk.org (Postfix) with ESMTP id 0067240272 for ; Tue, 22 Oct 2024 18:39:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729615192; x=1761151192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9b9Ck0/62u3Ddz1amEUxvsFaC7dDqaExwY2466265y0=; b=XktiBUofxco9Y5OS/6AQ+t9m93tS8n+hsV1p7KS7ShjM1WioVU4h81aj 73lPkk+4NVjZX5DFk2in3clcztPqKMhKM/GZOaqyqnSrBho0vfrYvQ4SI U9uyfcHFQ3nm5iZYvTPHGFaEko4gGjJw3Z0DcswbTm0yTgSOK2taEolXT 1Dc65w/26+SiUyZaRImBINd2KycOVc9Uk6H1Y8KbVtbi49OXaURMuJROU 6vNOvcekBYyzdOBN9Mheqa4Xs62X5SHSofsQXjm7x2+mvIOJfduxXoN1v Vw30rl+aVVMrF8M4kSHZxybdwK4cF/eMax6o70cCynPxVNNn0XNdAL7Sc g==; X-CSE-ConnectionGUID: 7DtwNv5ATeyJcFt1WfqwVA== X-CSE-MsgGUID: 0kfZF7VmREq+9BUPnNno/g== X-IronPort-AV: E=McAfee;i="6700,10204,11233"; a="40538715" X-IronPort-AV: E=Sophos;i="6.11,223,1725346800"; d="scan'208";a="40538715" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2024 09:39:51 -0700 X-CSE-ConnectionGUID: 1G+YgXYHTaeXNfk2GmMxVg== X-CSE-MsgGUID: x4RW2sSQSReYhRac+OFpSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,223,1725346800"; d="scan'208";a="103217660" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by fmviesa002.fm.intel.com with ESMTP; 22 Oct 2024 09:39:50 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Stephen Hemminger Subject: [PATCH v4 2/4] net/ice: improve Tx scheduler graph output Date: Tue, 22 Oct 2024 17:39:42 +0100 Message-ID: <20241022163944.3564662-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241022163944.3564662-1-bruce.richardson@intel.com> References: <20241009170822.344716-1-bruce.richardson@intel.com> <20241022163944.3564662-1-bruce.richardson@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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The function to dump the TX scheduler topology only adds to the chart nodes connected to TX queues or for the flow director VSI. Change the function to work recursively from the root node and thereby include all scheduler nodes, whether in use or not, in the dump. Also, improve the output of the Tx scheduler graphing function: * When number of children is >16, skip middle nodes to reduce size of the graph, otherwise dot output is unviewable for large hierarchies * For VSIs other than zero, use dot's clustering method to put those VSIs into subgraphs with borders * For leaf nodes, display queue numbers for the any nodes assigned to ethdev NIC Tx queues Signed-off-by: Bruce Richardson Acked-by: Stephen Hemminger --- drivers/net/ice/ice_diagnose.c | 202 ++++++++++++--------------------- 1 file changed, 71 insertions(+), 131 deletions(-) diff --git a/drivers/net/ice/ice_diagnose.c b/drivers/net/ice/ice_diagnose.c index c357554707..5bec9d00ad 100644 --- a/drivers/net/ice/ice_diagnose.c +++ b/drivers/net/ice/ice_diagnose.c @@ -510,7 +510,7 @@ int rte_pmd_ice_dump_switch(uint16_t port, uint8_t **buff, uint32_t *size) return ice_dump_switch(dev, buff, size); } -static void print_rl_profile(struct ice_aqc_rl_profile_elem *prof, +static void print_rl_profile(const struct ice_aqc_rl_profile_elem *prof, FILE *stream) { fprintf(stream, "\t\t\t\t\t\n"); @@ -545,29 +545,15 @@ static void print_rl_profile(struct ice_aqc_rl_profile_elem *prof, fprintf(stream, "\t\t\t\t\t\n"); } -static -void print_elem_type(FILE *stream, u8 type) +static const char * +get_elem_type(u8 type) { - switch (type) { - case 1: - fprintf(stream, "root"); - break; - case 2: - fprintf(stream, "tc"); - break; - case 3: - fprintf(stream, "se_generic"); - break; - case 4: - fprintf(stream, "entry_point"); - break; - case 5: - fprintf(stream, "leaf"); - break; - default: - fprintf(stream, "%d", type); - break; - } + static const char * const ice_sched_node_types[] = { + "Undefined", "Root", "TC", "SE Generic", "SW Entry", "Leaf" + }; + if (type < RTE_DIM(ice_sched_node_types)) + return ice_sched_node_types[type]; + return "*UNKNOWN*"; } static @@ -602,10 +588,11 @@ void print_priority_mode(FILE *stream, bool flag) } static -void print_node(struct ice_aqc_txsched_elem_data *data, - struct ice_aqc_rl_profile_elem *cir_prof, - struct ice_aqc_rl_profile_elem *eir_prof, - struct ice_aqc_rl_profile_elem *shared_prof, +void print_node(const struct rte_eth_dev_data *ethdata, + const struct ice_aqc_txsched_elem_data *data, + const struct ice_aqc_rl_profile_elem *cir_prof, + const struct ice_aqc_rl_profile_elem *eir_prof, + const struct ice_aqc_rl_profile_elem *shared_prof, bool detail, FILE *stream) { fprintf(stream, "\tNODE_%d [\n", data->node_teid); @@ -613,17 +600,18 @@ void print_node(struct ice_aqc_txsched_elem_data *data, fprintf(stream, "\t\t\t\n"); - fprintf(stream, "\t\t\t\t\n"); - fprintf(stream, "\t\t\t\t\t\n"); - fprintf(stream, "\t\t\t\t\t\n", data->node_teid); - fprintf(stream, "\t\t\t\t\n"); - - fprintf(stream, "\t\t\t\t\n"); - fprintf(stream, "\t\t\t\t\t\n"); - fprintf(stream, "\t\t\t\t\t\n"); - fprintf(stream, "\t\t\t\t\n"); + fprintf(stream, "\t\t\t\t\n", data->node_teid); + fprintf(stream, "\t\t\t\t\n", + get_elem_type(data->data.elem_type)); + if (data->data.elem_type == ICE_AQC_ELEM_TYPE_LEAF) { + for (uint16_t i = 0; i < ethdata->nb_tx_queues; i++) { + struct ice_tx_queue *q = ethdata->tx_queues[i]; + if (q->q_teid == data->node_teid) { + fprintf(stream, "\t\t\t\t\n", i); + break; + } + } + } if (!detail) goto brief; @@ -705,8 +693,6 @@ void print_node(struct ice_aqc_txsched_elem_data *data, fprintf(stream, "\t\tshape=plain\n"); fprintf(stream, "\t]\n"); - if (data->parent_teid != 0xFFFFFFFF) - fprintf(stream, "\tNODE_%d -> NODE_%d\n", data->parent_teid, data->node_teid); } static @@ -731,112 +717,92 @@ int query_rl_profile(struct ice_hw *hw, return 0; } -static -int query_node(struct ice_hw *hw, uint32_t child, uint32_t *parent, - uint8_t level, bool detail, FILE *stream) +static int +query_node(struct ice_hw *hw, struct rte_eth_dev_data *ethdata, + struct ice_sched_node *node, bool detail, FILE *stream) { - struct ice_aqc_txsched_elem_data data; + struct ice_aqc_txsched_elem_data *data = &node->info; struct ice_aqc_rl_profile_elem cir_prof; struct ice_aqc_rl_profile_elem eir_prof; struct ice_aqc_rl_profile_elem shared_prof; struct ice_aqc_rl_profile_elem *cp = NULL; struct ice_aqc_rl_profile_elem *ep = NULL; struct ice_aqc_rl_profile_elem *sp = NULL; - int status, ret; - - status = ice_sched_query_elem(hw, child, &data); - if (status != ICE_SUCCESS) { - if (level == hw->num_tx_sched_layers) { - /* ignore the error when a queue has been stopped. */ - PMD_DRV_LOG(WARNING, "Failed to query queue node %d.", child); - *parent = 0xffffffff; - return 0; - } - PMD_DRV_LOG(ERR, "Failed to query scheduling node %d.", child); - return -EINVAL; - } - - *parent = data.parent_teid; + u8 level = node->tx_sched_layer; + int ret; - if (data.data.cir_bw.bw_profile_idx != 0) { - ret = query_rl_profile(hw, level, 0, data.data.cir_bw.bw_profile_idx, &cir_prof); + if (data->data.cir_bw.bw_profile_idx != 0) { + ret = query_rl_profile(hw, level, 0, data->data.cir_bw.bw_profile_idx, &cir_prof); if (ret) return ret; cp = &cir_prof; } - if (data.data.eir_bw.bw_profile_idx != 0) { - ret = query_rl_profile(hw, level, 1, data.data.eir_bw.bw_profile_idx, &eir_prof); + if (data->data.eir_bw.bw_profile_idx != 0) { + ret = query_rl_profile(hw, level, 1, data->data.eir_bw.bw_profile_idx, &eir_prof); if (ret) return ret; ep = &eir_prof; } - if (data.data.srl_id != 0) { - ret = query_rl_profile(hw, level, 2, data.data.srl_id, &shared_prof); + if (data->data.srl_id != 0) { + ret = query_rl_profile(hw, level, 2, data->data.srl_id, &shared_prof); if (ret) return ret; sp = &shared_prof; } - print_node(&data, cp, ep, sp, detail, stream); + print_node(ethdata, data, cp, ep, sp, detail, stream); return 0; } -static -int query_nodes(struct ice_hw *hw, - uint32_t *children, int child_num, - uint32_t *parents, int *parent_num, - uint8_t level, bool detail, - FILE *stream) +static int +query_node_recursive(struct ice_hw *hw, struct rte_eth_dev_data *ethdata, + struct ice_sched_node *node, bool detail, FILE *stream) { - uint32_t parent; - int i; - int j; - - *parent_num = 0; - for (i = 0; i < child_num; i++) { - bool exist = false; - int ret; + bool close = false; + if (node->parent != NULL && node->vsi_handle != node->parent->vsi_handle) { + fprintf(stream, "subgraph cluster_%u {\n", node->vsi_handle); + fprintf(stream, "\tlabel = \"VSI %u\";\n", node->vsi_handle); + close = true; + } - ret = query_node(hw, children[i], &parent, level, detail, stream); - if (ret) - return -EINVAL; + int ret = query_node(hw, ethdata, node, detail, stream); + if (ret != 0) + return ret; - for (j = 0; j < *parent_num; j++) { - if (parents[j] == parent) { - exist = true; - break; - } + for (uint16_t i = 0; i < node->num_children; i++) { + ret = query_node_recursive(hw, ethdata, node->children[i], detail, stream); + if (ret != 0) + return ret; + /* if we have a lot of nodes, skip a bunch in the middle */ + if (node->num_children > 16 && i == 2) { + uint16_t inc = node->num_children - 5; + fprintf(stream, "\tn%d_children [label=\"... +%d child nodes ...\"];\n", + node->info.node_teid, inc); + fprintf(stream, "\tNODE_%d -> n%d_children;\n", + node->info.node_teid, node->info.node_teid); + i += inc; } - - if (!exist && parent != 0xFFFFFFFF) - parents[(*parent_num)++] = parent; } + if (close) + fprintf(stream, "}\n"); + if (node->info.parent_teid != 0xFFFFFFFF) + fprintf(stream, "\tNODE_%d -> NODE_%d\n", + node->info.parent_teid, node->info.node_teid); return 0; } -int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream) +int +rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream) { struct rte_eth_dev *dev; struct ice_hw *hw; - struct ice_pf *pf; - struct ice_q_ctx *q_ctx; - uint16_t q_num; - uint16_t i; - struct ice_tx_queue *txq; - uint32_t buf1[256]; - uint32_t buf2[256]; - uint32_t *children = buf1; - uint32_t *parents = buf2; - int child_num = 0; - int parent_num = 0; - uint8_t level; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); @@ -846,35 +812,9 @@ int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream) dev = &rte_eth_devices[port]; hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); - level = hw->num_tx_sched_layers; - - q_num = dev->data->nb_tx_queues; - - /* main vsi */ - for (i = 0; i < q_num; i++) { - txq = dev->data->tx_queues[i]; - q_ctx = ice_get_lan_q_ctx(hw, txq->vsi->idx, 0, i); - children[child_num++] = q_ctx->q_teid; - } - - /* fdir vsi */ - q_ctx = ice_get_lan_q_ctx(hw, pf->fdir.fdir_vsi->idx, 0, 0); - children[child_num++] = q_ctx->q_teid; fprintf(stream, "digraph tx_sched {\n"); - while (child_num > 0) { - int ret; - ret = query_nodes(hw, children, child_num, - parents, &parent_num, - level, detail, stream); - if (ret) - return ret; - - children = parents; - child_num = parent_num; - level--; - } + query_node_recursive(hw, dev->data, hw->port_info->root, detail, stream); fprintf(stream, "}\n"); return 0; -- 2.43.0
teid %d
type "); - print_elem_type(stream, data->data.elem_type); - fprintf(stream, "
teid%d
type%s
TXQ%u