X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fark%2Fark_pktchkr.c;h=84bb567a4198531c01a495111cf28168251b0d8a;hb=05b405d581486651305551a9f7295f40388d95db;hp=202a1d9be819173f522130ba56faa503dd2f9f14;hpb=53a9ba132c0cec168dc7ffcf07506326afeccb0e;p=dpdk.git diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c index 202a1d9be8..84bb567a41 100644 --- a/drivers/net/ark/ark_pktchkr.c +++ b/drivers/net/ark/ark_pktchkr.c @@ -1,42 +1,10 @@ -/*- - * 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 -#include -#include #include -#include +#include #include #include "ark_pktchkr.h" @@ -113,7 +81,7 @@ ark_pktchkr_init(void *addr, int ord, int l2_mode) rte_malloc("ark_pkt_chkr_inst", sizeof(struct ark_pkt_chkr_inst), 0); if (inst == NULL) { - PMD_DRV_LOG(ERR, "Failed to malloc ark_pkt_chkr_inst.\n"); + ARK_PMD_LOG(ERR, "Failed to malloc ark_pkt_chkr_inst.\n"); return inst; } inst->sregs = (struct ark_pkt_chkr_stat_regs *)addr; @@ -158,10 +126,10 @@ ark_pktchkr_stop(ark_pkt_chkr_t handle) while (!ark_pktchkr_stopped(handle) && (wait_cycle > 0)) { usleep(1000); wait_cycle--; - PMD_DEBUG_LOG(DEBUG, "Waiting for pktchk %d to stop...\n", + ARK_PMD_LOG(DEBUG, "Waiting for pktchk %d to stop...\n", inst->ordinal); } - PMD_DEBUG_LOG(DEBUG, "Pktchk %d stopped.\n", inst->ordinal); + ARK_PMD_LOG(DEBUG, "Pktchk %d stopped.\n", inst->ordinal); } int @@ -217,7 +185,7 @@ ark_pktchkr_wait_done(ark_pkt_chkr_t handle) struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle; if (ark_pktchkr_is_gen_forever(handle)) { - PMD_DEBUG_LOG(ERR, "Pktchk wait_done will not terminate" + ARK_PMD_LOG(NOTICE, "Pktchk wait_done will not terminate" " because gen_forever=1\n"); return -1; } @@ -226,10 +194,10 @@ ark_pktchkr_wait_done(ark_pkt_chkr_t handle) while (!ark_pktchkr_stopped(handle) && (wait_cycle > 0)) { usleep(1000); wait_cycle--; - PMD_DEBUG_LOG(DEBUG, "Waiting for packet checker %d's" + ARK_PMD_LOG(DEBUG, "Waiting for packet checker %d's" " internal pktgen to finish sending...\n", inst->ordinal); - PMD_DEBUG_LOG(DEBUG, "Pktchk %d's pktgen done.\n", + ARK_PMD_LOG(DEBUG, "Pktchk %d's pktgen done.\n", inst->ordinal); } return 0; @@ -324,25 +292,25 @@ ark_pktchkr_dump_stats(ark_pkt_chkr_t handle) { struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle; - PMD_STATS_LOG(INFO, "pkts_rcvd = (%'u)\n", + ARK_PMD_LOG(INFO, "pkts_rcvd = (%'u)\n", inst->sregs->pkts_rcvd); - PMD_STATS_LOG(INFO, "bytes_rcvd = (%'" PRIU64 ")\n", + ARK_PMD_LOG(INFO, "bytes_rcvd = (%'" PRIU64 ")\n", inst->sregs->bytes_rcvd); - PMD_STATS_LOG(INFO, "pkts_ok = (%'u)\n", + ARK_PMD_LOG(INFO, "pkts_ok = (%'u)\n", inst->sregs->pkts_ok); - PMD_STATS_LOG(INFO, "pkts_mismatch = (%'u)\n", + ARK_PMD_LOG(INFO, "pkts_mismatch = (%'u)\n", inst->sregs->pkts_mismatch); - PMD_STATS_LOG(INFO, "pkts_err = (%'u)\n", + ARK_PMD_LOG(INFO, "pkts_err = (%'u)\n", inst->sregs->pkts_err); - PMD_STATS_LOG(INFO, "first_mismatch = (%'u)\n", + ARK_PMD_LOG(INFO, "first_mismatch = (%'u)\n", inst->sregs->first_mismatch); - PMD_STATS_LOG(INFO, "resync_events = (%'u)\n", + ARK_PMD_LOG(INFO, "resync_events = (%'u)\n", inst->sregs->resync_events); - PMD_STATS_LOG(INFO, "pkts_missing = (%'u)\n", + ARK_PMD_LOG(INFO, "pkts_missing = (%'u)\n", inst->sregs->pkts_missing); - PMD_STATS_LOG(INFO, "min_latency = (%'u)\n", + ARK_PMD_LOG(INFO, "min_latency = (%'u)\n", inst->sregs->min_latency); - PMD_STATS_LOG(INFO, "max_latency = (%'u)\n", + ARK_PMD_LOG(INFO, "max_latency = (%'u)\n", inst->sregs->max_latency); } @@ -355,7 +323,7 @@ options(const char *id) if (strcmp(id, toptions[i].opt) == 0) return &toptions[i]; } - PMD_DRV_LOG(ERR, + ARK_PMD_LOG(ERR, "pktchkr: Could not find requested option!, option = %s\n", id); return NULL; @@ -376,7 +344,7 @@ 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; @@ -471,7 +439,7 @@ ark_pktchkr_setup(ark_pkt_chkr_t handle) ark_pktchkr_stop(handle); if (options("run")->v.BOOL) { - PMD_DEBUG_LOG(DEBUG, "Starting packet checker on port %d\n", + ARK_PMD_LOG(DEBUG, "Starting packet checker on port %d\n", options("port")->v.INT); ark_pktchkr_run(handle); }