[19.08,4/6] ipc: handle unsupported ipc in sendmsg

Message ID 8bfb0428de85290a8126dd0311a522aaed261fee.1556195690.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [19.08,1/6] ipc: handle unsupported ipc in init |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Anatoly Burakov April 25, 2019, 12:45 p.m. UTC
  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 | 6 ++++++
 lib/librte_eal/common/include/rte_eal.h | 3 +++
 2 files changed, 9 insertions(+)
  

Patch

diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index 4c062a306..0db842f84 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -792,6 +792,12 @@  rte_mp_sendmsg(struct rte_mp_msg *msg)
 	if (!check_input(msg))
 		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 7f807aa8e..d47cb2440 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -290,6 +290,9 @@  rte_mp_action_unregister(const char *name);
  * This function will send a message which will be responsed by the action
  * identified by name in the peer process.
  *
+ * @note IPC may be unsupported in certain circumstances, so caller should check
+ *    for ENOTSUP error.
+ *
  * @param msg
  *   The msg argument contains the customized message.
  *