ipc: handle unsupported IPC in async request
[dpdk.git] / lib / librte_eal / common / eal_common_proc.c
index 1a2259f..cfd571e 100644 (file)
@@ -205,6 +205,12 @@ rte_mp_action_register(const char *name, rte_mp_t action)
        if (validate_action_name(name) != 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;
+       }
+
        entry = malloc(sizeof(struct action_entry));
        if (entry == NULL) {
                rte_errno = ENOMEM;
@@ -233,6 +239,11 @@ rte_mp_action_unregister(const char *name)
        if (validate_action_name(name) != 0)
                return;
 
+       if (internal_config.no_shconf) {
+               RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
+               return;
+       }
+
        pthread_mutex_lock(&mp_mutex_action);
        entry = find_action_entry_by_name(name);
        if (entry == NULL) {
@@ -576,7 +587,8 @@ rte_mp_channel_init(void)
         */
        if (internal_config.no_shconf) {
                RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC will be disabled\n");
-               return 0;
+               rte_errno = ENOTSUP;
+               return -1;
        }
 
        /* create filter path */
@@ -795,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);
 }
@@ -951,7 +969,8 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,
 
        if (internal_config.no_shconf) {
                RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
-               return 0;
+               rte_errno = ENOTSUP;
+               return -1;
        }
 
        if (gettimeofday(&now, NULL) < 0) {
@@ -1047,7 +1066,8 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
 
        if (internal_config.no_shconf) {
                RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n");
-               return 0;
+               rte_errno = ENOTSUP;
+               return -1;
        }
 
        if (gettimeofday(&now, NULL) < 0) {