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

Function rte_node_ip6_route_add

dpdk/lib/node/ip6_lookup.c:260–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260int
261rte_node_ip6_route_add(const uint8_t *ip, uint8_t depth, uint16_t next_hop,
262 enum rte_node_ip6_lookup_next next_node)
263{
264 char abuf[INET6_ADDRSTRLEN];
265 struct in6_addr in6;
266 uint8_t socket;
267 uint32_t val;
268 int ret;
269
270 memcpy(in6.s6_addr, ip, RTE_LPM6_IPV6_ADDR_SIZE);
271 inet_ntop(AF_INET6, &in6, abuf, sizeof(abuf));
272 /* Embedded next node id into 24 bit next hop */
273 val = ((next_node << 16) | next_hop) & ((1ull << 24) - 1);
274 node_dbg("ip6_lookup", "LPM: Adding route %s / %d nh (0x%x)", abuf,
275 depth, val);
276
277 for (socket = 0; socket < RTE_MAX_NUMA_NODES; socket++) {
278 if (!ip6_lookup_nm.lpm_tbl[socket])
279 continue;
280
281 ret = rte_lpm6_add(ip6_lookup_nm.lpm_tbl[socket], ip, depth,
282 val);
283 if (ret < 0) {
284 node_err("ip6_lookup",
285 "Unable to add entry %s / %d nh (%x) to LPM "
286 "table on sock %d, rc=%d",
287 abuf, depth, val, socket, ret);
288 return ret;
289 }
290 }
291
292 return 0;
293}
294
295static int
296setup_lpm6(struct ip6_lookup_node_main *nm, int socket)

Callers 2

mainFunction · 0.85

Calls 3

inet_ntopFunction · 0.85
memcpyFunction · 0.50
rte_lpm6_addFunction · 0.50

Tested by

no test coverage detected