From: Remy Horton <remy.horton@intel.com>
To: thomas.monjalon@6wind.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 1/3] eal: export keepalive state enumerations
Date: Wed, 15 Jun 2016 16:25:49 +0100 [thread overview]
Message-ID: <1466004351-18512-2-git-send-email-remy.horton@intel.com> (raw)
In-Reply-To: <1466004351-18512-1-git-send-email-remy.horton@intel.com>
Changes the keepalive state from an anonymous enum to a declared one
which is externally visible, so that keepalive enum values can be
used by applications.
Signed-off-by: Remy Horton <remy.horton@intel.com>
---
lib/librte_eal/common/include/rte_keepalive.h | 12 +++++++++-
lib/librte_eal/common/rte_keepalive.c | 34 +++++++++++++++------------
2 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_keepalive.h b/lib/librte_eal/common/include/rte_keepalive.h
index 10dac2e..d01a654 100644
--- a/lib/librte_eal/common/include/rte_keepalive.h
+++ b/lib/librte_eal/common/include/rte_keepalive.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright 2015 Intel Shannon Ltd. All rights reserved.
+ * Copyright 2015-2016 Intel Shannon Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -48,6 +48,16 @@
#define RTE_KEEPALIVE_MAXCORES RTE_MAX_LCORE
#endif
+enum rte_keepalive_state {
+ RTE_KA_STATE_UNUSED = 0,
+ RTE_KA_STATE_ALIVE = 1,
+ RTE_KA_STATE_MISSING = 4,
+ RTE_KA_STATE_DEAD = 2,
+ RTE_KA_STATE_GONE = 3,
+ RTE_KA_STATE_DOZING = 5,
+ RTE_KA_STATE_SLEEP = 6
+};
+
/**
* Keepalive failure callback.
*
diff --git a/lib/librte_eal/common/rte_keepalive.c b/lib/librte_eal/common/rte_keepalive.c
index 23363ec..8b14370 100644
--- a/lib/librte_eal/common/rte_keepalive.c
+++ b/lib/librte_eal/common/rte_keepalive.c
@@ -42,12 +42,8 @@
struct rte_keepalive {
/** Core Liveness. */
- enum rte_keepalive_state {
- ALIVE = 1,
- MISSING = 0,
- DEAD = 2,
- GONE = 3
- } __rte_cache_aligned state_flags[RTE_KEEPALIVE_MAXCORES];
+ enum rte_keepalive_state __rte_cache_aligned state_flags[
+ RTE_KEEPALIVE_MAXCORES];
/** Last-seen-alive timestamps */
uint64_t last_alive[RTE_KEEPALIVE_MAXCORES];
@@ -92,16 +88,18 @@ rte_keepalive_dispatch_pings(__rte_unused void *ptr_timer,
continue;
switch (keepcfg->state_flags[idx_core]) {
- case ALIVE: /* Alive */
- keepcfg->state_flags[idx_core] = MISSING;
+ case RTE_KA_STATE_UNUSED:
+ break;
+ case RTE_KA_STATE_ALIVE: /* Alive */
+ keepcfg->state_flags[idx_core] = RTE_KA_STATE_MISSING;
keepcfg->last_alive[idx_core] = rte_rdtsc();
break;
- case MISSING: /* MIA */
+ case RTE_KA_STATE_MISSING: /* MIA */
print_trace("Core MIA. ", keepcfg, idx_core);
- keepcfg->state_flags[idx_core] = DEAD;
+ keepcfg->state_flags[idx_core] = RTE_KA_STATE_DEAD;
break;
- case DEAD: /* Dead */
- keepcfg->state_flags[idx_core] = GONE;
+ case RTE_KA_STATE_DEAD: /* Dead */
+ keepcfg->state_flags[idx_core] = RTE_KA_STATE_GONE;
print_trace("Core died. ", keepcfg, idx_core);
if (keepcfg->callback)
keepcfg->callback(
@@ -109,7 +107,13 @@ rte_keepalive_dispatch_pings(__rte_unused void *ptr_timer,
idx_core
);
break;
- case GONE: /* Buried */
+ case RTE_KA_STATE_GONE: /* Buried */
+ break;
+ case RTE_KA_STATE_DOZING: /* Core going idle */
+ keepcfg->state_flags[idx_core] = RTE_KA_STATE_SLEEP;
+ keepcfg->last_alive[idx_core] = rte_rdtsc();
+ break;
+ case RTE_KA_STATE_SLEEP: /* Idled core */
break;
}
}
@@ -137,7 +141,7 @@ void
rte_keepalive_register_core(struct rte_keepalive *keepcfg, const int id_core)
{
if (id_core < RTE_KEEPALIVE_MAXCORES) {
- keepcfg->active_cores[id_core] = 1;
+ keepcfg->active_cores[id_core] = RTE_KA_STATE_ALIVE;
keepcfg->last_alive[id_core] = rte_rdtsc();
}
}
@@ -145,5 +149,5 @@ rte_keepalive_register_core(struct rte_keepalive *keepcfg, const int id_core)
void
rte_keepalive_mark_alive(struct rte_keepalive *keepcfg)
{
- keepcfg->state_flags[rte_lcore_id()] = ALIVE;
+ keepcfg->state_flags[rte_lcore_id()] = RTE_KA_STATE_ALIVE;
}
--
2.5.5
next prev parent reply other threads:[~2016-06-15 15:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 5:41 [dpdk-dev] [PATCH v1 0/3] Keep-alive enhancements Remy Horton
2016-04-29 5:41 ` [dpdk-dev] [PATCH v1 1/3] eal: add new keepalive state & callback hook Remy Horton
2016-04-29 5:41 ` [dpdk-dev] [PATCH v1 2/3] examples/l2fwd-keepalive: add IPC liveness reporting Remy Horton
2016-04-29 5:41 ` [dpdk-dev] [PATCH v1 3/3] doc: add keepalive enhancement documentation Remy Horton
2016-05-17 7:30 ` [dpdk-dev] FW: [PATCH v1 0/3] Keep-alive enhancements Liu, Shucong
2016-05-18 9:30 ` [dpdk-dev] [PATCH v2 " Remy Horton
2016-05-18 9:30 ` [dpdk-dev] [PATCH v2 1/3] eal: add new keepalive states & callback hooks Remy Horton
2016-06-08 9:53 ` Thomas Monjalon
2016-05-18 9:30 ` [dpdk-dev] [PATCH v2 2/3] examples/l2fwd-keepalive: add IPC liveness reporting Remy Horton
2016-05-18 9:30 ` [dpdk-dev] [PATCH v2 3/3] doc: add keepalive enhancement documentation Remy Horton
2016-06-08 9:52 ` Thomas Monjalon
2016-06-14 10:03 ` Remy Horton
2016-06-02 13:57 ` [dpdk-dev] [PATCH v2 0/3] Keep-alive enhancements Tahhan, Maryam
2016-06-15 9:17 ` [dpdk-dev] [PATCH v3 " Remy Horton
2016-06-15 9:17 ` [dpdk-dev] [PATCH v3 1/3] eal: export keepalive state enumerations Remy Horton
2016-06-15 9:27 ` Thomas Monjalon
2016-06-15 9:32 ` Remy Horton
2016-06-15 9:17 ` [dpdk-dev] [PATCH v3 2/3] eal: add additional keepalive callbacks Remy Horton
2016-06-15 9:17 ` [dpdk-dev] [PATCH v3 3/3] examples/l2fwd-keepalive: add IPC liveness reporting Remy Horton
2016-06-15 15:25 ` [dpdk-dev] [PATCH v4 0/3] Keep-alive enhancements Remy Horton
2016-06-15 15:25 ` Remy Horton [this message]
2016-06-15 15:25 ` [dpdk-dev] [PATCH v4 2/3] eal: add additional keepalive callbacks Remy Horton
2016-06-15 15:25 ` [dpdk-dev] [PATCH v4 3/3] examples/l2fwd-keepalive: add IPC liveness reporting Remy Horton
2016-06-16 16:30 ` [dpdk-dev] [PATCH v4 0/3] Keep-alive enhancements Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466004351-18512-2-git-send-email-remy.horton@intel.com \
--to=remy.horton@intel.com \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).