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

Function process_msg

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

Source from the content-addressed store, hash-verified

331}
332
333static void
334process_msg(struct mp_msg_internal *m, struct sockaddr_un *s)
335{
336 struct pending_request *pending_req;
337 struct action_entry *entry;
338 struct rte_mp_msg *msg = &m->msg;
339 rte_mp_t action = NULL;
340 const struct internal_config *internal_conf =
341 eal_get_internal_configuration();
342
343 RTE_LOG(DEBUG, EAL, "msg: %s\n", msg->name);
344
345 if (m->type == MP_REP || m->type == MP_IGN) {
346 struct pending_request *req = NULL;
347
348 pthread_mutex_lock(&pending_requests.lock);
349 pending_req = find_pending_request(s->sun_path, msg->name);
350 if (pending_req) {
351 memcpy(pending_req->reply, msg, sizeof(*msg));
352 /* -1 indicates that we've been asked to ignore */
353 pending_req->reply_received =
354 m->type == MP_REP ? 1 : -1;
355
356 if (pending_req->type == REQUEST_TYPE_SYNC)
357 pthread_cond_signal(&pending_req->sync.cond);
358 else if (pending_req->type == REQUEST_TYPE_ASYNC)
359 req = async_reply_handle_thread_unsafe(
360 pending_req);
361 } else {
362 RTE_LOG(ERR, EAL, "Drop mp reply: %s\n", msg->name);
363 cleanup_msg_fds(msg);
364 }
365 pthread_mutex_unlock(&pending_requests.lock);
366
367 if (req != NULL)
368 trigger_async_action(req);
369 return;
370 }
371
372 pthread_mutex_lock(&mp_mutex_action);
373 entry = find_action_entry_by_name(msg->name);
374 if (entry != NULL)
375 action = entry->action;
376 pthread_mutex_unlock(&mp_mutex_action);
377
378 if (!action) {
379 if (m->type == MP_REQ && !internal_conf->init_complete) {
380 /* if this is a request, and init is not yet complete,
381 * and callback wasn't registered, we should tell the
382 * requester to ignore our existence because we're not
383 * yet ready to process this request.
384 */
385 struct rte_mp_msg dummy;
386
387 memset(&dummy, 0, sizeof(dummy));
388 strlcpy(dummy.name, msg->name, sizeof(dummy.name));
389 mp_send(&dummy, s->sun_path, MP_IGN);
390 } else {

Callers 1

mp_handleFunction · 0.70

Calls 13

pthread_mutex_lockFunction · 0.85
find_pending_requestFunction · 0.85
cleanup_msg_fdsFunction · 0.85
pthread_mutex_unlockFunction · 0.85
trigger_async_actionFunction · 0.85
memsetFunction · 0.85
mp_sendFunction · 0.85
memcpyFunction · 0.50
strlcpyFunction · 0.50

Tested by

no test coverage detected