DPDK 26.11.0-rc1
rte_graph_model_rtc.h
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2020 Marvell International Ltd.
3 * Copyright(C) 2023 Intel Corporation
4 */
5
7
20static inline void
21rte_graph_walk_rtc(struct rte_graph *graph)
22{
23 const uint16_t nwords = graph->nb_sched_words;
24 struct rte_node *node;
25 uint16_t word, bit;
26
27 /*
28 * Nodes are assigned a bit position (sched_idx) sorted by
29 * (topo_order, node_id) at graph creation time. Source nodes have
30 * topo_order 0, so they always come first.
31 *
32 * sched_table[] maps bit positions to node offsets:
33 *
34 * pending[] sched_table[]
35 * +----------+ +------------------+
36 * | word 0 | ---> | src_node_0 | bit 0 (depth=0)
37 * | 1100...1 | | src_node_1 | bit 1 (depth=0)
38 * | | | eth_input | bit 2 (depth=1)
39 * | | | mpls_input | bit 3 (depth=2)
40 * | | | ipv4_input | bit 4 (depth=3)
41 * | | | ... |
42 * +----------+ +------------------+
43 * | word 1 | ---> | ip4_rewrite | bit 64 (depth=4)
44 * | ... | | ... |
45 * +----------+ +------------------+
46 *
47 * Walk: for each word, find lowest set bit (rte_ctz64), process
48 * that node, clear the bit, re-read the word (processing may
49 * have set new bits), repeat.
50 */
51
52 /* Seed pending bitmap with source nodes */
53 for (word = 0; word < nwords; word++)
54 graph->pending[word] |= graph->src_pending[word];
55
56 for (;;) {
57 /* find first word with any pending bit */
58 for (word = 0; word < nwords; word++)
59 if (graph->pending[word])
60 break;
61 if (word == nwords)
62 break; /* no more pending nodes */
63
64 bit = rte_ctz64(graph->pending[word]);
65 graph->pending[word] &= ~(1ULL << bit);
66 node = __rte_graph_pending_node(graph, word, bit);
67 __rte_node_process(graph, node);
68 }
69}
static unsigned int rte_ctz64(uint64_t v)
Definition: rte_bitops.h:1006