- /* First time configuration */
- if (dev->data->ports == NULL && nb_ports != 0) {
- dev->data->ports = rte_zmalloc_socket("eventdev->data->ports",
- sizeof(dev->data->ports[0]) * nb_ports,
- RTE_CACHE_LINE_SIZE, dev->data->socket_id);
- if (dev->data->ports == NULL) {
- dev->data->nb_ports = 0;
- RTE_EDEV_LOG_ERR("failed to get mem for port meta data,"
- "nb_ports %u", nb_ports);
- return -(ENOMEM);
- }
-
- /* Allocate memory to store port configurations */
- dev->data->ports_cfg =
- rte_zmalloc_socket("eventdev->ports_cfg",
- sizeof(dev->data->ports_cfg[0]) * nb_ports,
- RTE_CACHE_LINE_SIZE, dev->data->socket_id);
- if (dev->data->ports_cfg == NULL) {
- dev->data->nb_ports = 0;
- RTE_EDEV_LOG_ERR("failed to get mem for port cfg,"
- "nb_ports %u", nb_ports);
- return -(ENOMEM);
- }
-
- /* Allocate memory to store queue to port link connection */
- dev->data->links_map =
- rte_zmalloc_socket("eventdev->links_map",
- sizeof(dev->data->links_map[0]) * nb_ports *
- RTE_EVENT_MAX_QUEUES_PER_DEV,
- RTE_CACHE_LINE_SIZE, dev->data->socket_id);
- if (dev->data->links_map == NULL) {
- dev->data->nb_ports = 0;
- RTE_EDEV_LOG_ERR("failed to get mem for port_map area,"
- "nb_ports %u", nb_ports);
- return -(ENOMEM);
- }
- for (i = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV; i++)
- dev->data->links_map[i] =
- EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
- } else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */