| 760 | } |
| 761 | |
| 762 | static int |
| 763 | sw_start(struct rte_eventdev *dev) |
| 764 | { |
| 765 | unsigned int i, j; |
| 766 | struct sw_evdev *sw = sw_pmd_priv(dev); |
| 767 | |
| 768 | rte_service_component_runstate_set(sw->service_id, 1); |
| 769 | |
| 770 | /* check a service core is mapped to this service */ |
| 771 | if (!rte_service_runstate_get(sw->service_id)) { |
| 772 | SW_LOG_ERR("Warning: No Service core enabled on service %s", |
| 773 | sw->service_name); |
| 774 | return -ENOENT; |
| 775 | } |
| 776 | |
| 777 | /* check all ports are set up */ |
| 778 | for (i = 0; i < sw->port_count; i++) |
| 779 | if (sw->ports[i].rx_worker_ring == NULL) { |
| 780 | SW_LOG_ERR("Port %d not configured", i); |
| 781 | return -ESTALE; |
| 782 | } |
| 783 | |
| 784 | /* check all queues are configured and mapped to ports*/ |
| 785 | for (i = 0; i < sw->qid_count; i++) |
| 786 | if (!sw->qids[i].initialized || |
| 787 | sw->qids[i].cq_num_mapped_cqs == 0) { |
| 788 | SW_LOG_ERR("Queue %d not configured", i); |
| 789 | return -ENOLINK; |
| 790 | } |
| 791 | |
| 792 | /* build up our prioritized array of qids */ |
| 793 | /* We don't use qsort here, as if all/multiple entries have the same |
| 794 | * priority, the result is non-deterministic. From "man 3 qsort": |
| 795 | * "If two members compare as equal, their order in the sorted |
| 796 | * array is undefined." |
| 797 | */ |
| 798 | uint32_t qidx = 0; |
| 799 | for (j = 0; j <= RTE_EVENT_DEV_PRIORITY_LOWEST; j++) { |
| 800 | for (i = 0; i < sw->qid_count; i++) { |
| 801 | if (sw->qids[i].priority == j) { |
| 802 | sw->qids_prioritized[qidx] = &sw->qids[i]; |
| 803 | qidx++; |
| 804 | } |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | sw_init_qid_iqs(sw); |
| 809 | |
| 810 | if (sw_xstats_init(sw) < 0) |
| 811 | return -EINVAL; |
| 812 | |
| 813 | rte_smp_wmb(); |
| 814 | sw->started = 1; |
| 815 | |
| 816 | return 0; |
| 817 | } |
| 818 | |
| 819 | static void |
nothing calls this directly
no test coverage detected