From patchwork Wed Dec 20 08:59:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 135378 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 01E3343731; Wed, 20 Dec 2023 09:59:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79FF940266; Wed, 20 Dec 2023 09:59:52 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 89979400EF for ; Wed, 20 Dec 2023 09:59:50 +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 3BK0WruU028376 for ; Wed, 20 Dec 2023 00:59:49 -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=lYapMK+5n/65h1Ia1rNklTek0oQvS36mIOK0rN4/3jk=; b=ZzF clEOa6at7TrtsOR9qGxbWPWO6wrwaVQNndwjcZgin43dkxPRSUeye/JIHp4Dnidt ANYhrpZmFb5EClWl9dan/zLiP8Eoax8kP6hvg55r+WPbRvkq5S2M2UdhGEb4i1Me ga21sbkuaks6fG7VGQNmJqQHdU7Qh54b2Eewd4BdjeGSeKYXlceOSXx6nEaG/43M ph0TuvfKUjOQ90ZbKoJrjoC7P94/RAI4ux91aJJ3jEg0sWuDX967LSLAlW6Xi6Iw v45b29U8fDq35P9J3EQshN65dZ0n2DlhedqxjsfVFZGCbPZBL7BU+XC4vs2+f/9U YWSmEgRcVnfNlWE1SLA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3v3ntrh9ey-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 20 Dec 2023 00:59:49 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 20 Dec 2023 00:59:47 -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; Wed, 20 Dec 2023 00:59:46 -0800 Received: from localhost.localdomain (unknown [10.28.36.154]) by maili.marvell.com (Postfix) with ESMTP id 265623F7048; Wed, 20 Dec 2023 00:59:44 -0800 (PST) From: Rakesh Kudurumalla To: Nithin Dabilpuram , Pavan Nikhilesh CC: , , Rakesh Kudurumalla Subject: [PATCH v6 1/3] node: support to add next node to ethdev Rx node Date: Wed, 20 Dec 2023 14:29:40 +0530 Message-ID: <20231220085942.759954-1-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215091551.298964-1-rkudurumalla@marvell.com> References: <20231215091551.298964-1-rkudurumalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: LPUpnlCwkctLQQcheCxEhg7KYjKqWNz4 X-Proofpoint-ORIG-GUID: LPUpnlCwkctLQQcheCxEhg7KYjKqWNz4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_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 --- V6: Addressed comments updated documentation lib/node/ethdev_ctrl.c | 49 ++++++++++++++++++++++++++++++++++++- lib/node/rte_node_eth_api.h | 18 ++++++++++++++ lib/node/version.map | 3 +++ 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/lib/node/ethdev_ctrl.c b/lib/node/ethdev_ctrl.c index d564b80e37..ab54b7f0d4 100644 --- a/lib/node/ethdev_ctrl.c +++ b/lib/node/ethdev_ctrl.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(C) 2020 Marvell International Ltd. */ - +#include #include #include @@ -129,3 +129,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 size; + uint16_t i = 0; + + if (edge_name == NULL) + goto exit; + + size = rte_node_edge_get(id, NULL); + + if (size == RTE_NODE_ID_INVALID) + goto exit; + + next_nodes = calloc(size + 1, sizeof(*next_nodes)); + if (next_nodes == NULL) { + rc = -ENOMEM; + goto exit; + } + + size = 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); +exit: + return rc; +} diff --git a/lib/node/rte_node_eth_api.h b/lib/node/rte_node_eth_api.h index eaae50772d..d2f705e908 100644 --- a/lib/node/rte_node_eth_api.h +++ b/lib/node/rte_node_eth_api.h @@ -22,6 +22,7 @@ extern "C" { #include #include +#include #include /** @@ -57,6 +58,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 + * 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..6bdb944c4c 100644 --- a/lib/node/version.map +++ b/lib/node/version.map @@ -19,4 +19,7 @@ EXPERIMENTAL { rte_node_ip4_reassembly_configure; rte_node_udp4_dst_port_add; rte_node_udp4_usr_node_add; + + # added in 24.03 + rte_node_ethdev_rx_next_update; };