X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fark%2Fark_pktgen.c;h=28a44f754628c4b6e7d89bc8baf5a9278306fb83;hb=0475c7770502cb4166b2577df3ff446af9d85515;hp=2cae252d66e8f9ee3c5bf2c16104ca2aed9ad161;hpb=6723c0fc7207ca4416822b170b1485a78aa47c7c;p=dpdk.git diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c index 2cae252d66..28a44f7546 100644 --- a/drivers/net/ark/ark_pktgen.c +++ b/drivers/net/ark/ark_pktgen.c @@ -2,15 +2,9 @@ * Copyright (c) 2015-2018 Atomic Rules LLC */ -#include -#include -#include #include #include -#include - -#include #include #include "ark_pktgen.h" @@ -83,7 +77,7 @@ ark_pktgen_init(void *adr, int ord, int l2_mode) rte_malloc("ark_pkt_gen_inst_pmd", sizeof(struct ark_pkt_gen_inst), 0); if (inst == NULL) { - PMD_DRV_LOG(ERR, "Failed to malloc ark_pkt_gen_inst.\n"); + ARK_PMD_LOG(ERR, "Failed to malloc ark_pkt_gen_inst.\n"); return inst; } inst->regs = (struct ark_pkt_gen_regs *)adr; @@ -126,12 +120,12 @@ ark_pktgen_pause(ark_pkt_gen_t handle) while (!ark_pktgen_paused(handle)) { usleep(1000); if (cnt++ > 100) { - PMD_DRV_LOG(ERR, "Pktgen %d failed to pause.\n", + ARK_PMD_LOG(NOTICE, "Pktgen %d failed to pause.\n", inst->ordinal); break; } } - PMD_DEBUG_LOG(DEBUG, "Pktgen %d paused.\n", inst->ordinal); + ARK_PMD_LOG(DEBUG, "Pktgen %d paused.\n", inst->ordinal); } void @@ -141,7 +135,7 @@ ark_pktgen_reset(ark_pkt_gen_t handle) if (!ark_pktgen_is_running(handle) && !ark_pktgen_paused(handle)) { - PMD_DEBUG_LOG(DEBUG, "Pktgen %d is not running" + ARK_PMD_LOG(DEBUG, "Pktgen %d is not running" " and is not paused. No need to reset.\n", inst->ordinal); return; @@ -149,13 +143,13 @@ ark_pktgen_reset(ark_pkt_gen_t handle) if (ark_pktgen_is_running(handle) && !ark_pktgen_paused(handle)) { - PMD_DEBUG_LOG(DEBUG, + ARK_PMD_LOG(DEBUG, "Pktgen %d is not paused. Pausing first.\n", inst->ordinal); ark_pktgen_pause(handle); } - PMD_DEBUG_LOG(DEBUG, "Resetting pktgen %d.\n", inst->ordinal); + ARK_PMD_LOG(DEBUG, "Resetting pktgen %d.\n", inst->ordinal); inst->regs->pkt_start_stop = (1 << 8); } @@ -193,17 +187,17 @@ ark_pktgen_wait_done(ark_pkt_gen_t handle) int wait_cycle = 10; if (ark_pktgen_is_gen_forever(handle)) - PMD_DRV_LOG(ERR, "Pktgen wait_done will not terminate" + ARK_PMD_LOG(NOTICE, "Pktgen wait_done will not terminate" " because gen_forever=1\n"); while (!ark_pktgen_tx_done(handle) && (wait_cycle > 0)) { usleep(1000); wait_cycle--; - PMD_DEBUG_LOG(DEBUG, + ARK_PMD_LOG(DEBUG, "Waiting for pktgen %d to finish sending...\n", inst->ordinal); } - PMD_DEBUG_LOG(DEBUG, "Pktgen %d done.\n", inst->ordinal); + ARK_PMD_LOG(DEBUG, "Pktgen %d done.\n", inst->ordinal); } uint32_t @@ -306,7 +300,7 @@ options(const char *id) return &toptions[i]; } - PMD_DRV_LOG(ERR, + ARK_PMD_LOG(ERR, "Pktgen: Could not find requested option!, " "option = %s\n", id @@ -465,8 +459,22 @@ ark_pktgen_setup(ark_pkt_gen_t handle) if (options("reset")->v.BOOL) ark_pktgen_reset(handle); if (options("run")->v.BOOL) { - PMD_DEBUG_LOG(DEBUG, "Starting packet generator on port %d\n", + ARK_PMD_LOG(DEBUG, "Starting packet generator on port %d\n", options("port")->v.INT); ark_pktgen_run(handle); } } + +void * +ark_pktgen_delay_start(void *arg) +{ + struct ark_pkt_gen_inst *inst = (struct ark_pkt_gen_inst *)arg; + + /* This function is used exclusively for regression testing, We + * perform a blind sleep here to ensure that the external test + * application has time to setup the test before we generate packets + */ + usleep(100000); + ark_pktgen_run(inst); + return NULL; +}