All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Singh, Aman Deep" <aman.deep.singh@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>, <dev@dpdk.org>
Cc: Huisong Li <lihuisong@huawei.com>, Yuying Zhang <yuying.zhang@intel.com>
Subject: Re: [PATCH v2 3/3] testpmd: replace EAL logtype TESTPMD_LOG
Date: Fri, 8 Mar 2024 19:05:32 +0530	[thread overview]
Message-ID: <e1104a47-d3c6-40f0-9db8-c44f60740929@intel.com> (raw)
In-Reply-To: <20240216033743.150800-4-stephen@networkplumber.org>


On 2/16/2024 9:06 AM, Stephen Hemminger wrote:
> Testpmd is misusing EAL logtype for some errors.
> Since the code directly has a macro for logging, use that.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: Huisong Li <lihuisong@huawei.com>
>
> fix testpmd
> ---
>   app/test-pmd/testpmd.c | 42 +++++++++++++++---------------------------
>   1 file changed, 15 insertions(+), 27 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 9e4e99e53b9a..249e934a3013 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -3413,8 +3413,8 @@ stop_port(portid_t pid)
>   
>   		ret = eth_dev_stop_mp(pi);
>   		if (ret != 0) {
> -			RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n",
> -				pi);
> +			TESTPMD_LOG(ERR,
> +				    "rte_eth_dev_stop failed for port %u\n", pi);
>   			/* Allow to retry stopping the port. */
>   			port->port_status = RTE_PORT_STARTED;
>   			continue;
> @@ -3423,8 +3423,7 @@ stop_port(portid_t pid)
>   		if (port->port_status == RTE_PORT_HANDLING)
>   			port->port_status = RTE_PORT_STOPPED;
>   		else
> -			fprintf(stderr, "Port %d can not be set into stopped\n",
> -				pi);
> +			TESTPMD_LOG(ERR, "Port %d can not be set into stopped\n", pi);
>   		need_check_link_status = 1;
>   	}
>   	if (need_check_link_status && !no_link_check)
> @@ -3812,23 +3811,20 @@ pmd_test_exit(void)
>   	if (hot_plug) {
>   		ret = rte_dev_event_monitor_stop();
>   		if (ret) {
> -			RTE_LOG(ERR, EAL,
> -				"fail to stop device event monitor.");
> +			TESTPMD_LOG(ERR, "fail to stop device event monitor.");
>   			return;
>   		}
>   
>   		ret = rte_dev_event_callback_unregister(NULL,
>   			dev_event_callback, NULL);
>   		if (ret < 0) {
> -			RTE_LOG(ERR, EAL,
> -				"fail to unregister device event callback.\n");
> +			TESTPMD_LOG(ERR, "fail to unregister device event callback.\n");
>   			return;
>   		}
>   
>   		ret = rte_dev_hotplug_handle_disable();
>   		if (ret) {
> -			RTE_LOG(ERR, EAL,
> -				"fail to disable hotplug handling.\n");
> +			TESTPMD_LOG(ERR, "fail to disable hotplug handling.\n");
>   			return;
>   		}
>   	}
> @@ -4062,12 +4058,10 @@ dev_event_callback(const char *device_name, enum rte_dev_event_type type,
>   
>   	switch (type) {
>   	case RTE_DEV_EVENT_REMOVE:
> -		RTE_LOG(DEBUG, EAL, "The device: %s has been removed!\n",
> -			device_name);
> +		TESTPMD_LOG(INFO, "The device: %s has been removed!\n", device_name);
>   		ret = rte_eth_dev_get_port_by_name(device_name, &port_id);
>   		if (ret) {
> -			RTE_LOG(ERR, EAL, "can not get port by device %s!\n",
> -				device_name);
> +			fprintf(stderr, "Can not get port by device %s!\n", device_name);

Any specific reason to use fprintf() here rather than TESTPMD_LOG

>   			return;
>   		}
>   		/*
> @@ -4081,12 +4075,10 @@ dev_event_callback(const char *device_name, enum rte_dev_event_type type,
>   		 */
>   		if (rte_eal_alarm_set(100000,
>   				rmv_port_callback, (void *)(intptr_t)port_id))
> -			RTE_LOG(ERR, EAL,
> -				"Could not set up deferred device removal\n");
> +			TESTPMD_LOG(ERR, "Could not set up deferred device removal\n");
>   		break;
>   	case RTE_DEV_EVENT_ADD:
> -		RTE_LOG(ERR, EAL, "The device: %s has been added!\n",
> -			device_name);
> +		TESTPMD_LOG(INFO, "The device: %s has been added!\n", device_name);
>   		/* TODO: After finish kernel driver binding,
>   		 * begin to attach port.
>   		 */
> @@ -4632,23 +4624,19 @@ main(int argc, char** argv)
>   	if (hot_plug) {
>   		ret = rte_dev_hotplug_handle_enable();
>   		if (ret) {
> -			RTE_LOG(ERR, EAL,
> -				"fail to enable hotplug handling.");
> +			TESTPMD_LOG(ERR, "fail to enable hotplug handling.");
>   			return -1;
>   		}
>   
>   		ret = rte_dev_event_monitor_start();
>   		if (ret) {
> -			RTE_LOG(ERR, EAL,
> -				"fail to start device event monitoring.");
> +			TESTPMD_LOG(ERR, "fail to start device event monitoring.");
>   			return -1;
>   		}
>   
> -		ret = rte_dev_event_callback_register(NULL,
> -			dev_event_callback, NULL);
> +		ret = rte_dev_event_callback_register(NULL, dev_event_callback, NULL);
>   		if (ret) {
> -			RTE_LOG(ERR, EAL,
> -				"fail  to register device event callback\n");
> +			TESTPMD_LOG(ERR, "fail to register device event callback\n");
>   			return -1;
>   		}
>   	}
> @@ -4658,7 +4646,7 @@ main(int argc, char** argv)
>   			rte_eal_cleanup();
>   			rte_exit(EXIT_FAILURE, "Start ports failed\n");
>   		}
> -		fprintf(stderr, "Start ports failed\n");
> +		TESTPMD_LOG(ERR, "Start ports failed\n");
>   	}
>   
>   	/* set all ports to promiscuous mode by default */

  reply	other threads:[~2024-03-08 13:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 17:23 [PATCH 0/3] replace use of EAL logtype Stephen Hemminger
2023-12-11 17:23 ` [PATCH 1/3] testpmd: replace EAL logtype with fprintf Stephen Hemminger
2023-12-12 11:51   ` lihuisong (C)
2023-12-11 17:23 ` [PATCH 2/3] examples/l2fwd-keepalive: don't use EAL logtype Stephen Hemminger
2023-12-12 11:53   ` lihuisong (C)
2023-12-11 17:23 ` [PATCH 3/3] examples/vm_power_manager: do not " Stephen Hemminger
2023-12-12 11:24   ` Hunt, David
2023-12-12 11:53   ` lihuisong (C)
2023-12-11 19:19 ` [PATCH 0/3] replace use of " Tyler Retzlaff
2023-12-11 20:15   ` Stephen Hemminger
2023-12-12  8:01   ` David Marchand
2024-02-16  3:36 ` [PATCH v2 0/3] replace use of EAL logtype in applications Stephen Hemminger
2024-02-16  3:36   ` [PATCH v2 1/3] examples/l2fwd-keepalive: don't use EAL logtype Stephen Hemminger
2024-02-16  8:04     ` Morten Brørup
2024-02-16  3:36   ` [PATCH v2 2/3] examples/vm_power_manager: do not " Stephen Hemminger
2024-02-16  3:36   ` [PATCH v2 3/3] testpmd: replace EAL logtype TESTPMD_LOG Stephen Hemminger
2024-03-08 13:35     ` Singh, Aman Deep [this message]
2024-03-08 16:26       ` Stephen Hemminger
2024-02-18  3:16   ` [PATCH v2 0/3] replace use of EAL logtype in applications fengchengwen
2024-03-08 18:10 ` [PATCH v3 " Stephen Hemminger
2024-03-08 18:10   ` [PATCH v3 1/3] examples/l2fwd-keepalive: don't use EAL logtype Stephen Hemminger
2024-03-08 18:10   ` [PATCH v3 2/3] examples/vm_power_manager: do not " Stephen Hemminger
2024-03-08 18:10   ` [PATCH v3 3/3] testpmd: replace EAL logtype TESTPMD_LOG Stephen Hemminger
2024-03-08 22:33 ` [PATCH v4 0/3] replace use of EAL logtype in applications Stephen Hemminger
2024-03-08 22:33   ` [PATCH v4 1/3] examples/l2fwd-keepalive: don't use EAL logtype Stephen Hemminger
2024-03-08 22:33   ` [PATCH v4 2/3] examples/vm_power_manager: do not " Stephen Hemminger
2024-03-08 22:33   ` [PATCH v4 3/3] testpmd: replace EAL logtype TESTPMD_LOG Stephen Hemminger
2024-03-11 10:24     ` Singh, Aman Deep
2024-07-03 16:28 ` [PATCH v5 0/3] replace use of EAL logtype in examples and testpmd Stephen Hemminger
2024-07-03 16:28   ` [PATCH v5 1/3] examples/l2fwd-keepalive: don't use EAL logtype Stephen Hemminger
2024-07-03 16:28   ` [PATCH v5 2/3] examples/vm_power_manager: do not " Stephen Hemminger
2024-07-03 16:28   ` [PATCH v5 3/3] testpmd: replace EAL logtype TESTPMD_LOG Stephen Hemminger
2024-07-09 12:20   ` [PATCH v5 0/3] replace use of EAL logtype in examples and testpmd David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1104a47-d3c6-40f0-9db8-c44f60740929@intel.com \
    --to=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=lihuisong@huawei.com \
    --cc=stephen@networkplumber.org \
    --cc=yuying.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.