/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2015 Akamai Technologies.
* All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
#define N_TIMERS 50
static struct rte_timer timer[N_TIMERS];
-static unsigned timer_lcore_id[N_TIMERS];
+static unsigned int timer_lcore_id[N_TIMERS];
-static unsigned master;
-static volatile unsigned stop_slaves;
+static unsigned int main_lcore;
+static volatile unsigned int stop_workers;
static int reload_timer(struct rte_timer *tim);
-int timer_logtype_test;
-
-RTE_INIT(test_timer_init_log)
-{
- timer_logtype_test = rte_log_register("test.timer");
-}
+RTE_LOG_REGISTER(timer_logtype_test, test.timer, INFO);
static void
timer_cb(struct rte_timer *tim, void *arg __rte_unused)
(tim - timer);
int ret;
- ret = rte_timer_reset(tim, ticks, PERIODICAL, master, timer_cb, NULL);
+ ret = rte_timer_reset(tim, ticks, PERIODICAL, main_lcore, timer_cb, NULL);
if (ret != 0) {
rte_log(RTE_LOG_DEBUG, timer_logtype_test,
"- core %u failed to reset timer %" PRIuPTR " (OK)\n",
}
static int
-slave_main_loop(__attribute__((unused)) void *arg)
+worker_main_loop(__rte_unused void *arg)
{
unsigned lcore_id = rte_lcore_id();
unsigned i;
printf("Starting main loop on core %u\n", lcore_id);
- while (!stop_slaves) {
+ while (!stop_workers) {
/* Wait until the timer manager is running.
* We know it's running when we see timer[0] NOT pending.
*/
unsigned lcore_id;
unsigned i;
- master = lcore_id = rte_lcore_id();
+ main_lcore = lcore_id = rte_lcore_id();
hz = rte_get_timer_hz();
/* init and start timers */
ret = reload_timer(&timer[i]);
TEST_ASSERT(ret == 0, "reload_timer failed");
- /* Distribute timers to slaves.
- * Note that we assign timer[0] to the master.
+ /* Distribute timers to workers.
+ * Note that we assign timer[0] to the main.
*/
timer_lcore_id[i] = lcore_id;
lcore_id = rte_get_next_lcore(lcore_id, 1, 1);
cur_time = rte_get_timer_cycles();
end_time = cur_time + (hz * TEST_DURATION_S);
- /* start slave cores */
- stop_slaves = 0;
+ /* start worker cores */
+ stop_workers = 0;
printf("Start timer manage race condition test (%u seconds)\n",
TEST_DURATION_S);
- rte_eal_mp_remote_launch(slave_main_loop, NULL, SKIP_MASTER);
+ rte_eal_mp_remote_launch(worker_main_loop, NULL, SKIP_MAIN);
while (diff >= 0) {
/* run the timers */
diff = end_time - cur_time;
}
- /* stop slave cores */
+ /* stop worker cores */
printf("Stopping timer manage race condition test\n");
- stop_slaves = 1;
+ stop_workers = 1;
rte_eal_mp_wait_lcore();
/* stop timers */