| 1443 | } |
| 1444 | |
| 1445 | static inline int |
| 1446 | l3fwd_service_enable(uint32_t service_id) |
| 1447 | { |
| 1448 | uint8_t min_service_count = UINT8_MAX; |
| 1449 | uint32_t slcore_array[RTE_MAX_LCORE]; |
| 1450 | unsigned int slcore = 0; |
| 1451 | uint8_t service_count; |
| 1452 | int32_t slcore_count; |
| 1453 | |
| 1454 | if (!rte_service_lcore_count()) |
| 1455 | return -ENOENT; |
| 1456 | |
| 1457 | slcore_count = rte_service_lcore_list(slcore_array, RTE_MAX_LCORE); |
| 1458 | if (slcore_count < 0) |
| 1459 | return -ENOENT; |
| 1460 | /* Get the core which has least number of services running. */ |
| 1461 | while (slcore_count--) { |
| 1462 | /* Reset default mapping */ |
| 1463 | if (rte_service_map_lcore_set(service_id, |
| 1464 | slcore_array[slcore_count], 0) != 0) |
| 1465 | return -ENOENT; |
| 1466 | service_count = rte_service_lcore_count_services( |
| 1467 | slcore_array[slcore_count]); |
| 1468 | if (service_count < min_service_count) { |
| 1469 | slcore = slcore_array[slcore_count]; |
| 1470 | min_service_count = service_count; |
| 1471 | } |
| 1472 | } |
| 1473 | if (rte_service_map_lcore_set(service_id, slcore, 1)) |
| 1474 | return -ENOENT; |
| 1475 | rte_service_lcore_start(slcore); |
| 1476 | |
| 1477 | return 0; |
| 1478 | } |
| 1479 | |
| 1480 | #ifdef RTE_LIB_EVENTDEV |
| 1481 | static void |
no test coverage detected