service: add count per lcore
[dpdk.git] / lib / librte_eal / common / rte_service.c
index 7efb76d..616bad3 100644 (file)
@@ -396,6 +396,19 @@ rte_service_lcore_list(uint32_t array[], uint32_t n)
        return count;
 }
 
+int32_t
+rte_service_lcore_count_services(uint32_t lcore)
+{
+       if (lcore >= RTE_MAX_LCORE)
+               return -EINVAL;
+
+       struct core_state *cs = &lcore_states[lcore];
+       if (!cs->is_service_core)
+               return -ENOTSUP;
+
+       return __builtin_popcountll(cs->service_mask);
+}
+
 int32_t
 rte_service_start_with_defaults(void)
 {