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

Function rte_mp_request_async

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

Source from the content-addressed store, hash-verified

1086}
1087
1088int
1089rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
1090 rte_mp_async_reply_t clb)
1091{
1092 struct rte_mp_msg *copy;
1093 struct pending_request *dummy;
1094 struct async_request_param *param;
1095 struct rte_mp_reply *reply;
1096 int dir_fd, ret = 0;
1097 DIR *mp_dir;
1098 struct dirent *ent;
1099 struct timespec now;
1100 struct timespec *end;
1101 bool dummy_used = false;
1102 const struct internal_config *internal_conf =
1103 eal_get_internal_configuration();
1104
1105 RTE_LOG(DEBUG, EAL, "request: %s\n", req->name);
1106
1107 if (check_input(req) != 0)
1108 return -1;
1109
1110 if (internal_conf->no_shconf) {
1111 RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
1112 rte_errno = ENOTSUP;
1113 return -1;
1114 }
1115
1116 if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) {
1117 RTE_LOG(ERR, EAL, "Failed to get current time\n");
1118 rte_errno = errno;
1119 return -1;
1120 }
1121 copy = calloc(1, sizeof(*copy));
1122 dummy = calloc(1, sizeof(*dummy));
1123 param = calloc(1, sizeof(*param));
1124 if (copy == NULL || dummy == NULL || param == NULL) {
1125 RTE_LOG(ERR, EAL, "Failed to allocate memory for async reply\n");
1126 rte_errno = ENOMEM;
1127 goto fail;
1128 }
1129
1130 /* copy message */
1131 memcpy(copy, req, sizeof(*copy));
1132
1133 param->n_responses_processed = 0;
1134 param->clb = clb;
1135 end = &param->end;
1136 reply = &param->user_reply;
1137
1138 end->tv_nsec = (now.tv_nsec + ts->tv_nsec) % 1000000000;
1139 end->tv_sec = now.tv_sec + ts->tv_sec +
1140 (now.tv_nsec + ts->tv_nsec) / 1000000000;
1141 reply->nb_sent = 0;
1142 reply->nb_received = 0;
1143 reply->msgs = NULL;
1144
1145 /* we have to lock the request queue here, as we will be adding a bunch

Callers 2

handle_requestFunction · 0.70
handle_sync_responseFunction · 0.70

Calls 15

callocFunction · 0.85
pthread_mutex_lockFunction · 0.85
rte_eal_process_typeFunction · 0.85
mp_request_asyncFunction · 0.85
eal_mp_socket_pathFunction · 0.85
pthread_mutex_unlockFunction · 0.85
opendirFunction · 0.85
readdirFunction · 0.85
snprintfFunction · 0.85
closedirFunction · 0.85
check_inputFunction · 0.70

Tested by

no test coverage detected