aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_eal/common/eal_common_proc.c
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2018-11-27 10:44:39 +0000
committerLuca Boccassi <luca.boccassi@gmail.com>2018-11-27 10:45:47 +0000
commita4f0fa29488e582ab8b5ef9db475b3d26ded690c (patch)
treede163f35a726d518a3f93ab6ee4ac25b8982635d /lib/librte_eal/common/eal_common_proc.c
parent29058550643267a554e0368806dece63b047c5cb (diff)
New upstream version 18.11upstream/18.11upstream
Change-Id: I6c63198045de1e34fda8a7b4665d89d5f4a20d20 Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'lib/librte_eal/common/eal_common_proc.c')
-rw-r--r--lib/librte_eal/common/eal_common_proc.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index f65ef56c..1c3f09aa 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -827,28 +827,6 @@ mp_request_async(const char *dst, struct rte_mp_msg *req,
goto fail;
}
- /*
- * set the alarm before sending message. there are two possible error
- * scenarios to consider here:
- *
- * - if the alarm set fails, we free the memory right there
- * - if the alarm set succeeds but sending message fails, then the alarm
- * will trigger and clean up the memory
- *
- * Even if the alarm triggers too early (i.e. immediately), we're still
- * holding the lock to pending requests queue, so the interrupt thread
- * will just spin until we release the lock, and either release the
- * memory, or doesn't find any pending requests in the queue because we
- * never added any due to send message failure.
- */
- if (rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000,
- async_reply_handle, pending_req) < 0) {
- RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n",
- dst, req->name);
- ret = -1;
- goto fail;
- }
-
ret = send_msg(dst, req, MP_REQ);
if (ret < 0) {
RTE_LOG(ERR, EAL, "Fail to send request %s:%s\n",
@@ -859,10 +837,18 @@ mp_request_async(const char *dst, struct rte_mp_msg *req,
ret = 0;
goto fail;
}
- TAILQ_INSERT_TAIL(&pending_requests.requests, pending_req, next);
-
param->user_reply.nb_sent++;
+ /* if alarm set fails, we simply ignore the reply */
+ if (rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000,
+ async_reply_handle, pending_req) < 0) {
+ RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n",
+ dst, req->name);
+ ret = -1;
+ goto fail;
+ }
+ TAILQ_INSERT_TAIL(&pending_requests.requests, pending_req, next);
+
return 0;
fail:
free(pending_req);