From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7F0FA4596C; Thu, 12 Sep 2024 10:27:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0204D4113C; Thu, 12 Sep 2024 10:27:31 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 65AC740EDC for ; Thu, 12 Sep 2024 10:27:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726129649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4li+4SHGu/8vlGXpXq4x4cXqN9I8RovoeBpC5GpUkLc=; b=c+M/SKdPovlKkmd86oabYlW4gAuCqtXE11BzTm0lZ8vWbVpI1xujHPXFFp6y5DHhv+brGa vBam3At9MLV103+lhN0r+wbJS36HW/vxpcx6SfP0hfndOXnw1oDURlshOY15S0AaLysJda YCJV7LPZxgRokU650BrQOzW7q6YcAQE= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-46-IRnaSVJQO6-c4oIp-QHs4A-1; Thu, 12 Sep 2024 04:27:25 -0400 X-MC-Unique: IRnaSVJQO6-c4oIp-QHs4A-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C15DF19560AE; Thu, 12 Sep 2024 08:27:24 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.230]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AA12819560A3; Thu, 12 Sep 2024 08:27:23 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Abdullah Sevincer Subject: [PATCH v2 08/14] event/dlb2: fix base driver logs Date: Thu, 12 Sep 2024 10:26:34 +0200 Message-ID: <20240912082643.1532679-9-david.marchand@redhat.com> In-Reply-To: <20240912082643.1532679-1-david.marchand@redhat.com> References: <20240907145433.1479091-1-david.marchand@redhat.com> <20240912082643.1532679-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 DLB2_(HW_)?(INFO|ERR|DEBUG) are defined in osdep.h for base/ driver code to log messages. The base/ driver should not bypass those macros, directly calling DLB2_LOG_(INFO|ERR|DEBUG). Besides, DLB2_LOG_* macros always append a \n, meaning that most of the logs coming from the base/ driver code have double \n. This patch fixes osdep.h macro definition, then remove a few direct calls to DLB2_LOG_* (and adjust \n accordingly). Signed-off-by: David Marchand --- drivers/event/dlb2/dlb2_log.h | 7 +++---- drivers/event/dlb2/pf/base/dlb2_osdep.h | 16 +++++++++++++--- drivers/event/dlb2/pf/base/dlb2_resource.c | 18 +++++++++--------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/event/dlb2/dlb2_log.h b/drivers/event/dlb2/dlb2_log.h index 54d6a3011f..81908af71f 100644 --- a/drivers/event/dlb2/dlb2_log.h +++ b/drivers/event/dlb2/dlb2_log.h @@ -6,12 +6,11 @@ #define _DLB2_EVDEV_LOG_H_ extern int eventdev_dlb2_log_level; -#define RTE_LOGTYPE_EVENTDEV_DLB2_LOG_LEVEL eventdev_dlb2_log_level +#define RTE_LOGTYPE_EVENTDEV_DLB2 eventdev_dlb2_log_level /* Dynamic logging */ #define DLB2_LOG_IMPL(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, eventdev_dlb2_log_level, "%s" fmt "\n", \ - __func__, ##args) + RTE_LOG(level, EVENTDEV_DLB2, "%s" fmt "\n", __func__, ##args) #define DLB2_LOG_INFO(fmt, args...) \ DLB2_LOG_IMPL(INFO, fmt, ## args) @@ -21,6 +20,6 @@ extern int eventdev_dlb2_log_level; /* remove debug logs at compile time unless actually debugging */ #define DLB2_LOG_DBG(fmt, args...) \ - RTE_LOG_DP(DEBUG, EVENTDEV_DLB2_LOG_LEVEL, fmt, ## args) + RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## args) #endif /* _DLB2_EVDEV_LOG_H_ */ diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h index 06d69f39b1..16c5e3b797 100644 --- a/drivers/event/dlb2/pf/base/dlb2_osdep.h +++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h @@ -41,13 +41,13 @@ /* Map to PMDs logging interface */ #define DLB2_ERR(dev, fmt, args...) \ - DLB2_LOG_ERR(fmt, ## args) + RTE_LOG(ERR, EVENTDEV_DLB2, "%s" fmt, __func__, ## args) #define DLB2_INFO(dev, fmt, args...) \ - DLB2_LOG_INFO(fmt, ## args) + RTE_LOG(INFO, EVENTDEV_DLB2, "%s" fmt, __func__, ## args) #define DLB2_DEBUG(dev, fmt, args...) \ - DLB2_LOG_DBG(fmt, ## args) + RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## args) /** * os_udelay() - busy-wait for a number of microseconds @@ -139,6 +139,16 @@ static inline void os_fence_hcw(struct dlb2_hw *hw, u64 *pp_addr) DLB2_ERR(dlb2, __VA_ARGS__); \ } while (0) +/** + * DLB2_HW_INFO() - log an error message + * @dlb2: dlb2_hw handle for a particular device. + * @...: variable string args. + */ +#define DLB2_HW_INFO(dlb2, ...) do { \ + RTE_SET_USED(dlb2); \ + DLB2_INFO(dlb2, __VA_ARGS__); \ +} while (0) + /** * DLB2_HW_DBG() - log an info message * @dlb2: dlb2_hw handle for a particular device. diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c index 7ce3e3531c..3004902118 100644 --- a/drivers/event/dlb2/pf/base/dlb2_resource.c +++ b/drivers/event/dlb2/pf/base/dlb2_resource.c @@ -841,7 +841,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type) dlb2_dev->enqueue_four = dlb2_movdir64b; - DLB2_LOG_INFO(" for %s: cpu core used in pp profiling: %d\n", + DLB2_HW_INFO(hw, " for %s: cpu core used in pp profiling: %d\n", is_ldb ? "LDB" : "DIR", cpu); memset(cos_cycles, 0, num_sort * sizeof(struct dlb2_pp_thread_data)); @@ -854,7 +854,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type) err = rte_thread_attr_init(&th_attr); if (err != 0) { - DLB2_LOG_ERR(": thread attribute failed! err=%d", err); + DLB2_HW_ERR(hw, ": thread attribute failed! err=%d\n", err); return; } CPU_SET(cpu, &th_attr.cpuset); @@ -862,7 +862,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type) err = rte_thread_create(&thread, &th_attr, &dlb2_pp_profile_func, &dlb2_thread_data[i]); if (err) { - DLB2_LOG_ERR(": thread creation failed! err=%d", err); + DLB2_HW_ERR(hw, ": thread creation failed! err=%d\n", err); return; } @@ -871,7 +871,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type) err = rte_thread_join(thread, NULL); if (err) { - DLB2_LOG_ERR(": thread join failed! err=%d", err); + DLB2_HW_ERR(hw, ": thread join failed! err=%d\n", err); return; } @@ -911,7 +911,7 @@ dlb2_get_pp_allocation(struct dlb2_hw *hw, int cpu, int port_type) for (i = 0; i < num_ports; i++) { port_allocations[i] = dlb2_thread_data[i].pp; - DLB2_LOG_INFO(": pp %d cycles %d", port_allocations[i], + DLB2_HW_INFO(hw, ": pp %d cycles %d\n", port_allocations[i], dlb2_thread_data[i].cycles); } @@ -929,7 +929,7 @@ dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args) } if (mask && rte_eal_parse_coremask(mask, cores)) { - DLB2_LOG_ERR(": Invalid producer coremask=%s", mask); + DLB2_HW_ERR(hw, ": Invalid producer coremask=%s\n", mask); return -1; } @@ -956,7 +956,7 @@ dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args) break; } } else if (is_pcore) { - DLB2_LOG_ERR("Producer coremask(%s) must be a subset of EAL coremask", + DLB2_HW_ERR(hw, "Producer coremask(%s) must be a subset of EAL coremask\n", mask); return -1; } @@ -4599,7 +4599,7 @@ dlb2_verify_create_ldb_port_args(struct dlb2_hw *hw, return -EINVAL; } - DLB2_LOG_INFO(": LDB: cos=%d port:%d\n", id, port->id.phys_id); + DLB2_HW_INFO(hw, ": LDB: cos=%d port:%d\n", id, port->id.phys_id); /* Check cache-line alignment */ if ((cq_dma_base & 0x3F) != 0) { @@ -4826,7 +4826,7 @@ dlb2_verify_create_dir_port_args(struct dlb2_hw *hw, resp->status = DLB2_ST_DIR_PORTS_UNAVAILABLE; return -EINVAL; } - DLB2_LOG_INFO(": DIR: port:%d is_producer=%d\n", + DLB2_HW_INFO(hw, ": DIR: port:%d is_producer=%d\n", pq->id.phys_id, args->is_producer); } -- 2.46.0