From 144767514e5ee8436f6e5959f95c2c6559f315b3 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Thu, 25 Apr 2019 13:45:17 +0100 Subject: [PATCH] ipc: handle unsupported IPC in sendmsg Currently, IPC API will silently ignore unsupported IPC. Fix the API call and its callers to explicitly handle unsupported IPC cases. Signed-off-by: Anatoly Burakov --- lib/librte_eal/common/eal_common_proc.c | 6 ++++++ lib/librte_eal/common/include/rte_eal.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index d14d55657b..5bb117c745 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -807,6 +807,12 @@ rte_mp_sendmsg(struct rte_mp_msg *msg) if (check_input(msg) != 0) return -1; + if (internal_config.no_shconf) { + RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n"); + rte_errno = ENOTSUP; + return -1; + } + RTE_LOG(DEBUG, EAL, "sendmsg: %s\n", msg->name); return mp_send(msg, NULL, MP_MSG); } diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index 4820298cfc..a409d32dee 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -288,6 +288,9 @@ rte_mp_action_register(const char *name, rte_mp_t action); * not want to response the messages from the corresponding component in its * primary process or secondary processes. * + * @note IPC may be unsupported in certain circumstances, so caller should check + * for ENOTSUP error. + * * @param name * The name argument plays as the nonredundant key to find the action. * -- 2.20.1