Pull queue operation results from the queue. */
| 3336 | |
| 3337 | /** Pull queue operation results from the queue. */ |
| 3338 | static int |
| 3339 | port_queue_aged_flow_destroy(portid_t port_id, queueid_t queue_id, |
| 3340 | const uint64_t *rule, int nb_flows) |
| 3341 | { |
| 3342 | struct rte_port *port = &ports[port_id]; |
| 3343 | struct rte_flow_op_result *res; |
| 3344 | struct rte_flow_error error; |
| 3345 | uint32_t n = nb_flows; |
| 3346 | int ret = 0; |
| 3347 | int i; |
| 3348 | |
| 3349 | res = calloc(port->queue_sz, sizeof(struct rte_flow_op_result)); |
| 3350 | if (!res) { |
| 3351 | printf("Failed to allocate memory for pulled results\n"); |
| 3352 | return -ENOMEM; |
| 3353 | } |
| 3354 | |
| 3355 | memset(&error, 0x66, sizeof(error)); |
| 3356 | while (nb_flows > 0) { |
| 3357 | int success = 0; |
| 3358 | |
| 3359 | if (n > port->queue_sz) |
| 3360 | n = port->queue_sz; |
| 3361 | ret = port_queue_flow_destroy(port_id, queue_id, true, n, rule); |
| 3362 | if (ret < 0) { |
| 3363 | free(res); |
| 3364 | return ret; |
| 3365 | } |
| 3366 | ret = rte_flow_push(port_id, queue_id, &error); |
| 3367 | if (ret < 0) { |
| 3368 | printf("Failed to push operations in the queue: %s\n", |
| 3369 | strerror(-ret)); |
| 3370 | free(res); |
| 3371 | return ret; |
| 3372 | } |
| 3373 | while (success < nb_flows) { |
| 3374 | ret = rte_flow_pull(port_id, queue_id, res, |
| 3375 | port->queue_sz, &error); |
| 3376 | if (ret < 0) { |
| 3377 | printf("Failed to pull a operation results: %s\n", |
| 3378 | strerror(-ret)); |
| 3379 | free(res); |
| 3380 | return ret; |
| 3381 | } |
| 3382 | |
| 3383 | for (i = 0; i < ret; i++) { |
| 3384 | if (res[i].status == RTE_FLOW_OP_SUCCESS) |
| 3385 | success++; |
| 3386 | } |
| 3387 | } |
| 3388 | rule += n; |
| 3389 | nb_flows -= n; |
| 3390 | n = nb_flows; |
| 3391 | } |
| 3392 | |
| 3393 | free(res); |
| 3394 | return ret; |
| 3395 | } |
no test coverage detected