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 B137945B37; Mon, 14 Oct 2024 13:59:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 80B3940676; Mon, 14 Oct 2024 13:58:51 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id B511040659 for ; Mon, 14 Oct 2024 13:58:47 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49E9kSsZ015853; Mon, 14 Oct 2024 04:58:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=y FRmkG7OJv7On/fozU3RV/beRTH7CBpWxzS3QrAwH/I=; b=WtpDCCyv9awbW9MJ+ r7w/cZe7zZIxtdgrywAPATSt3MquNGtnxtQ/eWZw8TRts8ihzT0bsy5DLGQG6y0j E6Lws/7axXhHfjgegHiyqkOxSnR5hB9WFJijLFEe92Zyz0KicrtQsgeVsmx3cmbu 1bVrK/b/CBxA7YhyPbxYKmLqC6KgoW23Yiao49566zQ19kQxXgVV6Htlbr3pY9OA pUtIcYZdI+gNbaxRQcaAJ0Gs0Fuz1H+CYxCW/gwasJSDSWNllymXNTmCN7PaE2hS fUSVcXjO4C39f7MT6i/lUc2P4zg7hKTnYBYtVlNbX8mbifkdRE+OvOwEXM/GD9iM MrrpQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 4290y706m9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Oct 2024 04:58:37 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 14 Oct 2024 04:58:34 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 14 Oct 2024 04:58:34 -0700 Received: from MININT-80QBFE8.corp.innovium.com (MININT-80QBFE8.marvell.com [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 5098A5B6924; Mon, 14 Oct 2024 04:58:29 -0700 (PDT) From: To: , , , , , , Zhirun Yan CC: , Pavan Nikhilesh Subject: [PATCH v5 1/3] graph: add support for node specific errors Date: Mon, 14 Oct 2024 17:28:19 +0530 Message-ID: <20241014115821.4204-2-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241014115821.4204-1-pbhagavatula@marvell.com> References: <20240816150926.5789-1-pbhagavatula@marvell.com> <20241014115821.4204-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-Proofpoint-GUID: HFUEooHj31fa2DRT3TYqlRZ3VldNpMyt X-Proofpoint-ORIG-GUID: HFUEooHj31fa2DRT3TYqlRZ3VldNpMyt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 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 Acked-by: Kiran Kumar K --- 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 +++++++++++++----- doc/guides/rel_notes/deprecation.rst | 6 - doc/guides/rel_notes/release_24_11.rst | 8 + lib/graph/graph_private.h | 1 + lib/graph/node.c | 37 +- lib/graph/rte_graph.h | 7 + 8 files changed, 1024 insertions(+), 307 deletions(-) diff --git a/doc/guides/prog_guide/graph_lib.rst b/doc/guides/prog_guide/gr= aph_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 sou= rce 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 gr= aph. +functions can link them together to create a complex packet processing gra= ph. 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 r= te_node_register::nb_edges``. This is a use case to address the static node scheme where one knows upfro= nt the ``next_nodes[]`` of the node. @@ -385,8 +398,9 @@ Understanding the memory layout helps to debug the grap= h 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 functio= ns 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/p= rog_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=3D"1.3.2 (091e20e, 2023-11-25, custom)" + xmlns:inkscape=3D"http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi=3D"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns=3D"http://www.w3.org/2000/svg" + xmlns:svg=3D"http://www.w3.org/2000/svg" + xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc=3D"http://creativecommons.org/ns#" + xmlns:dc=3D"http://purl.org/dc/elements/1.1/"> @@ -27,12 +27,51 @@ image/svg+xml - + + id=3D"defs423"> + + + + + + + + + + inkscape:current-layer=3D"g417" + inkscape:showpageshadow=3D"2" + inkscape:pagecheckerboard=3D"0" + inkscape:deskcolor=3D"#d1d1d1" + inkscape:lockguides=3D"true" /> + style=3D"fill:#ffffff;fill-rule:evenodd;fill-opacity:1" /> @@ -90,87 +133,92 @@ inkscape:connector-curvature=3D"0" style=3D"fill-rule:evenodd;stroke:#c27ba0;stroke-width:1;stroke-lin= ecap:butt;stroke-linejoin:round;stroke-dasharray:4, 3, 1, 3" /> + style=3D"fill-rule:nonzero;stroke:#1155cc;stroke-width:0.99953708;s= troke-linecap:butt;stroke-dasharray:none" /> + @@ -275,32 +323,37 @@ inkscape:connector-curvature=3D"0" style=3D"fill:#000000;fill-opacity:0;fill-rule:evenodd" /> + @@ -975,10 +1028,11 @@ inkscape:connector-curvature=3D"0" style=3D"fill:#000000;fill-opacity:0;fill-rule:evenodd" /> + style=3D"fill-rule:evenodd;stroke:#595959;stroke-width:1.2253;strok= e-linecap:butt;stroke-linejoin:round;stroke-dasharray:9.80238, 3.67589" + sodipodi:nodetypes=3D"cssscc" /> + style=3D"fill-rule:evenodd;stroke:#595959;stroke-width:1;stroke-lin= ecap:butt;stroke-linejoin:round;stroke-dasharray:8, 3" + sodipodi:nodetypes=3D"cssscc" /> + style=3D"fill-rule:evenodd;stroke:#595959;stroke-width:1;stroke-lin= ecap:butt;stroke-linejoin:round;stroke-dasharray:8, 3" + sodipodi:nodetypes=3D"cssc" /> @@ -1020,10 +1076,11 @@ inkscape:connector-curvature=3D"0" style=3D"fill:#000000;fill-opacity:0;fill-rule:evenodd" /> + style=3D"fill-rule:evenodd;stroke:#595959;stroke-width:1;stroke-lin= ecap:butt;stroke-linejoin:round;stroke-dasharray:8, 3" + sodipodi:nodetypes=3D"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/pr= og_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=3D"svg1" + inkscape:version=3D"1.3.2 (091e20e, 2023-11-25, custom)" + sodipodi:docname=3D"graph_mem_layout.svg" + xmlns:inkscape=3D"http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi=3D"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink=3D"http://www.w3.org/1999/xlink" + xmlns=3D"http://www.w3.org/2000/svg" + xmlns:svg=3D"http://www.w3.org/2000/svg"> - - - + inkscape:current-layer=3D"layer1"> + + + + + + + + + + + + + + + + + + + + + + + - - - + inkscape:label=3D"Layer 1" + inkscape:groupmode=3D"layer" + id=3D"layer1"> + + + + + id=3D"path286" + style=3D"fill:none" /> + + + id=3D"path338" + style=3D"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/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/de= precation.rst index 1535ea7abf..8f1d43e18e 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -196,9 +196,3 @@ Deprecation Notices will be deprecated and subsequently removed in DPDK 24.11 release. Before this, the new port library API (functions rte_swx_port_*) will gradually transition from experimental to stable status. - -* graph: The graph library data structures will be modified - to support node specific errors. - The structures ``rte_node``, ``rte_node_register`` - and ``rte_graph_cluster_node_stats`` will be extended - to include node error counters and error description. diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/= release_24_11.rst index 10e3617251..e0a86ad9ef 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -162,6 +162,10 @@ New Features * Added independent enqueue feature. +* **Add node error stats for rte_graph** + + * Added ability for node to advertise and update multiple error counters, + that can be retrieved using rte_graph_cluster_stats_get. Removed Items ------------- @@ -244,6 +248,10 @@ ABI Changes * eventdev: Added ``preschedule_type`` field to ``rte_event_dev_config`` s= tructure. +* graph: To accommodate node specific error counters added ``error_cntrs``, + ``error_desc`` and ``error_count`` to ``rte_graph_cluster_node_stats``, + added new structure ``rte_node_errors`` to ``rte_node_register`` and + added ``err_off`` to ``rte_node``. Known Issues ------------ diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h index d557d55f2d..e663b04d8b 100644 --- a/lib/graph/graph_private.h +++ b/lib/graph/graph_private.h @@ -61,6 +61,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 =3D sizeof(*reg->errs) + (reg->errs->nb_errors * RTE_NODE_ERROR_DESC_= SIZE); + node->errs =3D calloc(1, sz); + if (node->errs =3D=3D NULL) { + rte_errno =3D ENOMEM; + goto free; + } + + node->errs->nb_errors =3D reg->errs->nb_errors; + for (i =3D 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 =3D reg->flags; node->process =3D reg->process; node->init =3D reg->init; @@ -97,7 +112,7 @@ __rte_node_register(const struct rte_node_register *reg) for (i =3D 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 =3D 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 =3D calloc(1, sizeof(*node->errs) + + (node->errs->nb_errors * RTE_NODE_ERROR_DESC_SIZE)); + if (reg->errs =3D=3D NULL) { + rte_errno =3D ENOMEM; + goto fail; + } + + for (i =3D 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 =3D node->flags; reg->process =3D node->process; @@ -150,6 +181,8 @@ node_clone(struct node *node, const char *name) goto free; rc =3D __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 ecfec2068a..b28143d737 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_clus= ter_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. */ -- 2.25.1