MCPcopy Create free account
hub / github.com/F-Stack/f-stack / handle_rollback_response

Function handle_rollback_response

dpdk/lib/eal/common/malloc_mp.c:550–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548}
549
550static int
551handle_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;
594fail:
595 pthread_mutex_unlock(&mp_request_list.lock);
596 return -1;
597}
598
599/* final stage of the request from secondary */
600static int

Callers

nothing calls this directly

Calls 7

pthread_mutex_lockFunction · 0.85
memsetFunction · 0.85
find_request_by_idFunction · 0.85
pthread_mutex_unlockFunction · 0.85
rte_mp_sendmsgFunction · 0.70
strlcpyFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected