X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnx2x%2Fbnx2x_stats.c;h=1cd972591a52d088465277c388d6b12c70b9049b;hb=6affeabaf3210f52a90dd1bb96741d23256a39c6;hp=80260f09825b24081aea206b58e53a622519f37b;hpb=a9b863582731f118669ed27e65485e901bcc9289;p=dpdk.git diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c index 80260f0982..1cd972591a 100644 --- a/drivers/net/bnx2x/bnx2x_stats.c +++ b/drivers/net/bnx2x/bnx2x_stats.c @@ -1,37 +1,14 @@ -/*- - * Copyright (c) 2007-2013 QLogic Corporation. All rights reserved. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2007-2013 Broadcom Corporation. * * Eric Davis * David Christensen * Gary Zambrano * * Copyright (c) 2013-2015 Brocade Communications Systems, Inc. + * Copyright (c) 2015-2018 Cavium Inc. * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * 3. Neither the name of Broadcom Corporation nor the name of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written consent. - * - * 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. + * www.cavium.com */ #include "bnx2x.h" @@ -105,7 +82,7 @@ bnx2x_storm_stats_post(struct bnx2x_softc *sc) sc->fw_stats_req->hdr.drv_stats_counter = htole16(sc->stats_counter++); - PMD_DRV_LOG(DEBUG, + PMD_DEBUG_PERIODIC_LOG(DEBUG, sc, "sending statistics ramrod %d", le16toh(sc->fw_stats_req->hdr.drv_stats_counter)); @@ -177,7 +154,7 @@ bnx2x_stats_comp(struct bnx2x_softc *sc) while (*stats_comp != DMAE_COMP_VAL) { if (!cnt) { - PMD_DRV_LOG(ERR, "Timeout waiting for stats finished"); + PMD_DRV_LOG(ERR, sc, "Timeout waiting for stats finished"); break; } @@ -212,7 +189,7 @@ bnx2x_stats_pmf_update(struct bnx2x_softc *sc) } /* sanity */ if (!sc->port.pmf || !sc->port.port_stx) { - PMD_DRV_LOG(ERR, "BUG!"); + PMD_DRV_LOG(ERR, sc, "BUG!"); return; } @@ -262,7 +239,7 @@ bnx2x_port_stats_init(struct bnx2x_softc *sc) /* sanity */ if (!sc->link_vars.link_up || !sc->port.pmf) { - PMD_DRV_LOG(ERR, "BUG!"); + PMD_DRV_LOG(ERR, sc, "BUG!"); return; } @@ -486,7 +463,7 @@ bnx2x_func_stats_init(struct bnx2x_softc *sc) /* sanity */ if (!sc->func_stx) { - PMD_DRV_LOG(ERR, "BUG!"); + PMD_DRV_LOG(ERR, sc, "BUG!"); return; } @@ -820,12 +797,12 @@ bnx2x_hw_stats_update(struct bnx2x_softc *sc) break; case ELINK_MAC_TYPE_NONE: /* unreached */ - PMD_DRV_LOG(DEBUG, + PMD_DRV_LOG(DEBUG, sc, "stats updated by DMAE but no MAC active"); return -1; default: /* unreached */ - PMD_DRV_LOG(ERR, "stats update failed, unknown MAC type"); + PMD_DRV_LOG(ERR, sc, "stats update failed, unknown MAC type"); } ADD_EXTEND_64(pstats->brb_drop_hi, pstats->brb_drop_lo, @@ -860,7 +837,7 @@ bnx2x_hw_stats_update(struct bnx2x_softc *sc) nig_timer_max = SHMEM_RD(sc, port_mb[SC_PORT(sc)].stat_nig_timer); if (nig_timer_max != estats->nig_timer_max) { estats->nig_timer_max = nig_timer_max; - PMD_DRV_LOG(ERR, "invalid NIG timer max (%u)", + PMD_DRV_LOG(ERR, sc, "invalid NIG timer max (%u)", estats->nig_timer_max); } } @@ -882,7 +859,7 @@ bnx2x_storm_stats_validate_counters(struct bnx2x_softc *sc) /* are storm stats valid? */ if (le16toh(counters->xstats_counter) != cur_stats_counter) { - PMD_DRV_LOG(DEBUG, + PMD_DRV_LOG(DEBUG, sc, "stats not updated by xstorm, " "counter 0x%x != stats_counter 0x%x", le16toh(counters->xstats_counter), sc->stats_counter); @@ -890,7 +867,7 @@ bnx2x_storm_stats_validate_counters(struct bnx2x_softc *sc) } if (le16toh(counters->ustats_counter) != cur_stats_counter) { - PMD_DRV_LOG(DEBUG, + PMD_DRV_LOG(DEBUG, sc, "stats not updated by ustorm, " "counter 0x%x != stats_counter 0x%x", le16toh(counters->ustats_counter), sc->stats_counter); @@ -898,7 +875,7 @@ bnx2x_storm_stats_validate_counters(struct bnx2x_softc *sc) } if (le16toh(counters->cstats_counter) != cur_stats_counter) { - PMD_DRV_LOG(DEBUG, + PMD_DRV_LOG(DEBUG, sc, "stats not updated by cstorm, " "counter 0x%x != stats_counter 0x%x", le16toh(counters->cstats_counter), sc->stats_counter); @@ -906,7 +883,7 @@ bnx2x_storm_stats_validate_counters(struct bnx2x_softc *sc) } if (le16toh(counters->tstats_counter) != cur_stats_counter) { - PMD_DRV_LOG(DEBUG, + PMD_DRV_LOG(DEBUG, sc, "stats not updated by tstorm, " "counter 0x%x != stats_counter 0x%x", le16toh(counters->tstats_counter), sc->stats_counter); @@ -952,12 +929,13 @@ bnx2x_storm_stats_update(struct bnx2x_softc *sc) uint32_t diff; - /* PMD_DRV_LOG(DEBUG, + /* PMD_DRV_LOG(DEBUG, sc, "queue[%d]: ucast_sent 0x%x bcast_sent 0x%x mcast_sent 0x%x", i, xclient->ucast_pkts_sent, xclient->bcast_pkts_sent, xclient->mcast_pkts_sent); - PMD_DRV_LOG(DEBUG, "---------------"); */ + PMD_DRV_LOG(DEBUG, sc, "---------------"); + */ UPDATE_QSTAT(tclient->rcv_bcast_bytes, total_broadcast_bytes_received); @@ -1311,7 +1289,7 @@ void bnx2x_stats_handle(struct bnx2x_softc *sc, enum bnx2x_stats_event event) bnx2x_stats_stm[state][event].action(sc); if (event != STATS_EVENT_UPDATE) { - PMD_DRV_LOG(DEBUG, + PMD_DRV_LOG(DEBUG, sc, "state %d -> event %d -> state %d", state, event, sc->stats_state); } @@ -1325,7 +1303,7 @@ bnx2x_port_stats_base_init(struct bnx2x_softc *sc) /* sanity */ if (!sc->port.pmf || !sc->port.port_stx) { - PMD_DRV_LOG(ERR, "BUG!"); + PMD_DRV_LOG(ERR, sc, "BUG!"); return; } @@ -1359,7 +1337,7 @@ bnx2x_prep_fw_stats_req(struct bnx2x_softc *sc) int i; int first_queue_query_index; struct stats_query_header *stats_hdr = &sc->fw_stats_req->hdr; - phys_addr_t cur_data_offset; + rte_iova_t cur_data_offset; struct stats_query_entry *cur_query_entry; stats_hdr->cmd_num = sc->fw_stats_num; @@ -1392,9 +1370,9 @@ bnx2x_prep_fw_stats_req(struct bnx2x_softc *sc) cur_query_entry = &sc->fw_stats_req->query[BNX2X_PORT_QUERY_IDX]; cur_query_entry->kind = STATS_TYPE_PORT; - /* For port query index is a DONT CARE */ + /* For port query index is a DON'T CARE */ cur_query_entry->index = SC_PORT(sc); - /* For port query funcID is a DONT CARE */ + /* For port query funcID is a DON'T CARE */ cur_query_entry->funcID = htole16(SC_FUNC(sc)); cur_query_entry->address.hi = htole32(U64_HI(cur_data_offset)); cur_query_entry->address.lo = htole32(U64_LO(cur_data_offset)); @@ -1406,7 +1384,7 @@ bnx2x_prep_fw_stats_req(struct bnx2x_softc *sc) cur_query_entry = &sc->fw_stats_req->query[BNX2X_PF_QUERY_IDX]; cur_query_entry->kind = STATS_TYPE_PF; - /* For PF query index is a DONT CARE */ + /* For PF query index is a DON'T CARE */ cur_query_entry->index = SC_PORT(sc); cur_query_entry->funcID = htole16(SC_FUNC(sc)); cur_query_entry->address.hi = htole32(U64_HI(cur_data_offset)); @@ -1471,7 +1449,7 @@ void bnx2x_memset_stats(struct bnx2x_softc *sc) if (sc->port.pmf && sc->port.port_stx) bnx2x_port_stats_base_init(sc); - /* mark the end of statistics initializiation */ + /* mark the end of statistics initialization */ sc->stats_init = false; } @@ -1497,7 +1475,7 @@ bnx2x_stats_init(struct bnx2x_softc *sc) sc->func_stx = 0; } - PMD_DRV_LOG(DEBUG, "port_stx 0x%x func_stx 0x%x", + PMD_DRV_LOG(DEBUG, sc, "port_stx 0x%x func_stx 0x%x", sc->port.port_stx, sc->func_stx); /* pmf should retrieve port statistics from SP on a non-init*/ @@ -1557,7 +1535,7 @@ bnx2x_stats_init(struct bnx2x_softc *sc) bnx2x_port_stats_base_init(sc); } - /* mark the end of statistics initializiation */ + /* mark the end of statistics initialization */ sc->stats_init = FALSE; }