From patchwork Thu Nov 23 06:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 134549 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 D56CD433A3; Thu, 23 Nov 2023 07:16:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A801A427E8; Thu, 23 Nov 2023 07:16:04 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id C5F7F402C2 for ; Thu, 23 Nov 2023 07:16:02 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN5Ymoj022832 for ; Wed, 22 Nov 2023 22:16:02 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=SC9QVhGAYFi4xmTHqOOketJtpcvtyn50z6VT3DaR5FA=; b=I9JWIqWUMt9Qibvc1bLZ5Tc1yArt3A2zXy4+gNbMcJIfFYIhRX/9F9YfXdvvLC8jx42A dNknPg6BTjq5I/BSm01l9sVx/tVptKalCGB+t0AQDlWhOzForqsMUTjb+vjDIzDYVVl1 9wxESf/Luam9R0+wLXa5+j6oq9xkhImnTlTz4EA0qkGpWeD1MPDU4fEkNXCWmdyFPyNc 5XhMYMrQQNT9yKeHPY4sy0iANpaB3gTwJt4CJwJtxhBS8UfIiWhBBWs/Pq7X3M0BQ/YM 2xPxiS7gndmaD9nTKTF3igiRwVlK1iRYWGS7Cm7s+yIO5pyS+/hPvnKgykgov21GfFh6 9w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uhpxn2056-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 22 Nov 2023 22:16:01 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 22 Nov 2023 22:15:59 -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; Wed, 22 Nov 2023 22:15:59 -0800 Received: from localhost.localdomain (unknown [10.28.36.154]) by maili.marvell.com (Postfix) with ESMTP id EF46D3F7088; Wed, 22 Nov 2023 22:15:57 -0800 (PST) From: Rakesh Kudurumalla To: Nithin Dabilpuram , Pavan Nikhilesh CC: , , Rakesh Kudurumalla Subject: [PATCH 1/2] node: forward packet from ethdev_rx node Date: Thu, 23 Nov 2023 11:45:54 +0530 Message-ID: <20231123061555.469038-1-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: mcnvCZJ_O-o4y9FBH4LVu-8bkaZW9Ggw X-Proofpoint-GUID: mcnvCZJ_O-o4y9FBH4LVu-8bkaZW9Ggw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-23_03,2023-11-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 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 --- lib/node/ethdev_ctrl.c | 40 +++++++++++++++++++++++++++++++++++++ lib/node/rte_node_eth_api.h | 17 ++++++++++++++++ lib/node/version.map | 1 + 3 files changed, 58 insertions(+) diff --git a/lib/node/ethdev_ctrl.c b/lib/node/ethdev_ctrl.c index d564b80e37..d64fc33655 100644 --- a/lib/node/ethdev_ctrl.c +++ b/lib/node/ethdev_ctrl.c @@ -129,3 +129,43 @@ 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 (id == RTE_EDGE_ID_INVALID) + return id; + + count = rte_node_edge_get(id, NULL); + next_nodes = malloc(count); + if (next_nodes == NULL) + return rc; + + count = rte_node_edge_get(id, next_nodes); + + 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 found; + } + elem = elem->next; + } + } + i++; + } +found: + 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..66cea2d31e 100644 --- a/lib/node/rte_node_eth_api.h +++ b/lib/node/rte_node_eth_api.h @@ -57,6 +57,23 @@ 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 + * EINVAL if edge name doesn't exist + * 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;