X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fark%2Fark_pktgen.c;h=4a02662a46e795e8ab60fa423bcbf8a91c4d7f7d;hb=5043a0608da1f4774465298a39ced350b151d80c;hp=d3c3dee1eda372a1cf95d72562747e293318be84;hpb=ffc905f3b856b96c6d8d864dba4052104fae4064;p=dpdk.git diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c index d3c3dee1ed..4a02662a46 100644 --- a/drivers/net/ark/ark_pktgen.c +++ b/drivers/net/ark/ark_pktgen.c @@ -1,34 +1,5 @@ -/* - * BSD LICENSE - * - * Copyright (c) 2015-2017 Atomic Rules LLC - * 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 copyright holder 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. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2015-2018 Atomic Rules LLC */ #include @@ -36,6 +7,7 @@ #include #include +#include #include #include @@ -111,7 +83,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; @@ -154,12 +126,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 @@ -169,7 +141,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; @@ -177,13 +149,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); } @@ -221,17 +193,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 @@ -334,7 +306,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 @@ -358,7 +330,7 @@ pmd_set_arg(char *arg, char *val) o->v.INT = atoll(val); break; case OTSTRING: - snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val); + strlcpy(o->v.STR, val, ARK_MAX_STR_LEN); break; } return 1; @@ -493,7 +465,7 @@ 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); }