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

Function rte_table_lpm_lookup

dpdk/lib/table/rte_table_lpm.c:300–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300static int
301rte_table_lpm_lookup(
302 void *table,
303 struct rte_mbuf **pkts,
304 uint64_t pkts_mask,
305 uint64_t *lookup_hit_mask,
306 void **entries)
307{
308 struct rte_table_lpm *lpm = (struct rte_table_lpm *) table;
309 uint64_t pkts_out_mask = 0;
310 uint32_t i;
311
312 __rte_unused uint32_t n_pkts_in = rte_popcount64(pkts_mask);
313 RTE_TABLE_LPM_STATS_PKTS_IN_ADD(lpm, n_pkts_in);
314
315 pkts_out_mask = 0;
316 for (i = 0; i < (uint32_t)(RTE_PORT_IN_BURST_SIZE_MAX -
317 rte_clz64(pkts_mask)); i++) {
318 uint64_t pkt_mask = 1LLU << i;
319
320 if (pkt_mask & pkts_mask) {
321 struct rte_mbuf *pkt = pkts[i];
322 uint32_t ip = rte_bswap32(
323 RTE_MBUF_METADATA_UINT32(pkt, lpm->offset));
324 int status;
325 uint32_t nht_pos;
326
327 status = rte_lpm_lookup(lpm->lpm, ip, &nht_pos);
328 if (status == 0) {
329 pkts_out_mask |= pkt_mask;
330 entries[i] = (void *) &lpm->nht[nht_pos *
331 lpm->entry_size];
332 }
333 }
334 }
335
336 *lookup_hit_mask = pkts_out_mask;
337 RTE_TABLE_LPM_STATS_PKTS_LOOKUP_MISS(lpm, n_pkts_in - rte_popcount64(pkts_out_mask));
338 return 0;
339}
340
341static int
342rte_table_lpm_stats_read(void *table, struct rte_table_stats *stats, int clear)

Callers

nothing calls this directly

Calls 3

rte_popcount64Function · 0.85
rte_clz64Function · 0.85
rte_lpm_lookupFunction · 0.50

Tested by

no test coverage detected