X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fsfc%2Fsfc_mcdi.c;h=872e4e76b1cfeec2e1ba00a56ceb286f4b228f80;hb=d0f6c960367f83259175348878278592e989b562;hp=f4763abd68d19aba17b4edff6d626b1c46cda490;hpb=e77f9f1906cb105bb5988d0ec9fc28aa30eff5fc;p=dpdk.git diff --git a/drivers/net/sfc/sfc_mcdi.c b/drivers/net/sfc/sfc_mcdi.c index f4763abd68..872e4e76b1 100644 --- a/drivers/net/sfc/sfc_mcdi.c +++ b/drivers/net/sfc/sfc_mcdi.c @@ -1,32 +1,10 @@ -/*- - * BSD LICENSE +/* SPDX-License-Identifier: BSD-3-Clause * - * Copyright (c) 2016-2017 Solarflare Communications Inc. - * All rights reserved. + * Copyright(c) 2019-2020 Xilinx, Inc. + * Copyright(c) 2016-2019 Solarflare Communications Inc. * * This software was jointly developed between OKTET Labs (under contract * for Solarflare) and Solarflare Communications, Inc. - * - * 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. - * - * 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 @@ -37,7 +15,6 @@ #include "sfc.h" #include "sfc_log.h" -#include "sfc_kvargs.h" #include "sfc_ev.h" #define SFC_MCDI_POLL_INTERVAL_MIN_US 10 /* 10us in 1us units */ @@ -198,7 +175,7 @@ sfc_mcdi_do_log(const struct sfc_adapter *sa, * at the end which is required by netlogdecode. */ buffer[position] = '\0'; - sfc_info(sa, "%s \\", buffer); + sfc_log_mcdi(sa, "%s \\", buffer); /* Preserve prefix for the next log message */ position = pfxsize; } @@ -220,10 +197,17 @@ sfc_mcdi_logger(void *arg, efx_log_msg_t type, size_t pfxsize; size_t start; - if (!sa->mcdi.logging) + /* + * Unlike the other cases, MCDI logging implies more onerous work + * needed to produce a message. If the dynamic log level prevents + * the end result from being printed, the CPU time will be wasted. + * + * To avoid wasting time, the actual level is examined in advance. + */ + if (rte_log_get_level(sa->mcdi.logtype) < (int)SFC_LOG_LEVEL_MCDI) return; - /* The format including prefix added by sfc_info() is the format + /* The format including prefix added by sfc_log_mcdi() is the format * consumed by the Solarflare netlogdecode tool. */ pfxsize = snprintf(buffer, sizeof(buffer), "MCDI RPC %s:", @@ -234,7 +218,7 @@ sfc_mcdi_logger(void *arg, efx_log_msg_t type, start = sfc_mcdi_do_log(sa, buffer, data, data_size, pfxsize, start); if (start != pfxsize) { buffer[start] = '\0'; - sfc_info(sa, "%s", buffer); + sfc_log_mcdi(sa, "%s", buffer); } } @@ -272,11 +256,9 @@ sfc_mcdi_init(struct sfc_adapter *sa) if (rc != 0) goto fail_dma_alloc; - /* Convert negative error to positive used in the driver */ - rc = sfc_kvargs_process(sa, SFC_KVARG_MCDI_LOGGING, - sfc_kvarg_bool_handler, &mcdi->logging); - if (rc != 0) - goto fail_kvargs_process; + mcdi->logtype = sfc_register_logtype(&sa->priv.shared->pci_addr, + SFC_LOGTYPE_MCDI_STR, + RTE_LOG_NOTICE); emtp = &mcdi->transport; emtp->emt_context = sa; @@ -296,8 +278,6 @@ sfc_mcdi_init(struct sfc_adapter *sa) fail_mcdi_init: memset(emtp, 0, sizeof(*emtp)); - -fail_kvargs_process: sfc_dma_free(sa, &mcdi->mem); fail_dma_alloc: