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 8ADEFA00C2; Thu, 17 Nov 2022 06:10:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8447442D35; Thu, 17 Nov 2022 06:09:51 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 436E242D23 for ; Thu, 17 Nov 2022 06:09:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668661790; x=1700197790; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LRl9+ra30MDOROE6qrYIY9jAsfM8i0CuHNXHlpatb0A=; b=CAx9yZawpSsK1dKVWBQE2rIh2Sjb2F3qwSXX3KkBDVlfZ+ckFupaD9gp PvRXENjEl1GL857WDo311xPjY7BzgjiaZrfgb8ck4q5rl3NKmxx6kvQe2 tVIGMtkLLZG2E8j2tKmV98WruJP9HmQEwzZYtYK+2pXIxAES64pO5JsDx CD4ofZrM0wfDrrcqkFy7xT8Oz8vZkswZDQffYweeb8QKYblIPCZALUczp zQsmXPP6b44CGOi072q1m86pM4aUT1ZO+4cm2Jv/PvTHkKJYthKCZwFZS CPaF42wcBFRec43KUObdFjqvXq8i2wJgKDfQQkQDMg0wi8dWmnmdCUw3k Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="377026667" X-IronPort-AV: E=Sophos;i="5.96,169,1665471600"; d="scan'208";a="377026667" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2022 21:09:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="617466057" X-IronPort-AV: E=Sophos;i="5.96,169,1665471600"; d="scan'208";a="617466057" Received: from dpdk-zhirun-lmm.sh.intel.com ([10.67.118.230]) by orsmga006.jf.intel.com with ESMTP; 16 Nov 2022 21:09:47 -0800 From: Zhirun Yan To: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com Cc: cunming.liang@intel.com, haiyue.wang@intel.com, Zhirun Yan Subject: [PATCH v1 04/13] graph: add get/set graph worker model APIs Date: Thu, 17 Nov 2022 13:09:17 +0800 Message-Id: <20221117050926.136974-5-zhirun.yan@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117050926.136974-1-zhirun.yan@intel.com> References: <20221117050926.136974-1-zhirun.yan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Add new get/set APIs to configure graph worker model which is used to determine which model will be chosen. Signed-off-by: Haiyue Wang Signed-off-by: Cunming Liang Signed-off-by: Zhirun Yan --- lib/graph/rte_graph_worker.h | 51 +++++++++++++++++++++++++++++ lib/graph/rte_graph_worker_common.h | 13 ++++++++ lib/graph/version.map | 3 ++ 3 files changed, 67 insertions(+) diff --git a/lib/graph/rte_graph_worker.h b/lib/graph/rte_graph_worker.h index 54d1390786..a0ea0df153 100644 --- a/lib/graph/rte_graph_worker.h +++ b/lib/graph/rte_graph_worker.h @@ -1,5 +1,56 @@ #include "rte_graph_model_rtc.h" +static enum rte_graph_worker_model worker_model = RTE_GRAPH_MODEL_DEFAULT; + +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * Set the graph worker model + * + * @note This function does not perform any locking, and is only safe to call + * before graph running. + * + * @param name + * Name of the graph worker model. + * + * @return + * 0 on success, -1 otherwise. + */ +__rte_experimental +static inline int +rte_graph_worker_model_set(enum rte_graph_worker_model model) +{ + if (model >= RTE_GRAPH_MODEL_MAX) + goto fail; + + worker_model = model; + return 0; + +fail: + worker_model = RTE_GRAPH_MODEL_DEFAULT; + return -1; +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + * Get the graph worker model + * + * @param name + * Name of the graph worker model. + * + * @return + * Graph worker model on success. + */ +__rte_experimental +static inline +enum rte_graph_worker_model +rte_graph_worker_model_get(void) +{ + return worker_model; +} + /** * Perform graph walk on the circular buffer and invoke the process function * of the nodes and collect the stats. diff --git a/lib/graph/rte_graph_worker_common.h b/lib/graph/rte_graph_worker_common.h index df33204336..507a344afd 100644 --- a/lib/graph/rte_graph_worker_common.h +++ b/lib/graph/rte_graph_worker_common.h @@ -86,6 +86,19 @@ struct rte_node { struct rte_node *nodes[] __rte_cache_min_aligned; /**< Next nodes. */ } __rte_cache_aligned; + + +/** Graph worker models */ +enum rte_graph_worker_model { +#define WORKER_MODEL_DEFAULT "default" + RTE_GRAPH_MODEL_DEFAULT = 0, +#define WORKER_MODEL_RTC "rtc" + RTE_GRAPH_MODEL_RTC, +#define WORKER_MODEL_GENERIC "generic" + RTE_GRAPH_MODEL_GENERIC, + RTE_GRAPH_MODEL_MAX, +}; + /** * @internal * diff --git a/lib/graph/version.map b/lib/graph/version.map index 13b838752d..eea73ec9ca 100644 --- a/lib/graph/version.map +++ b/lib/graph/version.map @@ -43,5 +43,8 @@ EXPERIMENTAL { rte_node_next_stream_put; rte_node_next_stream_move; + rte_graph_worker_model_set; + rte_graph_worker_model_get; + local: *; }; -- 2.25.1