| 26 | } |
| 27 | |
| 28 | int |
| 29 | rte_pie_config_init(struct rte_pie_config *pie_cfg, |
| 30 | const uint16_t qdelay_ref, |
| 31 | const uint16_t dp_update_interval, |
| 32 | const uint16_t max_burst, |
| 33 | const uint16_t tailq_th) |
| 34 | { |
| 35 | uint64_t tsc_hz = rte_get_tsc_hz(); |
| 36 | |
| 37 | if (pie_cfg == NULL) |
| 38 | return -1; |
| 39 | |
| 40 | if (qdelay_ref <= 0) { |
| 41 | RTE_LOG(ERR, SCHED, |
| 42 | "%s: Incorrect value for qdelay_ref\n", __func__); |
| 43 | return -EINVAL; |
| 44 | } |
| 45 | |
| 46 | if (dp_update_interval <= 0) { |
| 47 | RTE_LOG(ERR, SCHED, |
| 48 | "%s: Incorrect value for dp_update_interval\n", __func__); |
| 49 | return -EINVAL; |
| 50 | } |
| 51 | |
| 52 | if (max_burst <= 0) { |
| 53 | RTE_LOG(ERR, SCHED, |
| 54 | "%s: Incorrect value for max_burst\n", __func__); |
| 55 | return -EINVAL; |
| 56 | } |
| 57 | |
| 58 | if (tailq_th <= 0) { |
| 59 | RTE_LOG(ERR, SCHED, |
| 60 | "%s: Incorrect value for tailq_th\n", __func__); |
| 61 | return -EINVAL; |
| 62 | } |
| 63 | |
| 64 | pie_cfg->qdelay_ref = (tsc_hz * qdelay_ref) / 1000; |
| 65 | pie_cfg->dp_update_interval = (tsc_hz * dp_update_interval) / 1000; |
| 66 | pie_cfg->max_burst = (tsc_hz * max_burst) / 1000; |
| 67 | pie_cfg->tailq_th = tailq_th; |
| 68 | |
| 69 | return 0; |
| 70 | } |