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

Function l3fwd_pattern_configure

dpdk/app/graph/l3fwd.c:21–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include "module_api.h"
20
21static int
22l3fwd_pattern_configure(void)
23{
24 /* Graph initialization. 8< */
25 static const char * const default_patterns[] = {
26 "ip4*",
27 "ethdev_tx-*",
28 "pkt_drop",
29 };
30 struct rte_graph_param graph_conf;
31 const char **node_patterns;
32 uint64_t pcap_pkts_count;
33 struct lcore_conf *qconf;
34 uint16_t nb_patterns;
35 uint8_t pcap_ena;
36 int rc, lcore_id;
37 char *pcap_file;
38
39 nb_patterns = RTE_DIM(default_patterns);
40 node_patterns = malloc((ETHDEV_RX_QUEUE_PER_LCORE_MAX + nb_patterns) *
41 sizeof(*node_patterns));
42 if (!node_patterns)
43 return -ENOMEM;
44 memcpy(node_patterns, default_patterns,
45 nb_patterns * sizeof(*node_patterns));
46
47 memset(&graph_conf, 0, sizeof(graph_conf));
48 graph_conf.node_patterns = node_patterns;
49
50 /* Pcap config */
51 graph_pcap_config_get(&pcap_ena, &pcap_pkts_count, &pcap_file);
52 graph_conf.pcap_enable = pcap_ena;
53 graph_conf.num_pkt_to_capture = pcap_pkts_count;
54 graph_conf.pcap_filename = strdup(pcap_file);
55
56 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
57 rte_graph_t graph_id;
58 rte_edge_t i;
59
60 if (rte_lcore_is_enabled(lcore_id) == 0)
61 continue;
62
63 qconf = &lcore_conf[lcore_id];
64
65 /* Skip graph creation if no source exists */
66 if (!qconf->n_rx_queue)
67 continue;
68
69 /* Add rx node patterns of this lcore */
70 for (i = 0; i < qconf->n_rx_queue; i++) {
71 graph_conf.node_patterns[nb_patterns + i] =
72 qconf->rx_queue_list[i].node_name;
73 }
74
75 graph_conf.nb_node_patterns = nb_patterns + i;
76 graph_conf.socket_id = rte_lcore_to_socket_id(lcore_id);
77
78 snprintf(qconf->name, sizeof(qconf->name), "worker_%u",

Callers 1

usecase_l3fwd_configureFunction · 0.85

Calls 15

mallocFunction · 0.85
memsetFunction · 0.85
graph_pcap_config_getFunction · 0.85
strdupFunction · 0.85
rte_lcore_is_enabledFunction · 0.85
rte_lcore_to_socket_idFunction · 0.85
snprintfFunction · 0.85
rte_graph_createFunction · 0.85
rte_exitFunction · 0.85
rte_graph_lookupFunction · 0.85
route_ip4_add_to_lookupFunction · 0.85
route_ip6_add_to_lookupFunction · 0.85

Tested by

no test coverage detected