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 4CAAC43735 for ; Mon, 18 Dec 2023 15:38:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 00F51427E8; Mon, 18 Dec 2023 15:38:50 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 1C790427DC for ; Mon, 18 Dec 2023 15:38:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702910323; 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=u+xsiv2GYlH4Z0DjpP4VIwumy+DwV02bgxaIU6aVegU=; b=ZYcHBKuKkIqZfThKRvfqpAgmkGza52e0HQn3dMPs4GBcqU8DC7V2RfR2HWcus9v3TKUUo7 Qf28Ov5k457fDStxJ3Y7J7j71p1MT1DXCL1cmaS6eFzqrQ5wZ+eSvVOEzilqhzUKzSXVY7 UUdDhS17MG/YlQTXgGj8Rzl3aviW3z8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-6asz-mNVOR-sNW5afGIXmg-1; Mon, 18 Dec 2023 09:38:40 -0500 X-MC-Unique: 6asz-mNVOR-sNW5afGIXmg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id EDEF98D26FC; Mon, 18 Dec 2023 14:38:21 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id A776D3C25; Mon, 18 Dec 2023 14:38:19 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@amd.com, bruce.richardson@intel.com, stephen@networkplumber.org, mb@smartsharesystems.com, stable@dpdk.org, Tyler Retzlaff , Andrew Rybchenko , Akhil Goyal , Fan Zhang , Amit Prakash Shukla , Jerin Jacob , Naga Harish K S V Subject: [PATCH v4 03/14] lib: use dedicated logtypes and macros Date: Mon, 18 Dec 2023 15:37:52 +0100 Message-ID: <20231218143805.1500121-4-david.marchand@redhat.com> In-Reply-To: <20231218143805.1500121-1-david.marchand@redhat.com> References: <20231117131824.1977792-1-david.marchand@redhat.com> <20231218143805.1500121-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org No printf! When a dedicated log helper exists, use it. And no usurpation please: a library should log under its logtype (see the eventdev rx adapter update for example). Note: the RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET macro is renamed for consistency with the rest of eventdev (private) macros. Cc: stable@dpdk.org Signed-off-by: David Marchand Reviewed-by: Stephen Hemminger Reviewed-by: Tyler Retzlaff Reviewed-by: Andrew Rybchenko --- lib/cryptodev/rte_cryptodev.c | 2 +- lib/ethdev/ethdev_driver.c | 4 ++-- lib/ethdev/ethdev_private.c | 2 +- lib/ethdev/rte_class_eth.c | 2 +- lib/eventdev/rte_event_dma_adapter.c | 4 ++-- lib/eventdev/rte_event_eth_rx_adapter.c | 12 ++++++------ lib/eventdev/rte_eventdev.c | 6 +++--- lib/mempool/rte_mempool_ops.c | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 25e3ec12d1..ead8c9a623 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -2684,7 +2684,7 @@ rte_cryptodev_driver_id_get(const char *name) int driver_id = -1; if (name == NULL) { - RTE_LOG(DEBUG, CRYPTODEV, "name pointer NULL"); + CDEV_LOG_DEBUG("name pointer NULL"); return -1; } diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c index fff4b7b4cd..55a9dcc565 100644 --- a/lib/ethdev/ethdev_driver.c +++ b/lib/ethdev/ethdev_driver.c @@ -487,7 +487,7 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) pair = &args.pairs[i]; if (strcmp("representor", pair->key) == 0) { if (eth_da->type != RTE_ETH_REPRESENTOR_NONE) { - RTE_LOG(ERR, EAL, "duplicated representor key: %s\n", + RTE_ETHDEV_LOG(ERR, "duplicated representor key: %s\n", dargs); result = -1; goto parse_cleanup; @@ -713,7 +713,7 @@ rte_eth_representor_id_get(uint16_t port_id, if (info->ranges[i].controller != controller) continue; if (info->ranges[i].id_end < info->ranges[i].id_base) { - RTE_LOG(WARNING, EAL, "Port %hu invalid representor ID Range %u - %u, entry %d\n", + RTE_ETHDEV_LOG(WARNING, "Port %hu invalid representor ID Range %u - %u, entry %d\n", port_id, info->ranges[i].id_base, info->ranges[i].id_end, i); continue; diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c index e98b7188b0..0e1c7b23c1 100644 --- a/lib/ethdev/ethdev_private.c +++ b/lib/ethdev/ethdev_private.c @@ -182,7 +182,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) RTE_DIM(eth_da->representor_ports)); done: if (str == NULL) - RTE_LOG(ERR, EAL, "wrong representor format: %s\n", str); + RTE_ETHDEV_LOG(ERR, "wrong representor format: %s\n", str); return str == NULL ? -1 : 0; } diff --git a/lib/ethdev/rte_class_eth.c b/lib/ethdev/rte_class_eth.c index b61dae849d..311beb17cb 100644 --- a/lib/ethdev/rte_class_eth.c +++ b/lib/ethdev/rte_class_eth.c @@ -165,7 +165,7 @@ eth_dev_iterate(const void *start, valid_keys = eth_params_keys; kvargs = rte_kvargs_parse(str, valid_keys); if (kvargs == NULL) { - RTE_LOG(ERR, EAL, "cannot parse argument list\n"); + RTE_ETHDEV_LOG(ERR, "cannot parse argument list\n"); rte_errno = EINVAL; return NULL; } diff --git a/lib/eventdev/rte_event_dma_adapter.c b/lib/eventdev/rte_event_dma_adapter.c index af4b5ad388..cbf9405438 100644 --- a/lib/eventdev/rte_event_dma_adapter.c +++ b/lib/eventdev/rte_event_dma_adapter.c @@ -1046,7 +1046,7 @@ rte_event_dma_adapter_vchan_add(uint8_t id, int16_t dma_dev_id, uint16_t vchan, sizeof(struct dma_vchan_info), 0, adapter->socket_id); if (dev_info->vchanq == NULL) { - printf("Queue pair add not supported\n"); + RTE_EDEV_LOG_ERR("Queue pair add not supported"); return -ENOMEM; } } @@ -1057,7 +1057,7 @@ rte_event_dma_adapter_vchan_add(uint8_t id, int16_t dma_dev_id, uint16_t vchan, sizeof(struct dma_vchan_info), 0, adapter->socket_id); if (dev_info->tqmap == NULL) { - printf("tq pair add not supported\n"); + RTE_EDEV_LOG_ERR("tq pair add not supported"); return -ENOMEM; } } diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index 6db03adf04..82ae31712d 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -314,9 +314,9 @@ rxa_event_buf_get(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id, } \ } while (0) -#define RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(port_id, retval) do { \ +#define RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(port_id, retval) do { \ if (!rte_eth_dev_is_valid_port(port_id)) { \ - RTE_ETHDEV_LOG(ERR, "Invalid port_id=%u\n", port_id); \ + RTE_EDEV_LOG_ERR("Invalid port_id=%u", port_id); \ ret = retval; \ goto error; \ } \ @@ -3671,7 +3671,7 @@ handle_rxa_get_queue_conf(const char *cmd __rte_unused, /* Get device ID from parameter string */ eth_dev_id = strtoul(token, NULL, 10); - RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); + RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); token = strtok(NULL, ","); RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); @@ -3743,7 +3743,7 @@ handle_rxa_get_queue_stats(const char *cmd __rte_unused, /* Get device ID from parameter string */ eth_dev_id = strtoul(token, NULL, 10); - RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); + RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); token = strtok(NULL, ","); RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); @@ -3813,7 +3813,7 @@ handle_rxa_queue_stats_reset(const char *cmd __rte_unused, /* Get device ID from parameter string */ eth_dev_id = strtoul(token, NULL, 10); - RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); + RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); token = strtok(NULL, ","); RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); @@ -3868,7 +3868,7 @@ handle_rxa_instance_get(const char *cmd __rte_unused, /* Get device ID from parameter string */ eth_dev_id = strtoul(token, NULL, 10); - RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); + RTE_EVENT_ETH_RX_ADAPTER_PORTID_VALID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); token = strtok(NULL, ","); RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index 0ca32d6721..ae50821a3f 100644 --- a/lib/eventdev/rte_eventdev.c +++ b/lib/eventdev/rte_eventdev.c @@ -1428,8 +1428,8 @@ rte_event_vector_pool_create(const char *name, unsigned int n, int ret; if (!nb_elem) { - RTE_LOG(ERR, EVENTDEV, - "Invalid number of elements=%d requested\n", nb_elem); + RTE_EDEV_LOG_ERR("Invalid number of elements=%d requested", + nb_elem); rte_errno = EINVAL; return NULL; } @@ -1444,7 +1444,7 @@ rte_event_vector_pool_create(const char *name, unsigned int n, mp_ops_name = rte_mbuf_best_mempool_ops(); ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL); if (ret != 0) { - RTE_LOG(ERR, EVENTDEV, "error setting mempool handler\n"); + RTE_EDEV_LOG_ERR("error setting mempool handler"); goto err; } diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c index ae1d288f27..e871de9ec9 100644 --- a/lib/mempool/rte_mempool_ops.c +++ b/lib/mempool/rte_mempool_ops.c @@ -46,7 +46,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h) if (strlen(h->name) >= sizeof(ops->name) - 1) { rte_spinlock_unlock(&rte_mempool_ops_table.sl); - RTE_LOG(DEBUG, EAL, "%s(): mempool_ops <%s>: name too long\n", + RTE_LOG(DEBUG, MEMPOOL, "%s(): mempool_ops <%s>: name too long\n", __func__, h->name); rte_errno = EEXIST; return -EEXIST; -- 2.43.0