summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Burakov <anatoly.burakov@intel.com>2019-05-03 12:50:50 +0100
committerThomas Monjalon <thomas@monjalon.net>2019-05-09 17:50:59 +0200
commitbfbc3a50416419d79c9cbe7868d1e9901919c346 (patch)
treed66039413757a697d642f97c6dcd14a56cd6b813
parent3855b4150037142435b5c1f4195e44c142785f1f (diff)
downloaddpdk-bfbc3a50416419d79c9cbe7868d1e9901919c346.zip
dpdk-bfbc3a50416419d79c9cbe7868d1e9901919c346.tar.gz
dpdk-bfbc3a50416419d79c9cbe7868d1e9901919c346.tar.xz
ipc: add warnings about correct API usage
When handling synchronous or asynchronous requests, the reply must be sent explicitly even if the result of the operation is an error, to avoid the other side timing out. Make note of this in documentation explicitly. Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
-rw-r--r--doc/guides/prog_guide/multi_proc_support.rst7
-rw-r--r--lib/librte_eal/common/include/rte_eal.h15
2 files changed, 22 insertions, 0 deletions
diff --git a/doc/guides/prog_guide/multi_proc_support.rst b/doc/guides/prog_guide/multi_proc_support.rst
index 63d08b6..a84083b 100644
--- a/doc/guides/prog_guide/multi_proc_support.rst
+++ b/doc/guides/prog_guide/multi_proc_support.rst
@@ -309,6 +309,13 @@ If a response is required, a new ``rte_mp_msg`` message descriptor must be
constructed and sent via ``rte_mp_reply()`` function, along with ``peer``
pointer. The resulting response will then be delivered to the correct requestor.
+.. warning::
+ Simply returning a value when processing a request callback will not send a
+ response to the request - it must always be explicitly sent even in case
+ of errors. Implementation of error signalling rests with the application,
+ there is no built-in way to indicate success or error for a request. Failing
+ to do so will cause the requestor to time out while waiting on a response.
+
Misc considerations
~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 7db0225..73754aa 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -226,6 +226,11 @@ struct rte_mp_reply {
* As we create socket channel for primary/secondary communication, use
* this function typedef to register action for coming messages.
*
+ * @note When handling IPC request callbacks, the reply must be sent even in
+ * cases of error handling. Simply returning success or failure will *not*
+ * send a response to the requestor.
+ * Implementation of error signalling mechanism is up to the application.
+ *
* @note No memory allocations should take place inside the callback.
*/
typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
@@ -237,6 +242,11 @@ typedef int (*rte_mp_t)(const struct rte_mp_msg *msg, const void *peer);
* this function typedef to register action for coming responses to asynchronous
* requests.
*
+ * @note When handling IPC request callbacks, the reply must be sent even in
+ * cases of error handling. Simply returning success or failure will *not*
+ * send a response to the requestor.
+ * Implementation of error signalling mechanism is up to the application.
+ *
* @note No memory allocations should take place inside the callback.
*/
typedef int (*rte_mp_async_reply_t)(const struct rte_mp_msg *request,
@@ -368,6 +378,11 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
* This function will send a reply message in response to a request message
* received previously.
*
+ * @note When handling IPC request callbacks, the reply must be sent even in
+ * cases of error handling. Simply returning success or failure will *not*
+ * send a response to the requestor.
+ * Implementation of error signalling mechanism is up to the application.
+ *
* @param msg
* The msg argument contains the customized message.
*