199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(C) 2020 Marvell International Ltd. 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _RTE_GRAPH_PRIVATE_H_ 699a2dd95SBruce Richardson #define _RTE_GRAPH_PRIVATE_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson #include <inttypes.h> 999a2dd95SBruce Richardson #include <sys/queue.h> 1099a2dd95SBruce Richardson 1199a2dd95SBruce Richardson #include <rte_common.h> 1299a2dd95SBruce Richardson #include <rte_eal.h> 13476fd9a2SDavid Marchand #include <rte_spinlock.h> 14b6ef3794SZhirun Yan #include <rte_errno.h> 15b6ef3794SZhirun Yan #include <rte_string_fns.h> 1699a2dd95SBruce Richardson 1799a2dd95SBruce Richardson #include "rte_graph.h" 18a2bc0584SZhirun Yan #include "rte_graph_worker.h" 1999a2dd95SBruce Richardson 2099a2dd95SBruce Richardson extern int rte_graph_logtype; 2197433132SDavid Marchand #define RTE_LOGTYPE_GRAPH rte_graph_logtype 2299a2dd95SBruce Richardson 2399a2dd95SBruce Richardson #define GRAPH_LOG(level, ...) \ 240f1dc8cbSTyler Retzlaff RTE_LOG_LINE_PREFIX(level, GRAPH, \ 250f1dc8cbSTyler Retzlaff "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) 2699a2dd95SBruce Richardson 2799a2dd95SBruce Richardson #define graph_err(...) GRAPH_LOG(ERR, __VA_ARGS__) 289b72ea1fSAmit Prakash Shukla #define graph_warn(...) GRAPH_LOG(WARNING, __VA_ARGS__) 2999a2dd95SBruce Richardson #define graph_info(...) GRAPH_LOG(INFO, __VA_ARGS__) 3099a2dd95SBruce Richardson #define graph_dbg(...) GRAPH_LOG(DEBUG, __VA_ARGS__) 3199a2dd95SBruce Richardson 3299a2dd95SBruce Richardson #define ID_CHECK(id, id_max) \ 3399a2dd95SBruce Richardson do { \ 3499a2dd95SBruce Richardson if ((id) >= (id_max)) { \ 3599a2dd95SBruce Richardson rte_errno = EINVAL; \ 3699a2dd95SBruce Richardson goto fail; \ 3799a2dd95SBruce Richardson } \ 3899a2dd95SBruce Richardson } while (0) 3999a2dd95SBruce Richardson 4099a2dd95SBruce Richardson #define SET_ERR_JMP(err, where, fmt, ...) \ 4199a2dd95SBruce Richardson do { \ 4299a2dd95SBruce Richardson graph_err(fmt, ##__VA_ARGS__); \ 4399a2dd95SBruce Richardson rte_errno = err; \ 4499a2dd95SBruce Richardson goto where; \ 4599a2dd95SBruce Richardson } while (0) 4699a2dd95SBruce Richardson 4799a2dd95SBruce Richardson /** 4899a2dd95SBruce Richardson * @internal 4999a2dd95SBruce Richardson * 5099a2dd95SBruce Richardson * Structure that holds node internal data. 5199a2dd95SBruce Richardson */ 5299a2dd95SBruce Richardson struct node { 5399a2dd95SBruce Richardson STAILQ_ENTRY(node) next; /**< Next node in the list. */ 5499a2dd95SBruce Richardson char name[RTE_NODE_NAMESIZE]; /**< Name of the node. */ 5599a2dd95SBruce Richardson uint64_t flags; /**< Node configuration flag. */ 561d08f290SZhirun Yan unsigned int lcore_id; 571d08f290SZhirun Yan /**< Node runs on the Lcore ID used for mcore dispatch model. */ 5899a2dd95SBruce Richardson rte_node_process_t process; /**< Node process function. */ 5999a2dd95SBruce Richardson rte_node_init_t init; /**< Node init function. */ 6099a2dd95SBruce Richardson rte_node_fini_t fini; /**< Node fini function. */ 6199a2dd95SBruce Richardson rte_node_t id; /**< Allocated identifier for the node. */ 6299a2dd95SBruce Richardson rte_node_t parent_id; /**< Parent node identifier. */ 6399a2dd95SBruce Richardson rte_edge_t nb_edges; /**< Number of edges from this node. */ 64*070db97eSPavan Nikhilesh struct rte_node_xstats *xstats; /**< Node specific xstats. */ 6599a2dd95SBruce Richardson char next_nodes[][RTE_NODE_NAMESIZE]; /**< Names of next nodes. */ 6699a2dd95SBruce Richardson }; 6799a2dd95SBruce Richardson 6899a2dd95SBruce Richardson /** 6999a2dd95SBruce Richardson * @internal 7099a2dd95SBruce Richardson * 71e6c67c9eSZhirun Yan * Structure that holds the graph scheduling workqueue node stream. 72e6c67c9eSZhirun Yan * Used for mcore dispatch model. 73e6c67c9eSZhirun Yan */ 74c6552d9aSTyler Retzlaff struct __rte_cache_aligned graph_mcore_dispatch_wq_node { 75e6c67c9eSZhirun Yan rte_graph_off_t node_off; 76e6c67c9eSZhirun Yan uint16_t nb_objs; 77e6c67c9eSZhirun Yan void *objs[RTE_GRAPH_BURST_SIZE]; 78c6552d9aSTyler Retzlaff }; 79e6c67c9eSZhirun Yan 80e6c67c9eSZhirun Yan /** 81e6c67c9eSZhirun Yan * @internal 82e6c67c9eSZhirun Yan * 8399a2dd95SBruce Richardson * Structure that holds the graph node data. 8499a2dd95SBruce Richardson */ 8599a2dd95SBruce Richardson struct graph_node { 8699a2dd95SBruce Richardson STAILQ_ENTRY(graph_node) next; /**< Next graph node in the list. */ 8799a2dd95SBruce Richardson struct node *node; /**< Pointer to internal node. */ 8899a2dd95SBruce Richardson bool visited; /**< Flag used in BFS to mark node visited. */ 8999a2dd95SBruce Richardson struct graph_node *adjacency_list[]; /**< Adjacency list of the node. */ 9099a2dd95SBruce Richardson }; 9199a2dd95SBruce Richardson 9299a2dd95SBruce Richardson /** 9399a2dd95SBruce Richardson * @internal 9499a2dd95SBruce Richardson * 9599a2dd95SBruce Richardson * Structure that holds graph internal data. 9699a2dd95SBruce Richardson */ 9799a2dd95SBruce Richardson struct graph { 9899a2dd95SBruce Richardson STAILQ_ENTRY(graph) next; 9999a2dd95SBruce Richardson /**< List of graphs. */ 10099a2dd95SBruce Richardson char name[RTE_GRAPH_NAMESIZE]; 10199a2dd95SBruce Richardson /**< Name of the graph. */ 10299a2dd95SBruce Richardson const struct rte_memzone *mz; 10399a2dd95SBruce Richardson /**< Memzone to store graph data. */ 10499a2dd95SBruce Richardson rte_graph_off_t nodes_start; 10599a2dd95SBruce Richardson /**< Node memory start offset in graph reel. */ 106*070db97eSPavan Nikhilesh rte_graph_off_t xstats_start; 107*070db97eSPavan Nikhilesh /**< Node xstats memory start offset in graph reel. */ 10899a2dd95SBruce Richardson rte_node_t src_node_count; 10999a2dd95SBruce Richardson /**< Number of source nodes in a graph. */ 11099a2dd95SBruce Richardson struct rte_graph *graph; 11199a2dd95SBruce Richardson /**< Pointer to graph data. */ 11299a2dd95SBruce Richardson rte_node_t node_count; 11399a2dd95SBruce Richardson /**< Total number of nodes. */ 11499a2dd95SBruce Richardson uint32_t cir_start; 11599a2dd95SBruce Richardson /**< Circular buffer start offset in graph reel. */ 11699a2dd95SBruce Richardson uint32_t cir_mask; 11799a2dd95SBruce Richardson /**< Circular buffer mask for wrap around. */ 11899a2dd95SBruce Richardson rte_graph_t id; 11999a2dd95SBruce Richardson /**< Graph identifier. */ 120d6e2e9d8SZhirun Yan rte_graph_t parent_id; 121d6e2e9d8SZhirun Yan /**< Parent graph identifier. */ 122ecb22a29SZhirun Yan unsigned int lcore_id; 123ecb22a29SZhirun Yan /**< Lcore identifier where the graph prefer to run on. Used for mcore dispatch model. */ 12499a2dd95SBruce Richardson size_t mem_sz; 12599a2dd95SBruce Richardson /**< Memory size of the graph. */ 12699a2dd95SBruce Richardson int socket; 12799a2dd95SBruce Richardson /**< Socket identifier where memory is allocated. */ 1289b72ea1fSAmit Prakash Shukla uint64_t num_pkt_to_capture; 1299b72ea1fSAmit Prakash Shukla /**< Number of packets to be captured per core. */ 1309b72ea1fSAmit Prakash Shukla char pcap_filename[RTE_GRAPH_PCAP_FILE_SZ]; 1319b72ea1fSAmit Prakash Shukla /**< pcap file name/path. */ 13299a2dd95SBruce Richardson STAILQ_HEAD(gnode_list, graph_node) node_list; 13399a2dd95SBruce Richardson /**< Nodes in a graph. */ 13499a2dd95SBruce Richardson }; 13599a2dd95SBruce Richardson 136b6ef3794SZhirun Yan /* Node and graph common functions */ 137b6ef3794SZhirun Yan /** 138b6ef3794SZhirun Yan * @internal 139b6ef3794SZhirun Yan * 140b6ef3794SZhirun Yan * Naming a cloned graph or node by appending a string to base name. 141b6ef3794SZhirun Yan * 142b6ef3794SZhirun Yan * @param new_name 143b6ef3794SZhirun Yan * Pointer to the name of the cloned object. 144b6ef3794SZhirun Yan * @param base_name 145b6ef3794SZhirun Yan * Pointer to the name of original object. 146b6ef3794SZhirun Yan * @param append_str 147b6ef3794SZhirun Yan * Pointer to the appended string. 148b6ef3794SZhirun Yan * 149b6ef3794SZhirun Yan * @return 150b6ef3794SZhirun Yan * 0 on success, negative errno value otherwise. 151b6ef3794SZhirun Yan */ 152b6ef3794SZhirun Yan static inline int clone_name(char *new_name, char *base_name, const char *append_str) 153b6ef3794SZhirun Yan { 154b6ef3794SZhirun Yan ssize_t sz, rc; 155b6ef3794SZhirun Yan 156b6ef3794SZhirun Yan #define SZ RTE_MIN(RTE_NODE_NAMESIZE, RTE_GRAPH_NAMESIZE) 157b6ef3794SZhirun Yan rc = rte_strscpy(new_name, base_name, SZ); 158b6ef3794SZhirun Yan if (rc < 0) 159b6ef3794SZhirun Yan goto fail; 160b6ef3794SZhirun Yan sz = rc; 161b6ef3794SZhirun Yan rc = rte_strscpy(new_name + sz, "-", RTE_MAX((int16_t)(SZ - sz), 0)); 162b6ef3794SZhirun Yan if (rc < 0) 163b6ef3794SZhirun Yan goto fail; 164b6ef3794SZhirun Yan sz += rc; 165b6ef3794SZhirun Yan sz = rte_strscpy(new_name + sz, append_str, RTE_MAX((int16_t)(SZ - sz), 0)); 166b6ef3794SZhirun Yan if (sz < 0) 167b6ef3794SZhirun Yan goto fail; 168b6ef3794SZhirun Yan 169b6ef3794SZhirun Yan return 0; 170b6ef3794SZhirun Yan fail: 171b6ef3794SZhirun Yan rte_errno = E2BIG; 172b6ef3794SZhirun Yan return -rte_errno; 173b6ef3794SZhirun Yan } 174b6ef3794SZhirun Yan 17599a2dd95SBruce Richardson /* Node functions */ 17699a2dd95SBruce Richardson STAILQ_HEAD(node_head, node); 17799a2dd95SBruce Richardson 17899a2dd95SBruce Richardson /** 17999a2dd95SBruce Richardson * @internal 18099a2dd95SBruce Richardson * 18199a2dd95SBruce Richardson * Get the head of the node list. 18299a2dd95SBruce Richardson * 18399a2dd95SBruce Richardson * @return 18499a2dd95SBruce Richardson * Pointer to the node head. 18599a2dd95SBruce Richardson */ 18699a2dd95SBruce Richardson struct node_head *node_list_head_get(void); 18799a2dd95SBruce Richardson 18899a2dd95SBruce Richardson /** 18999a2dd95SBruce Richardson * @internal 19099a2dd95SBruce Richardson * 19199a2dd95SBruce Richardson * Get node pointer from node name. 19299a2dd95SBruce Richardson * 19399a2dd95SBruce Richardson * @param name 19499a2dd95SBruce Richardson * Pointer to character string containing the node name. 19599a2dd95SBruce Richardson * 19699a2dd95SBruce Richardson * @return 19799a2dd95SBruce Richardson * Pointer to the node. 19899a2dd95SBruce Richardson */ 19999a2dd95SBruce Richardson struct node *node_from_name(const char *name); 20099a2dd95SBruce Richardson 20199a2dd95SBruce Richardson /* Graph list functions */ 20299a2dd95SBruce Richardson STAILQ_HEAD(graph_head, graph); 20399a2dd95SBruce Richardson 20499a2dd95SBruce Richardson /** 20599a2dd95SBruce Richardson * @internal 20699a2dd95SBruce Richardson * 20799a2dd95SBruce Richardson * Get the head of the graph list. 20899a2dd95SBruce Richardson * 20999a2dd95SBruce Richardson * @return 21099a2dd95SBruce Richardson * Pointer to the graph head. 21199a2dd95SBruce Richardson */ 21299a2dd95SBruce Richardson struct graph_head *graph_list_head_get(void); 21399a2dd95SBruce Richardson 214476fd9a2SDavid Marchand rte_spinlock_t * 215476fd9a2SDavid Marchand graph_spinlock_get(void); 216476fd9a2SDavid Marchand 21799a2dd95SBruce Richardson /* Lock functions */ 21899a2dd95SBruce Richardson /** 21999a2dd95SBruce Richardson * @internal 22099a2dd95SBruce Richardson * 22199a2dd95SBruce Richardson * Take a lock on the graph internal spin lock. 22299a2dd95SBruce Richardson */ 223476fd9a2SDavid Marchand void graph_spinlock_lock(void) 224476fd9a2SDavid Marchand __rte_exclusive_lock_function(graph_spinlock_get()); 22599a2dd95SBruce Richardson 22699a2dd95SBruce Richardson /** 22799a2dd95SBruce Richardson * @internal 22899a2dd95SBruce Richardson * 22999a2dd95SBruce Richardson * Release a lock on the graph internal spin lock. 23099a2dd95SBruce Richardson */ 231476fd9a2SDavid Marchand void graph_spinlock_unlock(void) 232476fd9a2SDavid Marchand __rte_unlock_function(graph_spinlock_get()); 23399a2dd95SBruce Richardson 23499a2dd95SBruce Richardson /* Graph operations */ 23599a2dd95SBruce Richardson /** 23699a2dd95SBruce Richardson * @internal 23799a2dd95SBruce Richardson * 23899a2dd95SBruce Richardson * Run a BFS(Breadth First Search) on the graph marking all 23999a2dd95SBruce Richardson * the graph nodes as visited. 24099a2dd95SBruce Richardson * 24199a2dd95SBruce Richardson * @param graph 24299a2dd95SBruce Richardson * Pointer to the internal graph object. 24399a2dd95SBruce Richardson * @param start 24499a2dd95SBruce Richardson * Pointer to the starting graph node. 24599a2dd95SBruce Richardson * 24699a2dd95SBruce Richardson * @return 24799a2dd95SBruce Richardson * - 0: Success. 24899a2dd95SBruce Richardson * - -ENOMEM: Not enough memory for BFS. 24999a2dd95SBruce Richardson */ 25099a2dd95SBruce Richardson int graph_bfs(struct graph *graph, struct graph_node *start); 25199a2dd95SBruce Richardson 25299a2dd95SBruce Richardson /** 25399a2dd95SBruce Richardson * @internal 25499a2dd95SBruce Richardson * 25599a2dd95SBruce Richardson * Check if there is an isolated node in the given graph. 25699a2dd95SBruce Richardson * 25799a2dd95SBruce Richardson * @param graph 25899a2dd95SBruce Richardson * Pointer to the internal graph object. 25999a2dd95SBruce Richardson * 26099a2dd95SBruce Richardson * @return 26199a2dd95SBruce Richardson * - 0: No isolated node found. 26299a2dd95SBruce Richardson * - 1: Isolated node found. 26399a2dd95SBruce Richardson */ 26499a2dd95SBruce Richardson int graph_has_isolated_node(struct graph *graph); 26599a2dd95SBruce Richardson 26699a2dd95SBruce Richardson /** 26799a2dd95SBruce Richardson * @internal 26899a2dd95SBruce Richardson * 26999a2dd95SBruce Richardson * Check whether a node in the graph has next_node to a source node. 27099a2dd95SBruce Richardson * 27199a2dd95SBruce Richardson * @param graph 27299a2dd95SBruce Richardson * Pointer to the internal graph object. 27399a2dd95SBruce Richardson * 27499a2dd95SBruce Richardson * @return 27599a2dd95SBruce Richardson * - 0: Node has an edge to source node. 27699a2dd95SBruce Richardson * - 1: Node doesn't have an edge to source node. 27799a2dd95SBruce Richardson */ 27899a2dd95SBruce Richardson int graph_node_has_edge_to_src_node(struct graph *graph); 27999a2dd95SBruce Richardson 28099a2dd95SBruce Richardson /** 28199a2dd95SBruce Richardson * @internal 28299a2dd95SBruce Richardson * 28399a2dd95SBruce Richardson * Checks whether node in the graph has a edge to itself i.e. forms a 28499a2dd95SBruce Richardson * loop. 28599a2dd95SBruce Richardson * 28699a2dd95SBruce Richardson * @param graph 28799a2dd95SBruce Richardson * Pointer to the internal graph object. 28899a2dd95SBruce Richardson * 28999a2dd95SBruce Richardson * @return 29099a2dd95SBruce Richardson * - 0: Node has an edge to itself. 29199a2dd95SBruce Richardson * - 1: Node doesn't have an edge to itself. 29299a2dd95SBruce Richardson */ 29399a2dd95SBruce Richardson int graph_node_has_loop_edge(struct graph *graph); 29499a2dd95SBruce Richardson 29599a2dd95SBruce Richardson /** 29699a2dd95SBruce Richardson * @internal 29799a2dd95SBruce Richardson * 29899a2dd95SBruce Richardson * Get the count of source nodes in the graph. 29999a2dd95SBruce Richardson * 30099a2dd95SBruce Richardson * @param graph 30199a2dd95SBruce Richardson * Pointer to the internal graph object. 30299a2dd95SBruce Richardson * 30399a2dd95SBruce Richardson * @return 30499a2dd95SBruce Richardson * Number of source nodes. 30599a2dd95SBruce Richardson */ 30699a2dd95SBruce Richardson rte_node_t graph_src_nodes_count(struct graph *graph); 30799a2dd95SBruce Richardson 30899a2dd95SBruce Richardson /** 30999a2dd95SBruce Richardson * @internal 31099a2dd95SBruce Richardson * 31199a2dd95SBruce Richardson * Get the count of total number of nodes in the graph. 31299a2dd95SBruce Richardson * 31399a2dd95SBruce Richardson * @param graph 31499a2dd95SBruce Richardson * Pointer to the internal graph object. 31599a2dd95SBruce Richardson * 31699a2dd95SBruce Richardson * @return 31799a2dd95SBruce Richardson * Number of nodes. 31899a2dd95SBruce Richardson */ 31999a2dd95SBruce Richardson rte_node_t graph_nodes_count(struct graph *graph); 32099a2dd95SBruce Richardson 32199a2dd95SBruce Richardson /** 32299a2dd95SBruce Richardson * @internal 32399a2dd95SBruce Richardson * 32499a2dd95SBruce Richardson * Clear the visited flag of all the nodes in the graph. 32599a2dd95SBruce Richardson * 32699a2dd95SBruce Richardson * @param graph 32799a2dd95SBruce Richardson * Pointer to the internal graph object. 32899a2dd95SBruce Richardson */ 32999a2dd95SBruce Richardson void graph_mark_nodes_as_not_visited(struct graph *graph); 33099a2dd95SBruce Richardson 33199a2dd95SBruce Richardson /* Fast path graph memory populate unctions */ 33299a2dd95SBruce Richardson 33399a2dd95SBruce Richardson /** 33499a2dd95SBruce Richardson * @internal 33599a2dd95SBruce Richardson * 33699a2dd95SBruce Richardson * Create fast-path memory for the graph and nodes. 33799a2dd95SBruce Richardson * 33899a2dd95SBruce Richardson * @param graph 33999a2dd95SBruce Richardson * Pointer to the internal graph object. 34099a2dd95SBruce Richardson * 34199a2dd95SBruce Richardson * @return 34299a2dd95SBruce Richardson * - 0: Success. 34399a2dd95SBruce Richardson * - -ENOMEM: Not enough for graph and nodes. 34499a2dd95SBruce Richardson * - -EINVAL: Graph nodes not found. 34599a2dd95SBruce Richardson */ 34699a2dd95SBruce Richardson int graph_fp_mem_create(struct graph *graph); 34799a2dd95SBruce Richardson 34899a2dd95SBruce Richardson /** 34999a2dd95SBruce Richardson * @internal 35099a2dd95SBruce Richardson * 35199a2dd95SBruce Richardson * Free fast-path memory used by graph and nodes. 35299a2dd95SBruce Richardson * 35399a2dd95SBruce Richardson * @param graph 35499a2dd95SBruce Richardson * Pointer to the internal graph object. 35599a2dd95SBruce Richardson * 35699a2dd95SBruce Richardson * @return 35799a2dd95SBruce Richardson * - 0: Success. 35899a2dd95SBruce Richardson * - <0: Graph memzone related error. 35999a2dd95SBruce Richardson */ 36099a2dd95SBruce Richardson int graph_fp_mem_destroy(struct graph *graph); 36199a2dd95SBruce Richardson 36299a2dd95SBruce Richardson /* Lookup functions */ 36399a2dd95SBruce Richardson /** 36499a2dd95SBruce Richardson * @internal 36599a2dd95SBruce Richardson * 36699a2dd95SBruce Richardson * Get graph node object from node id. 36799a2dd95SBruce Richardson * 36899a2dd95SBruce Richardson * @param graph 36999a2dd95SBruce Richardson * Pointer to rte_graph object. 37099a2dd95SBruce Richardson * @param id 37199a2dd95SBruce Richardson * Node Identifier. 37299a2dd95SBruce Richardson * 37399a2dd95SBruce Richardson * @return 37499a2dd95SBruce Richardson * Pointer to rte_node if identifier is valid else NULL. 37599a2dd95SBruce Richardson */ 37699a2dd95SBruce Richardson struct rte_node *graph_node_id_to_ptr(const struct rte_graph *graph, 37799a2dd95SBruce Richardson rte_node_t id); 37899a2dd95SBruce Richardson 37999a2dd95SBruce Richardson /** 38099a2dd95SBruce Richardson * @internal 38199a2dd95SBruce Richardson * 38299a2dd95SBruce Richardson * Get graph node object from node name. 38399a2dd95SBruce Richardson * 38499a2dd95SBruce Richardson * @param graph 38599a2dd95SBruce Richardson * Pointer to rte_graph object. 38699a2dd95SBruce Richardson * @param node_name 38799a2dd95SBruce Richardson * Pointer to character string holding the node name. 38899a2dd95SBruce Richardson * 38999a2dd95SBruce Richardson * @return 39099a2dd95SBruce Richardson * Pointer to rte_node if identifier is valid else NULL. 39199a2dd95SBruce Richardson */ 39299a2dd95SBruce Richardson struct rte_node *graph_node_name_to_ptr(const struct rte_graph *graph, 39399a2dd95SBruce Richardson const char *node_name); 39499a2dd95SBruce Richardson 39599a2dd95SBruce Richardson /* Debug functions */ 39699a2dd95SBruce Richardson /** 39799a2dd95SBruce Richardson * @internal 39899a2dd95SBruce Richardson * 39999a2dd95SBruce Richardson * Dump internal graph object data. 40099a2dd95SBruce Richardson * 40199a2dd95SBruce Richardson * @param f 40299a2dd95SBruce Richardson * FILE pointer to dump the data. 40399a2dd95SBruce Richardson * @param g 40499a2dd95SBruce Richardson * Pointer to the internal graph object. 40599a2dd95SBruce Richardson */ 40699a2dd95SBruce Richardson void graph_dump(FILE *f, struct graph *g); 40799a2dd95SBruce Richardson 40899a2dd95SBruce Richardson /** 40999a2dd95SBruce Richardson * @internal 41099a2dd95SBruce Richardson * 41199a2dd95SBruce Richardson * Dump internal node object data. 41299a2dd95SBruce Richardson * 41399a2dd95SBruce Richardson * @param f 41499a2dd95SBruce Richardson * FILE pointer to dump the info. 41599a2dd95SBruce Richardson * @param g 41699a2dd95SBruce Richardson * Pointer to the internal node object. 41799a2dd95SBruce Richardson */ 41899a2dd95SBruce Richardson void node_dump(FILE *f, struct node *n); 41999a2dd95SBruce Richardson 4201e2aed1aSZhirun Yan /** 4211e2aed1aSZhirun Yan * @internal 4221e2aed1aSZhirun Yan * 4231e2aed1aSZhirun Yan * Create the graph schedule work queue for mcore dispatch model. 4241e2aed1aSZhirun Yan * All cloned graphs attached to the parent graph MUST be destroyed together 4251e2aed1aSZhirun Yan * for fast schedule design limitation. 4261e2aed1aSZhirun Yan * 4271e2aed1aSZhirun Yan * @param _graph 4281e2aed1aSZhirun Yan * The graph object 4291e2aed1aSZhirun Yan * @param _parent_graph 4301e2aed1aSZhirun Yan * The parent graph object which holds the run-queue head. 4311e2aed1aSZhirun Yan * @param prm 4321e2aed1aSZhirun Yan * Graph parameter, includes model-specific parameters in this graph. 4331e2aed1aSZhirun Yan * 4341e2aed1aSZhirun Yan * @return 4351e2aed1aSZhirun Yan * - 0: Success. 4361e2aed1aSZhirun Yan * - <0: Graph schedule work queue related error. 4371e2aed1aSZhirun Yan */ 4381e2aed1aSZhirun Yan int graph_sched_wq_create(struct graph *_graph, struct graph *_parent_graph, 4391e2aed1aSZhirun Yan struct rte_graph_param *prm); 4401e2aed1aSZhirun Yan 4411e2aed1aSZhirun Yan /** 4421e2aed1aSZhirun Yan * @internal 4431e2aed1aSZhirun Yan * 4441e2aed1aSZhirun Yan * Destroy the graph schedule work queue for mcore dispatch model. 4451e2aed1aSZhirun Yan * 4461e2aed1aSZhirun Yan * @param _graph 4471e2aed1aSZhirun Yan * The graph object 4481e2aed1aSZhirun Yan */ 4491e2aed1aSZhirun Yan void graph_sched_wq_destroy(struct graph *_graph); 4501e2aed1aSZhirun Yan 45199a2dd95SBruce Richardson #endif /* _RTE_GRAPH_PRIVATE_H_ */ 452