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

Function channel_manager_init

dpdk/examples/vm_power_manager/channel_manager.c:952–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

950 return 0;
951}
952int
953channel_manager_init(const char *path __rte_unused)
954{
955 virNodeInfo info;
956
957 TAILQ_INIT(&vm_list_head);
958 if (connect_hypervisor(path) < 0) {
959 global_n_host_cpus = 64;
960 global_hypervisor_available = 0;
961 RTE_LOG(INFO, CHANNEL_MANAGER, "Unable to initialize channel manager\n");
962 } else {
963 global_hypervisor_available = 1;
964
965 global_maplen = VIR_CPU_MAPLEN(RTE_MAX_LCORE);
966
967 global_vircpuinfo = rte_zmalloc(NULL,
968 sizeof(*global_vircpuinfo) *
969 RTE_MAX_LCORE, RTE_CACHE_LINE_SIZE);
970 if (global_vircpuinfo == NULL) {
971 RTE_LOG(ERR, CHANNEL_MANAGER, "Error allocating memory for CPU Info\n");
972 goto error;
973 }
974 global_cpumaps = rte_zmalloc(NULL,
975 RTE_MAX_LCORE * global_maplen,
976 RTE_CACHE_LINE_SIZE);
977 if (global_cpumaps == NULL)
978 goto error;
979
980 if (virNodeGetInfo(global_vir_conn_ptr, &info)) {
981 RTE_LOG(ERR, CHANNEL_MANAGER, "Unable to retrieve node Info\n");
982 goto error;
983 }
984 global_n_host_cpus = (unsigned int)info.cpus;
985 }
986
987
988
989 if (global_n_host_cpus > RTE_MAX_LCORE) {
990 RTE_LOG(WARNING, CHANNEL_MANAGER, "The number of host CPUs(%u) exceeds the "
991 "maximum of %u. No cores over %u should be used.\n",
992 global_n_host_cpus, RTE_MAX_LCORE,
993 RTE_MAX_LCORE - 1);
994 global_n_host_cpus = RTE_MAX_LCORE;
995 }
996
997 return 0;
998error:
999 if (global_hypervisor_available)
1000 disconnect_hypervisor();
1001 return -1;
1002}
1003
1004void
1005channel_manager_exit(void)

Callers 1

mainFunction · 0.85

Calls 3

connect_hypervisorFunction · 0.85
rte_zmallocFunction · 0.85
disconnect_hypervisorFunction · 0.85

Tested by

no test coverage detected