| 548 | } |
| 549 | |
| 550 | static int |
| 551 | handle_rollback_response(const struct rte_mp_msg *request, |
| 552 | const struct rte_mp_reply *reply __rte_unused) |
| 553 | { |
| 554 | struct rte_mp_msg msg; |
| 555 | struct malloc_mp_req *resp = (struct malloc_mp_req *)msg.param; |
| 556 | const struct malloc_mp_req *mpreq = |
| 557 | (const struct malloc_mp_req *)request->param; |
| 558 | struct mp_request *entry; |
| 559 | |
| 560 | /* lock the request */ |
| 561 | pthread_mutex_lock(&mp_request_list.lock); |
| 562 | |
| 563 | memset(&msg, 0, sizeof(msg)); |
| 564 | |
| 565 | entry = find_request_by_id(mpreq->id); |
| 566 | if (entry == NULL) { |
| 567 | RTE_LOG(ERR, EAL, "Wrong request ID\n"); |
| 568 | goto fail; |
| 569 | } |
| 570 | |
| 571 | if (entry->user_req.t != REQ_TYPE_ALLOC) { |
| 572 | RTE_LOG(ERR, EAL, "Unexpected active request\n"); |
| 573 | goto fail; |
| 574 | } |
| 575 | |
| 576 | /* we don't care if rollback succeeded, request still failed */ |
| 577 | resp->t = REQ_TYPE_ALLOC; |
| 578 | resp->result = REQ_RESULT_FAIL; |
| 579 | resp->id = mpreq->id; |
| 580 | msg.num_fds = 0; |
| 581 | msg.len_param = sizeof(*resp); |
| 582 | strlcpy(msg.name, MP_ACTION_RESPONSE, sizeof(msg.name)); |
| 583 | |
| 584 | if (rte_mp_sendmsg(&msg)) |
| 585 | RTE_LOG(ERR, EAL, "Could not send message to secondary process\n"); |
| 586 | |
| 587 | /* clean up */ |
| 588 | TAILQ_REMOVE(&mp_request_list.list, entry, next); |
| 589 | free(entry->alloc_state.ms); |
| 590 | free(entry); |
| 591 | |
| 592 | pthread_mutex_unlock(&mp_request_list.lock); |
| 593 | return 0; |
| 594 | fail: |
| 595 | pthread_mutex_unlock(&mp_request_list.lock); |
| 596 | return -1; |
| 597 | } |
| 598 | |
| 599 | /* final stage of the request from secondary */ |
| 600 | static int |
nothing calls this directly
no test coverage detected