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

Function rte_lpm_find_existing

dpdk/lib/lpm/rte_lpm.c:117–140  ·  view source on GitHub ↗

* Find an existing lpm table and return a pointer to it. */

Source from the content-addressed store, hash-verified

115 * Find an existing lpm table and return a pointer to it.
116 */
117struct rte_lpm *
118rte_lpm_find_existing(const char *name)
119{
120 struct __rte_lpm *i_lpm = NULL;
121 struct rte_tailq_entry *te;
122 struct rte_lpm_list *lpm_list;
123
124 lpm_list = RTE_TAILQ_CAST(rte_lpm_tailq.head, rte_lpm_list);
125
126 rte_mcfg_tailq_read_lock();
127 TAILQ_FOREACH(te, lpm_list, next) {
128 i_lpm = te->data;
129 if (strncmp(name, i_lpm->name, RTE_LPM_NAMESIZE) == 0)
130 break;
131 }
132 rte_mcfg_tailq_read_unlock();
133
134 if (te == NULL) {
135 rte_errno = ENOENT;
136 return NULL;
137 }
138
139 return &i_lpm->lpm;
140}
141
142/*
143 * Allocates memory for LPM object

Callers 4

lpm_cleanFunction · 0.50
lpm_create_freeFunction · 0.50
test15Function · 0.50

Calls 3

rte_mcfg_tailq_read_lockFunction · 0.85
strncmpFunction · 0.85

Tested by 4

lpm_cleanFunction · 0.40
lpm_create_freeFunction · 0.40
test15Function · 0.40