DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sunil Kumar Kori <skori@marvell.com>
To: Rakesh Kudurumalla <rkudurumalla@marvell.com>,
	Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>,
	Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	Rakesh Kudurumalla <rkudurumalla@marvell.com>
Subject: RE: [EXT] [PATCH v4 1/3] node: support to add next node to ethdev Rx node
Date: Thu, 7 Dec 2023 08:26:28 +0000	[thread overview]
Message-ID: <CO6PR18MB3860D66785A74D242050FBFFB48BA@CO6PR18MB3860.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20231205092710.1375795-1-rkudurumalla@marvell.com>

> -----Original Message-----
> From: Rakesh Kudurumalla <rkudurumalla@marvell.com>
> Sent: Tuesday, December 5, 2023 2:57 PM
> To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Pavan
> Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
> Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
> Rakesh Kudurumalla <rkudurumalla@marvell.com>
> Subject: [EXT] [PATCH v4 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@marvell.com>
> ---
> v4: Resolve compilation issues
> 
>  lib/node/ethdev_ctrl.c      | 45
> +++++++++++++++++++++++++++++++++++++
>  lib/node/rte_node_eth_api.h | 19 ++++++++++++++++
>  lib/node/version.map        |  1 +
>  3 files changed, 65 insertions(+)
> 
> diff --git a/lib/node/ethdev_ctrl.c b/lib/node/ethdev_ctrl.c index
> d564b80e37..0faf4c19f2 100644
> --- a/lib/node/ethdev_ctrl.c
> +++ b/lib/node/ethdev_ctrl.c
> @@ -3,6 +3,7 @@
>   */
> 
>  #include <stdlib.h>
> +#include <errno.h>
> 
>  #include <rte_ethdev.h>
>  #include <rte_graph.h>
> @@ -129,3 +130,47 @@ 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)
> +		return rc;
> +
Better to use goto scheme. 

> +	count = rte_node_edge_get(id, NULL);
> +
> +	if (count == RTE_NODE_ID_INVALID)
> +		return rc;
> +
> +	next_nodes = malloc(count);
> +	if (next_nodes == NULL)
> +		return -ENOMEM;
> +
> +	count = rte_node_edge_get(id, next_nodes);
> +
Here it looks like that loop can misbehave for invalid edge_name. I might be wrong.
Consider the case. 
1. edge_name = "test_name"
2. number of elements in next_nodes is 2 and no element is matching with edge_name.
In this case, loop might misbehave as there will not be any NULL entry. 

Did you try a negative test case on this API ?

> +	while (next_nodes[i] != NULL) {
> +		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 exit;
> +				}
> +				elem = elem->next;
> +			}
> +		}
> +		i++;
> +	}
> +exit:
> +	free(next_nodes);
> +	return rc;
> +}
> diff --git a/lib/node/rte_node_eth_api.h b/lib/node/rte_node_eth_api.h index
> eaae50772d..b082a5bec1 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>
> 
>  /**
>   * Port config for ethdev_rx and ethdev_tx node.
> @@ -57,6 +58,24 @@ struct rte_node_ethdev_config {
>   */
>  int rte_node_eth_config(struct rte_node_ethdev_config *cfg,
>  			uint16_t cnt, uint16_t nb_graphs);
> +
> +/**
> + * Update ethdev rx next node.
> + *
> + * @param id
> + *   Node id whose edge is to be updated.
> + * @param edge_name
> + *   Name of the next node.
> + *
> + * @return
> + *   RTE_EDGE_ID_INVALID if id is invalid
I think, This is not needed now. Below error code handles for invalid ID too. 

> + *   ENINVAL: Either of input parameters are invalid
> + *   ENOMEM: If memory allocation failed
> + *   0 on successful initialization.
> + */
> +__rte_experimental
> +int rte_node_ethdev_rx_next_update(rte_node_t id, const char
> +*edge_name);
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/lib/node/version.map b/lib/node/version.map index
> 99ffcdd414..07abc3a79f 100644
> --- a/lib/node/version.map
> +++ b/lib/node/version.map
> @@ -16,6 +16,7 @@ EXPERIMENTAL {
>  	rte_node_ip6_route_add;
> 
>  	# added in 23.11
> +	rte_node_ethdev_rx_next_update;
>  	rte_node_ip4_reassembly_configure;
>  	rte_node_udp4_dst_port_add;
>  	rte_node_udp4_usr_node_add;
> --
> 2.25.1


  parent reply	other threads:[~2023-12-07  8:26 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23  6:15 [PATCH 1/2] node: forward packet from ethdev_rx node Rakesh Kudurumalla
2023-11-23  6:15 ` [PATCH 2/2] app/graph: implement L2FWD usecase Rakesh Kudurumalla
2023-11-24  8:13   ` Sunil Kumar Kori
2023-11-24  7:45 ` [EXT] [PATCH 1/2] node: forward packet from ethdev_rx node Sunil Kumar Kori
2023-12-04 18:04 ` [PATCH v2 1/3] node: support to add next node to ethdev Rx node Rakesh Kudurumalla
2023-12-04 18:04   ` [PATCH v2 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2023-12-04 18:04   ` [PATCH v2 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2023-12-05  7:46   ` [PATCH v3 1/3] node: support to add next node to ethdev Rx node Rakesh Kudurumalla
2023-12-05  7:46     ` [PATCH v3 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2023-12-05  7:46     ` [PATCH v3 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2023-12-05  9:27     ` [PATCH v4 1/3] node: support to add next node to ethdev Rx node Rakesh Kudurumalla
2023-12-05  9:27       ` [PATCH v4 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2023-12-07 10:38         ` Sunil Kumar Kori
2023-12-05  9:27       ` [PATCH v4 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2023-12-07 11:07         ` Sunil Kumar Kori
2023-12-07  8:26       ` Sunil Kumar Kori [this message]
2023-12-07  9:30       ` [PATCH v4 1/3] node: support to add next node to ethdev Rx node David Marchand
2023-12-15  9:15       ` [PATCH v5 " Rakesh Kudurumalla
2023-12-15  9:15         ` [PATCH v5 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2023-12-18 10:44           ` Sunil Kumar Kori
2023-12-15  9:15         ` [PATCH v5 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2023-12-18 10:57           ` Sunil Kumar Kori
2023-12-18 10:41         ` [EXT] [PATCH v5 1/3] node: support to add next node to ethdev Rx node Sunil Kumar Kori
2023-12-20  8:59         ` [PATCH v6 " Rakesh Kudurumalla
2023-12-20  8:59           ` [PATCH v6 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2023-12-20  8:59           ` [PATCH v6 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2023-12-20  9:44           ` [PATCH v7 1/3] node: support to add next node to ethdev Rx node Rakesh Kudurumalla
2023-12-20  9:44             ` [PATCH v7 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2023-12-20  9:44             ` [PATCH v7 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2024-01-01  8:37             ` [PATCH v8 1/3] node: support to add next node to ethdev Rx node Rakesh Kudurumalla
2024-01-01  8:37               ` [PATCH v8 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2024-01-02  6:45                 ` Sunil Kumar Kori
2024-01-01  8:37               ` [PATCH v8 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2024-01-02  6:46                 ` Sunil Kumar Kori
2024-01-02  7:28               ` [PATCH v9 1/3] node: support to add next node to ethdev Rx node Rakesh Kudurumalla
2024-01-02  7:28                 ` [PATCH v9 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2024-01-02  7:28                 ` [PATCH v9 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2024-01-02  7:30                 ` [PATCH v10 1/3] node: support to add next node to ethdev Rx node Rakesh Kudurumalla
2024-01-02  7:30                   ` [PATCH v10 2/3] app/graph: add ethdev forward command Rakesh Kudurumalla
2024-01-02  7:30                   ` [PATCH v10 3/3] app/graph: implement port forward usecase Rakesh Kudurumalla
2024-02-18 22:22                     ` Thomas Monjalon
2024-02-19  3:14                       ` Jerin Jacob
2024-01-02  9:20                   ` [EXT] [PATCH v10 1/3] node: support to add next node to ethdev Rx node Sunil Kumar Kori
2024-02-18 23:15                   ` Thomas Monjalon
2024-02-18 23:17                   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO6PR18MB3860D66785A74D242050FBFFB48BA@CO6PR18MB3860.namprd18.prod.outlook.com \
    --to=skori@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=pbhagavatula@marvell.com \
    --cc=rkudurumalla@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).