MCPcopy Create free account
hub / github.com/F-Stack/f-stack / add_edge

Function add_edge

dpdk/lib/bpf/bpf_validate.c:1825–1847  ·  view source on GitHub ↗

* helper function, add new edge between two nodes. */

Source from the content-addressed store, hash-verified

1823 * helper function, add new edge between two nodes.
1824 */
1825static int
1826add_edge(struct bpf_verifier *bvf, struct inst_node *node, uint32_t nidx)
1827{
1828 uint32_t ne;
1829
1830 if (nidx > bvf->prm->nb_ins) {
1831 RTE_BPF_LOG(ERR,
1832 "%s: program boundary violation at pc: %u, next pc: %u\n",
1833 __func__, get_node_idx(bvf, node), nidx);
1834 return -EINVAL;
1835 }
1836
1837 ne = node->nb_edge;
1838 if (ne >= RTE_DIM(node->edge_dest)) {
1839 RTE_BPF_LOG(ERR, "%s: internal error at pc: %u\n",
1840 __func__, get_node_idx(bvf, node));
1841 return -EINVAL;
1842 }
1843
1844 node->edge_dest[ne] = nidx;
1845 node->nb_edge = ne + 1;
1846 return 0;
1847}
1848
1849/*
1850 * helper function, determine type of edge between two nodes.

Callers 1

validateFunction · 0.85

Calls 1

get_node_idxFunction · 0.85

Tested by

no test coverage detected