From patchwork Thu Apr 21 15:18:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Miller X-Patchwork-Id: 110011 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9FA83A0093; Thu, 21 Apr 2022 17:19:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 770C042802; Thu, 21 Apr 2022 17:19:25 +0200 (CEST) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id C4AB140040 for ; Thu, 21 Apr 2022 17:19:23 +0200 (CEST) Received: by mail-pj1-f50.google.com with SMTP id m14-20020a17090a34ce00b001d5fe250e23so2147775pjf.3 for ; Thu, 21 Apr 2022 08:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atomicrules-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jZSHTWfhGlOkEMOc/uL2I3QKIRkesfnfv2I3pJIsrrQ=; b=yn3P2/44thXBxjEHcDzWkqLMh0x3pj6sdM+S3H19S7SuAxCYhjlxIClgGA8cMirb6p LSyZC+D6CyF+IQWjih9SQ9bRZbIp97JplvPMNLqBU+icbCmvk2QdRdMXpAA/JTgH4r48 52EWLzoygK3QIiCmv2SVH4naRtMEec+K5Q8oOSF5/h314r8maIyQUSMld/sLaVQPNmtV lByrCdp1IEX26jE1xZpT4W1iRC53aA+lS8MyV4qQye3MWCWgqhRY6aKN7oh7VbRgZrpU tf/i7kQ9+kLYc7sxRiVcek+qbm2zXAiKr7IOt9nhPNXiZJg4+9R9D4zCc0FdTtZDtXGe UFPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jZSHTWfhGlOkEMOc/uL2I3QKIRkesfnfv2I3pJIsrrQ=; b=ji2gKuT0oKNK4ptL8yBI9XMD9syj7ytohbKteO12npzQV+TicgAc9cDQfoPRfJVmIH vdrCPqn+8mGmqbNq8XBKhrEIYW5X+naSSppte/QUPnC0/HkS3pYsW7LRo+137Jvez/2G wRCTW+5Q6CvIUYuTyNWr82xCsx6G00PTQwX5Sk6HLLksfkwjFRn70MNe+M0WKCqx4BwU 75T9VEaEjL9TELesQerJosutAKRLHd5T2e9AuMHPjlX/pJp6kf5llZx4d61KE73hvwf3 stxd6lbHHWIPAvI1NCTBw3a5MnHHA9Ir+3XDVuaHcRoe3gys4uRUSBHMM3VoYdgDg+v1 E+uw== X-Gm-Message-State: AOAM532HmuZ3CZmXsthb4Jb3WKm+jkLZjUyuQO3VGoUsJieBCXVzVqIM B6pj9w+1X8eySqd1rtouwgLmJsoRf4qTMQ== X-Google-Smtp-Source: ABdhPJyizedX5E4aFhM0DlczFdqsqZwzHrI86RwlUAHIiW+EUAIdICRs7JrBHROIJvpOLs+mKx0wZQ== X-Received: by 2002:a17:902:a9c2:b0:156:1859:2d05 with SMTP id b2-20020a170902a9c200b0015618592d05mr26812731plr.86.1650554362537; Thu, 21 Apr 2022 08:19:22 -0700 (PDT) Received: from john-All-Series.tds (h75-100-85-216.cntcnh.broadband.dynamic.tds.net. [75.100.85.216]) by smtp.gmail.com with ESMTPSA id q5-20020a056a00084500b0050ace4a699dsm6463465pfk.95.2022.04.21.08.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 08:19:22 -0700 (PDT) From: John Miller To: dev@dpdk.org Cc: ferruh.yigit@xilinx.com, ed.czeck@atomicrules.com, John Miller Subject: [PATCH 06/10] net/ark: add ark PMD log interface Date: Thu, 21 Apr 2022 10:18:56 -0500 Message-Id: <20220421151900.703467-6-john.miller@atomicrules.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421151900.703467-1-john.miller@atomicrules.com> References: <20220421151900.703467-1-john.miller@atomicrules.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Added ark PMD log interface for use in arkville devices. Signed-off-by: John Miller --- drivers/net/ark/ark_ethdev.c | 93 ++++++++++++------------------- drivers/net/ark/ark_ethdev_logs.c | 7 +++ drivers/net/ark/ark_ethdev_logs.h | 25 +++++++++ drivers/net/ark/ark_ethdev_rx.c | 40 ++++++------- drivers/net/ark/ark_ethdev_tx.c | 10 ++-- drivers/net/ark/ark_logs.h | 34 ----------- 6 files changed, 94 insertions(+), 115 deletions(-) create mode 100644 drivers/net/ark/ark_ethdev_logs.c create mode 100644 drivers/net/ark/ark_ethdev_logs.h delete mode 100644 drivers/net/ark/ark_logs.h diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 76b88c62d0..22cf598593 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -11,7 +11,7 @@ #include #include "ark_global.h" -#include "ark_logs.h" +#include "ark_ethdev_logs.h" #include "ark_ethdev_tx.h" #include "ark_ethdev_rx.h" #include "ark_mpu.h" @@ -99,25 +99,6 @@ static const struct rte_pci_id pci_id_ark_map[] = { {.vendor_id = 0, /* sentinel */ }, }; -/* - * This structure is used to statically define the capabilities - * of supported devices. - * Capabilities: - * rqpacing - - * Some HW variants require that PCIe read-requests be correctly throttled. - * This is called "rqpacing" and has to do with credit and flow control - * on certain Arkville implementations. - */ -struct ark_caps { - bool rqpacing; -}; -struct ark_dev_caps { - uint32_t device_id; - struct ark_caps caps; -}; -#define SET_DEV_CAPS(id, rqp) \ - {id, {.rqpacing = rqp} } - static const struct ark_dev_caps ark_device_caps[] = { SET_DEV_CAPS(0x100d, true), @@ -204,26 +185,26 @@ check_for_ext(struct ark_adapter *ark) const char *dllpath = getenv("ARK_EXT_PATH"); if (dllpath == NULL) { - ARK_PMD_LOG(DEBUG, "EXT NO dll path specified\n"); + ARK_ETHDEV_LOG(DEBUG, "EXT NO dll path specified\n"); return 0; } - ARK_PMD_LOG(NOTICE, "EXT found dll path at %s\n", dllpath); + ARK_ETHDEV_LOG(NOTICE, "EXT found dll path at %s\n", dllpath); /* Open and load the .so */ ark->d_handle = dlopen(dllpath, RTLD_LOCAL | RTLD_LAZY); if (ark->d_handle == NULL) { - ARK_PMD_LOG(ERR, "Could not load user extension %s\n", + ARK_ETHDEV_LOG(ERR, "Could not load user extension %s\n", dllpath); return -1; } - ARK_PMD_LOG(DEBUG, "SUCCESS: loaded user extension %s\n", + ARK_ETHDEV_LOG(DEBUG, "SUCCESS: loaded user extension %s\n", dllpath); /* Get the entry points */ ark->user_ext.dev_init = (void *(*)(struct rte_eth_dev *, void *, int)) dlsym(ark->d_handle, "rte_pmd_ark_dev_init"); - ARK_PMD_LOG(DEBUG, "device ext init pointer = %p\n", + ARK_ETHDEV_LOG(DEBUG, "device ext init pointer = %p\n", ark->user_ext.dev_init); ark->user_ext.dev_get_port_count = (int (*)(struct rte_eth_dev *, void *)) @@ -296,7 +277,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ark->eth_dev = dev; - ARK_PMD_LOG(DEBUG, "\n"); + ARK_ETHDEV_LOG(DEBUG, "\n"); /* Check to see if there is an extension that we need to load */ ret = check_for_ext(ark); @@ -343,15 +324,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ark->started = 0; ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL; - ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x HW Commit_ID: %08x\n", + ARK_ETHDEV_LOG(INFO, "Sys Ctrl Const = 0x%x HW Commit_ID: %08x\n", ark->sysctrl.t32[4], rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4])); - ARK_PMD_LOG(NOTICE, "Arkville HW Commit_ID: %08x\n", + ARK_ETHDEV_LOG(NOTICE, "Arkville HW Commit_ID: %08x\n", rte_be_to_cpu_32(ark->sysctrl.t32[0x20 / 4])); /* If HW sanity test fails, return an error */ if (ark->sysctrl.t32[4] != 0xcafef00d) { - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "HW Sanity test has failed, expected constant" " 0x%x, read 0x%x (%s)\n", 0xcafef00d, @@ -361,16 +342,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev) if (ark->sysctrl.t32[3] != 0) { if (ark->rqpacing) { if (ark_rqp_lasped(ark->rqpacing)) { - ARK_PMD_LOG(ERR, "Arkville Evaluation System - " + ARK_ETHDEV_LOG(ERR, "Arkville Evaluation System - " "Timer has Expired\n"); return -1; } - ARK_PMD_LOG(WARNING, "Arkville Evaluation System - " + ARK_ETHDEV_LOG(WARNING, "Arkville Evaluation System - " "Timer is Running\n"); } } - ARK_PMD_LOG(DEBUG, + ARK_ETHDEV_LOG(DEBUG, "HW Sanity test has PASSED, expected constant" " 0x%x, read 0x%x (%s)\n", 0xcafef00d, ark->sysctrl.t32[4], __func__); @@ -385,7 +366,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) dev->data->mac_addrs = rte_zmalloc("ark", RTE_ETHER_ADDR_LEN, 0); if (!dev->data->mac_addrs) { - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "Failed to allocated memory for storing mac address" ); } @@ -394,7 +375,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ark->user_data[dev->data->port_id] = ark->user_ext.dev_init(dev, ark->a_bar, 0); if (!ark->user_data[dev->data->port_id]) { - ARK_PMD_LOG(WARNING, + ARK_ETHDEV_LOG(WARNING, "Failed to initialize PMD extension!" " continuing without it\n"); memset(&ark->user_ext, 0, sizeof(struct ark_user_ext)); @@ -405,7 +386,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) if (pci_dev->device.devargs) ret = eth_ark_check_args(ark, pci_dev->device.devargs->args); else - ARK_PMD_LOG(INFO, "No Device args found\n"); + ARK_ETHDEV_LOG(INFO, "No Device args found\n"); if (ret) goto error; @@ -436,7 +417,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) /* reserve an ethdev entry */ eth_dev = rte_eth_dev_allocate(name); if (!eth_dev) { - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "Could not allocate eth_dev for port %d\n", p); goto error; @@ -454,7 +435,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) eth_dev->data->mac_addrs = rte_zmalloc(name, RTE_ETHER_ADDR_LEN, 0); if (!eth_dev->data->mac_addrs) { - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "Memory allocation for MAC failed!" " Exiting.\n"); goto error; @@ -514,7 +495,7 @@ ark_config_device(struct rte_eth_dev *dev) /* UDM */ if (ark_udm_reset(ark->udm.v)) { - ARK_PMD_LOG(ERR, "Unable to stop and reset UDM\n"); + ARK_ETHDEV_LOG(ERR, "Unable to stop and reset UDM\n"); return -1; } /* Keep in reset until the MPU are cleared */ @@ -530,7 +511,7 @@ ark_config_device(struct rte_eth_dev *dev) /* TX -- DDM */ if (ark_ddm_stop(ark->ddm.v, 1)) - ARK_PMD_LOG(ERR, "Unable to stop DDM\n"); + ARK_ETHDEV_LOG(ERR, "Unable to stop DDM\n"); mpu = ark->mputx.v; num_q = ark_api_num_queues(mpu); @@ -620,7 +601,7 @@ eth_ark_dev_start(struct rte_eth_dev *dev) if (rte_ctrl_thread_create(&thread, tname, NULL, ark_pktgen_delay_start, ark->pg)) { - ARK_PMD_LOG(ERR, "Could not create pktgen " + ARK_ETHDEV_LOG(ERR, "Could not create pktgen " "starter thread\n"); return -1; } @@ -666,7 +647,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev) status = eth_ark_tx_queue_stop(dev, i); if (status != 0) { uint16_t port = dev->data->port_id; - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "tx_queue stop anomaly" " port %u, queue %u\n", port, i); @@ -681,7 +662,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev) break; } if (status || i != 0) { - ARK_PMD_LOG(ERR, "DDM stop anomaly. status:" + ARK_ETHDEV_LOG(ERR, "DDM stop anomaly. status:" " %d iter: %u. (%s)\n", status, i, @@ -703,7 +684,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev) break; } if (status || i != 0) { - ARK_PMD_LOG(ERR, "UDM stop anomaly. status %d iter: %u. (%s)\n", + ARK_ETHDEV_LOG(ERR, "UDM stop anomaly. status %d iter: %u. (%s)\n", status, i, __func__); ark_udm_dump(ark->udm.v, "Stop anomaly"); @@ -805,7 +786,7 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev, static int eth_ark_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) { - ARK_PMD_LOG(DEBUG, "link status = %d\n", + ARK_ETHDEV_LOG(DEBUG, "link status = %d\n", dev->data->dev_link.link_status); struct ark_adapter *ark = dev->data->dev_private; @@ -940,20 +921,20 @@ static inline int process_pktdir_arg(const char *key, const char *value, void *extra_args) { - ARK_PMD_LOG(DEBUG, "key = %s, value = %s\n", + ARK_ETHDEV_LOG(DEBUG, "key = %s, value = %s\n", key, value); struct ark_adapter *ark = (struct ark_adapter *)extra_args; ark->pkt_dir_v = strtol(value, NULL, 16); - ARK_PMD_LOG(DEBUG, "pkt_dir_v = 0x%x\n", ark->pkt_dir_v); + ARK_ETHDEV_LOG(DEBUG, "pkt_dir_v = 0x%x\n", ark->pkt_dir_v); return 0; } static inline int process_file_args(const char *key, const char *value, void *extra_args) { - ARK_PMD_LOG(DEBUG, "key = %s, value = %s\n", + ARK_ETHDEV_LOG(DEBUG, "key = %s, value = %s\n", key, value); char *args = (char *)extra_args; @@ -964,7 +945,7 @@ process_file_args(const char *key, const char *value, void *extra_args) int first = 1; if (file == NULL) { - ARK_PMD_LOG(ERR, "Unable to open " + ARK_ETHDEV_LOG(ERR, "Unable to open " "config file %s\n", value); return -1; } @@ -972,7 +953,7 @@ process_file_args(const char *key, const char *value, void *extra_args) while (fgets(line, sizeof(line), file)) { size += strlen(line); if (size >= ARK_MAX_ARG_LEN) { - ARK_PMD_LOG(ERR, "Unable to parse file %s args, " + ARK_ETHDEV_LOG(ERR, "Unable to parse file %s args, " "parameter list is too long\n", value); fclose(file); return -1; @@ -984,7 +965,7 @@ process_file_args(const char *key, const char *value, void *extra_args) strncat(args, line, ARK_MAX_ARG_LEN); } } - ARK_PMD_LOG(DEBUG, "file = %s\n", args); + ARK_ETHDEV_LOG(DEBUG, "file = %s\n", args); fclose(file); return 0; } @@ -1006,7 +987,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) for (k_idx = 0; k_idx < kvlist->count; k_idx++) { pair = &kvlist->pairs[k_idx]; - ARK_PMD_LOG(DEBUG, "**** Arg passed to PMD = %s:%s\n", + ARK_ETHDEV_LOG(DEBUG, "**** Arg passed to PMD = %s:%s\n", pair->key, pair->value); } @@ -1015,7 +996,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) ARK_PKTDIR_ARG, &process_pktdir_arg, ark) != 0) { - ARK_PMD_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTDIR_ARG); + ARK_ETHDEV_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTDIR_ARG); goto free_kvlist; } @@ -1023,7 +1004,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) ARK_PKTGEN_ARG, &process_file_args, ark->pkt_gen_args) != 0) { - ARK_PMD_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTGEN_ARG); + ARK_ETHDEV_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTGEN_ARG); goto free_kvlist; } @@ -1031,17 +1012,17 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) ARK_PKTCHKR_ARG, &process_file_args, ark->pkt_chkr_args) != 0) { - ARK_PMD_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTCHKR_ARG); + ARK_ETHDEV_LOG(ERR, "Unable to parse arg %s\n", ARK_PKTCHKR_ARG); goto free_kvlist; } - ARK_PMD_LOG(INFO, "packet director set to 0x%x\n", ark->pkt_dir_v); + ARK_ETHDEV_LOG(INFO, "packet director set to 0x%x\n", ark->pkt_dir_v); /* Setup the packet director */ ark_pktdir_setup(ark->pd, ark->pkt_dir_v); /* Setup the packet generator */ if (ark->pkt_gen_args[0]) { - ARK_PMD_LOG(DEBUG, "Setting up the packet generator\n"); + ARK_ETHDEV_LOG(DEBUG, "Setting up the packet generator\n"); ark_pktgen_parse(ark->pkt_gen_args); ark_pktgen_reset(ark->pg); ark_pktgen_setup(ark->pg); diff --git a/drivers/net/ark/ark_ethdev_logs.c b/drivers/net/ark/ark_ethdev_logs.c new file mode 100644 index 0000000000..2ae2a5720e --- /dev/null +++ b/drivers/net/ark/ark_ethdev_logs.c @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2020-2021 Atomic Rules LLC + */ + +#include "ark_ethdev_logs.h" + +int ark_ethdev_logtype; diff --git a/drivers/net/ark/ark_ethdev_logs.h b/drivers/net/ark/ark_ethdev_logs.h new file mode 100644 index 0000000000..6db80655d7 --- /dev/null +++ b/drivers/net/ark/ark_ethdev_logs.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2015-2018 Atomic Rules LLC + */ + +#ifndef _ARK_ETHDEV_LOG_H_ +#define _ARK_ETHDEV_LOG_H_ + +#include +#include +#include "ark_common.h" + +extern int ark_ethdev_logtype; + +#define ARK_ETHDEV_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ##level, ark_ethdev_logtype, "ARK: " fmt, ## args) + + +/* Debug macro to enable core debug code */ +#ifdef RTE_LIBRTE_ETHDEV_DEBUG +#define ARK_DEBUG_CORE 1 +#else +#define ARK_DEBUG_CORE 0 +#endif + +#endif diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c index 0fbb2603db..e599e1f70d 100644 --- a/drivers/net/ark/ark_ethdev_rx.c +++ b/drivers/net/ark/ark_ethdev_rx.c @@ -6,7 +6,7 @@ #include "ark_ethdev_rx.h" #include "ark_global.h" -#include "ark_logs.h" +#include "ark_ethdev_logs.h" #include "ark_mpu.h" #include "ark_udm.h" @@ -82,7 +82,7 @@ eth_ark_rx_hw_setup(struct rte_eth_dev *dev, /* Verify HW */ if (ark_mpu_verify(queue->mpu, sizeof(rte_iova_t))) { - ARK_PMD_LOG(ERR, "Illegal configuration rx queue\n"); + ARK_ETHDEV_LOG(ERR, "Illegal configuration rx queue\n"); return -1; } @@ -137,19 +137,19 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, if (rx_conf != NULL && warning1 == 0) { warning1 = 1; - ARK_PMD_LOG(NOTICE, + ARK_ETHDEV_LOG(NOTICE, "Arkville ignores rte_eth_rxconf argument.\n"); } if (RTE_PKTMBUF_HEADROOM < ARK_RX_META_SIZE) { - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "Error: DPDK Arkville requires head room > %d bytes (%s)\n", ARK_RX_META_SIZE, __func__); return -1; /* ERROR CODE */ } if (!rte_is_power_of_2(nb_desc)) { - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "DPDK Arkville configuration queue size must be power of two %u (%s)\n", nb_desc, __func__); return -1; /* ERROR CODE */ @@ -161,7 +161,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, 64, socket_id); if (queue == 0) { - ARK_PMD_LOG(ERR, "Failed to allocate memory in %s\n", __func__); + ARK_ETHDEV_LOG(ERR, "Failed to allocate memory in %s\n", __func__); return -ENOMEM; } @@ -189,7 +189,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, socket_id); if (queue->reserve_q == 0 || queue->paddress_q == 0) { - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "Failed to allocate queue memory in %s\n", __func__); rte_free(queue->reserve_q); @@ -215,7 +215,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, status = eth_ark_rx_seed_mbufs(queue); if (queue->seed_index != nb_desc) { - ARK_PMD_LOG(ERR, "Failed to allocate %u mbufs for RX queue %d\n", + ARK_ETHDEV_LOG(ERR, "Failed to allocate %u mbufs for RX queue %d\n", nb_desc, qidx); status = -1; } @@ -226,7 +226,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, if (unlikely(status != 0)) { struct rte_mbuf **mbuf; - ARK_PMD_LOG(ERR, "Failed to initialize RX queue %d %s\n", + ARK_ETHDEV_LOG(ERR, "Failed to initialize RX queue %d %s\n", qidx, __func__); /* Free the mbufs allocated */ @@ -285,7 +285,7 @@ eth_ark_recv_pkts(void *rx_queue, if ((meta->pkt_len > (1024 * 16)) || (meta->pkt_len == 0)) { - ARK_PMD_LOG(DEBUG, "RX: Bad Meta Q: %u" + ARK_ETHDEV_LOG(DEBUG, "RX: Bad Meta Q: %u" " cons: %" PRIU32 " prod: %" PRIU32 " seed_index %" PRIU32 @@ -296,7 +296,7 @@ eth_ark_recv_pkts(void *rx_queue, queue->seed_index); - ARK_PMD_LOG(DEBUG, " : UDM" + ARK_ETHDEV_LOG(DEBUG, " : UDM" " prod: %" PRIU32 " len: %u\n", queue->udm->rt_cfg.prod_idx, @@ -464,7 +464,7 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue) int status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, nb); if (unlikely(status != 0)) { - ARK_PMD_LOG(NOTICE, + ARK_ETHDEV_LOG(NOTICE, "Could not allocate %u mbufs from pool" " for RX queue %u;" " %u free buffers remaining in queue\n", @@ -603,7 +603,7 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev) if (!ark_udm_is_flushed(ark->udm.v)) { /* restart the MPUs */ - ARK_PMD_LOG(NOTICE, "UDM not flushed -- forcing flush\n"); + ARK_ETHDEV_LOG(NOTICE, "UDM not flushed -- forcing flush\n"); for (i = 0; i < dev->data->nb_rx_queues; i++) { queue = (struct ark_rx_queue *)dev->data->rx_queues[i]; if (queue == 0) @@ -617,7 +617,7 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev) /* Wait to allow data to pass */ usleep(100); - ARK_PMD_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n", + ARK_ETHDEV_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n", ark_udm_is_flushed(ark->udm.v)); } ark_udm_reset(ark->udm.v); @@ -628,8 +628,8 @@ ark_ethdev_rx_dump(const char *name, struct ark_rx_queue *queue) { if (queue == NULL) return; - ARK_PMD_LOG(DEBUG, "RX QUEUE %d -- %s", queue->phys_qid, name); - ARK_PMD_LOG(DEBUG, ARK_SU32 ARK_SU32 ARK_SU32 ARK_SU32 "\n", + ARK_ETHDEV_LOG(DEBUG, "RX QUEUE %d -- %s", queue->phys_qid, name); + ARK_ETHDEV_LOG(DEBUG, ARK_SU32 ARK_SU32 ARK_SU32 ARK_SU32 "\n", "queue_size", queue->queue_size, "seed_index", queue->seed_index, "prod_index", queue->prod_index, @@ -653,15 +653,15 @@ dump_mbuf_data(struct rte_mbuf *mbuf, uint16_t lo, uint16_t hi) { uint16_t i, j; - ARK_PMD_LOG(DEBUG, " MBUF: %p len %d, off: %d\n", + ARK_ETHDEV_LOG(DEBUG, " MBUF: %p len %d, off: %d\n", mbuf, mbuf->pkt_len, mbuf->data_off); for (i = lo; i < hi; i += 16) { uint8_t *dp = RTE_PTR_ADD(mbuf->buf_addr, i); - ARK_PMD_LOG(DEBUG, " %6d: ", i); + ARK_ETHDEV_LOG(DEBUG, " %6d: ", i); for (j = 0; j < 16; j++) - ARK_PMD_LOG(DEBUG, " %02x", dp[j]); + ARK_ETHDEV_LOG(DEBUG, " %02x", dp[j]); - ARK_PMD_LOG(DEBUG, "\n"); + ARK_ETHDEV_LOG(DEBUG, "\n"); } } diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c index abdce6a8cc..66ea10735e 100644 --- a/drivers/net/ark/ark_ethdev_tx.c +++ b/drivers/net/ark/ark_ethdev_tx.c @@ -8,7 +8,7 @@ #include "ark_global.h" #include "ark_mpu.h" #include "ark_ddm.h" -#include "ark_logs.h" +#include "ark_ethdev_logs.h" #define ARK_TX_META_SIZE 32 #define ARK_TX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_TX_META_SIZE) @@ -172,7 +172,7 @@ eth_ark_xmit_pkts(void *vtxq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) } if (ARK_DEBUG_CORE && nb != nb_pkts) { - ARK_PMD_LOG(DEBUG, "TX: Failure to send:" + ARK_ETHDEV_LOG(DEBUG, "TX: Failure to send:" " req: %" PRIU32 " sent: %" PRIU32 " prod: %" PRIU32 @@ -238,7 +238,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev, int qidx = queue_idx; if (!rte_is_power_of_2(nb_desc)) { - ARK_PMD_LOG(ERR, + ARK_ETHDEV_LOG(ERR, "DPDK Arkville configuration queue size" " must be power of two %u (%s)\n", nb_desc, __func__); @@ -254,7 +254,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev, 64, socket_id); if (queue == 0) { - ARK_PMD_LOG(ERR, "Failed to allocate tx " + ARK_ETHDEV_LOG(ERR, "Failed to allocate tx " "queue memory in %s\n", __func__); return -ENOMEM; @@ -281,7 +281,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev, socket_id); if (queue->meta_q == 0 || queue->bufs == 0) { - ARK_PMD_LOG(ERR, "Failed to allocate " + ARK_ETHDEV_LOG(ERR, "Failed to allocate " "queue memory in %s\n", __func__); rte_free(queue->meta_q); rte_free(queue->bufs); diff --git a/drivers/net/ark/ark_logs.h b/drivers/net/ark/ark_logs.h deleted file mode 100644 index ca46d86c99..0000000000 --- a/drivers/net/ark/ark_logs.h +++ /dev/null @@ -1,34 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright (c) 2015-2018 Atomic Rules LLC - */ - -#ifndef _ARK_DEBUG_H_ -#define _ARK_DEBUG_H_ - -#include -#include - -/* system camel case definition changed to upper case */ -#define PRIU32 PRIu32 -#define PRIU64 PRIu64 - -/* Format specifiers for string data pairs */ -#define ARK_SU32 "\n\t%-20s %'20" PRIU32 -#define ARK_SU64 "\n\t%-20s %'20" PRIU64 -#define ARK_SU64X "\n\t%-20s %#20" PRIx64 -#define ARK_SPTR "\n\t%-20s %20p" - -extern int ark_logtype; - -#define ARK_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ##level, ark_logtype, "ARK: " fmt, ## args) - - -/* Debug macro to enable core debug code */ -#ifdef RTE_LIBRTE_ETHDEV_DEBUG -#define ARK_DEBUG_CORE 1 -#else -#define ARK_DEBUG_CORE 0 -#endif - -#endif