* Find an existing lpm table and return a pointer to it. */
| 115 | * Find an existing lpm table and return a pointer to it. |
| 116 | */ |
| 117 | struct rte_lpm * |
| 118 | rte_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 |