Pull queue operation results from the queue. */
| 3492 | |
| 3493 | /** Pull queue operation results from the queue. */ |
| 3494 | int |
| 3495 | port_queue_flow_pull(portid_t port_id, queueid_t queue_id) |
| 3496 | { |
| 3497 | struct rte_port *port; |
| 3498 | struct rte_flow_op_result *res; |
| 3499 | struct rte_flow_error error; |
| 3500 | int ret = 0; |
| 3501 | int success = 0; |
| 3502 | int i; |
| 3503 | struct queue_job *job; |
| 3504 | |
| 3505 | if (port_id_is_invalid(port_id, ENABLED_WARN) || |
| 3506 | port_id == (portid_t)RTE_PORT_ALL) |
| 3507 | return -EINVAL; |
| 3508 | port = &ports[port_id]; |
| 3509 | |
| 3510 | if (queue_id >= port->queue_nb) { |
| 3511 | printf("Queue #%u is invalid\n", queue_id); |
| 3512 | return -EINVAL; |
| 3513 | } |
| 3514 | |
| 3515 | res = calloc(port->queue_sz, sizeof(struct rte_flow_op_result)); |
| 3516 | if (!res) { |
| 3517 | printf("Failed to allocate memory for pulled results\n"); |
| 3518 | return -ENOMEM; |
| 3519 | } |
| 3520 | |
| 3521 | memset(&error, 0x66, sizeof(error)); |
| 3522 | ret = rte_flow_pull(port_id, queue_id, res, |
| 3523 | port->queue_sz, &error); |
| 3524 | if (ret < 0) { |
| 3525 | printf("Failed to pull a operation results\n"); |
| 3526 | free(res); |
| 3527 | return -EINVAL; |
| 3528 | } |
| 3529 | |
| 3530 | for (i = 0; i < ret; i++) { |
| 3531 | if (res[i].status == RTE_FLOW_OP_SUCCESS) |
| 3532 | success++; |
| 3533 | job = (struct queue_job *)res[i].user_data; |
| 3534 | if (job->type == QUEUE_JOB_TYPE_FLOW_DESTROY || |
| 3535 | job->type == QUEUE_JOB_TYPE_FLOW_UPDATE) |
| 3536 | free(job->pf); |
| 3537 | else if (job->type == QUEUE_JOB_TYPE_ACTION_DESTROY) |
| 3538 | free(job->pia); |
| 3539 | else if (job->type == QUEUE_JOB_TYPE_ACTION_QUERY) |
| 3540 | port_action_handle_query_dump(port_id, job->pia, |
| 3541 | &job->query); |
| 3542 | free(job); |
| 3543 | } |
| 3544 | printf("Queue #%u pulled %u operations (%u failed, %u succeeded)\n", |
| 3545 | queue_id, ret, ret - success, success); |
| 3546 | free(res); |
| 3547 | return ret; |
| 3548 | } |
| 3549 | |
| 3550 | /* Set group miss actions */ |
| 3551 | int |
no test coverage detected