| 258 | } |
| 259 | |
| 260 | int |
| 261 | rte_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 | |
| 295 | static int |
| 296 | setup_lpm6(struct ip6_lookup_node_main *nm, int socket) |
no test coverage detected