[EXT] [PATCH v5 1/3] node: support to add next node to ethdev Rx node
Sunil Kumar Kori
skori at marvell.com
Mon Dec 18 11:41:29 CET 2023
Overall patch looks okay.
Just a minor comments.
Regards
Sunil Kumar Kori
> -----Original Message-----
> From: Rakesh Kudurumalla <rkudurumalla at marvell.com>
> Sent: Friday, December 15, 2023 2:46 PM
> To: Nithin Kumar Dabilpuram <ndabilpuram at marvell.com>; Pavan
> Nikhilesh Bhagavatula <pbhagavatula at marvell.com>
> Cc: dev at dpdk.org; Jerin Jacob Kollanukkaran <jerinj at marvell.com>;
> Rakesh Kudurumalla <rkudurumalla at marvell.com>
> Subject: [EXT] [PATCH v5 1/3] node: support to add next node to ethdev Rx
> node
>
> External Email
>
> ----------------------------------------------------------------------
> By default all packets received on ethdev_rx node is forwarded to pkt_cls
> node.This patch provides library support to add a new node as next node to
> ethdev_rx node and forward packet to new node from rx node.
>
> Signed-off-by: Rakesh Kudurumalla <rkudurumalla at marvell.com>
> ---
> V5: Addressed comments
> Handled negative test case
>
> lib/node/ethdev_ctrl.c | 48
> +++++++++++++++++++++++++++++++++++++
> lib/node/rte_node_eth_api.h | 18 ++++++++++++++
> lib/node/version.map | 3 +++
> 3 files changed, 69 insertions(+)
>
> diff --git a/lib/node/ethdev_ctrl.c b/lib/node/ethdev_ctrl.c index
> d564b80e37..b886d2fe32 100644
> --- a/lib/node/ethdev_ctrl.c
> +++ b/lib/node/ethdev_ctrl.c
> @@ -3,6 +3,7 @@
> */
>
> #include <stdlib.h>
> +#include <errno.h>
>
Sort the header files.
> #include <rte_ethdev.h>
> #include <rte_graph.h>
> @@ -129,3 +130,50 @@ rte_node_eth_config(struct
> rte_node_ethdev_config *conf, uint16_t nb_confs,
> ctrl.nb_graphs = nb_graphs;
> return 0;
> }
> +
> +int
> +rte_node_ethdev_rx_next_update(rte_node_t id, const char *edge_name) {
> + struct ethdev_rx_node_main *data;
> + ethdev_rx_node_elem_t *elem;
> + char **next_nodes;
> + int rc = -EINVAL;
> + uint32_t count;
> + uint16_t i = 0;
> +
> + if (edge_name == NULL)
> + goto exit;
> +
> + count = rte_node_edge_get(id, NULL);
> +
> + if (count == RTE_NODE_ID_INVALID)
> + goto exit;
> +
> + next_nodes = malloc(count);
> + if (next_nodes == NULL) {
> + rc = -ENOMEM;
> + goto exit;
> + }
> +
> + count = rte_node_edge_get(id, next_nodes);
> +
> + while (next_nodes[i] != NULL && i < count) {
I believe, both conditions are not needed. Any of the condition will be sufficient to cater the loop termination.
Please avoid either of them.
> + if (strcmp(edge_name, next_nodes[i]) == 0) {
> + data = ethdev_rx_get_node_data_get();
> + elem = data->head;
> + while (elem->next != data->head) {
> + if (elem->nid == id) {
> + elem->ctx.cls_next = i;
> + rc = 0;
> + goto found;
> + }
> + elem = elem->next;
> + }
> + }
> + i++;
> + }
> +found:
> + free(next_nodes);
> +exit:
> + return rc;
> +}
> diff --git a/lib/node/rte_node_eth_api.h b/lib/node/rte_node_eth_api.h index
> eaae50772d..5b5ca491dc 100644
> --- a/lib/node/rte_node_eth_api.h
> +++ b/lib/node/rte_node_eth_api.h
> @@ -23,6 +23,7 @@ extern "C" {
> #include <rte_compat.h>
> #include <rte_common.h>
> #include <rte_mempool.h>
> +#include <rte_graph.h>
>
Sort the header files.
> --
> 2.25.1
More information about the dev
mailing list