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 80D9145FD0; Fri, 3 Jan 2025 07:06:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F2C8402DC; Fri, 3 Jan 2025 07:06:28 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 98A21402D5 for ; Fri, 3 Jan 2025 07:06:26 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5035tL3O020773; Thu, 2 Jan 2025 22:06:21 -0800 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=0 eOt2wdRRGSURaLbYBm7B8yB/Ao1UAzQlYxP5FpOgMQ=; b=bhRnVhNZPMLf7wDI/ id1fjrPZyEzgRwt8owu7T0XB0udtshtg6He7SoOdyU/Gjq2KgRnZObhPUPZQUzYg UD2WeH+e+umo08yJwXVrj2xOBY8S2996tlyr2Cm96x3mBdob2jeOBTWaCGTO7Ezw KwQMEDegr3V0qmpW3b3DXSB6K9uBgMpwltT4kXzddj/l1OtzTQGl1Q2FDXDctvGq lQo4Irl9GZtv/xsebYG0OI4JyYG8707tPSMVbpVP7WuevZUNGISidTgTHWZyPdy/ Iw7SUXo7Kv5bXlC7zjqXD+bM3fFtfQVvQcAgjVea9dwGTrWEa9JAYPTvDO6Zor3K DNnDw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 43xa5s00ge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Jan 2025 22:06:20 -0800 (PST) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:06:19 -0800 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 2 Jan 2025 22:06:19 -0800 Received: from cavium-PowerEdge-R640.. (unknown [10.28.36.207]) by maili.marvell.com (Postfix) with ESMTP id 149783F7084; Thu, 2 Jan 2025 22:06:16 -0800 (PST) From: Nitin Saxena To: Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Zhirun Yan , Robin Jarry , Christophe Fontaine CC: , Nitin Saxena Subject: [PATCH v6 1/4] graph: add API to override node process function Date: Fri, 3 Jan 2025 11:36:04 +0530 Message-ID: <20250103060612.2671836-2-nsaxena@marvell.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250103060612.2671836-1-nsaxena@marvell.com> References: <20241014143401.3135897-1-nsaxena@marvell.com> <20250103060612.2671836-1-nsaxena@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: dfKrkWdE5KZPkGCOB7ZIHTFHjqzdzpdE X-Proofpoint-ORIG-GUID: dfKrkWdE5KZPkGCOB7ZIHTFHjqzdzpdE 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 New API used by feature arc library to override node's original process() func. Signed-off-by: Nitin Saxena --- lib/graph/graph_private.h | 11 +++++++++++ lib/graph/node.c | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h index da48d73587..ceff0c8f50 100644 --- a/lib/graph/graph_private.h +++ b/lib/graph/graph_private.h @@ -198,6 +198,17 @@ struct node_head *node_list_head_get(void); */ struct node *node_from_name(const char *name); +/** + * @internal + * + * Override process func of a node. + * + * @return + * - 0: Success. + * - <0: Error + */ +int node_override_process_func(rte_node_t id, rte_node_process_t process); + /* Graph list functions */ STAILQ_HEAD(graph_head, graph); diff --git a/lib/graph/node.c b/lib/graph/node.c index 63db629da8..82834a6634 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -419,3 +419,26 @@ rte_node_max_count(void) { return node_id; } + +int +node_override_process_func(rte_node_t id, rte_node_process_t process) +{ + struct node *node; + + NODE_ID_CHECK(id); + graph_spinlock_lock(); + + STAILQ_FOREACH(node, &node_list, next) { + if (node->id == id) { + node->process = process; + graph_spinlock_unlock(); + return 0; + } + } + + graph_spinlock_unlock(); + + return 0; +fail: + return -1; +} -- 2.43.0