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

Function mp_request_async

dpdk/lib/eal/common/eal_common_proc.c:857–917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857static int
858mp_request_async(const char *dst, struct rte_mp_msg *req,
859 struct async_request_param *param, const struct timespec *ts)
860{
861 struct rte_mp_msg *reply_msg;
862 struct pending_request *pending_req, *exist;
863 int ret = -1;
864
865 pending_req = calloc(1, sizeof(*pending_req));
866 reply_msg = calloc(1, sizeof(*reply_msg));
867 if (pending_req == NULL || reply_msg == NULL) {
868 RTE_LOG(ERR, EAL, "Could not allocate space for sync request\n");
869 rte_errno = ENOMEM;
870 ret = -1;
871 goto fail;
872 }
873
874 pending_req->type = REQUEST_TYPE_ASYNC;
875 strlcpy(pending_req->dst, dst, sizeof(pending_req->dst));
876 pending_req->request = req;
877 pending_req->reply = reply_msg;
878 pending_req->async.param = param;
879
880 /* queue already locked by caller */
881
882 exist = find_pending_request(dst, req->name);
883 if (exist) {
884 RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
885 rte_errno = EEXIST;
886 ret = -1;
887 goto fail;
888 }
889
890 ret = send_msg(dst, req, MP_REQ);
891 if (ret < 0) {
892 RTE_LOG(ERR, EAL, "Fail to send request %s:%s\n",
893 dst, req->name);
894 ret = -1;
895 goto fail;
896 } else if (ret == 0) {
897 ret = 0;
898 goto fail;
899 }
900 param->user_reply.nb_sent++;
901
902 /* if alarm set fails, we simply ignore the reply */
903 if (rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000,
904 async_reply_handle, pending_req) < 0) {
905 RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n",
906 dst, req->name);
907 ret = -1;
908 goto fail;
909 }
910 TAILQ_INSERT_TAIL(&pending_requests.requests, pending_req, next);
911
912 return 0;
913fail:
914 free(pending_req);

Callers 1

rte_mp_request_asyncFunction · 0.85

Calls 6

callocFunction · 0.85
find_pending_requestFunction · 0.85
send_msgFunction · 0.70
strlcpyFunction · 0.50
rte_eal_alarm_setFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected