From patchwork Fri Feb 16 03:36:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 136840 X-Patchwork-Delegate: david.marchand@redhat.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 2357943B24; Fri, 16 Feb 2024 04:38:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A90642E6C; Fri, 16 Feb 2024 04:38:00 +0100 (CET) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id A694142DED for ; Fri, 16 Feb 2024 04:37:56 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1d7431e702dso15273185ad.1 for ; Thu, 15 Feb 2024 19:37:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1708054676; x=1708659476; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ysE5pN/HO4GC0b1AtBJ6NfRAukOnF90TuoG4pP+DSSc=; b=kxGZsYFENLMg/leJtXk/guoQMjUqcExC8CyzT3iHSb4luFS3TcaL4RPx0Hk9qummrc 6lauaV+5/66qqrHyNx9qYIf10jMcAPetGoBkQHDJt3y6I8vsW23GWMv1fB6VjcvCXWhA HU3bxHD81cIXNWvq6l+vj1HxQKQn0T2yKg+dm39tnrQOP/dxgv6aTRIfwxl0XP2udjHQ 4ATFIMjlQAO8/+nUXe0+bBZhkBPIEb6qrSaycI7pRygpfaFYyDRBK2gubZQVQHFqZBpk y63HF7P1gx3/HGDKToRAP+QDUlp3kmCwnUR/NG7yWsLAjvN7WBM51VzL9qSDSQT8M66S 7hHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708054676; x=1708659476; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ysE5pN/HO4GC0b1AtBJ6NfRAukOnF90TuoG4pP+DSSc=; b=Li0TUIsD6tH+ZZ/gvCFGJ18nXuVGG8GdCplt3Vlj62et5IcZf7oFXZdLG2p9aPvzh3 Se1LqwCA2dwkXvaq/9HwxrgjFMylpvG1W295BiBdUrnQCXjLl6kyvKvQv1L9HLJVBFDX V8denPvdDjK+pZm7RPPjwiax4guM30bx8vNC+VyDnhU+c9Y9VQy277d3ZiaCqjaSD/mS pXGidf0IntBCyepU/lp48aqnTEW24RDApXodnrv5zT5Q15bZAs5ETfs4S7fsFBGRTPWC qZ71ISiu0qzE4gwpncDWtPWGMX+G2Ly7NSRQk7FXF9sBvrSqllNLHrsSQhNNPkExfnP8 EdVw== X-Gm-Message-State: AOJu0YznS/8yfckwZLpViMyq7RdrK65zs5fxJU8qP5p9C9VYOb8yiKVv r83MFiPQhD+77N1ZKjKI4cRK+C/AHlZMz3LRvr1ZeIzxzbAk+zAIu3bWSrToliTVyV9rnX1+Fke D X-Google-Smtp-Source: AGHT+IH39G5YWsuGb66UEcmgF5zWcWj9h2excwA9xBAnuyrTBYRwKDwPAdeMq/5ArRYI7XUzOrL9fg== X-Received: by 2002:a17:902:bb8b:b0:1d7:88de:cff1 with SMTP id m11-20020a170902bb8b00b001d788decff1mr3377176pls.53.1708054675881; Thu, 15 Feb 2024 19:37:55 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id x9-20020a170902e04900b001db561fa164sm1967871plx.25.2024.02.15.19.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 19:37:55 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Huisong Li , Aman Singh , Yuying Zhang Subject: [PATCH v2 3/3] testpmd: replace EAL logtype TESTPMD_LOG Date: Thu, 15 Feb 2024 19:36:19 -0800 Message-ID: <20240216033743.150800-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240216033743.150800-1-stephen@networkplumber.org> References: <20231211172437.61958-1-stephen@networkplumber.org> <20240216033743.150800-1-stephen@networkplumber.org> 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 Testpmd is misusing EAL logtype for some errors. Since the code directly has a macro for logging, use that. Signed-off-by: Stephen Hemminger Acked-by: Huisong Li 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); 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 */