Note: 1 QM instance per QM device, QM instance/device == event device */
| 925 | |
| 926 | /* Note: 1 QM instance per QM device, QM instance/device == event device */ |
| 927 | static int |
| 928 | dlb2_eventdev_configure(const struct rte_eventdev *dev) |
| 929 | { |
| 930 | struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev); |
| 931 | struct dlb2_hw_dev *handle = &dlb2->qm_instance; |
| 932 | struct dlb2_hw_rsrcs *rsrcs = &handle->info.hw_rsrc_max; |
| 933 | const struct rte_eventdev_data *data = dev->data; |
| 934 | const struct rte_event_dev_config *config = &data->dev_conf; |
| 935 | int ret; |
| 936 | |
| 937 | /* If this eventdev is already configured, we must release the current |
| 938 | * scheduling domain before attempting to configure a new one. |
| 939 | */ |
| 940 | if (dlb2->configured) { |
| 941 | dlb2_hw_reset_sched_domain(dev, true); |
| 942 | ret = dlb2_hw_query_resources(dlb2); |
| 943 | if (ret) { |
| 944 | DLB2_LOG_ERR("get resources err=%d, devid=%d", |
| 945 | ret, data->dev_id); |
| 946 | return ret; |
| 947 | } |
| 948 | } |
| 949 | |
| 950 | if (config->nb_event_queues > rsrcs->num_queues) { |
| 951 | DLB2_LOG_ERR("nb_event_queues parameter (%d) exceeds the QM device's capabilities (%d).", |
| 952 | config->nb_event_queues, |
| 953 | rsrcs->num_queues); |
| 954 | return -EINVAL; |
| 955 | } |
| 956 | if (config->nb_event_ports > (rsrcs->num_ldb_ports |
| 957 | + rsrcs->num_dir_ports)) { |
| 958 | DLB2_LOG_ERR("nb_event_ports parameter (%d) exceeds the QM device's capabilities (%d).", |
| 959 | config->nb_event_ports, |
| 960 | (rsrcs->num_ldb_ports + rsrcs->num_dir_ports)); |
| 961 | return -EINVAL; |
| 962 | } |
| 963 | if (config->nb_events_limit > rsrcs->nb_events_limit) { |
| 964 | DLB2_LOG_ERR("nb_events_limit parameter (%d) exceeds the QM device's capabilities (%d).", |
| 965 | config->nb_events_limit, |
| 966 | rsrcs->nb_events_limit); |
| 967 | return -EINVAL; |
| 968 | } |
| 969 | |
| 970 | if (config->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) |
| 971 | dlb2->global_dequeue_wait = false; |
| 972 | else { |
| 973 | uint32_t timeout32; |
| 974 | |
| 975 | dlb2->global_dequeue_wait = true; |
| 976 | |
| 977 | /* note size mismatch of timeout vals in eventdev lib. */ |
| 978 | timeout32 = config->dequeue_timeout_ns; |
| 979 | |
| 980 | dlb2->global_dequeue_wait_ticks = |
| 981 | timeout32 * (rte_get_timer_hz() / 1E9); |
| 982 | } |
| 983 | |
| 984 | /* Does this platform support umonitor/umwait? */ |
nothing calls this directly
no test coverage detected