From patchwork Thu Feb 22 12:23:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 137029 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C300E43B74; Thu, 22 Feb 2024 13:24:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B1B940A6D; Thu, 22 Feb 2024 13:24:00 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E0F5040281 for ; Thu, 22 Feb 2024 13:23:56 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41M9BMF4021869; Thu, 22 Feb 2024 04:23:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=r+toDGkDyj1S4vHkUTqPMTg1Fb+WQIdGq/OzFAqFv4Q=; b=DTh wumRjTkNDipfgofMi0IFdCY1WGuG+i67m7IBfMTDza+R2H2qEJ3KA8/JLqPW1Nhf mGFEkC+3A3p1bY66APSY4eIUuu5waRUtnl4T6dsGGDVsYQG5MVenTL9xlNDCGHHa hgPYhDDRFzGDyz2opvE5bS1/fpXt7TOYfUyYtWLb6M9HfhaS7Y5u5fm4jEjcFyHj uU+59p5KNdowAoK8esw1/7WVjwC1/w/WLVUSztgn0oOuHx1ZLzH9SONRgl7FQNoe 1vmb8xttz86KZiBvP738+5I7VccfPThGSb5Vebl583dMUudhnq/8rhVEWL8510qz vU218lJNbASMBgcogEg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3we3dw8j6h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 04:23:54 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 22 Feb 2024 04:23:51 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 22 Feb 2024 04:23:51 -0800 Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 14BF43F71CF; Thu, 22 Feb 2024 04:23:45 -0800 (PST) From: To: , , , CC: , Pavan Nikhilesh Subject: [24.11 PATCH v3 1/5] graph: add support for node specific errors Date: Thu, 22 Feb 2024 17:53:38 +0530 Message-ID: <20240222122342.16375-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240222053639.15057-1-pbhagavatula@marvell.com> References: <20240222053639.15057-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 9ygP3FSP_LMwBeZamu4nX_Pnq9CRCiGo X-Proofpoint-ORIG-GUID: 9ygP3FSP_LMwBeZamu4nX_Pnq9CRCiGo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_09,2024-02-22_01,2023-05-22_02 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 From: Pavan Nikhilesh Add ability for Nodes to advertise error counters during registration. Signed-off-by: Pavan Nikhilesh --- v2 Changes: - Fix compilation. v3 Changes: - Resend as 1/5 didn't make it through. doc/guides/prog_guide/graph_lib.rst | 22 +- .../prog_guide/img/anatomy_of_a_node.svg | 329 +++++-- .../prog_guide/img/graph_mem_layout.svg | 921 +++++++++++++----- lib/graph/graph_private.h | 1 + lib/graph/node.c | 37 +- lib/graph/rte_graph.h | 7 + 6 files changed, 1016 insertions(+), 301 deletions(-) -- 2.25.1 diff --git a/doc/guides/prog_guide/graph_lib.rst b/doc/guides/prog_guide/graph_lib.rst index ad09bdfe26..018900caea 100644 --- a/doc/guides/prog_guide/graph_lib.rst +++ b/doc/guides/prog_guide/graph_lib.rst @@ -21,6 +21,7 @@ Features of the Graph library are: - Nodes as plugins. - Support for out of tree nodes. - Inbuilt nodes for packet processing. +- Node specific error counts. - Multi-process support. - Low overhead graph walk and node enqueue. - Low overhead statistics collection infrastructure. @@ -124,6 +125,18 @@ Source nodes are static nodes created using ``RTE_NODE_REGISTER`` by passing While performing the graph walk, the ``process()`` function of all the source nodes will be called first. So that these nodes can be used as input nodes for a graph. +nb_errors: +^^^^^^^^^^ + +The number of errors that this node can report. The ``err_desc[]`` stores the error +descriptions which will later be propagated to stats. + +err_desc[]: +^^^^^^^^^^^ + +The dynamic array to store the error descriptions that will be reported by this +node. + Node creation and registration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Node implementer creates the node by implementing ops and attributes of @@ -141,13 +154,13 @@ Link the Nodes to create the graph topology Topology after linking the nodes Once nodes are available to the program, Application or node public API -functions can links them together to create a complex packet processing graph. +functions can link them together to create a complex packet processing graph. There are multiple different types of strategies to link the nodes. Method (a): ^^^^^^^^^^^ -Provide the ``next_nodes[]`` at the node registration time. See ``struct rte_node_register::nb_edges``. +Provide the ``next_nodes[]`` at the node registration time. See ``struct rte_node_register::nb_edges``. This is a use case to address the static node scheme where one knows upfront the ``next_nodes[]`` of the node. @@ -385,8 +398,9 @@ Understanding the memory layout helps to debug the graph library and improve the performance if needed. Graph object consists of a header, circular buffer to store the pending -stream when walking over the graph, and variable-length memory to store -the ``rte_node`` objects. +stream when walking over the graph, variable-length memory to store +the ``rte_node`` objects, and variable-length memory to store the errors +reported by each ``rte_node``. The graph_nodes_mem_create() creates and populate this memory. The functions such as ``rte_graph_walk()`` and ``rte_node_enqueue_*`` use this memory diff --git a/doc/guides/prog_guide/img/anatomy_of_a_node.svg b/doc/guides/prog_guide/img/anatomy_of_a_node.svg index d3bc742e77..29818e267b 100644 --- a/doc/guides/prog_guide/img/anatomy_of_a_node.svg +++ b/doc/guides/prog_guide/img/anatomy_of_a_node.svg @@ -3,13 +3,6 @@ + inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> @@ -27,12 +27,51 @@ image/svg+xml - + + id="defs423"> + + + + + + + + + + inkscape:current-layer="g417" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + inkscape:lockguides="true" /> + style="fill:#ffffff;fill-rule:evenodd;fill-opacity:1" /> @@ -90,87 +133,92 @@ inkscape:connector-curvature="0" style="fill-rule:evenodd;stroke:#c27ba0;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:4, 3, 1, 3" /> + style="fill-rule:nonzero;stroke:#1155cc;stroke-width:0.99953708;stroke-linecap:butt;stroke-dasharray:none" /> + @@ -275,32 +323,37 @@ inkscape:connector-curvature="0" style="fill:#000000;fill-opacity:0;fill-rule:evenodd" /> + @@ -975,10 +1028,11 @@ inkscape:connector-curvature="0" style="fill:#000000;fill-opacity:0;fill-rule:evenodd" /> + style="fill-rule:evenodd;stroke:#595959;stroke-width:1.2253;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:9.80238, 3.67589" + sodipodi:nodetypes="cssscc" /> + style="fill-rule:evenodd;stroke:#595959;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:8, 3" + sodipodi:nodetypes="cssscc" /> + style="fill-rule:evenodd;stroke:#595959;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:8, 3" + sodipodi:nodetypes="cssc" /> @@ -1020,10 +1076,11 @@ inkscape:connector-curvature="0" style="fill:#000000;fill-opacity:0;fill-rule:evenodd" /> + style="fill-rule:evenodd;stroke:#595959;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:8, 3" + sodipodi:nodetypes="cssssscc" /> + + + + + + + nb_errors + Error 1 + Error 2 + Error 3 + Error n + + + + + + diff --git a/doc/guides/prog_guide/img/graph_mem_layout.svg b/doc/guides/prog_guide/img/graph_mem_layout.svg index 1d41729c9c..042c7fcb0d 100644 --- a/doc/guides/prog_guide/img/graph_mem_layout.svg +++ b/doc/guides/prog_guide/img/graph_mem_layout.svg @@ -3,700 +3,1141 @@ - - - - image/svg+xml - - - - - - + id="svg1" + inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)" + sodipodi:docname="graph_mem_layout.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> - - - + inkscape:current-layer="layer1"> + + + + + + + + + + + + + + + + + + + + + + + - - - + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + + + + + id="path286" + style="fill:none" /> + + + id="path338" + style="fill:none" /> + + + + + + + + Node 1 Errors + Node 1 + Error 1 + Error 1 + Error 1 + Error 2 + Error 2 + Error 2 + Error N + Error 3 + Error 3 + Error 4 + Node 4 + Node 8 + Node N + Node 4 Errors + Node 8 Errors + Node N Errors + + rte_node error memory layout + + + + + + + + + + + + diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h index fb88d4bc84..eb4d461c6e 100644 --- a/lib/graph/graph_private.h +++ b/lib/graph/graph_private.h @@ -62,6 +62,7 @@ struct node { rte_node_t id; /**< Allocated identifier for the node. */ rte_node_t parent_id; /**< Parent node identifier. */ rte_edge_t nb_edges; /**< Number of edges from this node. */ + struct rte_node_errors *errs; /**< Node specific errors. */ char next_nodes[][RTE_NODE_NAMESIZE]; /**< Names of next nodes. */ }; diff --git a/lib/graph/node.c b/lib/graph/node.c index 99a9622779..be96005a9e 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -85,9 +85,24 @@ __rte_node_register(const struct rte_node_register *reg) goto fail; } + if (reg->errs) { + sz = sizeof(*reg->errs) + (reg->errs->nb_errors * RTE_NODE_ERROR_DESC_SIZE); + node->errs = calloc(1, sz); + if (node->errs == NULL) { + rte_errno = ENOMEM; + goto free; + } + + node->errs->nb_errors = reg->errs->nb_errors; + for (i = 0; i < reg->errs->nb_errors; i++) + if (rte_strscpy(node->errs->err_desc[i], reg->errs->err_desc[i], + RTE_NODE_ERROR_DESC_SIZE) < 0) + goto free_err; + } + /* Initialize the node */ if (rte_strscpy(node->name, reg->name, RTE_NODE_NAMESIZE) < 0) - goto free; + goto free_err; node->flags = reg->flags; node->process = reg->process; node->init = reg->init; @@ -97,7 +112,7 @@ __rte_node_register(const struct rte_node_register *reg) for (i = 0; i < reg->nb_edges; i++) { if (rte_strscpy(node->next_nodes[i], reg->next_nodes[i], RTE_NODE_NAMESIZE) < 0) - goto free; + goto free_err; } node->lcore_id = RTE_MAX_LCORE; @@ -108,6 +123,8 @@ __rte_node_register(const struct rte_node_register *reg) graph_spinlock_unlock(); return node->id; +free_err: + free(node->errs); free: free(node); fail: @@ -134,6 +151,20 @@ node_clone(struct node *node, const char *name) goto fail; } + if (node->errs) { + reg->errs = calloc(1, sizeof(*node->errs) + + (node->errs->nb_errors * RTE_NODE_ERROR_DESC_SIZE)); + if (reg->errs == NULL) { + rte_errno = ENOMEM; + goto fail; + } + + for (i = 0; i < node->errs->nb_errors; i++) + if (rte_strscpy(reg->errs->err_desc[i], node->errs->err_desc[i], + RTE_NODE_ERROR_DESC_SIZE) < 0) + goto free_err; + } + /* Clone the source node */ reg->flags = node->flags; reg->process = node->process; @@ -150,6 +181,8 @@ node_clone(struct node *node, const char *name) goto free; rc = __rte_node_register(reg); +free_err: + free(reg->errs); free: free(reg); fail: diff --git a/lib/graph/rte_graph.h b/lib/graph/rte_graph.h index 2d37d5e0d6..70b68673c1 100644 --- a/lib/graph/rte_graph.h +++ b/lib/graph/rte_graph.h @@ -29,6 +29,7 @@ extern "C" { #define RTE_GRAPH_NAMESIZE 64 /**< Max length of graph name. */ #define RTE_NODE_NAMESIZE 64 /**< Max length of node name. */ +#define RTE_NODE_ERROR_DESC_SIZE 64 /**< Max length of node name. */ #define RTE_GRAPH_PCAP_FILE_SZ 64 /**< Max length of pcap file name. */ #define RTE_GRAPH_OFF_INVALID UINT32_MAX /**< Invalid graph offset. */ #define RTE_NODE_ID_INVALID UINT32_MAX /**< Invalid node id. */ @@ -460,6 +461,11 @@ void rte_graph_cluster_stats_get(struct rte_graph_cluster_stats *stat, */ void rte_graph_cluster_stats_reset(struct rte_graph_cluster_stats *stat); +struct rte_node_errors { + uint16_t nb_errors; /**< Number of errors. */ + char err_desc[][RTE_NODE_ERROR_DESC_SIZE]; /**< Names of errors. */ +}; + /** * Structure defines the node registration parameters. * @@ -472,6 +478,7 @@ struct rte_node_register { rte_node_process_t process; /**< Node process function. */ rte_node_init_t init; /**< Node init function. */ rte_node_fini_t fini; /**< Node fini function. */ + struct rte_node_errors *errs; /**< Node specific errors. */ rte_node_t id; /**< Node Identifier. */ rte_node_t parent_id; /**< Identifier of parent node. */ rte_edge_t nb_edges; /**< Number of edges from this node. */ From patchwork Thu Feb 22 12:23:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 137028 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5793A43B74; Thu, 22 Feb 2024 13:23:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 45F3E402CE; Thu, 22 Feb 2024 13:23:59 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 69D15409FA for ; Thu, 22 Feb 2024 13:23:57 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41M9BMF5021869; Thu, 22 Feb 2024 04:23:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=T7I1xto+LXgIR45RR8YCBH3IVze2msLGxo+inOHK2eA=; b=SAb qXTb+KOdrxnAmIkEoQCTyGX+emYvVr2h2vcwehEWk0wYGIDt/zHyY2eP+enbfCOm ZwqljJVz6ifp65YmpAuPja/7L7clP0CQlv7BKizNuT6TcMdHYvfC9OUs/+fli6rP 5bHJEDNSZ6LvbTZ2P01+pY9KNtSd8m/9H7NX4kNn3eGjH5opyYRYYult1/E3EsqF xSJCus/kgt5sPGVj5brlBc/8MHGsn3TFbmQLkug6j1/EupvSyso2nSa5DdxVSKXd sydNl3mFzKUB0A2VXZMtCg58tXCv49ho5uwS5EJneEoORqWbdLCj+PNmeJHKAPnF YAVqudSpWFNSwDtfAGw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3we3dw8j6h-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 04:23:56 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 22 Feb 2024 04:23:54 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 22 Feb 2024 04:23:54 -0800 Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id BFCD63F71D3; Thu, 22 Feb 2024 04:23:51 -0800 (PST) From: To: , , , CC: , Pavan Nikhilesh Subject: [24.11 PATCH v3 2/5] graph: add node fastpath error counters Date: Thu, 22 Feb 2024 17:53:39 +0530 Message-ID: <20240222122342.16375-2-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240222122342.16375-1-pbhagavatula@marvell.com> References: <20240222053639.15057-1-pbhagavatula@marvell.com> <20240222122342.16375-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: H83e7Xpqtx2p9ZBVCS2XmNh4gDYsUe8m X-Proofpoint-ORIG-GUID: H83e7Xpqtx2p9ZBVCS2XmNh4gDYsUe8m X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_09,2024-02-22_01,2023-05-22_02 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 From: Pavan Nikhilesh Add node fastpath error counters advertised during node registration. Signed-off-by: Pavan Nikhilesh --- lib/graph/graph_populate.c | 22 +++++++++++++++++++--- lib/graph/graph_private.h | 2 ++ lib/graph/rte_graph_worker_common.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/graph/graph_populate.c b/lib/graph/graph_populate.c index ed596a7711..924f5a3034 100644 --- a/lib/graph/graph_populate.c +++ b/lib/graph/graph_populate.c @@ -39,6 +39,15 @@ graph_fp_mem_calc_size(struct graph *graph) /* Pointer to next nodes(edges) */ sz += sizeof(struct rte_node *) * graph_node->node->nb_edges; } + sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE); + graph->errors_start = sz; + /* For 0..N node objects with error counters */ + STAILQ_FOREACH (graph_node, &graph->node_list, next) { + if (graph_node->node->errs == NULL) + continue; + sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE); + sz += sizeof(uint64_t) * graph_node->node->errs->nb_errors; + } graph->mem_sz = sz; return sz; @@ -64,6 +73,7 @@ graph_header_popluate(struct graph *_graph) static void graph_nodes_populate(struct graph *_graph) { + rte_graph_off_t err_off = _graph->errors_start; rte_graph_off_t off = _graph->nodes_start; struct rte_graph *graph = _graph->graph; struct graph_node *graph_node; @@ -99,6 +109,12 @@ graph_nodes_populate(struct graph *_graph) ->adjacency_list[count] ->node->name[0]; + if (graph_node->node->errs != NULL) { + node->err_off = err_off - off; + err_off += sizeof(uint64_t) * graph_node->node->errs->nb_errors; + err_off = RTE_ALIGN(err_off, RTE_CACHE_LINE_SIZE); + } + off += sizeof(struct rte_node *) * nb_edges; off = RTE_ALIGN(off, RTE_CACHE_LINE_SIZE); node->next = off; @@ -158,7 +174,7 @@ graph_node_nexts_populate(struct graph *_graph) } static int -graph_src_nodes_populate(struct graph *_graph) +graph_src_nodes_offset_populate(struct graph *_graph) { struct rte_graph *graph = _graph->graph; struct graph_node *graph_node; @@ -193,7 +209,7 @@ graph_fp_mem_populate(struct graph *graph) graph_pcap_init(graph); graph_nodes_populate(graph); rc = graph_node_nexts_populate(graph); - rc |= graph_src_nodes_populate(graph); + rc |= graph_src_nodes_offset_populate(graph); return rc; } @@ -228,7 +244,7 @@ graph_nodes_mem_destroy(struct rte_graph *graph) if (graph == NULL) return; - rte_graph_foreach_node(count, off, graph, node) + rte_graph_foreach_node (count, off, graph, node) rte_free(node->objs); } diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h index eb4d461c6e..a185a5a4ea 100644 --- a/lib/graph/graph_private.h +++ b/lib/graph/graph_private.h @@ -104,6 +104,8 @@ struct graph { /**< Memzone to store graph data. */ rte_graph_off_t nodes_start; /**< Node memory start offset in graph reel. */ + rte_graph_off_t errors_start; + /**< Node error memory start offset in graph reel. */ rte_node_t src_node_count; /**< Number of source nodes in a graph. */ struct rte_graph *graph; diff --git a/lib/graph/rte_graph_worker_common.h b/lib/graph/rte_graph_worker_common.h index 4045a7a8dc..b58f37c734 100644 --- a/lib/graph/rte_graph_worker_common.h +++ b/lib/graph/rte_graph_worker_common.h @@ -107,6 +107,7 @@ struct rte_node { uint64_t total_sched_fail; /**< Number of scheduled failure. */ } dispatch; }; + rte_graph_off_t err_off; /**< Offset to error counters. */ /* Fast path area */ #define RTE_NODE_CTX_SZ 16 uint8_t ctx[RTE_NODE_CTX_SZ] __rte_cache_aligned; /**< Node Context. */ From patchwork Thu Feb 22 12:23:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 137030 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE70B43B74; Thu, 22 Feb 2024 13:24:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A81CD40DDA; Thu, 22 Feb 2024 13:24:02 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id CD99E40A6C for ; Thu, 22 Feb 2024 13:23:59 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41MCBUsN015713; Thu, 22 Feb 2024 04:23:59 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=IyCZtznGjpbnlBQgca7ZUU/1WEPEf5gPrPWafDX4Gp0=; b=bMI PoYfCnrbXS/L4Gp1dyzw6120xWZ8PUlCNjjHLHUei+6NjRmhNUuXtmB0txroSWYl e479R2xzHhsJPhxuLzAfPaD5f/H8BKCcVmbOMEz0lwIUoY6Gn9G6uemnlqoA0Oxy xNdkEY6xP/8QxurNlCfeG7jYAE7p0mBbfWRftcyskus+DV090j4OqA4T+8GYSphf b9MXa6CNKuDEHkgSJYQzNcTSVMq88tLHMutduqYidghawuuLj+c/Y5yCXW34RUOv lgTGWe/7R2fEoGGUSqhMix/+h+OOlkCCQDpZ5ehocdK/4ZpnKN2jE9qREr8oEDEk E7H+djJrghEj9C+NzJg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3wd21kgc45-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 04:23:58 -0800 (PST) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 22 Feb 2024 04:23:56 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Thu, 22 Feb 2024 04:23:56 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 22 Feb 2024 04:23:56 -0800 Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 6814D3F71CF; Thu, 22 Feb 2024 04:23:54 -0800 (PST) From: To: , , , CC: , Pavan Nikhilesh Subject: [24.11 PATCH v3 3/5] graph: add stats for node specific errors Date: Thu, 22 Feb 2024 17:53:40 +0530 Message-ID: <20240222122342.16375-3-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240222122342.16375-1-pbhagavatula@marvell.com> References: <20240222053639.15057-1-pbhagavatula@marvell.com> <20240222122342.16375-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: ajJ8aO337dVoM_1QOAGAI3IB5sdnNXzs X-Proofpoint-ORIG-GUID: ajJ8aO337dVoM_1QOAGAI3IB5sdnNXzs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_09,2024-02-22_01,2023-05-22_02 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 From: Pavan Nikhilesh Add support for retrieving/printing stats for node specific errors using rte_graph_cluster_stats_get(). Signed-off-by: Pavan Nikhilesh --- lib/graph/graph_stats.c | 81 ++++++++++++++++++++++++++++++++++++++++- lib/graph/rte_graph.h | 4 ++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c index cc32245c05..7e026f0c68 100644 --- a/lib/graph/graph_stats.c +++ b/lib/graph/graph_stats.c @@ -122,6 +122,26 @@ print_node(FILE *f, const struct rte_graph_cluster_node_stats *stat) } } +static inline void +print_err(FILE *f, const struct rte_graph_cluster_node_stats *stat) +{ + int i; + + if (rte_graph_worker_model_get(STAILQ_FIRST(graph_list_head_get())->graph) == + RTE_GRAPH_MODEL_MCORE_DISPATCH) { + for (i = 0; i < stat->node_error_cntrs; i++) + fprintf(f, + "|\t%-24s|%15s|%-15" PRIu64 "|%15s|%15s|%15s|%15s|%15s|%11.4s|\n", + stat->node_error_desc[i], "", stat->node_error_count[i], "", "", "", + "", "", ""); + } else { + for (i = 0; i < stat->node_error_cntrs; i++) + fprintf(f, "|\t%-24s|%15s|%-15" PRIu64 "|%15s|%15.3s|%15.6s|%11.4s|\n", + stat->node_error_desc[i], "", stat->node_error_count[i], "", "", "", + ""); + } +} + static int graph_cluster_stats_cb(bool is_first, bool is_last, void *cookie, const struct rte_graph_cluster_node_stats *stat) @@ -133,8 +153,11 @@ graph_cluster_stats_cb(bool is_first, bool is_last, void *cookie, if (unlikely(is_first)) print_banner(f); - if (stat->objs) + if (stat->objs) { print_node(f, stat); + if (stat->node_error_cntrs) + print_err(f, stat); + } if (unlikely(is_last)) { if (model == RTE_GRAPH_MODEL_MCORE_DISPATCH) boarder_model_dispatch(); @@ -188,6 +211,7 @@ stats_mem_populate(struct rte_graph_cluster_stats **stats_in, struct cluster_node *cluster; struct rte_node *node; rte_node_t count; + uint8_t i; cluster = stats->clusters; @@ -225,6 +249,36 @@ stats_mem_populate(struct rte_graph_cluster_stats **stats_in, SET_ERR_JMP(ENOENT, free, "Failed to find node %s in graph %s", graph_node->node->name, graph->name); cluster->nodes[cluster->nb_nodes++] = node; + if (graph_node->node->errs) { + cluster->stat.node_error_cntrs = graph_node->node->errs->nb_errors; + cluster->stat.node_error_count = rte_zmalloc_socket( + NULL, sizeof(uint64_t) * graph_node->node->errs->nb_errors, + RTE_CACHE_LINE_SIZE, stats->socket_id); + if (cluster->stat.node_error_count == NULL) + SET_ERR_JMP(ENOMEM, free, "Failed to allocate memory node %s graph %s", + graph_node->node->name, graph->name); + + cluster->stat.node_error_desc = rte_zmalloc_socket( + NULL, sizeof(RTE_NODE_ERROR_DESC_SIZE) * graph_node->node->errs->nb_errors, + RTE_CACHE_LINE_SIZE, stats->socket_id); + if (cluster->stat.node_error_desc == NULL) { + rte_free(cluster->stat.node_error_count); + SET_ERR_JMP(ENOMEM, free, "Failed to allocate memory node %s graph %s", + graph_node->node->name, graph->name); + } + + for (i = 0; i < cluster->stat.node_error_cntrs; i++) { + if (rte_strscpy(cluster->stat.node_error_desc[i], + graph_node->node->errs->err_desc[i], + RTE_NODE_ERROR_DESC_SIZE) < 0) { + rte_free(cluster->stat.node_error_count); + rte_free(cluster->stat.node_error_desc); + SET_ERR_JMP(E2BIG, free, + "Error description overflow node %s graph %s", + graph_node->node->name, graph->name); + } + } + } stats->sz += stats->cluster_node_size; stats->max_nodes++; @@ -371,6 +425,18 @@ rte_graph_cluster_stats_create(const struct rte_graph_cluster_stats_param *prm) void rte_graph_cluster_stats_destroy(struct rte_graph_cluster_stats *stat) { + struct cluster_node *cluster; + rte_node_t count; + + cluster = stat->clusters; + for (count = 0; count < stat->max_nodes; count++) { + if (cluster->stat.node_error_cntrs) { + rte_free(cluster->stat.node_error_count); + rte_free(cluster->stat.node_error_desc); + } + + cluster = RTE_PTR_ADD(cluster, stat->cluster_node_size); + } return rte_free(stat); } @@ -382,9 +448,13 @@ cluster_node_arregate_stats(struct cluster_node *cluster) uint64_t sched_objs = 0, sched_fail = 0; struct rte_node *node; rte_node_t count; + uint64_t *err; + uint8_t i; int model; model = rte_graph_worker_model_get(STAILQ_FIRST(graph_list_head_get())->graph); + + memset(stat->node_error_count, 0, sizeof(uint64_t) * stat->node_error_cntrs); for (count = 0; count < cluster->nb_nodes; count++) { node = cluster->nodes[count]; @@ -397,6 +467,12 @@ cluster_node_arregate_stats(struct cluster_node *cluster) objs += node->total_objs; cycles += node->total_cycles; realloc_count += node->realloc_count; + + if (node->err_off == 0) + continue; + err = RTE_PTR_ADD(node, node->err_off); + for (i = 0; i < stat->node_error_cntrs; i++) + stat->node_error_count[i] += err[i]; } stat->calls = calls; @@ -449,6 +525,7 @@ rte_graph_cluster_stats_reset(struct rte_graph_cluster_stats *stat) { struct cluster_node *cluster; rte_node_t count; + uint8_t i; cluster = stat->clusters; @@ -464,6 +541,8 @@ rte_graph_cluster_stats_reset(struct rte_graph_cluster_stats *stat) node->prev_objs = 0; node->prev_cycles = 0; node->realloc_count = 0; + for (i = 0; i < node->node_error_cntrs; i++) + node->node_error_count[i] = 0; cluster = RTE_PTR_ADD(cluster, stat->cluster_node_size); } } diff --git a/lib/graph/rte_graph.h b/lib/graph/rte_graph.h index 70b68673c1..35f4c8db0c 100644 --- a/lib/graph/rte_graph.h +++ b/lib/graph/rte_graph.h @@ -223,6 +223,10 @@ struct rte_graph_cluster_node_stats { uint64_t realloc_count; /**< Realloc count. */ + uint8_t node_error_cntrs; /**< Number of Node error counters. */ + char (*node_error_desc)[RTE_NODE_ERROR_DESC_SIZE]; /**< Names of the Node error counters. */ + uint64_t *node_error_count; /**< Total error count per each error. */ + rte_node_t id; /**< Node identifier of stats. */ uint64_t hz; /**< Cycles per seconds. */ char name[RTE_NODE_NAMESIZE]; /**< Name of the node. */ From patchwork Thu Feb 22 12:23:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 137032 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B510843B74; Thu, 22 Feb 2024 13:24:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 451D240E54; Thu, 22 Feb 2024 13:24:10 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id DC59A40A7F for ; Thu, 22 Feb 2024 13:24:05 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41M9BWFI021919; Thu, 22 Feb 2024 04:24:02 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=Z8cq5e6L6bFw3u3xzLUEpmFPhasJoGYClZUnneRIIXo=; b=IvO FzhQc4bRmqMgpG5XC4aSQTIi7R5qOpdPo77ITkjxmdVyDnflU3/m8U05YzpElWw8 /+l9e3+J2UuDlxE2zoBiIqF1tGs5fzCems680xotz5O6tyx1Ks7pDn5muLElDzhj hgRDlVT5NJWtMB2dV3Nj7PH6YUd1zOJmi1jyN0WEZgaSD7E4JM/j5+hoeMiJViGZ dlbSAqkzLsJ/ubOMQ6B9Y4xN8quXTJT25oOUCVw2VQJb2ni6j4aHXDs+aaaiWZUO Q0roF7fBFhF/S4l7n4EMVRu63P0FfP9MmHlMK8C60TpOFZCi5hl8eJe+gyuXiGBE 3fTnl+68lR+K5ykM3Jg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3we3dw8j6w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 04:24:02 -0800 (PST) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 22 Feb 2024 04:24:00 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Thu, 22 Feb 2024 04:24:00 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 22 Feb 2024 04:24:00 -0800 Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 119F33F71CF; Thu, 22 Feb 2024 04:23:56 -0800 (PST) From: To: , , , , Pavan Nikhilesh , Ruifeng Wang , "Bruce Richardson" , Konstantin Ananyev CC: Subject: [24.11 PATCH v3 4/5] node: add error stats for ip4 lookup node Date: Thu, 22 Feb 2024 17:53:41 +0530 Message-ID: <20240222122342.16375-4-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240222122342.16375-1-pbhagavatula@marvell.com> References: <20240222053639.15057-1-pbhagavatula@marvell.com> <20240222122342.16375-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: oMxLMPVYWRTl5Zo5rHQdAmfi_FgFUg9_ X-Proofpoint-ORIG-GUID: oMxLMPVYWRTl5Zo5rHQdAmfi_FgFUg9_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_09,2024-02-22_01,2023-05-22_02 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 From: Pavan Nikhilesh Add error counters for ip4 LPM lookup failures in ip4_lookup node. Signed-off-by: Pavan Nikhilesh --- lib/node/ip4_lookup.c | 9 +++++++++ lib/node/ip4_lookup_neon.h | 5 +++++ lib/node/ip4_lookup_sse.h | 6 ++++++ lib/node/node_private.h | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/lib/node/ip4_lookup.c b/lib/node/ip4_lookup.c index 18955971f6..5a7921db75 100644 --- a/lib/node/ip4_lookup.c +++ b/lib/node/ip4_lookup.c @@ -86,6 +86,7 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; + NODE_INCREMENT_ERROR_ID(node, 0, (rc != 0), 1); node_mbuf_priv1(mbuf, dyn)->nh = (uint16_t)next_hop; next_hop = next_hop >> 16; @@ -219,11 +220,19 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node) return 0; } +static struct rte_node_errors ip4_lookup_errors = { + .nb_errors = 1, + .err_desc = { + [0] = "ip4_lookup_error", + }, +}; + static struct rte_node_register ip4_lookup_node = { .process = ip4_lookup_node_process_scalar, .name = "ip4_lookup", .init = ip4_lookup_node_init, + .errs = &ip4_lookup_errors, .nb_edges = RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP + 1, .next_nodes = { diff --git a/lib/node/ip4_lookup_neon.h b/lib/node/ip4_lookup_neon.h index d5c8da3719..907c7c955a 100644 --- a/lib/node/ip4_lookup_neon.h +++ b/lib/node/ip4_lookup_neon.h @@ -116,6 +116,10 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, priv01.u16[4] = result.u16[2]; priv23.u16[0] = result.u16[4]; priv23.u16[4] = result.u16[6]; + NODE_INCREMENT_ERROR_ID(node, 0, result.u16[1] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, result.u16[3] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, result.u16[5] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, result.u16[7] == (drop_nh >> 16), 1); node_mbuf_priv1(mbuf0, dyn)->u = priv01.u64[0]; node_mbuf_priv1(mbuf1, dyn)->u = priv01.u64[1]; @@ -202,6 +206,7 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; + NODE_INCREMENT_ERROR_ID(node, 0, (rc != 0), 1); node_mbuf_priv1(mbuf0, dyn)->nh = (uint16_t)next_hop; next_hop = next_hop >> 16; next0 = (uint16_t)next_hop; diff --git a/lib/node/ip4_lookup_sse.h b/lib/node/ip4_lookup_sse.h index 74dbf97533..a38131e629 100644 --- a/lib/node/ip4_lookup_sse.h +++ b/lib/node/ip4_lookup_sse.h @@ -115,6 +115,11 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, /* Perform LPM lookup to get NH and next node */ rte_lpm_lookupx4(lpm, dip, dst.u32, drop_nh); + NODE_INCREMENT_ERROR_ID(node, 0, dst.u16[1] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, dst.u16[3] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, dst.u16[5] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, dst.u16[7] == (drop_nh >> 16), 1); + /* Extract next node id and NH */ node_mbuf_priv1(mbuf0, dyn)->nh = dst.u32[0] & 0xFFFF; next0 = (dst.u32[0] >> 16); @@ -206,6 +211,7 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; + NODE_INCREMENT_ERROR_ID(node, 0, rc != 0, 1); node_mbuf_priv1(mbuf0, dyn)->nh = next_hop & 0xFFFF; next0 = (next_hop >> 16); diff --git a/lib/node/node_private.h b/lib/node/node_private.h index 2b9bad1a11..25870f97fe 100644 --- a/lib/node/node_private.h +++ b/lib/node/node_private.h @@ -12,6 +12,8 @@ #include #include +#include + extern int rte_node_logtype; #define RTE_LOGTYPE_NODE rte_node_logtype @@ -89,4 +91,10 @@ node_mbuf_priv2(struct rte_mbuf *m) return (struct node_mbuf_priv2 *)rte_mbuf_to_priv(m); } +#define NODE_INCREMENT_ERROR_ID(node, id, cond, cnt) \ + { \ + if (unlikely(rte_graph_has_stats_feature() && (cond))) \ + ((uint64_t *)RTE_PTR_ADD(node, node->err_off))[id] += (cnt); \ + } + #endif /* __NODE_PRIVATE_H__ */ From patchwork Thu Feb 22 12:23:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 137031 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D28A43B74; Thu, 22 Feb 2024 13:24:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1813D40A81; Thu, 22 Feb 2024 13:24:09 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 6608540281 for ; Thu, 22 Feb 2024 13:24:05 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41M9BLTl021857; Thu, 22 Feb 2024 04:24:04 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=eg2oWH9S5lVwQQp1XMkbpgWHLbUwI5F9wWezit3Imyc=; b=O2Y mA7+j7Ph9b/SdqKPyNntC5wjSFtcbiZgVdTt9ZVnsCikFvJxGVt+lro6/0t30mEn gx3hPcZr4W5jSdyZYY53UylDEzqlgvvGANjTUjxEgQJ9CoEiMxmnXjNGuumHrfo3 bDg+xhjCE/6ou+BNTWgnusPfEGJDzgFODBqRA1w19Uayhr+00PbEsUrU3Ttb15mb HZfcDk9jVQTx7Z4D0a2UruBZg+oNesNweDSRRY3VTICljIssDpp8lMHh/iZpo8md VQ13QbxsegyUUxoxmgOHi1Fv/9GBSDFEdofvGhSHOQvkG4Ir/U5K3/B1Z2Kno3vj YH0rKGx+bMmFT3Yd3PA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3we3dw8j75-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 04:24:04 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 22 Feb 2024 04:24:02 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 22 Feb 2024 04:24:02 -0800 Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 797E53F71CF; Thu, 22 Feb 2024 04:24:00 -0800 (PST) From: To: , , , , Pavan Nikhilesh CC: Subject: [24.11 PATCH v3 5/5] node: add error stats for ip4 reassembly node Date: Thu, 22 Feb 2024 17:53:42 +0530 Message-ID: <20240222122342.16375-5-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240222122342.16375-1-pbhagavatula@marvell.com> References: <20240222053639.15057-1-pbhagavatula@marvell.com> <20240222122342.16375-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 140N018ZJ2ZnS6Uqi-Nqd6QJ4SdguR4R X-Proofpoint-ORIG-GUID: 140N018ZJ2ZnS6Uqi-Nqd6QJ4SdguR4R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_09,2024-02-22_01,2023-05-22_02 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 From: Pavan Nikhilesh Add reassembly failure error counter for ip4 reassembly node. Signed-off-by: Pavan Nikhilesh --- lib/node/ip4_reassembly.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/node/ip4_reassembly.c b/lib/node/ip4_reassembly.c index 04823cc596..ab71ef1331 100644 --- a/lib/node/ip4_reassembly.c +++ b/lib/node/ip4_reassembly.c @@ -120,6 +120,7 @@ ip4_reassembly_node_process(struct rte_graph *graph, struct rte_node *node, void rte_node_next_stream_put(graph, node, RTE_NODE_IP4_REASSEMBLY_NEXT_PKT_DROP, dr->cnt); idx += dr->cnt; + NODE_INCREMENT_ERROR_ID(node, 0, dr->cnt, dr->cnt); dr->cnt = 0; } @@ -165,11 +166,19 @@ ip4_reassembly_node_init(const struct rte_graph *graph, struct rte_node *node) return 0; } +static struct rte_node_errors ip4_reassembly_errors = { + .nb_errors = 1, + .err_desc = { + [0] = "ip4_reassembly_error", + }, +}; + static struct rte_node_register ip4_reassembly_node = { .process = ip4_reassembly_node_process, .name = "ip4_reassembly", .init = ip4_reassembly_node_init, + .errs = &ip4_reassembly_errors, .nb_edges = RTE_NODE_IP4_REASSEMBLY_NEXT_PKT_DROP + 1, .next_nodes = {