ipc: handle unsupported IPC in sendmsg
authorAnatoly Burakov <anatoly.burakov@intel.com>
Thu, 25 Apr 2019 12:45:17 +0000 (13:45 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 5 Jun 2019 09:28:00 +0000 (11:28 +0200)
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 <anatoly.burakov@intel.com>
lib/librte_eal/common/eal_common_proc.c
lib/librte_eal/common/include/rte_eal.h

index d14d556..5bb117c 100644 (file)
@@ -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);
 }
index 4820298..a409d32 100644 (file)
@@ -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.
  *